From 7bbabbe29e82e03fe3282e8e8d77f13af2d32cb0 Mon Sep 17 00:00:00 2001 From: Microsoft Graph DevX Tooling Date: Tue, 31 Oct 2023 13:45:37 +0000 Subject: [PATCH 1/2] Update generated files with build 127857 --- src/Generated/Admin/AdminRequestBuilder.php | 39 +-- .../Admin/Edge/EdgeRequestBuilder.php | 57 ++-- .../InternetExplorerModeRequestBuilder.php | 57 ++-- .../SiteLists/Count/CountRequestBuilder.php | 22 +- .../BrowserSiteListItemRequestBuilder.php | 57 ++-- .../Item/Publish/PublishRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../BrowserSharedCookieItemRequestBuilder.php | 57 ++-- .../SharedCookiesRequestBuilder.php | 39 +-- .../Item/Sites/Count/CountRequestBuilder.php | 22 +- .../Item/BrowserSiteItemRequestBuilder.php | 57 ++-- .../Item/Sites/SitesRequestBuilder.php | 39 +-- .../SiteLists/SiteListsRequestBuilder.php | 39 +-- .../Admin/People/PeopleRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ProfileCardPropertyItemRequestBuilder.php | 57 ++-- .../ProfileCardPropertiesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../HealthOverviewsRequestBuilder.php | 39 +-- .../Item/Issues/Count/CountRequestBuilder.php | 22 +- .../Item/Issues/IssuesRequestBuilder.php | 39 +-- .../IncidentReportRequestBuilder.php | 21 +- .../ServiceHealthIssueItemRequestBuilder.php | 57 ++-- .../Item/ServiceHealthItemRequestBuilder.php | 57 ++-- .../Issues/Count/CountRequestBuilder.php | 22 +- .../Issues/IssuesRequestBuilder.php | 39 +-- .../IncidentReportRequestBuilder.php | 21 +- .../ServiceHealthIssueItemRequestBuilder.php | 57 ++-- .../Archive/ArchiveRequestBuilder.php | 20 +- .../Messages/Count/CountRequestBuilder.php | 22 +- .../Favorite/FavoriteRequestBuilder.php | 20 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- ...nouncementAttachmentItemRequestBuilder.php | 57 ++-- .../AttachmentsArchiveRequestBuilder.php | 43 ++- ...ServiceUpdateMessageItemRequestBuilder.php | 57 ++-- .../MarkRead/MarkReadRequestBuilder.php | 20 +- .../MarkUnread/MarkUnreadRequestBuilder.php | 20 +- .../Messages/MessagesRequestBuilder.php | 39 +-- .../Unarchive/UnarchiveRequestBuilder.php | 20 +- .../Unfavorite/UnfavoriteRequestBuilder.php | 20 +- .../ServiceAnnouncementRequestBuilder.php | 57 ++-- .../Settings/SettingsRequestBuilder.php | 57 ++-- .../Sharepoint/SharepointRequestBuilder.php | 57 ++-- .../AgreementAcceptancesRequestBuilder.php | 39 +-- .../AgreementAcceptanceItemRequestBuilder.php | 57 ++-- .../Agreements/AgreementsRequestBuilder.php | 39 +-- .../Acceptances/AcceptancesRequestBuilder.php | 39 +-- .../Acceptances/Count/CountRequestBuilder.php | 22 +- .../AgreementAcceptanceItemRequestBuilder.php | 57 ++-- .../Item/AgreementItemRequestBuilder.php | 57 ++-- .../Item/File/FileRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...mentFileLocalizationItemRequestBuilder.php | 57 ++-- .../Versions/Count/CountRequestBuilder.php | 22 +- ...AgreementFileVersionItemRequestBuilder.php | 61 ++-- ...onItemRequestBuilderGetQueryParameters.php | 2 +- .../Item/Versions/VersionsRequestBuilder.php | 43 ++- ...rsionsRequestBuilderGetQueryParameters.php | 2 +- .../LocalizationsRequestBuilder.php | 39 +-- .../Item/Files/Count/CountRequestBuilder.php | 22 +- .../Item/Files/FilesRequestBuilder.php | 39 +-- ...mentFileLocalizationItemRequestBuilder.php | 57 ++-- .../Versions/Count/CountRequestBuilder.php | 22 +- ...AgreementFileVersionItemRequestBuilder.php | 61 ++-- ...onItemRequestBuilderGetQueryParameters.php | 2 +- .../Item/Versions/VersionsRequestBuilder.php | 43 ++- ...rsionsRequestBuilderGetQueryParameters.php | 2 +- .../AppCatalogs/AppCatalogsRequestBuilder.php | 39 +-- .../TeamsApps/Count/CountRequestBuilder.php | 22 +- .../AppDefinitionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/Bot/BotRequestBuilder.php | 57 ++-- .../TeamsAppDefinitionItemRequestBuilder.php | 57 ++-- .../Item/TeamsAppItemRequestBuilder.php | 61 ++-- .../TeamsApps/TeamsAppsRequestBuilder.php | 39 +-- .../ApplicationTemplatesRequestBuilder.php | 24 +- ...platesRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../ApplicationTemplateItemRequestBuilder.php | 20 +- .../Instantiate/InstantiateRequestBuilder.php | 24 +- .../ApplicationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../GetByIds/GetByIdsRequestBuilder.php | 20 +- .../Item/AddKey/AddKeyRequestBuilder.php | 20 +- .../AddPassword/AddPasswordRequestBuilder.php | 20 +- .../AppManagementPoliciesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../Ref/RefRequestBuilder.php | 38 +-- .../Item/ApplicationItemRequestBuilder.php | 57 ++-- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- .../CreatedOnBehalfOfRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ExtensionPropertiesRequestBuilder.php | 39 +-- .../ExtensionPropertyItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...ratedIdentityCredentialsRequestBuilder.php | 43 ++- ...edIdentityCredentialItemRequestBuilder.php | 57 ++-- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...meRealmDiscoveryPoliciesRequestBuilder.php | 20 +- ...RealmDiscoveryPolicyItemRequestBuilder.php | 20 +- .../Item/Logo/LogoRequestBuilder.php | 43 ++- .../Item/Owners/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphEndpointRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/Count/CountRequestBuilder.php | 22 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../GraphEndpointRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../Owners/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/Owners/OwnersRequestBuilder.php | 20 +- .../Item/Owners/Ref/RefRequestBuilder.php | 38 +-- .../RemoveKey/RemoveKeyRequestBuilder.php | 19 +- .../RemovePasswordRequestBuilder.php | 19 +- .../Item/Restore/RestoreRequestBuilder.php | 20 +- .../SetVerifiedPublisherRequestBuilder.php | 19 +- .../AcquireAccessTokenRequestBuilder.php | 23 +- .../Jobs/Count/CountRequestBuilder.php | 22 +- .../Jobs/Item/Pause/PauseRequestBuilder.php | 19 +- .../ProvisionOnDemandRequestBuilder.php | 20 +- .../Item/Restart/RestartRequestBuilder.php | 19 +- .../Directories/Count/CountRequestBuilder.php | 22 +- .../Directories/DirectoriesRequestBuilder.php | 39 +-- .../DirectoryDefinitionItemRequestBuilder.php | 57 ++-- .../Item/Discover/DiscoverRequestBuilder.php | 20 +- .../FilterOperatorsRequestBuilder.php | 20 +- .../Functions/FunctionsRequestBuilder.php | 20 +- .../ParseExpressionRequestBuilder.php | 24 +- .../Jobs/Item/Schema/SchemaRequestBuilder.php | 57 ++-- .../Jobs/Item/Start/StartRequestBuilder.php | 19 +- .../SynchronizationJobItemRequestBuilder.php | 57 ++-- .../ValidateCredentialsRequestBuilder.php | 19 +- .../Jobs/JobsRequestBuilder.php | 39 +-- .../ValidateCredentialsRequestBuilder.php | 19 +- .../Secrets/Count/CountRequestBuilder.php | 22 +- .../Secrets/SecretsRequestBuilder.php | 20 +- .../SynchronizationRequestBuilder.php | 61 ++-- ...zationRequestBuilderGetQueryParameters.php | 2 +- .../Templates/Count/CountRequestBuilder.php | 22 +- .../Directories/Count/CountRequestBuilder.php | 22 +- .../Directories/DirectoriesRequestBuilder.php | 39 +-- .../DirectoryDefinitionItemRequestBuilder.php | 57 ++-- .../Item/Discover/DiscoverRequestBuilder.php | 20 +- .../FilterOperatorsRequestBuilder.php | 20 +- .../Functions/FunctionsRequestBuilder.php | 20 +- .../ParseExpressionRequestBuilder.php | 24 +- .../Item/Schema/SchemaRequestBuilder.php | 57 ++-- ...chronizationTemplateItemRequestBuilder.php | 57 ++-- .../Templates/TemplatesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../Ref/RefRequestBuilder.php | 38 +-- .../TokenIssuancePoliciesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../Ref/RefRequestBuilder.php | 38 +-- .../TokenLifetimePoliciesRequestBuilder.php | 20 +- .../UnsetVerifiedPublisherRequestBuilder.php | 19 +- .../ValidatePropertiesRequestBuilder.php | 19 +- .../ApplicationsWithAppIdRequestBuilder.php | 57 ++-- .../AuditLogs/AuditLogsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../DirectoryAuditsRequestBuilder.php | 43 ++- ...AuditsRequestBuilderGetQueryParameters.php | 2 +- .../Item/DirectoryAuditItemRequestBuilder.php | 61 ++-- ...itItemRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...sioningObjectSummaryItemRequestBuilder.php | 57 ++-- .../ProvisioningRequestBuilder.php | 39 +-- .../SignIns/Count/CountRequestBuilder.php | 22 +- .../SignIns/Item/SignInItemRequestBuilder.php | 61 ++-- ...InItemRequestBuilderGetQueryParameters.php | 2 +- .../SignIns/SignInsRequestBuilder.php | 43 ++- ...ignInsRequestBuilderGetQueryParameters.php | 2 +- ...tionMethodConfigurationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...nMethodConfigurationItemRequestBuilder.php | 57 ++-- ...tionMethodConfigurationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...nMethodConfigurationItemRequestBuilder.php | 57 ++-- ...henticationMethodsPolicyRequestBuilder.php | 39 +-- ...teBasedAuthConfigurationRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...sedAuthConfigurationItemRequestBuilder.php | 57 ++-- src/Generated/Chats/ChatsRequestBuilder.php | 39 +-- .../Chats/Count/CountRequestBuilder.php | 22 +- .../GetAllMessagesRequestBuilder.php | 20 +- .../Chats/Item/ChatItemRequestBuilder.php | 57 ++-- .../HideForUser/HideForUserRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../InstalledAppsRequestBuilder.php | 39 +-- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../TeamsAppDefinitionRequestBuilder.php | 20 +- ...TeamsAppInstallationItemRequestBuilder.php | 57 ++-- .../Item/Upgrade/UpgradeRequestBuilder.php | 19 +- .../LastMessagePreviewRequestBuilder.php | 57 ++-- .../MarkChatReadForUserRequestBuilder.php | 19 +- .../MarkChatUnreadForUserRequestBuilder.php | 19 +- .../Item/Members/Add/AddRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 57 ++-- .../Item/Members/MembersRequestBuilder.php | 39 +-- .../Messages/Count/CountRequestBuilder.php | 22 +- .../Messages/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Replies/Count/CountRequestBuilder.php | 22 +- .../Replies/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Replies/RepliesRequestBuilder.php | 39 +-- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Messages/MessagesRequestBuilder.php | 45 ++- .../Count/CountRequestBuilder.php | 22 +- ...cificPermissionGrantItemRequestBuilder.php | 57 ++-- .../PermissionGrantsRequestBuilder.php | 43 ++- ...GrantsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/Message/MessageRequestBuilder.php | 20 +- ...innedChatMessageInfoItemRequestBuilder.php | 57 ++-- .../PinnedMessagesRequestBuilder.php | 39 +-- ...SendActivityNotificationRequestBuilder.php | 19 +- .../Item/Tabs/Count/CountRequestBuilder.php | 22 +- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../Tabs/Item/TeamsTabItemRequestBuilder.php | 57 ++-- .../Chats/Item/Tabs/TabsRequestBuilder.php | 39 +-- .../UnhideForUserRequestBuilder.php | 19 +- .../CallRecords/CallRecordsRequestBuilder.php | 39 +-- .../CallRecords/Count/CountRequestBuilder.php | 22 +- .../Item/CallRecordItemRequestBuilder.php | 57 ++-- .../Sessions/Count/CountRequestBuilder.php | 22 +- .../Segments/Count/CountRequestBuilder.php | 22 +- .../Item/SegmentItemRequestBuilder.php | 57 ++-- .../Item/Segments/SegmentsRequestBuilder.php | 39 +-- .../Item/SessionItemRequestBuilder.php | 57 ++-- .../Item/Sessions/SessionsRequestBuilder.php | 39 +-- ...omDateTimeWithToDateTimeRequestBuilder.php | 20 +- ...omDateTimeWithToDateTimeRequestBuilder.php | 20 +- .../Calls/CallsRequestBuilder.php | 39 +-- .../Calls/Count/CountRequestBuilder.php | 22 +- .../AddLargeGalleryViewRequestBuilder.php | 20 +- .../Item/Answer/AnswerRequestBuilder.php | 19 +- .../AudioRoutingGroupsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AudioRoutingGroupItemRequestBuilder.php | 57 ++-- .../Calls/Item/CallItemRequestBuilder.php | 57 ++-- .../CancelMediaProcessingRequestBuilder.php | 20 +- .../ChangeScreenSharingRoleRequestBuilder.php | 19 +- .../ContentSharingSessionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ontentSharingSessionItemRequestBuilder.php | 57 ++-- .../KeepAlive/KeepAliveRequestBuilder.php | 19 +- .../Calls/Item/Mute/MuteRequestBuilder.php | 20 +- .../Operations/Count/CountRequestBuilder.php | 22 +- .../Item/CommsOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Invite/InviteRequestBuilder.php | 20 +- .../Item/Mute/MuteRequestBuilder.php | 20 +- .../Item/ParticipantItemRequestBuilder.php | 57 ++-- .../StartHoldMusicRequestBuilder.php | 20 +- .../StopHoldMusicRequestBuilder.php | 20 +- .../ParticipantsRequestBuilder.php | 39 +-- .../PlayPrompt/PlayPromptRequestBuilder.php | 20 +- .../RecordResponseRequestBuilder.php | 20 +- .../Item/Redirect/RedirectRequestBuilder.php | 19 +- .../Item/Reject/RejectRequestBuilder.php | 19 +- .../SubscribeToToneRequestBuilder.php | 20 +- .../Item/Transfer/TransferRequestBuilder.php | 19 +- .../Item/Unmute/UnmuteRequestBuilder.php | 20 +- .../UpdateRecordingStatusRequestBuilder.php | 20 +- ...econferenceDeviceQualityRequestBuilder.php | 19 +- .../CommunicationsRequestBuilder.php | 39 +-- .../GetPresencesByUserIdRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../CreateOrGet/CreateOrGetRequestBuilder.php | 20 +- .../AttendanceReportsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AttendanceRecordsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AttendanceRecordItemRequestBuilder.php | 57 ++-- ...tingAttendanceReportItemRequestBuilder.php | 57 ++-- .../AttendeeReportRequestBuilder.php | 43 ++- ...ualAppointmentJoinWebUrlRequestBuilder.php | 20 +- .../Item/OnlineMeetingItemRequestBuilder.php | 57 ++-- .../Transcripts/Count/CountRequestBuilder.php | 22 +- .../Item/CallTranscriptItemRequestBuilder.php | 57 ++-- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../MetadataContentRequestBuilder.php | 43 ++- .../Transcripts/TranscriptsRequestBuilder.php | 39 +-- .../OnlineMeetingsRequestBuilder.php | 39 +-- .../Presences/Count/CountRequestBuilder.php | 22 +- .../ClearPresenceRequestBuilder.php | 19 +- ...earUserPreferredPresenceRequestBuilder.php | 19 +- .../Item/PresenceItemRequestBuilder.php | 57 ++-- .../SetPresence/SetPresenceRequestBuilder.php | 19 +- .../SetStatusMessageRequestBuilder.php | 19 +- ...SetUserPreferredPresenceRequestBuilder.php | 19 +- .../Presences/PresencesRequestBuilder.php | 39 +-- .../Compliance/ComplianceRequestBuilder.php | 39 +-- .../Connections/ConnectionsRequestBuilder.php | 39 +-- .../Connections/Count/CountRequestBuilder.php | 22 +- .../ExternalConnectionItemRequestBuilder.php | 57 ++-- .../Item/Groups/Count/CountRequestBuilder.php | 22 +- .../Item/Groups/GroupsRequestBuilder.php | 39 +-- .../Item/ExternalGroupItemRequestBuilder.php | 57 ++-- .../Members/Count/CountRequestBuilder.php | 22 +- .../Item/IdentityItemRequestBuilder.php | 61 ++-- ...tyItemRequestBuilderGetQueryParameters.php | 2 +- .../Item/Members/MembersRequestBuilder.php | 43 ++- ...embersRequestBuilderGetQueryParameters.php | 2 +- .../Item/Items/Count/CountRequestBuilder.php | 22 +- .../Activities/ActivitiesRequestBuilder.php | 39 +-- .../Activities/Count/CountRequestBuilder.php | 22 +- .../ExternalActivityItemRequestBuilder.php | 57 ++-- .../PerformedBy/PerformedByRequestBuilder.php | 20 +- .../Item/ExternalItemItemRequestBuilder.php | 57 ++-- ...lConnectorsAddActivitiesRequestBuilder.php | 20 +- .../Item/Items/ItemsRequestBuilder.php | 39 +-- .../Operations/Count/CountRequestBuilder.php | 22 +- .../ConnectionOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Item/Schema/SchemaRequestBuilder.php | 43 ++- .../Contacts/ContactsRequestBuilder.php | 39 +-- .../Contacts/Count/CountRequestBuilder.php | 22 +- .../Contacts/Delta/DeltaRequestBuilder.php | 20 +- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../GetByIds/GetByIdsRequestBuilder.php | 20 +- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../DirectReportsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../GraphUser/Count/CountRequestBuilder.php | 22 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- .../Item/Manager/ManagerRequestBuilder.php | 20 +- .../MemberOf/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Item/MemberOf/MemberOfRequestBuilder.php | 20 +- .../Item/OrgContactItemRequestBuilder.php | 57 ++-- .../Item/Restore/RestoreRequestBuilder.php | 20 +- ...RetryServiceProvisioningRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../TransitiveMemberOfRequestBuilder.php | 20 +- .../ValidatePropertiesRequestBuilder.php | 19 +- .../Contracts/ContractsRequestBuilder.php | 39 +-- .../Contracts/Count/CountRequestBuilder.php | 22 +- .../Contracts/Delta/DeltaRequestBuilder.php | 20 +- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../GetByIds/GetByIdsRequestBuilder.php | 20 +- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- .../Item/ContractItemRequestBuilder.php | 57 ++-- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- .../Item/Restore/RestoreRequestBuilder.php | 20 +- .../ValidatePropertiesRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../DataPolicyOperationsRequestBuilder.php | 39 +-- .../DataPolicyOperationItemRequestBuilder.php | 57 ++-- ...oidManagedAppProtectionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ManagedAppProtectionItemRequestBuilder.php | 57 ++-- .../Item/Apps/AppsRequestBuilder.php | 39 +-- .../Item/Apps/Count/CountRequestBuilder.php | 22 +- .../ManagedMobileAppItemRequestBuilder.php | 57 ++-- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- ...dAppPolicyAssignmentItemRequestBuilder.php | 57 ++-- .../DeploymentSummaryRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...ultManagedAppProtectionsRequestBuilder.php | 39 +-- .../Item/Apps/AppsRequestBuilder.php | 39 +-- .../Item/Apps/Count/CountRequestBuilder.php | 22 +- .../ManagedMobileAppItemRequestBuilder.php | 57 ++-- ...ManagedAppProtectionItemRequestBuilder.php | 57 ++-- .../DeploymentSummaryRequestBuilder.php | 57 ++-- .../DeviceAppManagementRequestBuilder.php | 43 ++- .../Count/CountRequestBuilder.php | 22 +- ...IosManagedAppProtectionsRequestBuilder.php | 39 +-- .../Item/Apps/AppsRequestBuilder.php | 39 +-- .../Item/Apps/Count/CountRequestBuilder.php | 22 +- .../ManagedMobileAppItemRequestBuilder.php | 57 ++-- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- ...dAppPolicyAssignmentItemRequestBuilder.php | 57 ++-- .../DeploymentSummaryRequestBuilder.php | 57 ++-- ...ManagedAppProtectionItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../ManagedAppPolicyItemRequestBuilder.php | 63 ++-- ...cyItemRequestBuilderGetQueryParameters.php | 2 +- .../TargetApps/TargetAppsRequestBuilder.php | 21 +- .../ManagedAppPoliciesRequestBuilder.php | 45 ++- ...liciesRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...thFlaggedAppRegistrationRequestBuilder.php | 20 +- .../AppliedPoliciesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ManagedAppPolicyItemRequestBuilder.php | 57 ++-- .../TargetApps/TargetAppsRequestBuilder.php | 21 +- .../Count/CountRequestBuilder.php | 22 +- .../IntendedPoliciesRequestBuilder.php | 39 +-- .../ManagedAppPolicyItemRequestBuilder.php | 57 ++-- .../TargetApps/TargetAppsRequestBuilder.php | 21 +- ...nagedAppRegistrationItemRequestBuilder.php | 63 ++-- ...onItemRequestBuilderGetQueryParameters.php | 2 +- .../Operations/Count/CountRequestBuilder.php | 22 +- .../ManagedAppOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../ManagedAppRegistrationsRequestBuilder.php | 45 ++- ...ationsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../ManagedAppStatusItemRequestBuilder.php | 63 ++-- ...usItemRequestBuilderGetQueryParameters.php | 2 +- .../ManagedAppStatusesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/Assign/AssignRequestBuilder.php | 19 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- ...nagedEBookAssignmentItemRequestBuilder.php | 63 ++-- ...ntItemRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../DeviceStatesRequestBuilder.php | 39 +-- .../DeviceInstallStateItemRequestBuilder.php | 57 ++-- .../InstallSummaryRequestBuilder.php | 57 ++-- .../Item/ManagedEBookItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../DeviceStatesRequestBuilder.php | 39 +-- .../DeviceInstallStateItemRequestBuilder.php | 57 ++-- ...rInstallStateSummaryItemRequestBuilder.php | 57 ++-- .../UserStateSummaryRequestBuilder.php | 39 +-- .../ManagedEBooksRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- ...dAppPolicyAssignmentItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../ExemptAppLockerFilesRequestBuilder.php | 39 +-- ...tectionAppLockerFileItemRequestBuilder.php | 57 ++-- ...tionProtectionPolicyItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...tectionAppLockerFileItemRequestBuilder.php | 57 ++-- .../ProtectedAppLockerFilesRequestBuilder.php | 39 +-- ...mationProtectionPoliciesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 57 ++-- .../MobileAppCategoriesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/Assign/AssignRequestBuilder.php | 19 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- ...figurationAssignmentItemRequestBuilder.php | 57 ++-- .../DeviceStatusSummaryRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../DeviceStatusesRequestBuilder.php | 39 +-- ...gurationDeviceStatusItemRequestBuilder.php | 57 ++-- ...bileAppConfigurationItemRequestBuilder.php | 63 ++-- ...onItemRequestBuilderGetQueryParameters.php | 2 +- .../UserStatusSummaryRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...figurationUserStatusItemRequestBuilder.php | 57 ++-- .../UserStatusesRequestBuilder.php | 39 +-- .../MobileAppConfigurationsRequestBuilder.php | 39 +-- .../MobileApps/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAndroidLobAppRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAndroidStoreAppRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphIosLobAppRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphIosStoreAppRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphIosVppAppRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphMacOSDmgAppRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphMacOSLobAppRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...raphManagedAndroidLobAppRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphManagedIOSLobAppRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...GraphManagedMobileLobAppRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...osoftStoreForBusinessAppRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphWin32LobAppRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphWindowsAppXRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphWindowsMobileMSIRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...raphWindowsUniversalAppXRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphWindowsWebAppRequestBuilder.php | 20 +- .../Item/Assign/AssignRequestBuilder.php | 19 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../ContentVersionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ContainedAppsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MobileContainedAppItemRequestBuilder.php | 57 ++-- .../Item/Files/Count/CountRequestBuilder.php | 22 +- .../Item/Files/FilesRequestBuilder.php | 39 +-- .../Item/Commit/CommitRequestBuilder.php | 19 +- ...MobileAppContentFileItemRequestBuilder.php | 57 ++-- .../RenewUpload/RenewUploadRequestBuilder.php | 19 +- .../MobileAppContentItemRequestBuilder.php | 57 ++-- .../GraphAndroidLobAppRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../GraphAndroidStoreAppRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../ContentVersionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ContainedAppsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MobileContainedAppItemRequestBuilder.php | 57 ++-- .../Item/Files/Count/CountRequestBuilder.php | 22 +- .../Item/Files/FilesRequestBuilder.php | 39 +-- .../Item/Commit/CommitRequestBuilder.php | 19 +- ...MobileAppContentFileItemRequestBuilder.php | 57 ++-- .../RenewUpload/RenewUploadRequestBuilder.php | 19 +- .../MobileAppContentItemRequestBuilder.php | 57 ++-- .../GraphIosLobAppRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../GraphIosStoreAppRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../GraphIosVppAppRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../ContentVersionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ContainedAppsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MobileContainedAppItemRequestBuilder.php | 57 ++-- .../Item/Files/Count/CountRequestBuilder.php | 22 +- .../Item/Files/FilesRequestBuilder.php | 39 +-- .../Item/Commit/CommitRequestBuilder.php | 19 +- ...MobileAppContentFileItemRequestBuilder.php | 57 ++-- .../RenewUpload/RenewUploadRequestBuilder.php | 19 +- .../MobileAppContentItemRequestBuilder.php | 57 ++-- .../GraphMacOSDmgAppRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../ContentVersionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ContainedAppsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MobileContainedAppItemRequestBuilder.php | 57 ++-- .../Item/Files/Count/CountRequestBuilder.php | 22 +- .../Item/Files/FilesRequestBuilder.php | 39 +-- .../Item/Commit/CommitRequestBuilder.php | 19 +- ...MobileAppContentFileItemRequestBuilder.php | 57 ++-- .../RenewUpload/RenewUploadRequestBuilder.php | 19 +- .../MobileAppContentItemRequestBuilder.php | 57 ++-- .../GraphMacOSLobAppRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../ContentVersionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ContainedAppsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MobileContainedAppItemRequestBuilder.php | 57 ++-- .../Item/Files/Count/CountRequestBuilder.php | 22 +- .../Item/Files/FilesRequestBuilder.php | 39 +-- .../Item/Commit/CommitRequestBuilder.php | 19 +- ...MobileAppContentFileItemRequestBuilder.php | 57 ++-- .../RenewUpload/RenewUploadRequestBuilder.php | 19 +- .../MobileAppContentItemRequestBuilder.php | 57 ++-- ...raphManagedAndroidLobAppRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../ContentVersionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ContainedAppsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MobileContainedAppItemRequestBuilder.php | 57 ++-- .../Item/Files/Count/CountRequestBuilder.php | 22 +- .../Item/Files/FilesRequestBuilder.php | 39 +-- .../Item/Commit/CommitRequestBuilder.php | 19 +- ...MobileAppContentFileItemRequestBuilder.php | 57 ++-- .../RenewUpload/RenewUploadRequestBuilder.php | 19 +- .../MobileAppContentItemRequestBuilder.php | 57 ++-- .../GraphManagedIOSLobAppRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../ContentVersionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ContainedAppsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MobileContainedAppItemRequestBuilder.php | 57 ++-- .../Item/Files/Count/CountRequestBuilder.php | 22 +- .../Item/Files/FilesRequestBuilder.php | 39 +-- .../Item/Commit/CommitRequestBuilder.php | 19 +- ...MobileAppContentFileItemRequestBuilder.php | 57 ++-- .../RenewUpload/RenewUploadRequestBuilder.php | 19 +- .../MobileAppContentItemRequestBuilder.php | 57 ++-- ...GraphManagedMobileLobAppRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- ...osoftStoreForBusinessAppRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../ContentVersionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ContainedAppsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MobileContainedAppItemRequestBuilder.php | 57 ++-- .../Item/Files/Count/CountRequestBuilder.php | 22 +- .../Item/Files/FilesRequestBuilder.php | 39 +-- .../Item/Commit/CommitRequestBuilder.php | 19 +- ...MobileAppContentFileItemRequestBuilder.php | 57 ++-- .../RenewUpload/RenewUploadRequestBuilder.php | 19 +- .../MobileAppContentItemRequestBuilder.php | 57 ++-- .../GraphWin32LobAppRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../ContentVersionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ContainedAppsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MobileContainedAppItemRequestBuilder.php | 57 ++-- .../Item/Files/Count/CountRequestBuilder.php | 22 +- .../Item/Files/FilesRequestBuilder.php | 39 +-- .../Item/Commit/CommitRequestBuilder.php | 19 +- ...MobileAppContentFileItemRequestBuilder.php | 57 ++-- .../RenewUpload/RenewUploadRequestBuilder.php | 19 +- .../MobileAppContentItemRequestBuilder.php | 57 ++-- .../GraphWindowsAppXRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../ContentVersionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ContainedAppsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MobileContainedAppItemRequestBuilder.php | 57 ++-- .../Item/Files/Count/CountRequestBuilder.php | 22 +- .../Item/Files/FilesRequestBuilder.php | 39 +-- .../Item/Commit/CommitRequestBuilder.php | 19 +- ...MobileAppContentFileItemRequestBuilder.php | 57 ++-- .../RenewUpload/RenewUploadRequestBuilder.php | 19 +- .../MobileAppContentItemRequestBuilder.php | 57 ++-- .../GraphWindowsMobileMSIRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../CommittedContainedAppsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MobileContainedAppItemRequestBuilder.php | 57 ++-- .../ContentVersionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ContainedAppsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MobileContainedAppItemRequestBuilder.php | 57 ++-- .../Item/Files/Count/CountRequestBuilder.php | 22 +- .../Item/Files/FilesRequestBuilder.php | 39 +-- .../Item/Commit/CommitRequestBuilder.php | 19 +- ...MobileAppContentFileItemRequestBuilder.php | 57 ++-- .../RenewUpload/RenewUploadRequestBuilder.php | 19 +- .../MobileAppContentItemRequestBuilder.php | 57 ++-- ...raphWindowsUniversalAppXRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../MobileAppAssignmentItemRequestBuilder.php | 57 ++-- .../Categories/CategoriesRequestBuilder.php | 20 +- .../Categories/Count/CountRequestBuilder.php | 22 +- .../MobileAppCategoryItemRequestBuilder.php | 20 +- .../GraphWindowsWebAppRequestBuilder.php | 20 +- .../Item/MobileAppItemRequestBuilder.php | 75 ++--- ...ppItemRequestBuilderGetQueryParameters.php | 2 +- .../MobileApps/MobileAppsRequestBuilder.php | 51 ++- ...leAppsRequestBuilderGetQueryParameters.php | 2 +- ...softStoreForBusinessAppsRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/Apps/AppsRequestBuilder.php | 39 +-- .../Item/Apps/Count/CountRequestBuilder.php | 22 +- .../ManagedMobileAppItemRequestBuilder.php | 57 ++-- .../Item/Assign/AssignRequestBuilder.php | 19 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- ...dAppPolicyAssignmentItemRequestBuilder.php | 57 ++-- .../DeploymentSummaryRequestBuilder.php | 57 ++-- .../TargetApps/TargetAppsRequestBuilder.php | 19 +- ...agedAppConfigurationItemRequestBuilder.php | 57 ++-- ...ManagedAppConfigurationsRequestBuilder.php | 39 +-- .../VppTokens/Count/CountRequestBuilder.php | 22 +- .../SyncLicensesRequestBuilder.php | 20 +- .../Item/VppTokenItemRequestBuilder.php | 57 ++-- .../VppTokens/VppTokensRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- ...dAppPolicyAssignmentItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../ExemptAppLockerFilesRequestBuilder.php | 39 +-- ...tectionAppLockerFileItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...tectionAppLockerFileItemRequestBuilder.php | 57 ++-- .../ProtectedAppLockerFilesRequestBuilder.php | 39 +-- ...tionProtectionPolicyItemRequestBuilder.php | 57 ++-- ...mationProtectionPoliciesRequestBuilder.php | 39 +-- ...hNotificationCertificateRequestBuilder.php | 57 ++-- ...ertificateSigningRequestRequestBuilder.php | 20 +- .../AuditEvents/AuditEventsRequestBuilder.php | 39 +-- .../AuditEvents/Count/CountRequestBuilder.php | 22 +- ...ctivityTypesWithCategoryRequestBuilder.php | 20 +- .../GetAuditCategoriesRequestBuilder.php | 20 +- .../Item/AuditEventItemRequestBuilder.php | 57 ++-- ...lianceManagementPartnersRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...nceManagementPartnerItemRequestBuilder.php | 57 ++-- ...onditionalAccessSettingsRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../DetectedAppsRequestBuilder.php | 39 +-- .../Item/DetectedAppItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/ManagedDeviceItemRequestBuilder.php | 20 +- .../ManagedDevicesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../DeviceCategoriesRequestBuilder.php | 39 +-- .../Item/DeviceCategoryItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...DeviceCompliancePoliciesRequestBuilder.php | 51 ++- ...liciesRequestBuilderGetQueryParameters.php | 2 +- .../Item/Assign/AssignRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- ...ancePolicyAssignmentItemRequestBuilder.php | 57 ++-- ...viceCompliancePolicyItemRequestBuilder.php | 69 ++-- .../Count/CountRequestBuilder.php | 22 +- ...iceSettingStateSummariesRequestBuilder.php | 39 +-- ...ngStateDeviceSummaryItemRequestBuilder.php | 57 ++-- .../DeviceStatusOverviewRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../DeviceStatusesRequestBuilder.php | 39 +-- ...mplianceDeviceStatusItemRequestBuilder.php | 57 ++-- .../ScheduleActionsForRulesRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- ...heduledActionForRuleItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...ComplianceActionItemItemRequestBuilder.php | 57 ++-- ...uledActionConfigurationsRequestBuilder.php | 39 +-- .../ScheduledActionsForRuleRequestBuilder.php | 39 +-- .../UserStatusOverviewRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...ComplianceUserStatusItemRequestBuilder.php | 57 ++-- .../UserStatusesRequestBuilder.php | 39 +-- ...PolicyDeviceStateSummaryRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...icySettingStateSummariesRequestBuilder.php | 39 +-- ...ySettingStateSummaryItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...eComplianceSettingStatesRequestBuilder.php | 39 +-- ...mplianceSettingStateItemRequestBuilder.php | 57 ++-- ...tionDeviceStateSummariesRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../DeviceConfigurationsRequestBuilder.php | 51 ++- ...ationsRequestBuilderGetQueryParameters.php | 2 +- .../Item/Assign/AssignRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- ...figurationAssignmentItemRequestBuilder.php | 57 ++-- .../DeviceConfigurationItemRequestBuilder.php | 75 ++--- ...onItemRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...iceSettingStateSummariesRequestBuilder.php | 39 +-- ...ngStateDeviceSummaryItemRequestBuilder.php | 57 ++-- .../DeviceStatusOverviewRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../DeviceStatusesRequestBuilder.php | 39 +-- ...gurationDeviceStatusItemRequestBuilder.php | 57 ++-- ...thSecretReferenceValueIdRequestBuilder.php | 20 +- .../UserStatusOverviewRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...figurationUserStatusItemRequestBuilder.php | 57 ++-- .../UserStatusesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...EnrollmentConfigurationsRequestBuilder.php | 45 ++- .../Item/Assign/AssignRequestBuilder.php | 19 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- ...figurationAssignmentItemRequestBuilder.php | 57 ++-- ...ollmentConfigurationItemRequestBuilder.php | 69 ++-- .../SetPriority/SetPriorityRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- ...DeviceManagementPartnersRequestBuilder.php | 39 +-- ...iceManagementPartnerItemRequestBuilder.php | 57 ++-- .../Terminate/TerminateRequestBuilder.php | 19 +- .../DeviceManagementRequestBuilder.php | 43 ++- .../Count/CountRequestBuilder.php | 22 +- .../ExchangeConnectorsRequestBuilder.php | 39 +-- ...entExchangeConnectorItemRequestBuilder.php | 57 ++-- .../Item/Sync/SyncRequestBuilder.php | 19 +- ...tivePermissionsWithScopeRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Import/ImportRequestBuilder.php | 20 +- ...utopilotDeviceIdentitiesRequestBuilder.php | 39 +-- ...opilotDeviceIdentityItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../IosUpdateStatusesRequestBuilder.php | 39 +-- ...osUpdateDeviceStatusItemRequestBuilder.php | 57 ++-- .../ManagedDeviceOverviewRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../BypassActivationLockRequestBuilder.php | 19 +- .../CleanWindowsDeviceRequestBuilder.php | 19 +- ...serFromSharedAppleDeviceRequestBuilder.php | 19 +- .../DeviceCategoryRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...ceCompliancePolicyStatesRequestBuilder.php | 39 +-- ...ompliancePolicyStateItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...eviceConfigurationStatesRequestBuilder.php | 39 +-- ...ceConfigurationStateItemRequestBuilder.php | 57 ++-- .../DisableLostModeRequestBuilder.php | 19 +- .../LocateDeviceRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../CreateDownloadUrlRequestBuilder.php | 20 +- ...ogCollectionResponseItemRequestBuilder.php | 57 ++-- .../LogCollectionRequestsRequestBuilder.php | 39 +-- ...redAppleDeviceActiveUserRequestBuilder.php | 19 +- .../Item/ManagedDeviceItemRequestBuilder.php | 57 ++-- .../RebootNow/RebootNowRequestBuilder.php | 19 +- .../RecoverPasscodeRequestBuilder.php | 19 +- .../RemoteLock/RemoteLockRequestBuilder.php | 19 +- .../RequestRemoteAssistanceRequestBuilder.php | 19 +- .../ResetPasscodeRequestBuilder.php | 19 +- .../Item/Retire/RetireRequestBuilder.php | 19 +- .../Item/ShutDown/ShutDownRequestBuilder.php | 19 +- .../SyncDevice/SyncDeviceRequestBuilder.php | 19 +- ...dateWindowsDeviceAccountRequestBuilder.php | 19 +- .../Item/Users/UsersRequestBuilder.php | 20 +- .../WindowsDefenderScanRequestBuilder.php | 19 +- ...DefenderUpdateSignaturesRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../DetectedMalwareStateRequestBuilder.php | 39 +-- ...wsDeviceMalwareStateItemRequestBuilder.php | 57 ++-- .../WindowsProtectionStateRequestBuilder.php | 57 ++-- .../Item/Wipe/WipeRequestBuilder.php | 19 +- .../ManagedDevicesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...AppLogCollectionRequestsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...LogCollectionRequestItemRequestBuilder.php | 57 ++-- .../CreateDownloadUrlRequestBuilder.php | 20 +- ...TroubleshootingEventItemRequestBuilder.php | 57 ++-- ...AppTroubleshootingEventsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...reatDefenseConnectorItemRequestBuilder.php | 57 ++-- ...eThreatDefenseConnectorsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- ...dNotificationMessageItemRequestBuilder.php | 57 ++-- ...izedNotificationMessagesRequestBuilder.php | 39 +-- ...ationMessageTemplateItemRequestBuilder.php | 57 ++-- .../SendTestMessageRequestBuilder.php | 19 +- ...ficationMessageTemplatesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../BeginOnboardingRequestBuilder.php | 19 +- .../Disconnect/DisconnectRequestBuilder.php | 19 +- ...oteAssistancePartnerItemRequestBuilder.php | 57 ++-- ...RemoteAssistancePartnersRequestBuilder.php | 39 +-- .../ExportJobs/Count/CountRequestBuilder.php | 22 +- .../ExportJobs/ExportJobsRequestBuilder.php | 39 +-- ...eManagementExportJobItemRequestBuilder.php | 57 ++-- .../GetCachedReportRequestBuilder.php | 21 +- ...olicyNonComplianceReportRequestBuilder.php | 21 +- ...nComplianceSummaryReportRequestBuilder.php | 21 +- ...ttingNonComplianceReportRequestBuilder.php | 21 +- ...olicyNonComplianceReportRequestBuilder.php | 21 +- ...nComplianceSummaryReportRequestBuilder.php | 21 +- ...ttingNonComplianceReportRequestBuilder.php | 21 +- ...tingContributingProfilesRequestBuilder.php | 21 +- ...mentIntentSettingsReportRequestBuilder.php | 21 +- ...eviceNonComplianceReportRequestBuilder.php | 21 +- ...utCompliancePolicyReportRequestBuilder.php | 21 +- .../GetHistoricalReportRequestBuilder.php | 21 +- ...DevicesAndSettingsReportRequestBuilder.php | 21 +- ...icyNonComplianceMetadataRequestBuilder.php | 21 +- ...olicyNonComplianceReportRequestBuilder.php | 21 +- ...nComplianceSummaryReportRequestBuilder.php | 21 +- .../GetReportFiltersRequestBuilder.php | 21 +- ...ttingNonComplianceReportRequestBuilder.php | 21 +- .../Reports/ReportsRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../ResourceOperationItemRequestBuilder.php | 57 ++-- .../ResourceOperationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...gementRoleAssignmentItemRequestBuilder.php | 57 ++-- .../RoleDefinitionRequestBuilder.php | 20 +- .../RoleAssignmentsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/RoleAssignmentItemRequestBuilder.php | 57 ++-- .../RoleDefinitionRequestBuilder.php | 20 +- .../RoleAssignmentsRequestBuilder.php | 39 +-- .../Item/RoleDefinitionItemRequestBuilder.php | 69 ++-- ...onItemRequestBuilderGetQueryParameters.php | 2 +- .../RoleDefinitionsRequestBuilder.php | 39 +-- ...twareUpdateStatusSummaryRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...nseManagementPartnerItemRequestBuilder.php | 57 ++-- ...xpenseManagementPartnersRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AcceptanceStatusesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../TermsAndConditionsRequestBuilder.php | 20 +- ...ionsAcceptanceStatusItemRequestBuilder.php | 57 ++-- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- ...ConditionsAssignmentItemRequestBuilder.php | 57 ++-- .../TermsAndConditionsItemRequestBuilder.php | 57 ++-- .../TermsAndConditionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...TroubleshootingEventItemRequestBuilder.php | 57 ++-- .../TroubleshootingEventsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...plicationPerformanceItemRequestBuilder.php | 57 ++-- ...thApplicationPerformanceRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...eByAppVersionDetailsItemRequestBuilder.php | 57 ++-- ...manceByAppVersionDetailsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ByAppVersionDeviceIdItemRequestBuilder.php | 57 ++-- ...anceByAppVersionDeviceIdRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...rformanceByOSVersionItemRequestBuilder.php | 57 ++-- ...onPerformanceByOSVersionRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...viceModelPerformanceItemRequestBuilder.php | 57 ++-- ...thDeviceModelPerformanceRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...lthDevicePerformanceItemRequestBuilder.php | 57 ++-- ...pHealthDevicePerformanceRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...cePerformanceDetailsItemRequestBuilder.php | 57 ++-- ...DevicePerformanceDetailsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...OSVersionPerformanceItemRequestBuilder.php | 57 ++-- ...althOSVersionPerformanceRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ienceAnalyticsMetricItemRequestBuilder.php | 57 ++-- .../MetricValuesRequestBuilder.php | 39 +-- ...alyticsAppHealthOverviewRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../AppHealthMetricsRequestBuilder.php | 20 +- .../BatteryHealthMetricsRequestBuilder.php | 20 +- .../BestPracticesMetricsRequestBuilder.php | 20 +- ...ceBootPerformanceMetricsRequestBuilder.php | 20 +- .../RebootAnalyticsMetricsRequestBuilder.php | 20 +- ...sourcePerformanceMetricsRequestBuilder.php | 20 +- ...nceAnalyticsBaselineItemRequestBuilder.php | 57 ++-- .../WorkFromAnywhereMetricsRequestBuilder.php | 20 +- ...rienceAnalyticsBaselinesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- ...ienceAnalyticsMetricItemRequestBuilder.php | 57 ++-- .../MetricValuesRequestBuilder.php | 39 +-- ...nceAnalyticsCategoryItemRequestBuilder.php | 57 ++-- ...ienceAnalyticsCategoriesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...icsDevicePerformanceItemRequestBuilder.php | 57 ++-- ...ceDevicesWithSummarizeByRequestBuilder.php | 20 +- ...alyticsDevicePerformanceRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...nalyticsDeviceScoresItemRequestBuilder.php | 57 ++-- ...nceAnalyticsDeviceScoresRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...DeviceStartupHistoryItemRequestBuilder.php | 57 ++-- ...ticsDeviceStartupHistoryRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...upProcessPerformanceItemRequestBuilder.php | 57 ++-- ...tartupProcessPerformanceRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...DeviceStartupProcessItemRequestBuilder.php | 57 ++-- ...csDeviceStartupProcessesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...alyticsMetricHistoryItemRequestBuilder.php | 57 ++-- ...ceAnalyticsMetricHistoryRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...AnalyticsModelScoresItemRequestBuilder.php | 57 ++-- ...enceAnalyticsModelScoresRequestBuilder.php | 39 +-- ...erienceAnalyticsOverviewRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...nalyticsScoreHistoryItemRequestBuilder.php | 57 ++-- ...nceAnalyticsScoreHistoryRequestBuilder.php | 39 +-- ...eWorkFromAnywhereDevicesRequestBuilder.php | 20 +- ...eHardwareReadinessMetricRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- ...rkFromAnywhereDeviceItemRequestBuilder.php | 57 ++-- .../MetricDevicesRequestBuilder.php | 39 +-- ...rkFromAnywhereMetricItemRequestBuilder.php | 57 ++-- ...sWorkFromAnywhereMetricsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...hereModelPerformanceItemRequestBuilder.php | 57 ++-- ...AnywhereModelPerformanceRequestBuilder.php | 39 +-- ...oDiscoveryWithDomainNameRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../AssignUserToDeviceRequestBuilder.php | 19 +- .../UnassignUserFromDeviceRequestBuilder.php | 19 +- .../UpdateDevicePropertiesRequestBuilder.php | 19 +- ...opilotDeviceIdentityItemRequestBuilder.php | 57 ++-- ...utopilotDeviceIdentitiesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...onAppLearningSummaryItemRequestBuilder.php | 57 ++-- ...tionAppLearningSummariesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...tworkLearningSummaryItemRequestBuilder.php | 57 ++-- ...NetworkLearningSummariesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../DeviceMalwareStatesRequestBuilder.php | 39 +-- ...tateForWindowsDeviceItemRequestBuilder.php | 57 ++-- ...wsMalwareInformationItemRequestBuilder.php | 57 ++-- ...indowsMalwareInformationRequestBuilder.php | 39 +-- .../Devices/Count/CountRequestBuilder.php | 22 +- .../Devices/Delta/DeltaRequestBuilder.php | 20 +- .../Devices/DevicesRequestBuilder.php | 39 +-- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../GetByIds/GetByIdsRequestBuilder.php | 20 +- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- .../Devices/Item/DeviceItemRequestBuilder.php | 57 ++-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- .../MemberOf/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Item/MemberOf/MemberOfRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphEndpointRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/Count/CountRequestBuilder.php | 22 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../GraphEndpointRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../Ref/RefRequestBuilder.php | 38 +-- .../RegisteredOwnersRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphEndpointRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/Count/CountRequestBuilder.php | 22 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../GraphEndpointRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../RegisteredUsers/Ref/RefRequestBuilder.php | 38 +-- .../RegisteredUsersRequestBuilder.php | 20 +- .../Item/Restore/RestoreRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../TransitiveMemberOfRequestBuilder.php | 20 +- .../ValidatePropertiesRequestBuilder.php | 19 +- .../DevicesWithDeviceIdRequestBuilder.php | 57 ++-- .../AdministrativeUnitsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../AdministrativeUnitItemRequestBuilder.php | 57 ++-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Members/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/Count/CountRequestBuilder.php | 22 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/Count/CountRequestBuilder.php | 22 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../Members/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/Members/MembersRequestBuilder.php | 39 +-- .../Item/Members/Ref/RefRequestBuilder.php | 38 +-- .../Count/CountRequestBuilder.php | 22 +- ...ScopedRoleMembershipItemRequestBuilder.php | 65 ++-- ...ipItemRequestBuilderGetQueryParameters.php | 2 +- .../ScopedRoleMembersRequestBuilder.php | 47 ++- ...embersRequestBuilderGetQueryParameters.php | 2 +- .../AttributeSetsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/AttributeSetItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...rityAttributeDefinitionsRequestBuilder.php | 39 +-- .../AllowedValuesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/AllowedValueItemRequestBuilder.php | 57 ++-- ...yAttributeDefinitionItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../DeletedItemsRequestBuilder.php | 20 +- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../GetByIds/GetByIdsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/Count/CountRequestBuilder.php | 22 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/Count/CountRequestBuilder.php | 22 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 38 +-- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../Item/Restore/RestoreRequestBuilder.php | 20 +- .../ValidatePropertiesRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 26 +- .../CountRequestBuilderGetQueryParameters.php | 12 +- ...tRequestBuilderGetRequestConfiguration.php | 7 +- .../DeviceLocalCredentialsRequestBuilder.php | 136 ++++++++ ...ntialsRequestBuilderGetQueryParameters.php | 66 ++++ ...sRequestBuilderGetRequestConfiguration.php | 43 +++ ...RequestBuilderPostRequestConfiguration.php | 22 ++ ...eLocalCredentialInfoItemRequestBuilder.php | 148 +++++++++ ...questBuilderDeleteRequestConfiguration.php | 22 ++ ...foItemRequestBuilderGetQueryParameters.php | 26 ++ ...mRequestBuilderGetRequestConfiguration.php | 38 +++ ...equestBuilderPatchRequestConfiguration.php | 22 ++ .../Directory/DirectoryRequestBuilder.php | 47 +-- .../AvailableProviderTypesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...FederationConfigurationsRequestBuilder.php | 39 +-- ...IdentityProviderBaseItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...ctorySynchronizationItemRequestBuilder.php | 57 ++-- ...nPremisesSynchronizationRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../DirectoryObjectsRequestBuilder.php | 39 +-- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../GetByIds/GetByIdsRequestBuilder.php | 20 +- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 57 ++-- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- .../Item/Restore/RestoreRequestBuilder.php | 20 +- .../ValidatePropertiesRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../DirectoryRoleTemplatesRequestBuilder.php | 39 +-- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../GetByIds/GetByIdsRequestBuilder.php | 20 +- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- ...irectoryRoleTemplateItemRequestBuilder.php | 57 ++-- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- .../Item/Restore/RestoreRequestBuilder.php | 20 +- .../ValidatePropertiesRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../DirectoryRolesRequestBuilder.php | 43 ++- ...yRolesRequestBuilderGetQueryParameters.php | 2 +- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../GetByIds/GetByIdsRequestBuilder.php | 20 +- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- .../Item/DirectoryRoleItemRequestBuilder.php | 57 ++-- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/Count/CountRequestBuilder.php | 22 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/Count/CountRequestBuilder.php | 22 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../Members/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/Members/MembersRequestBuilder.php | 20 +- .../Item/Members/Ref/RefRequestBuilder.php | 38 +-- .../Item/Restore/RestoreRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...ScopedRoleMembershipItemRequestBuilder.php | 57 ++-- .../ScopedMembersRequestBuilder.php | 39 +-- .../ValidatePropertiesRequestBuilder.php | 19 +- ...yRolesWithRoleTemplateIdRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../DomainDnsRecordsRequestBuilder.php | 39 +-- .../DomainDnsRecordItemRequestBuilder.php | 57 ++-- .../Domains/Count/CountRequestBuilder.php | 22 +- .../Domains/DomainsRequestBuilder.php | 43 ++- .../Domains/Item/DomainItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../DomainNameReferencesRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../FederationConfigurationRequestBuilder.php | 44 ++- ...rationRequestBuilderGetQueryParameters.php | 2 +- ...rnalDomainFederationItemRequestBuilder.php | 57 ++-- .../ForceDelete/ForceDeleteRequestBuilder.php | 19 +- .../Item/Promote/PromoteRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../DomainDnsRecordItemRequestBuilder.php | 57 ++-- ...viceConfigurationRecordsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../DomainDnsRecordItemRequestBuilder.php | 61 ++-- ...rdItemRequestBuilderGetQueryParameters.php | 2 +- .../VerificationDnsRecordsRequestBuilder.php | 43 ++- ...ecordsRequestBuilderGetQueryParameters.php | 2 +- .../Item/Verify/VerifyRequestBuilder.php | 20 +- src/Generated/Drives/DrivesRequestBuilder.php | 39 +-- .../Item/Bundles/BundlesRequestBuilder.php | 39 +-- .../Bundles/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../Item/DriveItemItemRequestBuilder.php | 20 +- .../CreatedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Drives/Item/DriveItemRequestBuilder.php | 57 ++-- .../Columns/ColumnsRequestBuilder.php | 39 +-- .../Columns/Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 57 ++-- .../SourceColumnRequestBuilder.php | 20 +- .../AddCopy/AddCopyRequestBuilder.php | 20 +- ...ddCopyFromContentTypeHubRequestBuilder.php | 20 +- .../ContentTypesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ompatibleHubContentTypesRequestBuilder.php | 20 +- .../AssociateWithHubSitesRequestBuilder.php | 19 +- .../Item/Base/EscapedBaseRequestBuilder.php | 20 +- .../BaseTypes/BaseTypesRequestBuilder.php | 20 +- .../BaseTypes/Count/CountRequestBuilder.php | 22 +- .../Item/ContentTypeItemRequestBuilder.php | 20 +- .../ColumnLinks/ColumnLinksRequestBuilder.php | 39 +-- .../ColumnLinks/Count/CountRequestBuilder.php | 22 +- .../Item/ColumnLinkItemRequestBuilder.php | 57 ++-- .../ColumnPositionsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 20 +- .../Item/Columns/ColumnsRequestBuilder.php | 39 +-- .../Columns/Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 57 ++-- .../SourceColumnRequestBuilder.php | 20 +- .../Item/ContentTypeItemRequestBuilder.php | 57 ++-- ...ToDefaultContentLocationRequestBuilder.php | 19 +- .../IsPublished/IsPublishedRequestBuilder.php | 20 +- .../Item/Publish/PublishRequestBuilder.php | 19 +- .../Unpublish/UnpublishRequestBuilder.php | 19 +- .../CreatedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../EscapedList/Drive/DriveRequestBuilder.php | 20 +- .../Items/Count/CountRequestBuilder.php | 22 +- .../Analytics/AnalyticsRequestBuilder.php | 20 +- .../CreatedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../DocumentSetVersionsRequestBuilder.php | 39 +-- .../DocumentSetVersionItemRequestBuilder.php | 57 ++-- .../Item/Fields/FieldsRequestBuilder.php | 57 ++-- .../Item/Restore/RestoreRequestBuilder.php | 19 +- .../Content/ContentRequestBuilder.php | 42 ++- .../DriveItem/DriveItemRequestBuilder.php | 20 +- .../Item/Fields/FieldsRequestBuilder.php | 57 ++-- .../GetActivitiesByIntervalRequestBuilder.php | 20 +- ...hEndDateTimeWithIntervalRequestBuilder.php | 20 +- .../LastModifiedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Items/Item/ListItemItemRequestBuilder.php | 57 ++-- .../Versions/Count/CountRequestBuilder.php | 22 +- .../Item/Fields/FieldsRequestBuilder.php | 57 ++-- .../ListItemVersionItemRequestBuilder.php | 57 ++-- .../RestoreVersionRequestBuilder.php | 19 +- .../Item/Versions/VersionsRequestBuilder.php | 39 +-- .../EscapedList/Items/ItemsRequestBuilder.php | 39 +-- .../LastModifiedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/EscapedList/ListRequestBuilder.php | 57 ++-- .../Operations/Count/CountRequestBuilder.php | 22 +- ...LongRunningOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Reauthorize/ReauthorizeRequestBuilder.php | 19 +- .../Item/SubscriptionItemRequestBuilder.php | 57 ++-- .../SubscriptionsRequestBuilder.php | 39 +-- .../Following/Count/CountRequestBuilder.php | 22 +- .../Following/FollowingRequestBuilder.php | 20 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../Item/DriveItemItemRequestBuilder.php | 20 +- .../Item/Items/Count/CountRequestBuilder.php | 22 +- .../AllTime/AllTimeRequestBuilder.php | 20 +- .../Analytics/AnalyticsRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Activities/ActivitiesRequestBuilder.php | 39 +-- .../Activities/Count/CountRequestBuilder.php | 22 +- .../Content/ContentRequestBuilder.php | 42 ++- .../DriveItem/DriveItemRequestBuilder.php | 20 +- .../Item/ItemActivityItemRequestBuilder.php | 57 ++-- .../ItemActivityStatItemRequestBuilder.php | 57 ++-- .../ItemActivityStatsRequestBuilder.php | 39 +-- .../LastSevenDaysRequestBuilder.php | 20 +- .../AssignSensitivityLabelRequestBuilder.php | 19 +- .../Item/Checkin/CheckinRequestBuilder.php | 19 +- .../Item/Checkout/CheckoutRequestBuilder.php | 19 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../Item/DriveItemItemRequestBuilder.php | 20 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../Items/Item/Copy/CopyRequestBuilder.php | 20 +- .../CreateLink/CreateLinkRequestBuilder.php | 20 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../CreatedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Items/Item/Delta/DeltaRequestBuilder.php | 20 +- .../DeltaWithTokenRequestBuilder.php | 20 +- .../Item/DriveItemItemRequestBuilder.php | 63 ++-- ...ExtractSensitivityLabelsRequestBuilder.php | 20 +- .../Item/Follow/FollowRequestBuilder.php | 20 +- .../GetActivitiesByIntervalRequestBuilder.php | 20 +- ...hEndDateTimeWithIntervalRequestBuilder.php | 20 +- .../Item/Invite/InviteRequestBuilder.php | 20 +- .../LastModifiedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/ListItem/ListItemRequestBuilder.php | 20 +- .../PermanentDeleteRequestBuilder.php | 19 +- .../Permissions/Count/CountRequestBuilder.php | 22 +- .../Item/Grant/GrantRequestBuilder.php | 20 +- .../Item/PermissionItemRequestBuilder.php | 57 ++-- .../Permissions/PermissionsRequestBuilder.php | 39 +-- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Restore/RestoreRequestBuilder.php | 20 +- .../SearchWithQ/SearchWithQRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Reauthorize/ReauthorizeRequestBuilder.php | 19 +- .../Item/SubscriptionItemRequestBuilder.php | 57 ++-- .../SubscriptionsRequestBuilder.php | 39 +-- .../Thumbnails/Count/CountRequestBuilder.php | 22 +- .../Item/ThumbnailSetItemRequestBuilder.php | 57 ++-- .../Thumbnails/ThumbnailsRequestBuilder.php | 39 +-- .../Item/Unfollow/UnfollowRequestBuilder.php | 19 +- .../ValidatePermissionRequestBuilder.php | 19 +- .../Versions/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../DriveItemVersionItemRequestBuilder.php | 57 ++-- .../RestoreVersionRequestBuilder.php | 19 +- .../Item/Versions/VersionsRequestBuilder.php | 39 +-- .../Application/ApplicationRequestBuilder.php | 57 ++-- .../Calculate/CalculateRequestBuilder.php | 19 +- .../CloseSessionRequestBuilder.php | 19 +- .../Comments/CommentsRequestBuilder.php | 39 +-- .../Comments/Count/CountRequestBuilder.php | 22 +- .../Replies/Count/CountRequestBuilder.php | 22 +- ...WorkbookCommentReplyItemRequestBuilder.php | 57 ++-- .../Item/Replies/RepliesRequestBuilder.php | 39 +-- .../WorkbookCommentItemRequestBuilder.php | 57 ++-- .../CreateSessionRequestBuilder.php | 20 +- .../Functions/Abs/AbsRequestBuilder.php | 20 +- .../AccrInt/AccrIntRequestBuilder.php | 20 +- .../AccrIntM/AccrIntMRequestBuilder.php | 20 +- .../Functions/Acos/AcosRequestBuilder.php | 20 +- .../Functions/Acosh/AcoshRequestBuilder.php | 20 +- .../Functions/Acot/AcotRequestBuilder.php | 20 +- .../Functions/Acoth/AcothRequestBuilder.php | 20 +- .../AmorDegrc/AmorDegrcRequestBuilder.php | 20 +- .../AmorLinc/AmorLincRequestBuilder.php | 20 +- .../Functions/Arabic/ArabicRequestBuilder.php | 20 +- .../Functions/Areas/AreasRequestBuilder.php | 20 +- .../Functions/Asc/AscRequestBuilder.php | 20 +- .../Functions/Asin/AsinRequestBuilder.php | 20 +- .../Functions/Asinh/AsinhRequestBuilder.php | 20 +- .../Functions/Atan/AtanRequestBuilder.php | 20 +- .../Functions/Atan2/Atan2RequestBuilder.php | 20 +- .../Functions/Atanh/AtanhRequestBuilder.php | 20 +- .../Functions/AveDev/AveDevRequestBuilder.php | 20 +- .../Average/AverageRequestBuilder.php | 20 +- .../AverageA/AverageARequestBuilder.php | 20 +- .../AverageIf/AverageIfRequestBuilder.php | 20 +- .../AverageIfs/AverageIfsRequestBuilder.php | 20 +- .../BahtText/BahtTextRequestBuilder.php | 20 +- .../Base/EscapedBaseRequestBuilder.php | 20 +- .../BesselI/BesselIRequestBuilder.php | 20 +- .../BesselJ/BesselJRequestBuilder.php | 20 +- .../BesselK/BesselKRequestBuilder.php | 20 +- .../BesselY/BesselYRequestBuilder.php | 20 +- .../Beta_Dist/Beta_DistRequestBuilder.php | 20 +- .../Beta_Inv/Beta_InvRequestBuilder.php | 20 +- .../Bin2Dec/Bin2DecRequestBuilder.php | 20 +- .../Bin2Hex/Bin2HexRequestBuilder.php | 20 +- .../Bin2Oct/Bin2OctRequestBuilder.php | 20 +- .../Binom_Dist/Binom_DistRequestBuilder.php | 20 +- .../Binom_Dist_RangeRequestBuilder.php | 20 +- .../Binom_Inv/Binom_InvRequestBuilder.php | 20 +- .../Functions/Bitand/BitandRequestBuilder.php | 20 +- .../Bitlshift/BitlshiftRequestBuilder.php | 20 +- .../Functions/Bitor/BitorRequestBuilder.php | 20 +- .../Bitrshift/BitrshiftRequestBuilder.php | 20 +- .../Functions/Bitxor/BitxorRequestBuilder.php | 20 +- .../Ceiling_MathRequestBuilder.php | 20 +- .../Ceiling_PreciseRequestBuilder.php | 20 +- .../Functions/Char/CharRequestBuilder.php | 20 +- .../ChiSq_Dist/ChiSq_DistRequestBuilder.php | 20 +- .../ChiSq_Dist_RTRequestBuilder.php | 20 +- .../ChiSq_Inv/ChiSq_InvRequestBuilder.php | 20 +- .../ChiSq_Inv_RTRequestBuilder.php | 20 +- .../Functions/Choose/ChooseRequestBuilder.php | 20 +- .../Functions/Clean/CleanRequestBuilder.php | 20 +- .../Functions/Code/CodeRequestBuilder.php | 20 +- .../Columns/ColumnsRequestBuilder.php | 20 +- .../Functions/Combin/CombinRequestBuilder.php | 20 +- .../Combina/CombinaRequestBuilder.php | 20 +- .../Complex/ComplexRequestBuilder.php | 20 +- .../Concatenate/ConcatenateRequestBuilder.php | 20 +- .../Confidence_NormRequestBuilder.php | 20 +- .../Confidence_TRequestBuilder.php | 20 +- .../Convert/ConvertRequestBuilder.php | 20 +- .../Functions/Cos/CosRequestBuilder.php | 20 +- .../Functions/Cosh/CoshRequestBuilder.php | 20 +- .../Functions/Cot/CotRequestBuilder.php | 20 +- .../Functions/Coth/CothRequestBuilder.php | 20 +- .../Functions/Count/CountRequestBuilder.php | 20 +- .../Functions/CountA/CountARequestBuilder.php | 20 +- .../CountBlank/CountBlankRequestBuilder.php | 20 +- .../CountIf/CountIfRequestBuilder.php | 20 +- .../CountIfs/CountIfsRequestBuilder.php | 20 +- .../CoupDayBs/CoupDayBsRequestBuilder.php | 20 +- .../CoupDays/CoupDaysRequestBuilder.php | 20 +- .../CoupDaysNc/CoupDaysNcRequestBuilder.php | 20 +- .../CoupNcd/CoupNcdRequestBuilder.php | 20 +- .../CoupNum/CoupNumRequestBuilder.php | 20 +- .../CoupPcd/CoupPcdRequestBuilder.php | 20 +- .../Functions/Csc/CscRequestBuilder.php | 20 +- .../Functions/Csch/CschRequestBuilder.php | 20 +- .../CumIPmt/CumIPmtRequestBuilder.php | 20 +- .../CumPrinc/CumPrincRequestBuilder.php | 20 +- .../Functions/Date/DateRequestBuilder.php | 20 +- .../Datevalue/DatevalueRequestBuilder.php | 20 +- .../Daverage/DaverageRequestBuilder.php | 20 +- .../Functions/Day/DayRequestBuilder.php | 20 +- .../Functions/Days/DaysRequestBuilder.php | 20 +- .../Days360/Days360RequestBuilder.php | 20 +- .../Functions/Db/DbRequestBuilder.php | 20 +- .../Functions/Dbcs/DbcsRequestBuilder.php | 20 +- .../Functions/Dcount/DcountRequestBuilder.php | 20 +- .../DcountA/DcountARequestBuilder.php | 20 +- .../Functions/Ddb/DdbRequestBuilder.php | 20 +- .../Dec2Bin/Dec2BinRequestBuilder.php | 20 +- .../Dec2Hex/Dec2HexRequestBuilder.php | 20 +- .../Dec2Oct/Dec2OctRequestBuilder.php | 20 +- .../Decimal/DecimalRequestBuilder.php | 20 +- .../Degrees/DegreesRequestBuilder.php | 20 +- .../Functions/Delta/DeltaRequestBuilder.php | 20 +- .../Functions/DevSq/DevSqRequestBuilder.php | 20 +- .../Functions/Dget/DgetRequestBuilder.php | 20 +- .../Functions/Disc/DiscRequestBuilder.php | 20 +- .../Functions/Dmax/DmaxRequestBuilder.php | 20 +- .../Functions/Dmin/DminRequestBuilder.php | 20 +- .../Functions/Dollar/DollarRequestBuilder.php | 20 +- .../DollarDe/DollarDeRequestBuilder.php | 20 +- .../DollarFr/DollarFrRequestBuilder.php | 20 +- .../Dproduct/DproductRequestBuilder.php | 20 +- .../Functions/DstDev/DstDevRequestBuilder.php | 20 +- .../DstDevP/DstDevPRequestBuilder.php | 20 +- .../Functions/Dsum/DsumRequestBuilder.php | 20 +- .../Duration/DurationRequestBuilder.php | 20 +- .../Functions/Dvar/DvarRequestBuilder.php | 20 +- .../Functions/DvarP/DvarPRequestBuilder.php | 20 +- .../Ecma_CeilingRequestBuilder.php | 20 +- .../Functions/Edate/EdateRequestBuilder.php | 20 +- .../Functions/Effect/EffectRequestBuilder.php | 20 +- .../EoMonth/EoMonthRequestBuilder.php | 20 +- .../Functions/Erf/ErfRequestBuilder.php | 20 +- .../Functions/ErfC/ErfCRequestBuilder.php | 20 +- .../ErfC_PreciseRequestBuilder.php | 20 +- .../Erf_Precise/Erf_PreciseRequestBuilder.php | 20 +- .../Error_Type/Error_TypeRequestBuilder.php | 20 +- .../EscapedAnd/AndRequestBuilder.php | 20 +- .../Functions/EscapedIf/IfRequestBuilder.php | 20 +- .../Functions/EscapedOr/OrRequestBuilder.php | 20 +- .../EscapedXor/XorRequestBuilder.php | 20 +- .../EscapedYield/YieldRequestBuilder.php | 20 +- .../Functions/Even/EvenRequestBuilder.php | 20 +- .../Functions/Exact/ExactRequestBuilder.php | 20 +- .../Functions/Exp/ExpRequestBuilder.php | 20 +- .../Expon_Dist/Expon_DistRequestBuilder.php | 20 +- .../Functions/F_Dist/F_DistRequestBuilder.php | 20 +- .../F_Dist_RT/F_Dist_RTRequestBuilder.php | 20 +- .../Functions/F_Inv/F_InvRequestBuilder.php | 20 +- .../F_Inv_RT/F_Inv_RTRequestBuilder.php | 20 +- .../Functions/Fact/FactRequestBuilder.php | 20 +- .../FactDouble/FactDoubleRequestBuilder.php | 20 +- .../Functions/False/FalseRequestBuilder.php | 20 +- .../Functions/Find/FindRequestBuilder.php | 20 +- .../Functions/FindB/FindBRequestBuilder.php | 20 +- .../Functions/Fisher/FisherRequestBuilder.php | 20 +- .../FisherInv/FisherInvRequestBuilder.php | 20 +- .../Functions/Fixed/FixedRequestBuilder.php | 20 +- .../Floor_Math/Floor_MathRequestBuilder.php | 20 +- .../Floor_PreciseRequestBuilder.php | 20 +- .../Functions/FunctionsRequestBuilder.php | 57 ++-- .../Functions/Fv/FvRequestBuilder.php | 20 +- .../Fvschedule/FvscheduleRequestBuilder.php | 20 +- .../Functions/Gamma/GammaRequestBuilder.php | 20 +- .../GammaLn/GammaLnRequestBuilder.php | 20 +- .../GammaLn_PreciseRequestBuilder.php | 20 +- .../Gamma_Dist/Gamma_DistRequestBuilder.php | 20 +- .../Gamma_Inv/Gamma_InvRequestBuilder.php | 20 +- .../Functions/Gauss/GaussRequestBuilder.php | 20 +- .../Functions/Gcd/GcdRequestBuilder.php | 20 +- .../Functions/GeStep/GeStepRequestBuilder.php | 20 +- .../GeoMean/GeoMeanRequestBuilder.php | 20 +- .../HarMean/HarMeanRequestBuilder.php | 20 +- .../Hex2Bin/Hex2BinRequestBuilder.php | 20 +- .../Hex2Dec/Hex2DecRequestBuilder.php | 20 +- .../Hex2Oct/Hex2OctRequestBuilder.php | 20 +- .../Hlookup/HlookupRequestBuilder.php | 20 +- .../Functions/Hour/HourRequestBuilder.php | 20 +- .../HypGeom_DistRequestBuilder.php | 20 +- .../Hyperlink/HyperlinkRequestBuilder.php | 20 +- .../Functions/ImAbs/ImAbsRequestBuilder.php | 20 +- .../ImArgument/ImArgumentRequestBuilder.php | 20 +- .../ImConjugate/ImConjugateRequestBuilder.php | 20 +- .../Functions/ImCos/ImCosRequestBuilder.php | 20 +- .../Functions/ImCosh/ImCoshRequestBuilder.php | 20 +- .../Functions/ImCot/ImCotRequestBuilder.php | 20 +- .../Functions/ImCsc/ImCscRequestBuilder.php | 20 +- .../Functions/ImCsch/ImCschRequestBuilder.php | 20 +- .../Functions/ImDiv/ImDivRequestBuilder.php | 20 +- .../Functions/ImExp/ImExpRequestBuilder.php | 20 +- .../Functions/ImLn/ImLnRequestBuilder.php | 20 +- .../ImLog10/ImLog10RequestBuilder.php | 20 +- .../Functions/ImLog2/ImLog2RequestBuilder.php | 20 +- .../ImPower/ImPowerRequestBuilder.php | 20 +- .../ImProduct/ImProductRequestBuilder.php | 20 +- .../Functions/ImReal/ImRealRequestBuilder.php | 20 +- .../Functions/ImSec/ImSecRequestBuilder.php | 20 +- .../Functions/ImSech/ImSechRequestBuilder.php | 20 +- .../Functions/ImSin/ImSinRequestBuilder.php | 20 +- .../Functions/ImSinh/ImSinhRequestBuilder.php | 20 +- .../Functions/ImSqrt/ImSqrtRequestBuilder.php | 20 +- .../Functions/ImSub/ImSubRequestBuilder.php | 20 +- .../Functions/ImSum/ImSumRequestBuilder.php | 20 +- .../Functions/ImTan/ImTanRequestBuilder.php | 20 +- .../Imaginary/ImaginaryRequestBuilder.php | 20 +- .../Functions/Int/IntRequestBuilder.php | 20 +- .../IntRate/IntRateRequestBuilder.php | 20 +- .../Functions/Ipmt/IpmtRequestBuilder.php | 20 +- .../Functions/Irr/IrrRequestBuilder.php | 20 +- .../Functions/IsErr/IsErrRequestBuilder.php | 20 +- .../IsError/IsErrorRequestBuilder.php | 20 +- .../Functions/IsEven/IsEvenRequestBuilder.php | 20 +- .../IsFormula/IsFormulaRequestBuilder.php | 20 +- .../IsLogical/IsLogicalRequestBuilder.php | 20 +- .../Functions/IsNA/IsNARequestBuilder.php | 20 +- .../IsNonText/IsNonTextRequestBuilder.php | 20 +- .../IsNumber/IsNumberRequestBuilder.php | 20 +- .../Functions/IsOdd/IsOddRequestBuilder.php | 20 +- .../Functions/IsText/IsTextRequestBuilder.php | 20 +- .../IsoWeekNum/IsoWeekNumRequestBuilder.php | 20 +- .../Iso_Ceiling/Iso_CeilingRequestBuilder.php | 20 +- .../Functions/Ispmt/IspmtRequestBuilder.php | 20 +- .../Functions/Isref/IsrefRequestBuilder.php | 20 +- .../Functions/Kurt/KurtRequestBuilder.php | 20 +- .../Functions/Large/LargeRequestBuilder.php | 20 +- .../Functions/Lcm/LcmRequestBuilder.php | 20 +- .../Functions/Left/LeftRequestBuilder.php | 20 +- .../Functions/Leftb/LeftbRequestBuilder.php | 20 +- .../Functions/Len/LenRequestBuilder.php | 20 +- .../Functions/Lenb/LenbRequestBuilder.php | 20 +- .../Functions/Ln/LnRequestBuilder.php | 20 +- .../Functions/Log/LogRequestBuilder.php | 20 +- .../Functions/Log10/Log10RequestBuilder.php | 20 +- .../LogNorm_DistRequestBuilder.php | 20 +- .../LogNorm_Inv/LogNorm_InvRequestBuilder.php | 20 +- .../Functions/Lookup/LookupRequestBuilder.php | 20 +- .../Functions/Lower/LowerRequestBuilder.php | 20 +- .../Functions/Match/MatchRequestBuilder.php | 20 +- .../Functions/Max/MaxRequestBuilder.php | 20 +- .../Functions/MaxA/MaxARequestBuilder.php | 20 +- .../Mduration/MdurationRequestBuilder.php | 20 +- .../Functions/Median/MedianRequestBuilder.php | 20 +- .../Functions/Mid/MidRequestBuilder.php | 20 +- .../Functions/Midb/MidbRequestBuilder.php | 20 +- .../Functions/Min/MinRequestBuilder.php | 20 +- .../Functions/MinA/MinARequestBuilder.php | 20 +- .../Functions/Minute/MinuteRequestBuilder.php | 20 +- .../Functions/Mirr/MirrRequestBuilder.php | 20 +- .../Functions/Mod/ModRequestBuilder.php | 20 +- .../Functions/Month/MonthRequestBuilder.php | 20 +- .../Functions/Mround/MroundRequestBuilder.php | 20 +- .../MultiNomial/MultiNomialRequestBuilder.php | 20 +- .../Workbook/Functions/N/NRequestBuilder.php | 20 +- .../Functions/Na/NaRequestBuilder.php | 20 +- .../NegBinom_DistRequestBuilder.php | 20 +- .../NetworkDays/NetworkDaysRequestBuilder.php | 20 +- .../NetworkDays_IntlRequestBuilder.php | 20 +- .../Nominal/NominalRequestBuilder.php | 20 +- .../Norm_Dist/Norm_DistRequestBuilder.php | 20 +- .../Norm_Inv/Norm_InvRequestBuilder.php | 20 +- .../Norm_S_Dist/Norm_S_DistRequestBuilder.php | 20 +- .../Norm_S_Inv/Norm_S_InvRequestBuilder.php | 20 +- .../Functions/Not/NotRequestBuilder.php | 20 +- .../Functions/Now/NowRequestBuilder.php | 20 +- .../Functions/Nper/NperRequestBuilder.php | 20 +- .../Functions/Npv/NpvRequestBuilder.php | 20 +- .../NumberValue/NumberValueRequestBuilder.php | 20 +- .../Oct2Bin/Oct2BinRequestBuilder.php | 20 +- .../Oct2Dec/Oct2DecRequestBuilder.php | 20 +- .../Oct2Hex/Oct2HexRequestBuilder.php | 20 +- .../Functions/Odd/OddRequestBuilder.php | 20 +- .../OddFPrice/OddFPriceRequestBuilder.php | 20 +- .../OddFYield/OddFYieldRequestBuilder.php | 20 +- .../OddLPrice/OddLPriceRequestBuilder.php | 20 +- .../OddLYield/OddLYieldRequestBuilder.php | 20 +- .../Pduration/PdurationRequestBuilder.php | 20 +- .../PercentRank_ExcRequestBuilder.php | 20 +- .../PercentRank_IncRequestBuilder.php | 20 +- .../Percentile_ExcRequestBuilder.php | 20 +- .../Percentile_IncRequestBuilder.php | 20 +- .../Functions/Permut/PermutRequestBuilder.php | 20 +- .../PermutationaRequestBuilder.php | 20 +- .../Functions/Phi/PhiRequestBuilder.php | 20 +- .../Functions/Pi/PiRequestBuilder.php | 20 +- .../Functions/Pmt/PmtRequestBuilder.php | 20 +- .../Poisson_DistRequestBuilder.php | 20 +- .../Functions/Power/PowerRequestBuilder.php | 20 +- .../Functions/Ppmt/PpmtRequestBuilder.php | 20 +- .../Functions/Price/PriceRequestBuilder.php | 20 +- .../PriceDisc/PriceDiscRequestBuilder.php | 20 +- .../PriceMat/PriceMatRequestBuilder.php | 20 +- .../Product/ProductRequestBuilder.php | 20 +- .../Functions/Proper/ProperRequestBuilder.php | 20 +- .../Functions/Pv/PvRequestBuilder.php | 20 +- .../Quartile_ExcRequestBuilder.php | 20 +- .../Quartile_IncRequestBuilder.php | 20 +- .../Quotient/QuotientRequestBuilder.php | 20 +- .../Radians/RadiansRequestBuilder.php | 20 +- .../Functions/Rand/RandRequestBuilder.php | 20 +- .../RandBetween/RandBetweenRequestBuilder.php | 20 +- .../Rank_Avg/Rank_AvgRequestBuilder.php | 20 +- .../Rank_Eq/Rank_EqRequestBuilder.php | 20 +- .../Functions/Rate/RateRequestBuilder.php | 20 +- .../Received/ReceivedRequestBuilder.php | 20 +- .../Replace/ReplaceRequestBuilder.php | 20 +- .../ReplaceB/ReplaceBRequestBuilder.php | 20 +- .../Functions/Rept/ReptRequestBuilder.php | 20 +- .../Functions/Right/RightRequestBuilder.php | 20 +- .../Functions/Rightb/RightbRequestBuilder.php | 20 +- .../Functions/Roman/RomanRequestBuilder.php | 20 +- .../Functions/Round/RoundRequestBuilder.php | 20 +- .../RoundDown/RoundDownRequestBuilder.php | 20 +- .../RoundUp/RoundUpRequestBuilder.php | 20 +- .../Functions/Rows/RowsRequestBuilder.php | 20 +- .../Functions/Rri/RriRequestBuilder.php | 20 +- .../Functions/Sec/SecRequestBuilder.php | 20 +- .../Functions/Sech/SechRequestBuilder.php | 20 +- .../Functions/Second/SecondRequestBuilder.php | 20 +- .../SeriesSum/SeriesSumRequestBuilder.php | 20 +- .../Functions/Sheet/SheetRequestBuilder.php | 20 +- .../Functions/Sheets/SheetsRequestBuilder.php | 20 +- .../Functions/Sign/SignRequestBuilder.php | 20 +- .../Functions/Sin/SinRequestBuilder.php | 20 +- .../Functions/Sinh/SinhRequestBuilder.php | 20 +- .../Functions/Skew/SkewRequestBuilder.php | 20 +- .../Functions/Skew_p/Skew_pRequestBuilder.php | 20 +- .../Functions/Sln/SlnRequestBuilder.php | 20 +- .../Functions/Small/SmallRequestBuilder.php | 20 +- .../Functions/Sqrt/SqrtRequestBuilder.php | 20 +- .../Functions/SqrtPi/SqrtPiRequestBuilder.php | 20 +- .../Functions/StDevA/StDevARequestBuilder.php | 20 +- .../StDevPA/StDevPARequestBuilder.php | 20 +- .../StDev_P/StDev_PRequestBuilder.php | 20 +- .../StDev_S/StDev_SRequestBuilder.php | 20 +- .../Standardize/StandardizeRequestBuilder.php | 20 +- .../Substitute/SubstituteRequestBuilder.php | 20 +- .../Subtotal/SubtotalRequestBuilder.php | 20 +- .../Functions/Sum/SumRequestBuilder.php | 20 +- .../Functions/SumIf/SumIfRequestBuilder.php | 20 +- .../Functions/SumIfs/SumIfsRequestBuilder.php | 20 +- .../Functions/SumSq/SumSqRequestBuilder.php | 20 +- .../Functions/Syd/SydRequestBuilder.php | 20 +- .../Workbook/Functions/T/TRequestBuilder.php | 20 +- .../Functions/T_Dist/T_DistRequestBuilder.php | 20 +- .../T_Dist_2T/T_Dist_2TRequestBuilder.php | 20 +- .../T_Dist_RT/T_Dist_RTRequestBuilder.php | 20 +- .../Functions/T_Inv/T_InvRequestBuilder.php | 20 +- .../T_Inv_2T/T_Inv_2TRequestBuilder.php | 20 +- .../Functions/Tan/TanRequestBuilder.php | 20 +- .../Functions/Tanh/TanhRequestBuilder.php | 20 +- .../TbillEq/TbillEqRequestBuilder.php | 20 +- .../TbillPrice/TbillPriceRequestBuilder.php | 20 +- .../TbillYield/TbillYieldRequestBuilder.php | 20 +- .../Functions/Text/TextRequestBuilder.php | 20 +- .../Functions/Time/TimeRequestBuilder.php | 20 +- .../Timevalue/TimevalueRequestBuilder.php | 20 +- .../Functions/Today/TodayRequestBuilder.php | 20 +- .../Functions/Trim/TrimRequestBuilder.php | 20 +- .../TrimMean/TrimMeanRequestBuilder.php | 20 +- .../Functions/True/TrueRequestBuilder.php | 20 +- .../Functions/Trunc/TruncRequestBuilder.php | 20 +- .../Functions/Type/TypeRequestBuilder.php | 20 +- .../Unichar/UnicharRequestBuilder.php | 20 +- .../Unicode/UnicodeRequestBuilder.php | 20 +- .../Functions/Upper/UpperRequestBuilder.php | 20 +- .../Usdollar/UsdollarRequestBuilder.php | 20 +- .../Functions/Value/ValueRequestBuilder.php | 20 +- .../Functions/VarA/VarARequestBuilder.php | 20 +- .../Functions/VarPA/VarPARequestBuilder.php | 20 +- .../Functions/Var_P/Var_PRequestBuilder.php | 20 +- .../Functions/Var_S/Var_SRequestBuilder.php | 20 +- .../Functions/Vdb/VdbRequestBuilder.php | 20 +- .../Vlookup/VlookupRequestBuilder.php | 20 +- .../WeekNum/WeekNumRequestBuilder.php | 20 +- .../Weekday/WeekdayRequestBuilder.php | 20 +- .../Weibull_DistRequestBuilder.php | 20 +- .../WorkDay/WorkDayRequestBuilder.php | 20 +- .../WorkDay_IntlRequestBuilder.php | 20 +- .../Functions/Xirr/XirrRequestBuilder.php | 20 +- .../Functions/Xnpv/XnpvRequestBuilder.php | 20 +- .../Functions/Year/YearRequestBuilder.php | 20 +- .../YearFrac/YearFracRequestBuilder.php | 20 +- .../YieldDisc/YieldDiscRequestBuilder.php | 20 +- .../YieldMat/YieldMatRequestBuilder.php | 20 +- .../Functions/Z_Test/Z_TestRequestBuilder.php | 20 +- .../Workbook/Names/Add/AddRequestBuilder.php | 20 +- .../AddFormulaLocalRequestBuilder.php | 20 +- .../Names/Count/CountRequestBuilder.php | 22 +- .../Names/Item/Range/RangeRequestBuilder.php | 26 +- .../WorkbookNamedItemItemRequestBuilder.php | 57 ++-- .../Worksheet/WorksheetRequestBuilder.php | 20 +- .../Workbook/Names/NamesRequestBuilder.php | 39 +-- .../Operations/Count/CountRequestBuilder.php | 22 +- .../WorkbookOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../RefreshSessionRequestBuilder.php | 19 +- ...ssionInfoResourceWithKeyRequestBuilder.php | 20 +- ...owOperationResultWithKeyRequestBuilder.php | 20 +- .../Workbook/Tables/Add/AddRequestBuilder.php | 20 +- .../Tables/Count/CountRequestBuilder.php | 20 +- .../ClearFiltersRequestBuilder.php | 19 +- .../Item/Columns/Add/AddRequestBuilder.php | 20 +- .../Item/Columns/ColumnsRequestBuilder.php | 41 +-- .../Columns/Count/CountRequestBuilder.php | 20 +- .../DataBodyRangeRequestBuilder.php | 20 +- .../Item/Filter/Apply/ApplyRequestBuilder.php | 19 +- .../ApplyBottomItemsFilterRequestBuilder.php | 19 +- ...ApplyBottomPercentFilterRequestBuilder.php | 19 +- .../ApplyCellColorFilterRequestBuilder.php | 19 +- .../ApplyCustomFilterRequestBuilder.php | 19 +- .../ApplyDynamicFilterRequestBuilder.php | 19 +- .../ApplyFontColorFilterRequestBuilder.php | 19 +- .../ApplyIconFilterRequestBuilder.php | 19 +- .../ApplyTopItemsFilterRequestBuilder.php | 19 +- .../ApplyTopPercentFilterRequestBuilder.php | 19 +- .../ApplyValuesFilterRequestBuilder.php | 19 +- .../Item/Filter/Clear/ClearRequestBuilder.php | 19 +- .../Item/Filter/FilterRequestBuilder.php | 57 ++-- .../HeaderRowRangeRequestBuilder.php | 20 +- .../Item/Range/RangeRequestBuilder.php | 20 +- .../TotalRowRangeRequestBuilder.php | 20 +- .../WorkbookTableColumnItemRequestBuilder.php | 57 ++-- .../ItemAtWithIndexRequestBuilder.php | 20 +- .../ConvertToRangeRequestBuilder.php | 20 +- .../DataBodyRangeRequestBuilder.php | 20 +- .../HeaderRowRangeRequestBuilder.php | 20 +- .../Tables/Item/Range/RangeRequestBuilder.php | 20 +- .../ReapplyFiltersRequestBuilder.php | 19 +- .../Item/Rows/Add/AddRequestBuilder.php | 20 +- .../Item/Rows/Count/CountRequestBuilder.php | 20 +- .../Rows/Item/Range/RangeRequestBuilder.php | 20 +- .../WorkbookTableRowItemRequestBuilder.php | 57 ++-- .../ItemAtWithIndexRequestBuilder.php | 20 +- .../Tables/Item/Rows/RowsRequestBuilder.php | 41 +-- .../Item/Sort/Apply/ApplyRequestBuilder.php | 19 +- .../Item/Sort/Clear/ClearRequestBuilder.php | 19 +- .../Sort/Reapply/ReapplyRequestBuilder.php | 19 +- .../Tables/Item/Sort/SortRequestBuilder.php | 57 ++-- .../TotalRowRangeRequestBuilder.php | 20 +- .../Item/WorkbookTableItemRequestBuilder.php | 57 ++-- .../Worksheet/WorksheetRequestBuilder.php | 20 +- .../ItemAtWithIndexRequestBuilder.php | 20 +- .../Workbook/Tables/TablesRequestBuilder.php | 39 +-- .../Item/Workbook/WorkbookRequestBuilder.php | 57 ++-- .../Worksheets/Add/AddRequestBuilder.php | 20 +- .../Worksheets/Count/CountRequestBuilder.php | 22 +- .../CellWithRowWithColumnRequestBuilder.php | 20 +- .../Item/Charts/Add/AddRequestBuilder.php | 20 +- .../Item/Charts/ChartsRequestBuilder.php | 41 +-- .../Item/Charts/Count/CountRequestBuilder.php | 20 +- .../Charts/Item/Axes/AxesRequestBuilder.php | 57 ++-- .../CategoryAxisRequestBuilder.php | 57 ++-- .../Format/Font/FontRequestBuilder.php | 57 ++-- .../Format/FormatRequestBuilder.php | 57 ++-- .../Format/Line/Clear/ClearRequestBuilder.php | 19 +- .../Format/Line/LineRequestBuilder.php | 57 ++-- .../Format/FormatRequestBuilder.php | 57 ++-- .../Format/Line/Clear/ClearRequestBuilder.php | 19 +- .../Format/Line/LineRequestBuilder.php | 57 ++-- .../MajorGridlinesRequestBuilder.php | 57 ++-- .../Format/FormatRequestBuilder.php | 57 ++-- .../Format/Line/Clear/ClearRequestBuilder.php | 19 +- .../Format/Line/LineRequestBuilder.php | 57 ++-- .../MinorGridlinesRequestBuilder.php | 57 ++-- .../Title/Format/Font/FontRequestBuilder.php | 57 ++-- .../Title/Format/FormatRequestBuilder.php | 57 ++-- .../Title/TitleRequestBuilder.php | 57 ++-- .../Format/Font/FontRequestBuilder.php | 57 ++-- .../Format/FormatRequestBuilder.php | 57 ++-- .../Format/Line/Clear/ClearRequestBuilder.php | 19 +- .../Format/Line/LineRequestBuilder.php | 57 ++-- .../Format/FormatRequestBuilder.php | 57 ++-- .../Format/Line/Clear/ClearRequestBuilder.php | 19 +- .../Format/Line/LineRequestBuilder.php | 57 ++-- .../MajorGridlinesRequestBuilder.php | 57 ++-- .../Format/FormatRequestBuilder.php | 57 ++-- .../Format/Line/Clear/ClearRequestBuilder.php | 19 +- .../Format/Line/LineRequestBuilder.php | 57 ++-- .../MinorGridlinesRequestBuilder.php | 57 ++-- .../SeriesAxis/SeriesAxisRequestBuilder.php | 57 ++-- .../Title/Format/Font/FontRequestBuilder.php | 57 ++-- .../Title/Format/FormatRequestBuilder.php | 57 ++-- .../SeriesAxis/Title/TitleRequestBuilder.php | 57 ++-- .../Format/Font/FontRequestBuilder.php | 57 ++-- .../ValueAxis/Format/FormatRequestBuilder.php | 57 ++-- .../Format/Line/Clear/ClearRequestBuilder.php | 19 +- .../Format/Line/LineRequestBuilder.php | 57 ++-- .../Format/FormatRequestBuilder.php | 57 ++-- .../Format/Line/Clear/ClearRequestBuilder.php | 19 +- .../Format/Line/LineRequestBuilder.php | 57 ++-- .../MajorGridlinesRequestBuilder.php | 57 ++-- .../Format/FormatRequestBuilder.php | 57 ++-- .../Format/Line/Clear/ClearRequestBuilder.php | 19 +- .../Format/Line/LineRequestBuilder.php | 57 ++-- .../MinorGridlinesRequestBuilder.php | 57 ++-- .../Title/Format/Font/FontRequestBuilder.php | 57 ++-- .../Title/Format/FormatRequestBuilder.php | 57 ++-- .../ValueAxis/Title/TitleRequestBuilder.php | 57 ++-- .../ValueAxis/ValueAxisRequestBuilder.php | 57 ++-- .../DataLabels/DataLabelsRequestBuilder.php | 57 ++-- .../Format/Fill/Clear/ClearRequestBuilder.php | 19 +- .../Format/Fill/FillRequestBuilder.php | 57 ++-- .../SetSolidColorRequestBuilder.php | 19 +- .../Format/Font/FontRequestBuilder.php | 57 ++-- .../Format/FormatRequestBuilder.php | 57 ++-- .../Format/Fill/Clear/ClearRequestBuilder.php | 19 +- .../Item/Format/Fill/FillRequestBuilder.php | 57 ++-- .../SetSolidColorRequestBuilder.php | 19 +- .../Item/Format/Font/FontRequestBuilder.php | 57 ++-- .../Item/Format/FormatRequestBuilder.php | 57 ++-- .../Charts/Item/Image/ImageRequestBuilder.php | 20 +- .../ImageWithWidthRequestBuilder.php | 20 +- ...ImageWithWidthWithHeightRequestBuilder.php | 20 +- ...ithHeightWithFittingModeRequestBuilder.php | 20 +- .../Format/Fill/Clear/ClearRequestBuilder.php | 19 +- .../Legend/Format/Fill/FillRequestBuilder.php | 57 ++-- .../SetSolidColorRequestBuilder.php | 19 +- .../Legend/Format/Font/FontRequestBuilder.php | 57 ++-- .../Legend/Format/FormatRequestBuilder.php | 57 ++-- .../Item/Legend/LegendRequestBuilder.php | 57 ++-- .../Item/Series/Count/CountRequestBuilder.php | 20 +- .../Format/Fill/Clear/ClearRequestBuilder.php | 19 +- .../Item/Format/Fill/FillRequestBuilder.php | 57 ++-- .../SetSolidColorRequestBuilder.php | 19 +- .../Item/Format/FormatRequestBuilder.php | 57 ++-- .../Format/Line/Clear/ClearRequestBuilder.php | 19 +- .../Item/Format/Line/LineRequestBuilder.php | 57 ++-- .../Item/Points/Count/CountRequestBuilder.php | 20 +- .../Format/Fill/Clear/ClearRequestBuilder.php | 19 +- .../Item/Format/Fill/FillRequestBuilder.php | 57 ++-- .../SetSolidColorRequestBuilder.php | 19 +- .../Item/Format/FormatRequestBuilder.php | 57 ++-- .../WorkbookChartPointItemRequestBuilder.php | 57 ++-- .../ItemAtWithIndexRequestBuilder.php | 20 +- .../Item/Points/PointsRequestBuilder.php | 45 ++- ...PointsRequestBuilderGetQueryParameters.php | 2 +- .../WorkbookChartSeriesItemRequestBuilder.php | 57 ++-- .../ItemAtWithIndexRequestBuilder.php | 20 +- .../Item/Series/SeriesRequestBuilder.php | 41 +-- .../Item/SetData/SetDataRequestBuilder.php | 19 +- .../SetPosition/SetPositionRequestBuilder.php | 19 +- .../Format/Fill/Clear/ClearRequestBuilder.php | 19 +- .../Title/Format/Fill/FillRequestBuilder.php | 57 ++-- .../SetSolidColorRequestBuilder.php | 19 +- .../Title/Format/Font/FontRequestBuilder.php | 57 ++-- .../Title/Format/FormatRequestBuilder.php | 57 ++-- .../Charts/Item/Title/TitleRequestBuilder.php | 57 ++-- .../Item/WorkbookChartItemRequestBuilder.php | 57 ++-- .../Worksheet/WorksheetRequestBuilder.php | 20 +- .../ItemAtWithIndexRequestBuilder.php | 20 +- .../ItemWithNameRequestBuilder.php | 20 +- .../Item/Names/Add/AddRequestBuilder.php | 20 +- .../AddFormulaLocalRequestBuilder.php | 20 +- .../Item/Names/Count/CountRequestBuilder.php | 22 +- .../Names/Item/Range/RangeRequestBuilder.php | 26 +- .../WorkbookNamedItemItemRequestBuilder.php | 57 ++-- .../Worksheet/WorksheetRequestBuilder.php | 20 +- .../Item/Names/NamesRequestBuilder.php | 39 +-- .../PivotTables/Count/CountRequestBuilder.php | 22 +- .../Item/Refresh/RefreshRequestBuilder.php | 19 +- .../WorkbookPivotTableItemRequestBuilder.php | 57 ++-- .../Worksheet/WorksheetRequestBuilder.php | 20 +- .../PivotTables/PivotTablesRequestBuilder.php | 39 +-- .../RefreshAll/RefreshAllRequestBuilder.php | 19 +- .../Protect/ProtectRequestBuilder.php | 19 +- .../Protection/ProtectionRequestBuilder.php | 57 ++-- .../Unprotect/UnprotectRequestBuilder.php | 19 +- .../Item/Range/RangeRequestBuilder.php | 20 +- .../RangeWithAddressRequestBuilder.php | 20 +- .../Item/Tables/Add/AddRequestBuilder.php | 20 +- .../Item/Tables/Count/CountRequestBuilder.php | 20 +- .../ClearFiltersRequestBuilder.php | 19 +- .../Item/Columns/Add/AddRequestBuilder.php | 20 +- .../Item/Columns/ColumnsRequestBuilder.php | 41 +-- .../Columns/Count/CountRequestBuilder.php | 20 +- .../DataBodyRangeRequestBuilder.php | 20 +- .../Item/Filter/Apply/ApplyRequestBuilder.php | 19 +- .../ApplyBottomItemsFilterRequestBuilder.php | 19 +- ...ApplyBottomPercentFilterRequestBuilder.php | 19 +- .../ApplyCellColorFilterRequestBuilder.php | 19 +- .../ApplyCustomFilterRequestBuilder.php | 19 +- .../ApplyDynamicFilterRequestBuilder.php | 19 +- .../ApplyFontColorFilterRequestBuilder.php | 19 +- .../ApplyIconFilterRequestBuilder.php | 19 +- .../ApplyTopItemsFilterRequestBuilder.php | 19 +- .../ApplyTopPercentFilterRequestBuilder.php | 19 +- .../ApplyValuesFilterRequestBuilder.php | 19 +- .../Item/Filter/Clear/ClearRequestBuilder.php | 19 +- .../Item/Filter/FilterRequestBuilder.php | 57 ++-- .../HeaderRowRangeRequestBuilder.php | 20 +- .../Item/Range/RangeRequestBuilder.php | 20 +- .../TotalRowRangeRequestBuilder.php | 20 +- .../WorkbookTableColumnItemRequestBuilder.php | 57 ++-- .../ItemAtWithIndexRequestBuilder.php | 20 +- .../ConvertToRangeRequestBuilder.php | 20 +- .../DataBodyRangeRequestBuilder.php | 20 +- .../HeaderRowRangeRequestBuilder.php | 20 +- .../Tables/Item/Range/RangeRequestBuilder.php | 20 +- .../ReapplyFiltersRequestBuilder.php | 19 +- .../Item/Rows/Add/AddRequestBuilder.php | 20 +- .../Item/Rows/Count/CountRequestBuilder.php | 20 +- .../Rows/Item/Range/RangeRequestBuilder.php | 20 +- .../WorkbookTableRowItemRequestBuilder.php | 57 ++-- .../ItemAtWithIndexRequestBuilder.php | 20 +- .../Tables/Item/Rows/RowsRequestBuilder.php | 41 +-- .../Item/Sort/Apply/ApplyRequestBuilder.php | 19 +- .../Item/Sort/Clear/ClearRequestBuilder.php | 19 +- .../Sort/Reapply/ReapplyRequestBuilder.php | 19 +- .../Tables/Item/Sort/SortRequestBuilder.php | 57 ++-- .../TotalRowRangeRequestBuilder.php | 20 +- .../Item/WorkbookTableItemRequestBuilder.php | 57 ++-- .../Worksheet/WorksheetRequestBuilder.php | 20 +- .../ItemAtWithIndexRequestBuilder.php | 20 +- .../Item/Tables/TablesRequestBuilder.php | 39 +-- .../UsedRange/UsedRangeRequestBuilder.php | 20 +- .../UsedRangeWithValuesOnlyRequestBuilder.php | 20 +- .../WorkbookWorksheetItemRequestBuilder.php | 57 ++-- .../Worksheets/WorksheetsRequestBuilder.php | 41 +-- .../Drives/Item/Items/ItemsRequestBuilder.php | 39 +-- .../LastModifiedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Recent/RecentRequestBuilder.php | 20 +- .../Root/Content/ContentRequestBuilder.php | 42 ++- .../Drives/Item/Root/RootRequestBuilder.php | 20 +- .../SearchWithQ/SearchWithQRequestBuilder.php | 20 +- .../SharedWithMeRequestBuilder.php | 20 +- .../Special/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../Item/DriveItemItemRequestBuilder.php | 20 +- .../Item/Special/SpecialRequestBuilder.php | 20 +- .../Classes/ClassesRequestBuilder.php | 39 +-- .../Classes/Count/CountRequestBuilder.php | 22 +- .../Classes/Delta/DeltaRequestBuilder.php | 20 +- .../AssignmentCategoriesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../EducationCategoryItemRequestBuilder.php | 57 ++-- .../AssignmentDefaultsRequestBuilder.php | 57 ++-- .../AssignmentSettingsRequestBuilder.php | 57 ++-- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../Assignments/Delta/DeltaRequestBuilder.php | 20 +- .../Categories/CategoriesRequestBuilder.php | 39 +-- .../Categories/Count/CountRequestBuilder.php | 22 +- .../Categories/Delta/DeltaRequestBuilder.php | 20 +- .../Categories/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/Categories/Ref/RefRequestBuilder.php | 38 +-- .../EducationAssignmentItemRequestBuilder.php | 57 ++-- .../Item/Publish/PublishRequestBuilder.php | 20 +- .../Resources/Count/CountRequestBuilder.php | 22 +- ...onAssignmentResourceItemRequestBuilder.php | 57 ++-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../Item/Rubric/Ref/RefRequestBuilder.php | 58 ++-- .../Item/Rubric/RubricRequestBuilder.php | 57 ++-- ...pFeedbackResourcesFolderRequestBuilder.php | 20 +- .../SetUpResourcesFolderRequestBuilder.php | 20 +- .../Submissions/Count/CountRequestBuilder.php | 22 +- .../EducationSubmissionItemRequestBuilder.php | 57 ++-- .../EscapedReturn/ReturnRequestBuilder.php | 20 +- .../Outcomes/Count/CountRequestBuilder.php | 22 +- .../EducationOutcomeItemRequestBuilder.php | 57 ++-- .../Item/Outcomes/OutcomesRequestBuilder.php | 39 +-- .../Item/Reassign/ReassignRequestBuilder.php | 20 +- .../Resources/Count/CountRequestBuilder.php | 22 +- ...onSubmissionResourceItemRequestBuilder.php | 57 ++-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../SetUpResourcesFolderRequestBuilder.php | 20 +- .../Item/Submit/SubmitRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...onSubmissionResourceItemRequestBuilder.php | 57 ++-- .../SubmittedResourcesRequestBuilder.php | 39 +-- .../Item/Unsubmit/UnsubmitRequestBuilder.php | 20 +- .../Submissions/SubmissionsRequestBuilder.php | 39 +-- .../Item/EducationClassItemRequestBuilder.php | 57 ++-- .../Item/Group/GroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../Members/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/Members/MembersRequestBuilder.php | 20 +- .../Item/Members/Ref/RefRequestBuilder.php | 38 +-- .../Schools/Count/CountRequestBuilder.php | 22 +- .../EducationSchoolItemRequestBuilder.php | 20 +- .../Item/Schools/SchoolsRequestBuilder.php | 20 +- .../Teachers/Count/CountRequestBuilder.php | 22 +- .../Teachers/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/Teachers/Ref/RefRequestBuilder.php | 38 +-- .../Item/Teachers/TeachersRequestBuilder.php | 20 +- .../Education/EducationRequestBuilder.php | 39 +-- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../Assignments/Delta/DeltaRequestBuilder.php | 20 +- .../Categories/CategoriesRequestBuilder.php | 39 +-- .../Categories/Count/CountRequestBuilder.php | 22 +- .../Categories/Delta/DeltaRequestBuilder.php | 20 +- .../Categories/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/Categories/Ref/RefRequestBuilder.php | 38 +-- .../EducationAssignmentItemRequestBuilder.php | 57 ++-- .../Item/Publish/PublishRequestBuilder.php | 20 +- .../Resources/Count/CountRequestBuilder.php | 22 +- ...onAssignmentResourceItemRequestBuilder.php | 57 ++-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../Item/Rubric/Ref/RefRequestBuilder.php | 58 ++-- .../Item/Rubric/RubricRequestBuilder.php | 57 ++-- ...pFeedbackResourcesFolderRequestBuilder.php | 20 +- .../SetUpResourcesFolderRequestBuilder.php | 20 +- .../Submissions/Count/CountRequestBuilder.php | 22 +- .../EducationSubmissionItemRequestBuilder.php | 57 ++-- .../EscapedReturn/ReturnRequestBuilder.php | 20 +- .../Outcomes/Count/CountRequestBuilder.php | 22 +- .../EducationOutcomeItemRequestBuilder.php | 57 ++-- .../Item/Outcomes/OutcomesRequestBuilder.php | 39 +-- .../Item/Reassign/ReassignRequestBuilder.php | 20 +- .../Resources/Count/CountRequestBuilder.php | 22 +- ...onSubmissionResourceItemRequestBuilder.php | 57 ++-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../SetUpResourcesFolderRequestBuilder.php | 20 +- .../Item/Submit/SubmitRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...onSubmissionResourceItemRequestBuilder.php | 57 ++-- .../SubmittedResourcesRequestBuilder.php | 39 +-- .../Item/Unsubmit/UnsubmitRequestBuilder.php | 20 +- .../Submissions/SubmissionsRequestBuilder.php | 39 +-- .../Me/Classes/ClassesRequestBuilder.php | 20 +- .../Me/Classes/Count/CountRequestBuilder.php | 22 +- .../Item/EducationClassItemRequestBuilder.php | 20 +- .../Education/Me/MeRequestBuilder.php | 57 ++-- .../Me/Rubrics/Count/CountRequestBuilder.php | 22 +- .../EducationRubricItemRequestBuilder.php | 57 ++-- .../Me/Rubrics/RubricsRequestBuilder.php | 39 +-- .../Me/Schools/Count/CountRequestBuilder.php | 22 +- .../EducationSchoolItemRequestBuilder.php | 20 +- .../Me/Schools/SchoolsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/EducationClassItemRequestBuilder.php | 20 +- .../TaughtClassesRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Education/Me/User/UserRequestBuilder.php | 20 +- .../Schools/Count/CountRequestBuilder.php | 22 +- .../Schools/Delta/DeltaRequestBuilder.php | 20 +- .../AdministrativeUnitRequestBuilder.php | 39 +-- .../Item/Classes/ClassesRequestBuilder.php | 20 +- .../Classes/Count/CountRequestBuilder.php | 22 +- .../Classes/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/Classes/Ref/RefRequestBuilder.php | 38 +-- .../EducationSchoolItemRequestBuilder.php | 57 ++-- .../Item/Users/Count/CountRequestBuilder.php | 22 +- .../Item/Users/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/Users/Ref/RefRequestBuilder.php | 38 +-- .../Item/Users/UsersRequestBuilder.php | 20 +- .../Schools/SchoolsRequestBuilder.php | 39 +-- .../Users/Count/CountRequestBuilder.php | 22 +- .../Users/Delta/DeltaRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 39 +-- .../Assignments/Count/CountRequestBuilder.php | 22 +- .../Assignments/Delta/DeltaRequestBuilder.php | 20 +- .../Categories/CategoriesRequestBuilder.php | 39 +-- .../Categories/Count/CountRequestBuilder.php | 22 +- .../Categories/Delta/DeltaRequestBuilder.php | 20 +- .../Categories/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/Categories/Ref/RefRequestBuilder.php | 38 +-- .../EducationAssignmentItemRequestBuilder.php | 57 ++-- .../Item/Publish/PublishRequestBuilder.php | 20 +- .../Resources/Count/CountRequestBuilder.php | 22 +- ...onAssignmentResourceItemRequestBuilder.php | 57 ++-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../Item/Rubric/Ref/RefRequestBuilder.php | 58 ++-- .../Item/Rubric/RubricRequestBuilder.php | 57 ++-- ...pFeedbackResourcesFolderRequestBuilder.php | 20 +- .../SetUpResourcesFolderRequestBuilder.php | 20 +- .../Submissions/Count/CountRequestBuilder.php | 22 +- .../EducationSubmissionItemRequestBuilder.php | 57 ++-- .../EscapedReturn/ReturnRequestBuilder.php | 20 +- .../Outcomes/Count/CountRequestBuilder.php | 22 +- .../EducationOutcomeItemRequestBuilder.php | 57 ++-- .../Item/Outcomes/OutcomesRequestBuilder.php | 39 +-- .../Item/Reassign/ReassignRequestBuilder.php | 20 +- .../Resources/Count/CountRequestBuilder.php | 22 +- ...onSubmissionResourceItemRequestBuilder.php | 57 ++-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../SetUpResourcesFolderRequestBuilder.php | 20 +- .../Item/Submit/SubmitRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...onSubmissionResourceItemRequestBuilder.php | 57 ++-- .../SubmittedResourcesRequestBuilder.php | 39 +-- .../Item/Unsubmit/UnsubmitRequestBuilder.php | 20 +- .../Submissions/SubmissionsRequestBuilder.php | 39 +-- .../Item/Classes/ClassesRequestBuilder.php | 20 +- .../Classes/Count/CountRequestBuilder.php | 22 +- .../Item/EducationClassItemRequestBuilder.php | 20 +- .../Item/EducationUserItemRequestBuilder.php | 57 ++-- .../Rubrics/Count/CountRequestBuilder.php | 22 +- .../EducationRubricItemRequestBuilder.php | 57 ++-- .../Item/Rubrics/RubricsRequestBuilder.php | 39 +-- .../Schools/Count/CountRequestBuilder.php | 22 +- .../EducationSchoolItemRequestBuilder.php | 20 +- .../Item/Schools/SchoolsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/EducationClassItemRequestBuilder.php | 20 +- .../TaughtClassesRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Users/Item/User/UserRequestBuilder.php | 20 +- .../Education/Users/UsersRequestBuilder.php | 39 +-- .../EmployeeExperienceRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...arningCourseActivityItemRequestBuilder.php | 57 ++-- ...LearningCourseActivitiesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../LearningContentItemRequestBuilder.php | 57 ++-- .../LearningContentsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...arningCourseActivityItemRequestBuilder.php | 57 ++-- ...LearningCourseActivitiesRequestBuilder.php | 39 +-- .../LearningProviderItemRequestBuilder.php | 57 ++-- .../LearningProvidersRequestBuilder.php | 39 +-- .../Connectors/ConnectorsRequestBuilder.php | 39 +-- .../Connectors/Count/CountRequestBuilder.php | 22 +- .../Item/PrintConnectorItemRequestBuilder.php | 57 ++-- .../Operations/Count/CountRequestBuilder.php | 22 +- .../Item/PrintOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../EscapedPrint/PrintRequestBuilder.php | 39 +-- .../Printers/Count/CountRequestBuilder.php | 22 +- .../Printers/Create/CreateRequestBuilder.php | 19 +- .../Connectors/ConnectorsRequestBuilder.php | 20 +- .../Connectors/Count/CountRequestBuilder.php | 22 +- .../Item/PrintConnectorItemRequestBuilder.php | 20 +- .../Item/Jobs/Count/CountRequestBuilder.php | 22 +- .../Jobs/Item/Abort/AbortRequestBuilder.php | 19 +- .../Jobs/Item/Cancel/CancelRequestBuilder.php | 19 +- .../Documents/Count/CountRequestBuilder.php | 22 +- .../Documents/DocumentsRequestBuilder.php | 39 +-- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/PrintDocumentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Jobs/Item/PrintJobItemRequestBuilder.php | 57 ++-- .../Item/Redirect/RedirectRequestBuilder.php | 20 +- .../Jobs/Item/Start/StartRequestBuilder.php | 20 +- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- .../Definition/DefinitionRequestBuilder.php | 20 +- .../Item/PrintTaskItemRequestBuilder.php | 57 ++-- .../Item/Trigger/TriggerRequestBuilder.php | 20 +- .../Jobs/Item/Tasks/TasksRequestBuilder.php | 39 +-- .../Printers/Item/Jobs/JobsRequestBuilder.php | 39 +-- .../Item/PrinterItemRequestBuilder.php | 57 ++-- .../RestoreFactoryDefaultsRequestBuilder.php | 19 +- .../Item/Shares/Count/CountRequestBuilder.php | 22 +- .../Item/PrinterShareItemRequestBuilder.php | 20 +- .../Item/Shares/SharesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Definition/DefinitionRequestBuilder.php | 20 +- .../PrintTaskTriggerItemRequestBuilder.php | 57 ++-- .../TaskTriggersRequestBuilder.php | 39 +-- .../Printers/PrintersRequestBuilder.php | 39 +-- .../Services/Count/CountRequestBuilder.php | 22 +- .../Endpoints/Count/CountRequestBuilder.php | 22 +- .../Endpoints/EndpointsRequestBuilder.php | 39 +-- ...PrintServiceEndpointItemRequestBuilder.php | 57 ++-- .../Item/PrintServiceItemRequestBuilder.php | 57 ++-- .../Services/ServicesRequestBuilder.php | 39 +-- .../Shares/Count/CountRequestBuilder.php | 22 +- .../AllowedGroupsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../AllowedGroups/Ref/RefRequestBuilder.php | 38 +-- .../AllowedUsersRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Item/Ref/RefRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../AllowedUsers/Ref/RefRequestBuilder.php | 38 +-- .../Item/Jobs/Count/CountRequestBuilder.php | 22 +- .../Jobs/Item/Abort/AbortRequestBuilder.php | 19 +- .../Jobs/Item/Cancel/CancelRequestBuilder.php | 19 +- .../Documents/Count/CountRequestBuilder.php | 22 +- .../Documents/DocumentsRequestBuilder.php | 39 +-- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/PrintDocumentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Jobs/Item/PrintJobItemRequestBuilder.php | 57 ++-- .../Item/Redirect/RedirectRequestBuilder.php | 20 +- .../Jobs/Item/Start/StartRequestBuilder.php | 20 +- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- .../Definition/DefinitionRequestBuilder.php | 20 +- .../Item/PrintTaskItemRequestBuilder.php | 57 ++-- .../Item/Trigger/TriggerRequestBuilder.php | 20 +- .../Jobs/Item/Tasks/TasksRequestBuilder.php | 39 +-- .../Shares/Item/Jobs/JobsRequestBuilder.php | 39 +-- .../Item/Printer/PrinterRequestBuilder.php | 20 +- .../Item/PrinterShareItemRequestBuilder.php | 57 ++-- .../Shares/SharesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../PrintTaskDefinitionItemRequestBuilder.php | 57 ++-- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- .../Definition/DefinitionRequestBuilder.php | 20 +- .../Item/PrintTaskItemRequestBuilder.php | 57 ++-- .../Item/Trigger/TriggerRequestBuilder.php | 20 +- .../Item/Tasks/TasksRequestBuilder.php | 39 +-- .../TaskDefinitionsRequestBuilder.php | 39 +-- .../Connections/ConnectionsRequestBuilder.php | 39 +-- .../Connections/Count/CountRequestBuilder.php | 22 +- .../ExternalConnectionItemRequestBuilder.php | 57 ++-- .../Item/Groups/Count/CountRequestBuilder.php | 22 +- .../Item/Groups/GroupsRequestBuilder.php | 39 +-- .../Item/ExternalGroupItemRequestBuilder.php | 57 ++-- .../Members/Count/CountRequestBuilder.php | 22 +- .../Item/IdentityItemRequestBuilder.php | 61 ++-- ...tyItemRequestBuilderGetQueryParameters.php | 2 +- .../Item/Members/MembersRequestBuilder.php | 43 ++- ...embersRequestBuilderGetQueryParameters.php | 2 +- .../Item/Items/Count/CountRequestBuilder.php | 22 +- .../Activities/ActivitiesRequestBuilder.php | 39 +-- .../Activities/Count/CountRequestBuilder.php | 22 +- .../ExternalActivityItemRequestBuilder.php | 57 ++-- .../PerformedBy/PerformedByRequestBuilder.php | 20 +- .../Item/ExternalItemItemRequestBuilder.php | 57 ++-- ...lConnectorsAddActivitiesRequestBuilder.php | 20 +- .../Item/Items/ItemsRequestBuilder.php | 39 +-- .../Operations/Count/CountRequestBuilder.php | 22 +- .../ConnectionOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Item/Schema/SchemaRequestBuilder.php | 43 ++- .../External/ExternalRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../FilterOperatorsRequestBuilder.php | 39 +-- ...FilterOperatorSchemaItemRequestBuilder.php | 57 ++-- .../Functions/Count/CountRequestBuilder.php | 22 +- .../Functions/FunctionsRequestBuilder.php | 39 +-- ...appingFunctionSchemaItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../GroupLifecyclePoliciesRequestBuilder.php | 39 +-- .../Item/AddGroup/AddGroupRequestBuilder.php | 20 +- ...GroupLifecyclePolicyItemRequestBuilder.php | 57 ++-- .../RemoveGroup/RemoveGroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../GetByIds/GetByIdsRequestBuilder.php | 20 +- .../GroupSettingTemplatesRequestBuilder.php | 39 +-- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- ...GroupSettingTemplateItemRequestBuilder.php | 57 ++-- .../Item/Restore/RestoreRequestBuilder.php | 20 +- .../ValidatePropertiesRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../GroupSettingsRequestBuilder.php | 39 +-- .../Item/GroupSettingItemRequestBuilder.php | 57 ++-- .../Groups/Count/CountRequestBuilder.php | 22 +- .../Groups/Delta/DeltaRequestBuilder.php | 20 +- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../GetByIds/GetByIdsRequestBuilder.php | 20 +- src/Generated/Groups/GroupsRequestBuilder.php | 39 +-- .../AcceptedSendersRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../AcceptedSenders/Ref/RefRequestBuilder.php | 38 +-- .../AddFavorite/AddFavoriteRequestBuilder.php | 19 +- .../AppRoleAssignmentsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AppRoleAssignmentItemRequestBuilder.php | 57 ++-- .../AssignLicenseRequestBuilder.php | 24 +- ...ndarSharingRolesWithUserRequestBuilder.php | 20 +- .../CalendarPermissionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../CalendarPermissionItemRequestBuilder.php | 57 ++-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../CalendarViewRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Instances/Count/CountRequestBuilder.php | 22 +- .../Instances/Delta/DeltaRequestBuilder.php | 20 +- .../Instances/InstancesRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../Events/Count/CountRequestBuilder.php | 22 +- .../Events/Delta/DeltaRequestBuilder.php | 20 +- .../Calendar/Events/EventsRequestBuilder.php | 39 +-- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Events/Item/EventItemRequestBuilder.php | 57 ++-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Instances/Count/CountRequestBuilder.php | 22 +- .../Instances/Delta/DeltaRequestBuilder.php | 20 +- .../Instances/InstancesRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../GetSchedule/GetScheduleRequestBuilder.php | 20 +- .../CalendarViewRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Instances/Count/CountRequestBuilder.php | 22 +- .../Instances/Delta/DeltaRequestBuilder.php | 20 +- .../Instances/InstancesRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- ...GrantedPermissionsForAppRequestBuilder.php | 20 +- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- .../ConversationsRequestBuilder.php | 45 ++- .../Count/CountRequestBuilder.php | 22 +- .../Item/ConversationItemRequestBuilder.php | 44 ++- ...onItemRequestBuilderGetQueryParameters.php | 2 +- .../Threads/Count/CountRequestBuilder.php | 22 +- .../ConversationThreadItemRequestBuilder.php | 57 ++-- .../Item/Posts/Count/CountRequestBuilder.php | 22 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Forward/ForwardRequestBuilder.php | 19 +- .../InReplyTo/InReplyToRequestBuilder.php | 20 +- .../InReplyTo/Reply/ReplyRequestBuilder.php | 25 +- .../Posts/Item/PostItemRequestBuilder.php | 20 +- .../Posts/Item/Reply/ReplyRequestBuilder.php | 25 +- .../Item/Posts/PostsRequestBuilder.php | 20 +- .../Item/Reply/ReplyRequestBuilder.php | 19 +- .../Item/Threads/ThreadsRequestBuilder.php | 39 +-- .../CreatedOnBehalfOfRequestBuilder.php | 20 +- .../Groups/Item/Drive/DriveRequestBuilder.php | 20 +- .../Item/Drives/Count/CountRequestBuilder.php | 22 +- .../Item/Drives/DrivesRequestBuilder.php | 20 +- .../Drives/Item/DriveItemRequestBuilder.php | 20 +- .../Item/Events/Count/CountRequestBuilder.php | 22 +- .../Item/Events/Delta/DeltaRequestBuilder.php | 20 +- .../Item/Events/EventsRequestBuilder.php | 39 +-- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Events/Item/EventItemRequestBuilder.php | 57 ++-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Instances/Count/CountRequestBuilder.php | 22 +- .../Instances/Delta/DeltaRequestBuilder.php | 20 +- .../Instances/InstancesRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- .../Groups/Item/GroupItemRequestBuilder.php | 63 ++-- .../Count/CountRequestBuilder.php | 22 +- .../GroupLifecyclePoliciesRequestBuilder.php | 39 +-- .../Item/AddGroup/AddGroupRequestBuilder.php | 20 +- ...GroupLifecyclePolicyItemRequestBuilder.php | 57 ++-- .../RemoveGroup/RemoveGroupRequestBuilder.php | 20 +- .../MemberOf/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Item/MemberOf/MemberOfRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/Count/CountRequestBuilder.php | 22 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/Count/CountRequestBuilder.php | 22 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../Members/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/Members/MembersRequestBuilder.php | 20 +- .../Item/Members/Ref/RefRequestBuilder.php | 38 +-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/Count/CountRequestBuilder.php | 22 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/Count/CountRequestBuilder.php | 22 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- ...MembersWithLicenseErrorsRequestBuilder.php | 20 +- .../Notebooks/Count/CountRequestBuilder.php | 22 +- .../GetNotebookFromWebUrlRequestBuilder.php | 20 +- ...IncludePersonalNotebooksRequestBuilder.php | 20 +- .../CopyNotebookRequestBuilder.php | 20 +- .../Item/NotebookItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/SectionGroupItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/SectionGroupItemRequestBuilder.php | 20 +- .../SectionGroupsRequestBuilder.php | 20 +- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/Sections/SectionsRequestBuilder.php | 39 +-- .../SectionGroupsRequestBuilder.php | 39 +-- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/Sections/SectionsRequestBuilder.php | 39 +-- .../Notebooks/NotebooksRequestBuilder.php | 39 +-- .../Item/Onenote/OnenoteRequestBuilder.php | 57 ++-- .../Operations/Count/CountRequestBuilder.php | 22 +- .../OnenoteOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Onenote/Pages/PagesRequestBuilder.php | 39 +-- .../Resources/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../OnenoteResourceItemRequestBuilder.php | 57 ++-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/SectionGroupItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/SectionGroupItemRequestBuilder.php | 20 +- .../SectionGroupsRequestBuilder.php | 20 +- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/Sections/SectionsRequestBuilder.php | 39 +-- .../SectionGroupsRequestBuilder.php | 39 +-- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Sections/SectionsRequestBuilder.php | 39 +-- .../Item/Owners/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/Count/CountRequestBuilder.php | 22 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/Count/CountRequestBuilder.php | 22 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../Owners/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/Owners/OwnersRequestBuilder.php | 20 +- .../Item/Owners/Ref/RefRequestBuilder.php | 38 +-- .../Count/CountRequestBuilder.php | 22 +- ...cificPermissionGrantItemRequestBuilder.php | 57 ++-- .../PermissionGrantsRequestBuilder.php | 43 ++- ...GrantsRequestBuilderGetQueryParameters.php | 2 +- .../Groups/Item/Photo/PhotoRequestBuilder.php | 57 ++-- .../Photo/Value/ContentRequestBuilder.php | 43 ++- .../Item/ProfilePhotoItemRequestBuilder.php | 20 +- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Item/Photos/PhotosRequestBuilder.php | 30 +- ...PhotosRequestBuilderGetQueryParameters.php | 10 +- ...sRequestBuilderGetRequestConfiguration.php | 5 +- .../Item/Planner/PlannerRequestBuilder.php | 57 ++-- .../Plans/Count/CountRequestBuilder.php | 22 +- .../Item/Buckets/BucketsRequestBuilder.php | 39 +-- .../Buckets/Count/CountRequestBuilder.php | 22 +- .../Item/PlannerBucketItemRequestBuilder.php | 57 ++-- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- ...ssignedToTaskBoardFormatRequestBuilder.php | 57 ++-- .../BucketTaskBoardFormatRequestBuilder.php | 57 ++-- .../Item/Details/DetailsRequestBuilder.php | 57 ++-- .../Item/PlannerTaskItemRequestBuilder.php | 57 ++-- .../ProgressTaskBoardFormatRequestBuilder.php | 57 ++-- .../Item/Tasks/TasksRequestBuilder.php | 39 +-- .../Item/Details/DetailsRequestBuilder.php | 57 ++-- .../Item/PlannerPlanItemRequestBuilder.php | 57 ++-- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- ...ssignedToTaskBoardFormatRequestBuilder.php | 57 ++-- .../BucketTaskBoardFormatRequestBuilder.php | 57 ++-- .../Item/Details/DetailsRequestBuilder.php | 57 ++-- .../Item/PlannerTaskItemRequestBuilder.php | 57 ++-- .../ProgressTaskBoardFormatRequestBuilder.php | 57 ++-- .../Plans/Item/Tasks/TasksRequestBuilder.php | 39 +-- .../Planner/Plans/PlansRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../RejectedSenders/Ref/RefRequestBuilder.php | 38 +-- .../RejectedSendersRequestBuilder.php | 20 +- .../RemoveFavoriteRequestBuilder.php | 19 +- .../Groups/Item/Renew/RenewRequestBuilder.php | 19 +- .../ResetUnseenCountRequestBuilder.php | 19 +- .../Item/Restore/RestoreRequestBuilder.php | 20 +- ...RetryServiceProvisioningRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Settings/Count/CountRequestBuilder.php | 22 +- .../Item/GroupSettingItemRequestBuilder.php | 57 ++-- .../Item/Settings/SettingsRequestBuilder.php | 39 +-- .../Item/Sites/Add/AddRequestBuilder.php | 20 +- .../Item/Sites/Count/CountRequestBuilder.php | 22 +- .../Item/Sites/Delta/DeltaGetResponse.php | 72 +++++ .../Item/Sites/Delta/DeltaRequestBuilder.php | 77 +++++ .../DeltaRequestBuilderGetQueryParameters.php | 74 +++++ ...aRequestBuilderGetRequestConfiguration.php | 44 +++ .../GetAllSites/GetAllSitesRequestBuilder.php | 20 +- .../AllTime/AllTimeRequestBuilder.php | 20 +- .../Analytics/AnalyticsRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Activities/ActivitiesRequestBuilder.php | 39 +-- .../Activities/Count/CountRequestBuilder.php | 22 +- .../Content/ContentRequestBuilder.php | 42 ++- .../DriveItem/DriveItemRequestBuilder.php | 20 +- .../Item/ItemActivityItemRequestBuilder.php | 57 ++-- .../ItemActivityStatItemRequestBuilder.php | 57 ++-- .../ItemActivityStatsRequestBuilder.php | 39 +-- .../LastSevenDaysRequestBuilder.php | 20 +- .../Item/Columns/ColumnsRequestBuilder.php | 39 +-- .../Columns/Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 57 ++-- .../SourceColumnRequestBuilder.php | 20 +- .../AddCopy/AddCopyRequestBuilder.php | 20 +- ...ddCopyFromContentTypeHubRequestBuilder.php | 20 +- .../ContentTypesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ompatibleHubContentTypesRequestBuilder.php | 20 +- .../AssociateWithHubSitesRequestBuilder.php | 19 +- .../Item/Base/EscapedBaseRequestBuilder.php | 20 +- .../BaseTypes/BaseTypesRequestBuilder.php | 20 +- .../BaseTypes/Count/CountRequestBuilder.php | 22 +- .../Item/ContentTypeItemRequestBuilder.php | 20 +- .../ColumnLinks/ColumnLinksRequestBuilder.php | 39 +-- .../ColumnLinks/Count/CountRequestBuilder.php | 22 +- .../Item/ColumnLinkItemRequestBuilder.php | 57 ++-- .../ColumnPositionsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 20 +- .../Item/Columns/ColumnsRequestBuilder.php | 39 +-- .../Columns/Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 57 ++-- .../SourceColumnRequestBuilder.php | 20 +- .../Item/ContentTypeItemRequestBuilder.php | 57 ++-- ...ToDefaultContentLocationRequestBuilder.php | 19 +- .../IsPublished/IsPublishedRequestBuilder.php | 20 +- .../Item/Publish/PublishRequestBuilder.php | 19 +- .../Unpublish/UnpublishRequestBuilder.php | 19 +- .../CreatedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Sites/Item/Drive/DriveRequestBuilder.php | 20 +- .../Item/Drives/Count/CountRequestBuilder.php | 22 +- .../Item/Drives/DrivesRequestBuilder.php | 20 +- .../Drives/Item/DriveItemRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ExternalColumnsRequestBuilder.php | 20 +- .../ColumnDefinitionItemRequestBuilder.php | 20 +- .../GetActivitiesByIntervalRequestBuilder.php | 20 +- ...hEndDateTimeWithIntervalRequestBuilder.php | 20 +- ...ntTypesForListWithListIdRequestBuilder.php | 20 +- .../GetByPathWithPathRequestBuilder.php | 20 +- .../Item/Items/Count/CountRequestBuilder.php | 22 +- .../Items/Item/BaseItemItemRequestBuilder.php | 20 +- .../Sites/Item/Items/ItemsRequestBuilder.php | 20 +- .../LastModifiedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Lists/Count/CountRequestBuilder.php | 22 +- .../Item/Columns/ColumnsRequestBuilder.php | 39 +-- .../Columns/Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 57 ++-- .../SourceColumnRequestBuilder.php | 20 +- .../AddCopy/AddCopyRequestBuilder.php | 20 +- ...ddCopyFromContentTypeHubRequestBuilder.php | 20 +- .../ContentTypesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ompatibleHubContentTypesRequestBuilder.php | 20 +- .../AssociateWithHubSitesRequestBuilder.php | 19 +- .../Item/Base/EscapedBaseRequestBuilder.php | 20 +- .../BaseTypes/BaseTypesRequestBuilder.php | 20 +- .../BaseTypes/Count/CountRequestBuilder.php | 22 +- .../Item/ContentTypeItemRequestBuilder.php | 20 +- .../ColumnLinks/ColumnLinksRequestBuilder.php | 39 +-- .../ColumnLinks/Count/CountRequestBuilder.php | 22 +- .../Item/ColumnLinkItemRequestBuilder.php | 57 ++-- .../ColumnPositionsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 20 +- .../Item/Columns/ColumnsRequestBuilder.php | 39 +-- .../Columns/Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 57 ++-- .../SourceColumnRequestBuilder.php | 20 +- .../Item/ContentTypeItemRequestBuilder.php | 57 ++-- ...ToDefaultContentLocationRequestBuilder.php | 19 +- .../IsPublished/IsPublishedRequestBuilder.php | 20 +- .../Item/Publish/PublishRequestBuilder.php | 19 +- .../Unpublish/UnpublishRequestBuilder.php | 19 +- .../CreatedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Lists/Item/Drive/DriveRequestBuilder.php | 20 +- .../Analytics/AnalyticsRequestBuilder.php | 20 +- .../CreatedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../DocumentSetVersionsRequestBuilder.php | 39 +-- .../DocumentSetVersionItemRequestBuilder.php | 57 ++-- .../Item/Fields/FieldsRequestBuilder.php | 57 ++-- .../Item/Restore/RestoreRequestBuilder.php | 19 +- .../Content/ContentRequestBuilder.php | 42 ++- .../DriveItem/DriveItemRequestBuilder.php | 20 +- .../Item/Fields/FieldsRequestBuilder.php | 57 ++-- .../GetActivitiesByIntervalRequestBuilder.php | 20 +- ...hEndDateTimeWithIntervalRequestBuilder.php | 20 +- .../LastModifiedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Items/Item/ListItemItemRequestBuilder.php | 57 ++-- .../Versions/Count/CountRequestBuilder.php | 22 +- .../Item/Fields/FieldsRequestBuilder.php | 57 ++-- .../ListItemVersionItemRequestBuilder.php | 57 ++-- .../RestoreVersionRequestBuilder.php | 19 +- .../Item/Versions/VersionsRequestBuilder.php | 39 +-- .../Lists/Item/Items/ItemsRequestBuilder.php | 39 +-- .../LastModifiedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Lists/Item/ListItemRequestBuilder.php | 63 ++-- ...stItemRequestBuilderGetQueryParameters.php | 2 +- .../Operations/Count/CountRequestBuilder.php | 22 +- ...LongRunningOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Reauthorize/ReauthorizeRequestBuilder.php | 19 +- .../Item/SubscriptionItemRequestBuilder.php | 57 ++-- .../SubscriptionsRequestBuilder.php | 39 +-- .../Sites/Item/Lists/ListsRequestBuilder.php | 39 +-- .../Notebooks/Count/CountRequestBuilder.php | 22 +- .../GetNotebookFromWebUrlRequestBuilder.php | 20 +- ...IncludePersonalNotebooksRequestBuilder.php | 20 +- .../CopyNotebookRequestBuilder.php | 20 +- .../Item/NotebookItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/SectionGroupItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/SectionGroupItemRequestBuilder.php | 20 +- .../SectionGroupsRequestBuilder.php | 20 +- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/Sections/SectionsRequestBuilder.php | 39 +-- .../SectionGroupsRequestBuilder.php | 39 +-- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/Sections/SectionsRequestBuilder.php | 39 +-- .../Notebooks/NotebooksRequestBuilder.php | 39 +-- .../Item/Onenote/OnenoteRequestBuilder.php | 57 ++-- .../Operations/Count/CountRequestBuilder.php | 22 +- .../OnenoteOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Onenote/Pages/PagesRequestBuilder.php | 39 +-- .../Resources/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../OnenoteResourceItemRequestBuilder.php | 57 ++-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/SectionGroupItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/SectionGroupItemRequestBuilder.php | 20 +- .../SectionGroupsRequestBuilder.php | 20 +- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/Sections/SectionsRequestBuilder.php | 39 +-- .../SectionGroupsRequestBuilder.php | 39 +-- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Sections/SectionsRequestBuilder.php | 39 +-- .../Operations/Count/CountRequestBuilder.php | 22 +- ...LongRunningOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Permissions/Count/CountRequestBuilder.php | 22 +- .../Item/Grant/GrantRequestBuilder.php | 20 +- .../Item/PermissionItemRequestBuilder.php | 57 ++-- .../Permissions/PermissionsRequestBuilder.php | 39 +-- .../Sites/Item/SiteItemRequestBuilder.php | 39 +-- .../Item/Sites/Count/CountRequestBuilder.php | 22 +- .../Sites/Item/SiteItemRequestBuilder.php | 20 +- .../Sites/Item/Sites/SitesRequestBuilder.php | 20 +- .../Groups/Count/CountRequestBuilder.php | 22 +- .../TermStore/Groups/GroupsRequestBuilder.php | 39 +-- .../Groups/Item/GroupItemRequestBuilder.php | 57 ++-- .../Item/Sets/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../ParentGroup/ParentGroupRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Sets/Item/SetItemRequestBuilder.php | 57 ++-- .../Item/Terms/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Terms/Item/Set/SetRequestBuilder.php | 20 +- .../Terms/Item/TermItemRequestBuilder.php | 57 ++-- .../Sets/Item/Terms/TermsRequestBuilder.php | 39 +-- .../Groups/Item/Sets/SetsRequestBuilder.php | 39 +-- .../Sets/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../ParentGroup/ParentGroupRequestBuilder.php | 57 ++-- .../Sets/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Sets/Item/SetItemRequestBuilder.php | 57 ++-- .../Item/Terms/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Terms/Item/Set/SetRequestBuilder.php | 20 +- .../Terms/Item/TermItemRequestBuilder.php | 57 ++-- .../Sets/Item/Terms/TermsRequestBuilder.php | 39 +-- .../ParentGroup/Sets/SetsRequestBuilder.php | 39 +-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Sets/Item/SetItemRequestBuilder.php | 57 ++-- .../Item/Terms/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Terms/Item/Set/SetRequestBuilder.php | 20 +- .../Terms/Item/TermItemRequestBuilder.php | 57 ++-- .../Sets/Item/Terms/TermsRequestBuilder.php | 39 +-- .../TermStore/Sets/SetsRequestBuilder.php | 39 +-- .../TermStore/TermStoreRequestBuilder.php | 57 ++-- .../TermStores/Count/CountRequestBuilder.php | 22 +- .../Item/Groups/Count/CountRequestBuilder.php | 22 +- .../Item/Groups/GroupsRequestBuilder.php | 39 +-- .../Groups/Item/GroupItemRequestBuilder.php | 57 ++-- .../Item/Sets/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../ParentGroup/ParentGroupRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Sets/Item/SetItemRequestBuilder.php | 57 ++-- .../Item/Terms/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Terms/Item/Set/SetRequestBuilder.php | 20 +- .../Terms/Item/TermItemRequestBuilder.php | 57 ++-- .../Sets/Item/Terms/TermsRequestBuilder.php | 39 +-- .../Groups/Item/Sets/SetsRequestBuilder.php | 39 +-- .../Item/Sets/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../ParentGroup/ParentGroupRequestBuilder.php | 57 ++-- .../Sets/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Sets/Item/SetItemRequestBuilder.php | 57 ++-- .../Item/Terms/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Terms/Item/Set/SetRequestBuilder.php | 20 +- .../Terms/Item/TermItemRequestBuilder.php | 57 ++-- .../Sets/Item/Terms/TermsRequestBuilder.php | 39 +-- .../ParentGroup/Sets/SetsRequestBuilder.php | 39 +-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Sets/Item/SetItemRequestBuilder.php | 57 ++-- .../Item/Terms/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Terms/Item/Set/SetRequestBuilder.php | 20 +- .../Terms/Item/TermItemRequestBuilder.php | 57 ++-- .../Sets/Item/Terms/TermsRequestBuilder.php | 39 +-- .../Item/Sets/SetsRequestBuilder.php | 39 +-- .../Item/StoreItemRequestBuilder.php | 57 ++-- .../TermStores/TermStoresRequestBuilder.php | 39 +-- .../Sites/Remove/RemoveRequestBuilder.php | 20 +- .../Groups/Item/Sites/SitesRequestBuilder.php | 28 +- .../SubscribeByMailRequestBuilder.php | 19 +- .../AllChannels/AllChannelsRequestBuilder.php | 20 +- .../AllChannels/Count/CountRequestBuilder.php | 22 +- .../Item/ChannelItemRequestBuilder.php | 20 +- .../Team/Archive/ArchiveRequestBuilder.php | 19 +- .../Team/Channels/ChannelsRequestBuilder.php | 39 +-- .../Channels/Count/CountRequestBuilder.php | 22 +- .../GetAllMessagesRequestBuilder.php | 20 +- .../Item/ChannelItemRequestBuilder.php | 57 ++-- .../CompleteMigrationRequestBuilder.php | 19 +- ...palNameUserPrincipalNameRequestBuilder.php | 20 +- .../Content/ContentRequestBuilder.php | 42 ++- .../FilesFolder/FilesFolderRequestBuilder.php | 20 +- .../Item/Members/Add/AddRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 63 ++-- .../Item/Members/MembersRequestBuilder.php | 39 +-- .../Messages/Count/CountRequestBuilder.php | 22 +- .../Messages/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Replies/Count/CountRequestBuilder.php | 22 +- .../Replies/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Replies/RepliesRequestBuilder.php | 39 +-- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Messages/MessagesRequestBuilder.php | 45 ++- .../ProvisionEmailRequestBuilder.php | 20 +- .../RemoveEmail/RemoveEmailRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../AllowedMembersRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 20 +- ...dWithChannelTeamInfoItemRequestBuilder.php | 57 ++-- .../Item/Team/TeamRequestBuilder.php | 20 +- .../SharedWithTeamsRequestBuilder.php | 39 +-- .../Item/Tabs/Count/CountRequestBuilder.php | 22 +- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../Tabs/Item/TeamsTabItemRequestBuilder.php | 57 ++-- .../Channels/Item/Tabs/TabsRequestBuilder.php | 39 +-- .../CompleteMigrationRequestBuilder.php | 19 +- .../Team/EscapedClone/CloneRequestBuilder.php | 19 +- .../Item/Team/Group/GroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../IncomingChannelsRequestBuilder.php | 20 +- .../Item/ChannelItemRequestBuilder.php | 38 +-- .../Count/CountRequestBuilder.php | 22 +- .../InstalledAppsRequestBuilder.php | 39 +-- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../TeamsAppDefinitionRequestBuilder.php | 20 +- ...TeamsAppInstallationItemRequestBuilder.php | 57 ++-- .../Item/Upgrade/UpgradeRequestBuilder.php | 19 +- .../Team/Members/Add/AddRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 57 ++-- .../Team/Members/MembersRequestBuilder.php | 39 +-- .../Operations/Count/CountRequestBuilder.php | 22 +- .../TeamsAsyncOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...cificPermissionGrantItemRequestBuilder.php | 57 ++-- .../PermissionGrantsRequestBuilder.php | 43 ++- ...GrantsRequestBuilderGetQueryParameters.php | 2 +- .../Item/Team/Photo/PhotoRequestBuilder.php | 43 ++- .../PhotoRequestBuilderGetQueryParameters.php | 2 +- .../Photo/Value/ContentRequestBuilder.php | 43 ++- .../CompleteMigrationRequestBuilder.php | 19 +- ...palNameUserPrincipalNameRequestBuilder.php | 20 +- .../Content/ContentRequestBuilder.php | 42 ++- .../FilesFolder/FilesFolderRequestBuilder.php | 20 +- .../Members/Add/AddRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 63 ++-- .../Members/MembersRequestBuilder.php | 39 +-- .../Messages/Count/CountRequestBuilder.php | 22 +- .../Messages/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Replies/Count/CountRequestBuilder.php | 22 +- .../Replies/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Replies/RepliesRequestBuilder.php | 39 +-- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Messages/MessagesRequestBuilder.php | 45 ++- .../PrimaryChannelRequestBuilder.php | 57 ++-- .../ProvisionEmailRequestBuilder.php | 20 +- .../RemoveEmail/RemoveEmailRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../AllowedMembersRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 20 +- ...dWithChannelTeamInfoItemRequestBuilder.php | 57 ++-- .../Item/Team/TeamRequestBuilder.php | 20 +- .../SharedWithTeamsRequestBuilder.php | 39 +-- .../Tabs/Count/CountRequestBuilder.php | 22 +- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../Tabs/Item/TeamsTabItemRequestBuilder.php | 57 ++-- .../Tabs/TabsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../OfferShiftRequestItemRequestBuilder.php | 57 ++-- .../OfferShiftRequestsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...enShiftChangeRequestItemRequestBuilder.php | 57 ++-- .../OpenShiftChangeRequestsRequestBuilder.php | 39 +-- .../OpenShifts/Count/CountRequestBuilder.php | 22 +- .../Item/OpenShiftItemRequestBuilder.php | 57 ++-- .../OpenShifts/OpenShiftsRequestBuilder.php | 39 +-- .../Team/Schedule/ScheduleRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../SchedulingGroupItemRequestBuilder.php | 57 ++-- .../SchedulingGroupsRequestBuilder.php | 39 +-- .../Schedule/Share/ShareRequestBuilder.php | 19 +- .../Shifts/Count/CountRequestBuilder.php | 22 +- .../Shifts/Item/ShiftItemRequestBuilder.php | 57 ++-- .../Schedule/Shifts/ShiftsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...pShiftsChangeRequestItemRequestBuilder.php | 57 ++-- ...SwapShiftsChangeRequestsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/TimeOffReasonItemRequestBuilder.php | 57 ++-- .../TimeOffReasonsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/TimeOffRequestItemRequestBuilder.php | 57 ++-- .../TimeOffRequestsRequestBuilder.php | 39 +-- .../TimesOff/Count/CountRequestBuilder.php | 22 +- .../Item/TimeOffItemRequestBuilder.php | 57 ++-- .../TimesOff/TimesOffRequestBuilder.php | 39 +-- ...SendActivityNotificationRequestBuilder.php | 19 +- .../Team/Tags/Count/CountRequestBuilder.php | 22 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../TeamworkTagMemberItemRequestBuilder.php | 57 ++-- .../Item/Members/MembersRequestBuilder.php | 39 +-- .../Item/TeamworkTagItemRequestBuilder.php | 57 ++-- .../Item/Team/Tags/TagsRequestBuilder.php | 39 +-- .../Groups/Item/Team/TeamRequestBuilder.php | 57 ++-- .../Team/Template/TemplateRequestBuilder.php | 20 +- .../Unarchive/UnarchiveRequestBuilder.php | 19 +- .../Threads/Count/CountRequestBuilder.php | 22 +- .../ConversationThreadItemRequestBuilder.php | 57 ++-- .../Item/Posts/Count/CountRequestBuilder.php | 22 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Forward/ForwardRequestBuilder.php | 19 +- .../InReplyTo/InReplyToRequestBuilder.php | 20 +- .../InReplyTo/Reply/ReplyRequestBuilder.php | 25 +- .../Posts/Item/PostItemRequestBuilder.php | 20 +- .../Posts/Item/Reply/ReplyRequestBuilder.php | 25 +- .../Item/Posts/PostsRequestBuilder.php | 20 +- .../Item/Reply/ReplyRequestBuilder.php | 19 +- .../Item/Threads/ThreadsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../TransitiveMemberOfRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/Count/CountRequestBuilder.php | 22 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/Count/CountRequestBuilder.php | 22 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../TransitiveMembersRequestBuilder.php | 20 +- .../UnsubscribeByMailRequestBuilder.php | 19 +- .../ValidatePropertiesRequestBuilder.php | 19 +- .../ValidatePropertiesRequestBuilder.php | 19 +- .../ApiConnectorsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...IdentityApiConnectorItemRequestBuilder.php | 57 ++-- .../UploadClientCertificateRequestBuilder.php | 20 +- .../B2xUserFlowsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...piConnectorConfigurationRequestBuilder.php | 20 +- .../PostAttributeCollectionRequestBuilder.php | 57 ++-- .../Ref/RefRequestBuilder.php | 58 ++-- .../UploadClientCertificateRequestBuilder.php | 20 +- .../PostFederationSignupRequestBuilder.php | 57 ++-- .../Ref/RefRequestBuilder.php | 58 ++-- .../UploadClientCertificateRequestBuilder.php | 20 +- .../B2xIdentityUserFlowItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../IdentityProvidersRequestBuilder.php | 20 +- .../IdentityProviderItemRequestBuilder.php | 38 +-- .../Languages/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../DefaultPagesRequestBuilder.php | 39 +-- ...UserFlowLanguagePageItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Count/CountRequestBuilder.php | 22 +- ...UserFlowLanguagePageItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../OverridesPagesRequestBuilder.php | 39 +-- ...anguageConfigurationItemRequestBuilder.php | 61 ++-- ...onItemRequestBuilderGetQueryParameters.php | 2 +- .../Languages/LanguagesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../GetOrder/GetOrderRequestBuilder.php | 20 +- ...wAttributeAssignmentItemRequestBuilder.php | 57 ++-- .../UserAttributeRequestBuilder.php | 20 +- .../SetOrder/SetOrderRequestBuilder.php | 19 +- ...UserAttributeAssignmentsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../Ref/RefRequestBuilder.php | 38 +-- ...serFlowIdentityProvidersRequestBuilder.php | 20 +- ...onContextClassReferencesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ontextClassReferenceItemRequestBuilder.php | 57 ++-- ...uthenticationMethodModesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...tionMethodModeDetailItemRequestBuilder.php | 57 ++-- .../AuthenticationStrengthRequestBuilder.php | 57 ++-- .../Policies/Count/CountRequestBuilder.php | 22 +- ...cationStrengthPolicyItemRequestBuilder.php | 57 ++-- ...ombinationConfigurationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...inationConfigurationItemRequestBuilder.php | 57 ++-- ...pdateAllowedCombinationsRequestBuilder.php | 20 +- .../Item/Usage/UsageRequestBuilder.php | 20 +- .../Policies/PoliciesRequestBuilder.php | 39 +-- .../ConditionalAccessRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/NamedLocationItemRequestBuilder.php | 75 ++--- ...onItemRequestBuilderGetQueryParameters.php | 2 +- .../NamedLocationsRequestBuilder.php | 39 +-- .../Policies/Count/CountRequestBuilder.php | 22 +- ...ditionalAccessPolicyItemRequestBuilder.php | 57 ++-- .../Policies/PoliciesRequestBuilder.php | 39 +-- .../Templates/Count/CountRequestBuilder.php | 22 +- ...tionalAccessTemplateItemRequestBuilder.php | 20 +- .../Templates/TemplatesRequestBuilder.php | 20 +- .../AvailableProviderTypesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../IdentityProvidersRequestBuilder.php | 47 ++- ...vidersRequestBuilderGetQueryParameters.php | 2 +- ...IdentityProviderBaseItemRequestBuilder.php | 69 ++-- ...seItemRequestBuilderGetQueryParameters.php | 2 +- .../Identity/IdentityRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ityUserFlowAttributeItemRequestBuilder.php | 57 ++-- .../UserFlowAttributesRequestBuilder.php | 39 +-- .../AccessReviewsRequestBuilder.php | 57 ++-- .../Definitions/Count/CountRequestBuilder.php | 22 +- .../Definitions/DefinitionsRequestBuilder.php | 39 +-- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- ...ewScheduleDefinitionItemRequestBuilder.php | 57 ++-- .../Instances/Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Instances/InstancesRequestBuilder.php | 39 +-- .../AcceptRecommendationsRequestBuilder.php | 19 +- ...AccessReviewInstanceItemRequestBuilder.php | 57 ++-- .../ApplyDecisionsRequestBuilder.php | 19 +- .../BatchRecordDecisionsRequestBuilder.php | 19 +- .../ContactedReviewersRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...AccessReviewReviewerItemRequestBuilder.php | 57 ++-- .../Decisions/Count/CountRequestBuilder.php | 22 +- .../Decisions/DecisionsRequestBuilder.php | 39 +-- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- ...InstanceDecisionItemItemRequestBuilder.php | 57 ++-- .../Insights/Count/CountRequestBuilder.php | 22 +- .../Item/Insights/InsightsRequestBuilder.php | 39 +-- .../GovernanceInsightItemRequestBuilder.php | 57 ++-- .../ResetDecisionsRequestBuilder.php | 19 +- .../SendReminderRequestBuilder.php | 19 +- .../Item/Stages/Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../AccessReviewStageItemRequestBuilder.php | 57 ++-- .../Decisions/Count/CountRequestBuilder.php | 22 +- .../Decisions/DecisionsRequestBuilder.php | 39 +-- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- ...InstanceDecisionItemItemRequestBuilder.php | 57 ++-- .../Insights/Count/CountRequestBuilder.php | 22 +- .../Item/Insights/InsightsRequestBuilder.php | 39 +-- .../GovernanceInsightItemRequestBuilder.php | 57 ++-- .../Stages/Item/Stop/StopRequestBuilder.php | 19 +- .../Item/Stages/StagesRequestBuilder.php | 39 +-- .../Item/Stop/StopRequestBuilder.php | 19 +- .../Item/Stop/StopRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../HistoryDefinitionsRequestBuilder.php | 39 +-- ...iewHistoryDefinitionItemRequestBuilder.php | 57 ++-- .../Instances/Count/CountRequestBuilder.php | 22 +- .../Instances/InstancesRequestBuilder.php | 39 +-- ...eviewHistoryInstanceItemRequestBuilder.php | 57 ++-- .../GenerateDownloadUriRequestBuilder.php | 20 +- .../AppConsent/AppConsentRequestBuilder.php | 57 ++-- .../AppConsentRequestsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../AppConsentRequestItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Item/Approval/ApprovalRequestBuilder.php | 57 ++-- .../Stages/Count/CountRequestBuilder.php | 22 +- .../Item/ApprovalStageItemRequestBuilder.php | 57 ++-- .../Approval/Stages/StagesRequestBuilder.php | 43 ++- ...StagesRequestBuilderGetQueryParameters.php | 2 +- .../UserConsentRequestItemRequestBuilder.php | 57 ++-- .../UserConsentRequestsRequestBuilder.php | 39 +-- ...ckageAssignmentApprovalsRequestBuilder.php | 43 ++- ...rovalsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Item/ApprovalItemRequestBuilder.php | 61 ++-- ...alItemRequestBuilderGetQueryParameters.php | 2 +- .../Item/Stages/Count/CountRequestBuilder.php | 22 +- .../Item/ApprovalStageItemRequestBuilder.php | 57 ++-- .../Item/Stages/StagesRequestBuilder.php | 43 ++- ...StagesRequestBuilderGetQueryParameters.php | 2 +- .../AccessPackagesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Item/AccessPackageItemRequestBuilder.php | 57 ++-- ...PackagesIncompatibleWithRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/AccessPackageItemRequestBuilder.php | 20 +- .../AssignmentPoliciesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AccessPackageRequestBuilder.php | 20 +- ...kageAssignmentPolicyItemRequestBuilder.php | 57 ++-- .../Item/Catalog/CatalogRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...omExtensionStageSettingsRequestBuilder.php | 39 +-- .../CustomExtensionRequestBuilder.php | 20 +- ...xtensionStageSettingItemRequestBuilder.php | 57 ++-- .../Questions/Count/CountRequestBuilder.php | 22 +- ...ccessPackageQuestionItemRequestBuilder.php | 57 ++-- .../Questions/QuestionsRequestBuilder.php | 39 +-- .../Item/Catalog/CatalogRequestBuilder.php | 20 +- ...icablePolicyRequirementsRequestBuilder.php | 24 +- .../Count/CountRequestBuilder.php | 22 +- ...compatibleAccessPackagesRequestBuilder.php | 20 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../Ref/RefRequestBuilder.php | 38 +-- .../Count/CountRequestBuilder.php | 22 +- .../IncompatibleGroupsRequestBuilder.php | 20 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Ref/RefRequestBuilder.php | 38 +-- .../Count/CountRequestBuilder.php | 22 +- ...ageResourceRoleScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Role/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../Item/Role/RoleRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Scope/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../Item/Scope/ScopeRequestBuilder.php | 57 ++-- .../ResourceRoleScopesRequestBuilder.php | 39 +-- .../AssignmentPoliciesRequestBuilder.php | 47 ++- ...liciesRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../AccessPackageRequestBuilder.php | 20 +- ...kageAssignmentPolicyItemRequestBuilder.php | 65 ++-- ...cyItemRequestBuilderGetQueryParameters.php | 2 +- .../Item/Catalog/CatalogRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...omExtensionStageSettingsRequestBuilder.php | 39 +-- .../CustomExtensionRequestBuilder.php | 20 +- ...xtensionStageSettingItemRequestBuilder.php | 57 ++-- .../Questions/Count/CountRequestBuilder.php | 22 +- ...ccessPackageQuestionItemRequestBuilder.php | 57 ++-- .../Questions/QuestionsRequestBuilder.php | 39 +-- .../AssignmentRequestsRequestBuilder.php | 47 ++- ...questsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../AccessPackageRequestBuilder.php | 20 +- ...ageAssignmentRequestItemRequestBuilder.php | 61 ++-- ...stItemRequestBuilderGetQueryParameters.php | 2 +- .../Assignment/AssignmentRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 23 +- .../Reprocess/ReprocessRequestBuilder.php | 23 +- .../Requestor/RequestorRequestBuilder.php | 20 +- .../Item/Resume/ResumeRequestBuilder.php | 23 +- .../AdditionalAccessRequestBuilder.php | 20 +- ...ompatibleAccessPackageIdRequestBuilder.php | 20 +- .../Assignments/AssignmentsRequestBuilder.php | 43 ++- ...nmentsRequestBuilderGetQueryParameters.php | 2 +- .../Assignments/Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../AccessPackageRequestBuilder.php | 20 +- ...essPackageAssignmentItemRequestBuilder.php | 61 ++-- ...ntItemRequestBuilderGetQueryParameters.php | 2 +- .../AssignmentPolicyRequestBuilder.php | 20 +- .../Reprocess/ReprocessRequestBuilder.php | 23 +- .../Item/Target/TargetRequestBuilder.php | 20 +- .../Catalogs/CatalogsRequestBuilder.php | 39 +-- .../Catalogs/Count/CountRequestBuilder.php | 22 +- ...AccessPackageCatalogItemRequestBuilder.php | 57 ++-- .../AccessPackagesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/AccessPackageItemRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...CustomWorkflowExtensionsRequestBuilder.php | 39 +-- ...stomCalloutExtensionItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../ResourceRolesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../ResourceScopesRequestBuilder.php | 39 +-- .../Resources/Count/CountRequestBuilder.php | 22 +- ...ccessPackageResourceItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../Item/Roles/RolesRequestBuilder.php | 39 +-- .../Item/Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Item/Scopes/ScopesRequestBuilder.php | 39 +-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../ConnectedOrganizationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...onnectedOrganizationItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../ExternalSponsorsRequestBuilder.php | 20 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../Ref/RefRequestBuilder.php | 38 +-- .../Count/CountRequestBuilder.php | 22 +- .../InternalSponsorsRequestBuilder.php | 20 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../Ref/RefRequestBuilder.php | 38 +-- .../EntitlementManagementRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...eResourceEnvironmentItemRequestBuilder.php | 57 ++-- .../Resources/Count/CountRequestBuilder.php | 22 +- ...ccessPackageResourceItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../Item/Roles/RolesRequestBuilder.php | 39 +-- .../Item/Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Item/Scopes/ScopesRequestBuilder.php | 39 +-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../ResourceEnvironmentsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ckageResourceRequestItemRequestBuilder.php | 57 ++-- .../AccessPackagesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/AccessPackageItemRequestBuilder.php | 20 +- .../Item/Catalog/CatalogRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...CustomWorkflowExtensionsRequestBuilder.php | 39 +-- ...stomCalloutExtensionItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../ResourceRolesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../ResourceScopesRequestBuilder.php | 39 +-- .../Resources/Count/CountRequestBuilder.php | 22 +- ...ccessPackageResourceItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../Item/Roles/RolesRequestBuilder.php | 39 +-- .../Item/Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Item/Scopes/ScopesRequestBuilder.php | 39 +-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../ResourceRequestsRequestBuilder.php | 43 ++- .../Count/CountRequestBuilder.php | 22 +- ...ageResourceRoleScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Role/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../Item/Role/RoleRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Scope/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../Item/Scope/ScopeRequestBuilder.php | 57 ++-- .../ResourceRoleScopesRequestBuilder.php | 39 +-- .../Resources/Count/CountRequestBuilder.php | 22 +- ...ccessPackageResourceItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Resource/Scopes/ScopesRequestBuilder.php | 39 +-- .../Item/Roles/RolesRequestBuilder.php | 39 +-- .../Item/Scopes/Count/CountRequestBuilder.php | 22 +- ...PackageResourceScopeItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Roles/Count/CountRequestBuilder.php | 22 +- ...sPackageResourceRoleItemRequestBuilder.php | 57 ++-- .../Environment/EnvironmentRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 57 ++-- .../Resource/Roles/RolesRequestBuilder.php | 39 +-- .../Item/Scopes/ScopesRequestBuilder.php | 39 +-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../Settings/SettingsRequestBuilder.php | 57 ++-- .../IdentityGovernanceRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../CustomTaskExtensionsRequestBuilder.php | 39 +-- .../CreatedBy/CreatedByRequestBuilder.php | 24 +- ...atedByRequestBuilderGetQueryParameters.php | 2 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../CustomTaskExtensionItemRequestBuilder.php | 57 ++-- .../LastModifiedByRequestBuilder.php | 24 +- ...fiedByRequestBuilderGetQueryParameters.php | 2 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../DeletedItemsRequestBuilder.php | 38 +-- .../Workflows/Count/CountRequestBuilder.php | 22 +- .../CreatedBy/CreatedByRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ExecutionScopeRequestBuilder.php | 24 +- ...nScopeRequestBuilderGetQueryParameters.php | 2 +- ...UserProcessingResultItemRequestBuilder.php | 24 +- ...ltItemRequestBuilderGetQueryParameters.php | 2 +- .../LastModifiedByRequestBuilder.php | 24 +- ...fiedByRequestBuilderGetQueryParameters.php | 2 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- ...entityGovernanceActivateRequestBuilder.php | 19 +- ...vernanceCreateNewVersionRequestBuilder.php | 20 +- ...dentityGovernanceRestoreRequestBuilder.php | 24 +- .../Item/Runs/Count/CountRequestBuilder.php | 22 +- .../Item/Runs/Item/RunItemRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...IdentityGovernanceResumeRequestBuilder.php | 19 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 24 +- ...ubjectRequestBuilderGetQueryParameters.php | 2 +- .../Item/Task/TaskRequestBuilder.php | 20 +- ...TaskProcessingResultItemRequestBuilder.php | 20 +- .../TaskProcessingResultsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...IdentityGovernanceResumeRequestBuilder.php | 19 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 24 +- ...ubjectRequestBuilderGetQueryParameters.php | 2 +- .../Item/Task/TaskRequestBuilder.php | 20 +- ...TaskProcessingResultItemRequestBuilder.php | 20 +- .../TaskProcessingResultsRequestBuilder.php | 20 +- ...UserProcessingResultItemRequestBuilder.php | 20 +- ...tDateTimeWithEndDateTimeRequestBuilder.php | 20 +- .../UserProcessingResultsRequestBuilder.php | 20 +- ...tDateTimeWithEndDateTimeRequestBuilder.php | 20 +- .../Item/Runs/RunsRequestBuilder.php | 20 +- .../TaskReports/Count/CountRequestBuilder.php | 22 +- .../Item/Task/TaskRequestBuilder.php | 20 +- .../TaskDefinitionRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...IdentityGovernanceResumeRequestBuilder.php | 19 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 24 +- ...ubjectRequestBuilderGetQueryParameters.php | 2 +- .../Item/Task/TaskRequestBuilder.php | 20 +- ...TaskProcessingResultItemRequestBuilder.php | 20 +- .../TaskProcessingResultsRequestBuilder.php | 20 +- .../Item/TaskReportItemRequestBuilder.php | 20 +- ...tDateTimeWithEndDateTimeRequestBuilder.php | 20 +- .../TaskReports/TaskReportsRequestBuilder.php | 20 +- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- .../Tasks/Item/TaskItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...IdentityGovernanceResumeRequestBuilder.php | 19 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 24 +- ...ubjectRequestBuilderGetQueryParameters.php | 2 +- .../Item/Task/TaskRequestBuilder.php | 20 +- ...TaskProcessingResultItemRequestBuilder.php | 20 +- .../TaskProcessingResultsRequestBuilder.php | 20 +- .../Item/Tasks/TasksRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...IdentityGovernanceResumeRequestBuilder.php | 19 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 24 +- ...ubjectRequestBuilderGetQueryParameters.php | 2 +- .../Item/Task/TaskRequestBuilder.php | 20 +- ...TaskProcessingResultItemRequestBuilder.php | 20 +- .../TaskProcessingResultsRequestBuilder.php | 20 +- ...UserProcessingResultItemRequestBuilder.php | 20 +- ...tDateTimeWithEndDateTimeRequestBuilder.php | 20 +- .../UserProcessingResultsRequestBuilder.php | 20 +- .../Versions/Count/CountRequestBuilder.php | 22 +- .../CreatedBy/CreatedByRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../LastModifiedByRequestBuilder.php | 24 +- ...fiedByRequestBuilderGetQueryParameters.php | 2 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- .../Tasks/Item/TaskItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...IdentityGovernanceResumeRequestBuilder.php | 19 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 24 +- ...ubjectRequestBuilderGetQueryParameters.php | 2 +- .../Item/Task/TaskRequestBuilder.php | 20 +- ...TaskProcessingResultItemRequestBuilder.php | 20 +- .../TaskProcessingResultsRequestBuilder.php | 20 +- .../Item/Tasks/TasksRequestBuilder.php | 39 +-- ...VersionVersionNumberItemRequestBuilder.php | 20 +- .../Item/Versions/VersionsRequestBuilder.php | 20 +- .../Item/WorkflowItemRequestBuilder.php | 38 +-- .../Workflows/WorkflowsRequestBuilder.php | 20 +- .../LifecycleWorkflowsRequestBuilder.php | 57 ++-- .../Settings/SettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/TaskDefinitionItemRequestBuilder.php | 20 +- .../TaskDefinitionsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- .../Tasks/Item/TaskItemRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...IdentityGovernanceResumeRequestBuilder.php | 19 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 24 +- ...ubjectRequestBuilderGetQueryParameters.php | 2 +- .../Item/Task/TaskRequestBuilder.php | 20 +- ...TaskProcessingResultItemRequestBuilder.php | 20 +- .../TaskProcessingResultsRequestBuilder.php | 20 +- .../Item/Tasks/TasksRequestBuilder.php | 20 +- .../WorkflowTemplateItemRequestBuilder.php | 20 +- .../WorkflowTemplatesRequestBuilder.php | 20 +- .../Workflows/Count/CountRequestBuilder.php | 22 +- .../CreatedBy/CreatedByRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ExecutionScopeRequestBuilder.php | 24 +- ...nScopeRequestBuilderGetQueryParameters.php | 2 +- ...UserProcessingResultItemRequestBuilder.php | 24 +- ...ltItemRequestBuilderGetQueryParameters.php | 2 +- .../LastModifiedByRequestBuilder.php | 24 +- ...fiedByRequestBuilderGetQueryParameters.php | 2 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- ...entityGovernanceActivateRequestBuilder.php | 19 +- ...vernanceCreateNewVersionRequestBuilder.php | 20 +- ...dentityGovernanceRestoreRequestBuilder.php | 24 +- .../Item/Runs/Count/CountRequestBuilder.php | 22 +- .../Item/Runs/Item/RunItemRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...IdentityGovernanceResumeRequestBuilder.php | 19 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 24 +- ...ubjectRequestBuilderGetQueryParameters.php | 2 +- .../Item/Task/TaskRequestBuilder.php | 20 +- ...TaskProcessingResultItemRequestBuilder.php | 20 +- .../TaskProcessingResultsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...IdentityGovernanceResumeRequestBuilder.php | 19 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 24 +- ...ubjectRequestBuilderGetQueryParameters.php | 2 +- .../Item/Task/TaskRequestBuilder.php | 20 +- ...TaskProcessingResultItemRequestBuilder.php | 20 +- .../TaskProcessingResultsRequestBuilder.php | 20 +- ...UserProcessingResultItemRequestBuilder.php | 20 +- ...tDateTimeWithEndDateTimeRequestBuilder.php | 20 +- .../UserProcessingResultsRequestBuilder.php | 20 +- ...tDateTimeWithEndDateTimeRequestBuilder.php | 20 +- .../Item/Runs/RunsRequestBuilder.php | 20 +- .../TaskReports/Count/CountRequestBuilder.php | 22 +- .../Item/Task/TaskRequestBuilder.php | 20 +- .../TaskDefinitionRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...IdentityGovernanceResumeRequestBuilder.php | 19 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 24 +- ...ubjectRequestBuilderGetQueryParameters.php | 2 +- .../Item/Task/TaskRequestBuilder.php | 20 +- ...TaskProcessingResultItemRequestBuilder.php | 20 +- .../TaskProcessingResultsRequestBuilder.php | 20 +- .../Item/TaskReportItemRequestBuilder.php | 20 +- ...tDateTimeWithEndDateTimeRequestBuilder.php | 20 +- .../TaskReports/TaskReportsRequestBuilder.php | 20 +- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- .../Tasks/Item/TaskItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...IdentityGovernanceResumeRequestBuilder.php | 19 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 24 +- ...ubjectRequestBuilderGetQueryParameters.php | 2 +- .../Item/Task/TaskRequestBuilder.php | 20 +- ...TaskProcessingResultItemRequestBuilder.php | 20 +- .../TaskProcessingResultsRequestBuilder.php | 20 +- .../Item/Tasks/TasksRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...IdentityGovernanceResumeRequestBuilder.php | 19 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 24 +- ...ubjectRequestBuilderGetQueryParameters.php | 2 +- .../Item/Task/TaskRequestBuilder.php | 20 +- ...TaskProcessingResultItemRequestBuilder.php | 20 +- .../TaskProcessingResultsRequestBuilder.php | 20 +- ...UserProcessingResultItemRequestBuilder.php | 20 +- ...tDateTimeWithEndDateTimeRequestBuilder.php | 20 +- .../UserProcessingResultsRequestBuilder.php | 20 +- .../Versions/Count/CountRequestBuilder.php | 22 +- .../CreatedBy/CreatedByRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../LastModifiedByRequestBuilder.php | 24 +- ...fiedByRequestBuilderGetQueryParameters.php | 2 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- .../Tasks/Item/TaskItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...IdentityGovernanceResumeRequestBuilder.php | 19 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Subject/SubjectRequestBuilder.php | 24 +- ...ubjectRequestBuilderGetQueryParameters.php | 2 +- .../Item/Task/TaskRequestBuilder.php | 20 +- ...TaskProcessingResultItemRequestBuilder.php | 20 +- .../TaskProcessingResultsRequestBuilder.php | 20 +- .../Item/Tasks/TasksRequestBuilder.php | 39 +-- ...VersionVersionNumberItemRequestBuilder.php | 20 +- .../Item/Versions/VersionsRequestBuilder.php | 20 +- .../Item/WorkflowItemRequestBuilder.php | 57 ++-- .../Workflows/WorkflowsRequestBuilder.php | 39 +-- .../AssignmentApprovalsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Item/ApprovalItemRequestBuilder.php | 57 ++-- .../Item/Stages/Count/CountRequestBuilder.php | 22 +- .../Item/ApprovalStageItemRequestBuilder.php | 57 ++-- .../Item/Stages/StagesRequestBuilder.php | 43 ++- ...StagesRequestBuilderGetQueryParameters.php | 2 +- ...ignmentScheduleInstancesRequestBuilder.php | 43 ++- ...tancesRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../ActivatedUsingRequestBuilder.php | 20 +- .../Item/Group/GroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- ...mentScheduleInstanceItemRequestBuilder.php | 61 ++-- ...ceItemRequestBuilderGetQueryParameters.php | 2 +- ...signmentScheduleRequestsRequestBuilder.php | 47 ++- ...questsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../ActivatedUsingRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 23 +- .../Item/Group/GroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- ...nmentScheduleRequestItemRequestBuilder.php | 61 ++-- ...stItemRequestBuilderGetQueryParameters.php | 2 +- .../TargetScheduleRequestBuilder.php | 20 +- .../AssignmentSchedulesRequestBuilder.php | 43 ++- ...edulesRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../ActivatedUsingRequestBuilder.php | 20 +- .../Item/Group/GroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- ...upAssignmentScheduleItemRequestBuilder.php | 61 ++-- ...leItemRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...ibilityScheduleInstancesRequestBuilder.php | 43 ++- ...tancesRequestBuilderGetQueryParameters.php | 2 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Item/Group/GroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- ...lityScheduleInstanceItemRequestBuilder.php | 61 ++-- ...ceItemRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...gibilityScheduleRequestsRequestBuilder.php | 47 ++- ...questsRequestBuilderGetQueryParameters.php | 2 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 23 +- .../Item/Group/GroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- ...ilityScheduleRequestItemRequestBuilder.php | 61 ++-- ...stItemRequestBuilderGetQueryParameters.php | 2 +- .../TargetScheduleRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../EligibilitySchedulesRequestBuilder.php | 43 ++- ...edulesRequestBuilderGetQueryParameters.php | 2 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Item/Group/GroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- ...pEligibilityScheduleItemRequestBuilder.php | 61 ++-- ...leItemRequestBuilderGetQueryParameters.php | 2 +- .../Group/GroupRequestBuilder.php | 57 ++-- .../PrivilegedAccessRequestBuilder.php | 57 ++-- .../AgreementAcceptancesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AgreementAcceptanceItemRequestBuilder.php | 57 ++-- .../Agreements/AgreementsRequestBuilder.php | 39 +-- .../Agreements/Count/CountRequestBuilder.php | 22 +- .../Acceptances/AcceptancesRequestBuilder.php | 39 +-- .../Acceptances/Count/CountRequestBuilder.php | 22 +- .../AgreementAcceptanceItemRequestBuilder.php | 57 ++-- .../Item/AgreementItemRequestBuilder.php | 63 ++-- ...ntItemRequestBuilderGetQueryParameters.php | 2 +- .../Item/File/FileRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...mentFileLocalizationItemRequestBuilder.php | 57 ++-- .../Versions/Count/CountRequestBuilder.php | 22 +- ...AgreementFileVersionItemRequestBuilder.php | 61 ++-- ...onItemRequestBuilderGetQueryParameters.php | 2 +- .../Item/Versions/VersionsRequestBuilder.php | 43 ++- ...rsionsRequestBuilderGetQueryParameters.php | 2 +- .../LocalizationsRequestBuilder.php | 39 +-- .../Item/Files/Count/CountRequestBuilder.php | 22 +- .../Item/Files/FilesRequestBuilder.php | 39 +-- ...mentFileLocalizationItemRequestBuilder.php | 57 ++-- .../Versions/Count/CountRequestBuilder.php | 22 +- ...AgreementFileVersionItemRequestBuilder.php | 61 ++-- ...onItemRequestBuilderGetQueryParameters.php | 2 +- .../Item/Versions/VersionsRequestBuilder.php | 43 ++- ...rsionsRequestBuilderGetQueryParameters.php | 2 +- .../TermsOfUse/TermsOfUseRequestBuilder.php | 57 ++-- .../IdentityProtectionRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/RiskDetectionItemRequestBuilder.php | 57 ++-- .../RiskDetectionsRequestBuilder.php | 39 +-- .../ConfirmCompromisedRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../Dismiss/DismissRequestBuilder.php | 19 +- .../History/Count/CountRequestBuilder.php | 22 +- .../Item/History/HistoryRequestBuilder.php | 39 +-- ...PrincipalHistoryItemItemRequestBuilder.php | 61 ++-- ...emItemRequestBuilderGetQueryParameters.php | 2 +- ...iskyServicePrincipalItemRequestBuilder.php | 57 ++-- .../RiskyServicePrincipalsRequestBuilder.php | 39 +-- .../ConfirmCompromisedRequestBuilder.php | 19 +- .../RiskyUsers/Count/CountRequestBuilder.php | 22 +- .../Dismiss/DismissRequestBuilder.php | 19 +- .../History/Count/CountRequestBuilder.php | 22 +- .../Item/History/HistoryRequestBuilder.php | 39 +-- ...RiskyUserHistoryItemItemRequestBuilder.php | 57 ++-- .../Item/RiskyUserItemRequestBuilder.php | 57 ++-- .../RiskyUsers/RiskyUsersRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...incipalRiskDetectionItemRequestBuilder.php | 57 ++-- ...ePrincipalRiskDetectionsRequestBuilder.php | 39 +-- .../AvailableProviderTypesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../IdentityProvidersRequestBuilder.php | 39 +-- .../IdentityProviderItemRequestBuilder.php | 57 ++-- .../Bitlocker/BitlockerRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...BitlockerRecoveryKeyItemRequestBuilder.php | 24 +- ...eyItemRequestBuilderGetQueryParameters.php | 2 +- .../RecoveryKeysRequestBuilder.php | 20 +- .../InformationProtectionRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Results/Count/CountRequestBuilder.php | 22 +- ...reatAssessmentResultItemRequestBuilder.php | 57 ++-- .../Item/Results/ResultsRequestBuilder.php | 39 +-- ...eatAssessmentRequestItemRequestBuilder.php | 57 ++-- ...ThreatAssessmentRequestsRequestBuilder.php | 39 +-- .../Invitations/Count/CountRequestBuilder.php | 22 +- .../Invitations/InvitationsRequestBuilder.php | 39 +-- .../Item/InvitationItemRequestBuilder.php | 57 ++-- .../InvitedUser/InvitedUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Models/AadUserConversationMember.php | 4 +- .../Models/AadUserNotificationRecipient.php | 4 +- .../Models/AccessPackageResource.php | 4 +- .../AccessPackageResourceEnvironment.php | 4 +- .../Models/AccessReviewScheduleSettings.php | 4 +- .../Models/AccessReviewStageSettings.php | 4 +- src/Generated/Models/AccountTargetContent.php | 4 +- .../AddressBookAccountTargetContent.php | 4 +- src/Generated/Models/Agreement.php | 4 +- .../Models/AgreementFileLocalization.php | 4 +- src/Generated/Models/Alert.php | 4 +- src/Generated/Models/ApiApplication.php | 4 +- src/Generated/Models/AppIdentity.php | 8 +- src/Generated/Models/Application.php | 36 +-- .../Models/AttackSimulationOperation.php | 12 +- src/Generated/Models/AttackSimulationRoot.php | 24 +- src/Generated/Models/AttackSimulationUser.php | 4 +- ...thenticationMethodFeatureConfiguration.php | 4 +- ...thodsRegistrationCampaignIncludeTarget.php | 4 +- src/Generated/Models/AuthorizationPolicy.php | 8 +- .../Models/AzureActiveDirectoryTenant.php | 8 +- ...AzureCommunicationServicesUserIdentity.php | 68 ++++ .../Models/BaseEndUserNotification.php | 4 +- src/Generated/Models/BitlockerRecoveryKey.php | 4 +- .../Models/CallRecords/ClientUserAgent.php | 4 +- .../CallRecords/DirectRoutingLogRow.php | 36 +-- .../Models/CallRecords/PstnCallLogRow.php | 24 +- src/Generated/Models/Channel.php | 26 +- src/Generated/Models/ChannelSummary.php | 202 ++++++++++++ src/Generated/Models/CoachmarkLocation.php | 12 +- .../CommunicationsApplicationIdentity.php | 90 ++++++ ...municationsApplicationInstanceIdentity.php | 90 ++++++ .../CommunicationsEncryptedIdentity.php | 46 +++ .../Models/CommunicationsGuestIdentity.php | 46 +++ .../Models/CommunicationsIdentitySet.php | 222 +++++++++++++ .../Models/CommunicationsPhoneIdentity.php | 46 +++ .../Models/CommunicationsUserIdentity.php | 68 ++++ .../Models/ConditionalAccessFilter.php | 4 +- .../ConditionalAccessSessionControls.php | 4 +- .../CrossCloudAzureActiveDirectoryTenant.php | 8 +- .../Models/CrossTenantAccessPolicy.php | 8 +- ...TenantAccessPolicyConfigurationDefault.php | 20 +- ...TenantAccessPolicyConfigurationPartner.php | 20 +- .../CrossTenantAccessPolicyInboundTrust.php | 12 +- .../CrossTenantIdentitySyncPolicyPartner.php | 8 +- .../Models/CustomCalloutExtension.php | 4 +- .../CustomExtensionCallbackConfiguration.php | 4 +- .../CustomExtensionClientConfiguration.php | 4 +- .../Models/CustomTrainingSetting.php | 20 +- .../Models/DelegatedAdminAccessContainer.php | 4 +- .../Models/DelegatedAdminCustomer.php | 8 +- .../Models/DelegatedAdminRelationship.php | 22 ++ ...edAdminRelationshipCustomerParticipant.php | 8 +- src/Generated/Models/Device.php | 4 +- .../Models/DeviceLocalCredential.php | 134 ++++++++ .../Models/DeviceLocalCredentialInfo.php | 137 ++++++++ ...eLocalCredentialInfoCollectionResponse.php | 70 +++++ src/Generated/Models/Directory.php | 24 ++ src/Generated/Models/DirectoryAudit.php | 8 +- src/Generated/Models/Domain.php | 12 +- src/Generated/Models/EducationUser.php | 4 +- src/Generated/Models/EmailPayloadDetail.php | 16 +- src/Generated/Models/EndUserNotification.php | 40 +-- .../Models/EndUserNotificationDetail.php | 20 +- .../Models/EndUserNotificationSetting.php | 12 +- .../Models/EntitlementManagement.php | 4 +- src/Generated/Models/Entity.php | 5 + src/Generated/Models/ExcludeTarget.php | 4 +- src/Generated/Models/ExtensionProperty.php | 26 +- .../Models/ExternalConnectors/Acl.php | 4 +- .../ExternalConnectors/Configuration.php | 4 +- .../ExternalConnectors/ExternalConnection.php | 22 ++ .../ExternalConnectors/ExternalGroup.php | 4 +- .../Models/ExternalConnectors/Identity.php | 4 +- .../Models/FederatedIdentityCredential.php | 20 +- src/Generated/Models/Group.php | 12 +- src/Generated/Models/GroupMembers.php | 8 +- src/Generated/Models/Identity.php | 7 + .../CustomTaskExtension.php | 8 +- .../Models/IdentityGovernance/Workflow.php | 4 +- .../IdentityGovernance/WorkflowBase.php | 4 +- .../Models/IdentityProtectionRoot.php | 16 +- ...ntitySecurityDefaultsEnforcementPolicy.php | 4 +- src/Generated/Models/IdentitySet.php | 1 + .../Models/InternalDomainFederation.php | 16 +- src/Generated/Models/LandingPage.php | 44 +-- src/Generated/Models/LandingPageDetail.php | 12 +- src/Generated/Models/LoginPage.php | 40 +-- .../Models/MicrosoftCustomTrainingSetting.php | 12 +- .../MicrosoftManagedTrainingSetting.php | 8 +- .../MicrosoftTrainingAssignmentMapping.php | 4 +- .../Models/NoTrainingNotificationSetting.php | 4 +- .../Models/OAuthConsentAppDetail.php | 12 +- src/Generated/Models/ObjectIdentity.php | 4 +- ...remisesDirectorySynchronizationFeature.php | 12 +- .../OrganizationalBrandingProperties.php | 4 +- src/Generated/Models/PasswordCredential.php | 4 +- .../Models/PasswordResetResponse.php | 4 +- src/Generated/Models/Payload.php | 84 ++--- src/Generated/Models/PayloadCoachmark.php | 24 +- src/Generated/Models/PayloadDetail.php | 12 +- .../Models/PermissionGrantConditionSet.php | 4 +- src/Generated/Models/PolicyRoot.php | 28 +- .../PositiveReinforcementNotification.php | 4 +- .../Models/ProvisioningObjectSummary.php | 8 +- .../RemoteDesktopSecurityConfiguration.php | 92 ++++++ src/Generated/Models/ReportRoot.php | 4 +- .../ResourceSpecificPermissionGrant.php | 12 +- .../Models/RiskyServicePrincipal.php | 12 +- src/Generated/Models/SamlOrWsFedProvider.php | 8 +- src/Generated/Models/SchemaExtension.php | 4 +- .../Models/SecureScoreControlProfile.php | 4 +- src/Generated/Models/Security/Alert.php | 26 +- .../Models/Security/AlertEvidence.php | 1 + .../Models/Security/DetectionSource.php | 16 + .../Models/Security/DeviceEvidence.php | 4 +- src/Generated/Models/Security/Host.php | 28 +- src/Generated/Models/Security/HostPort.php | 294 ++++++++++++++++++ .../Models/Security/HostPortBanner.php | 225 ++++++++++++++ .../Security/HostPortCollectionResponse.php | 71 +++++ .../Models/Security/HostPortComponent.php | 203 ++++++++++++ .../Models/Security/HostPortProtocol.php | 11 + .../Models/Security/HostPortStatus.php | 12 + src/Generated/Models/Security/Incident.php | 4 +- .../Security/KubernetesSecretEvidence.php | 112 +++++++ .../Models/Security/ServiceSource.php | 1 + .../Models/Security/ThreatIntelligence.php | 24 ++ src/Generated/Models/Security/UserAccount.php | 12 +- src/Generated/Models/ServicePrincipal.php | 58 ++-- src/Generated/Models/SignIn.php | 20 +- src/Generated/Models/SignInActivity.php | 8 +- src/Generated/Models/Simulation.php | 40 +-- .../Models/SimulationNotification.php | 4 +- src/Generated/Models/SingleUser.php | 8 +- ...SkypeForBusinessUserConversationMember.php | 4 +- .../Models/SmsAuthenticationMethodTarget.php | 4 +- .../Models/StringKeyLongValuePair.php | 4 +- .../Models/SynchronizationJobSubject.php | 8 +- src/Generated/Models/TargetDeviceGroup.php | 67 ++++ .../TargetDeviceGroupCollectionResponse.php | 70 +++++ src/Generated/Models/Team.php | 4 +- src/Generated/Models/TeamInfo.php | 4 +- src/Generated/Models/TenantInformation.php | 16 +- src/Generated/Models/TermsOfUseContainer.php | 4 +- src/Generated/Models/Training.php | 56 ++-- .../Models/TrainingLanguageDetail.php | 36 +-- .../Models/TrainingNotificationSetting.php | 8 +- .../Models/TrainingReminderNotification.php | 4 +- src/Generated/Models/TrainingSetting.php | 4 +- .../UnifiedRoleAssignmentScheduleInstance.php | 4 +- .../Models/UnifiedRoleDefinition.php | 8 +- .../UnifiedRoleManagementPolicyAssignment.php | 4 +- src/Generated/Models/User.php | 48 +-- ...LastSignInRecommendationInsightSetting.php | 4 +- ...icateAuthenticationMethodConfiguration.php | 4 +- .../Models/X509CertificateUserBinding.php | 8 +- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- ...Auth2PermissionGrantItemRequestBuilder.php | 57 ++-- .../Oauth2PermissionGrantsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../GetByIds/GetByIdsRequestBuilder.php | 20 +- .../BackgroundImageRequestBuilder.php | 49 +-- .../BannerLogo/BannerLogoRequestBuilder.php | 49 +-- .../Item/Branding/BrandingRequestBuilder.php | 57 ++-- .../CustomCSS/CustomCSSRequestBuilder.php | 49 +-- .../Favicon/FaviconRequestBuilder.php | 57 ++-- .../HeaderLogo/HeaderLogoRequestBuilder.php | 49 +-- .../Count/CountRequestBuilder.php | 22 +- .../BackgroundImageRequestBuilder.php | 49 +-- .../BannerLogo/BannerLogoRequestBuilder.php | 49 +-- .../CustomCSS/CustomCSSRequestBuilder.php | 49 +-- .../Item/Favicon/FaviconRequestBuilder.php | 57 ++-- .../HeaderLogo/HeaderLogoRequestBuilder.php | 49 +-- ...BrandingLocalizationItemRequestBuilder.php | 57 ++-- .../SquareLogo/SquareLogoRequestBuilder.php | 49 +-- .../SquareLogoDarkRequestBuilder.php | 49 +-- .../LocalizationsRequestBuilder.php | 39 +-- .../SquareLogo/SquareLogoRequestBuilder.php | 49 +-- .../SquareLogoDarkRequestBuilder.php | 49 +-- ...teBasedAuthConfigurationRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...sedAuthConfigurationItemRequestBuilder.php | 38 +-- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- .../Item/OrganizationItemRequestBuilder.php | 57 ++-- .../Item/Restore/RestoreRequestBuilder.php | 20 +- ...eviceManagementAuthorityRequestBuilder.php | 20 +- .../OrganizationRequestBuilder.php | 45 ++- ...zationRequestBuilderGetQueryParameters.php | 2 +- .../ValidatePropertiesRequestBuilder.php | 19 +- .../Delta/DeltaRequestBuilder.php | 20 +- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../GetByIds/GetByIdsRequestBuilder.php | 20 +- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- ...cificPermissionGrantItemRequestBuilder.php | 57 ++-- .../Item/Restore/RestoreRequestBuilder.php | 20 +- .../PermissionGrantsRequestBuilder.php | 39 +-- .../ValidatePropertiesRequestBuilder.php | 19 +- .../Places/Count/CountRequestBuilder.php | 22 +- .../GraphRoom/Count/CountRequestBuilder.php | 22 +- .../GraphRoom/GraphRoomRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphRoomListRequestBuilder.php | 20 +- .../GraphRoom/GraphRoomRequestBuilder.php | 20 +- .../GraphRoomListRequestBuilder.php | 20 +- .../Rooms/Count/CountRequestBuilder.php | 22 +- .../Rooms/Item/RoomItemRequestBuilder.php | 57 ++-- .../Rooms/RoomsRequestBuilder.php | 39 +-- .../Places/Item/PlaceItemRequestBuilder.php | 38 +-- .../Planner/Buckets/BucketsRequestBuilder.php | 39 +-- .../Buckets/Count/CountRequestBuilder.php | 22 +- .../Item/PlannerBucketItemRequestBuilder.php | 57 ++-- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- ...ssignedToTaskBoardFormatRequestBuilder.php | 57 ++-- .../BucketTaskBoardFormatRequestBuilder.php | 57 ++-- .../Item/Details/DetailsRequestBuilder.php | 57 ++-- .../Item/PlannerTaskItemRequestBuilder.php | 57 ++-- .../ProgressTaskBoardFormatRequestBuilder.php | 57 ++-- .../Item/Tasks/TasksRequestBuilder.php | 39 +-- .../Planner/PlannerRequestBuilder.php | 39 +-- .../Plans/Count/CountRequestBuilder.php | 22 +- .../Item/Buckets/BucketsRequestBuilder.php | 39 +-- .../Buckets/Count/CountRequestBuilder.php | 22 +- .../Item/PlannerBucketItemRequestBuilder.php | 57 ++-- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- ...ssignedToTaskBoardFormatRequestBuilder.php | 57 ++-- .../BucketTaskBoardFormatRequestBuilder.php | 57 ++-- .../Item/Details/DetailsRequestBuilder.php | 57 ++-- .../Item/PlannerTaskItemRequestBuilder.php | 57 ++-- .../ProgressTaskBoardFormatRequestBuilder.php | 57 ++-- .../Item/Tasks/TasksRequestBuilder.php | 39 +-- .../Item/Details/DetailsRequestBuilder.php | 57 ++-- .../Item/PlannerPlanItemRequestBuilder.php | 57 ++-- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- ...ssignedToTaskBoardFormatRequestBuilder.php | 57 ++-- .../BucketTaskBoardFormatRequestBuilder.php | 57 ++-- .../Item/Details/DetailsRequestBuilder.php | 57 ++-- .../Item/PlannerTaskItemRequestBuilder.php | 57 ++-- .../ProgressTaskBoardFormatRequestBuilder.php | 57 ++-- .../Plans/Item/Tasks/TasksRequestBuilder.php | 39 +-- .../Planner/Plans/PlansRequestBuilder.php | 39 +-- .../Tasks/Count/CountRequestBuilder.php | 22 +- ...ssignedToTaskBoardFormatRequestBuilder.php | 57 ++-- .../BucketTaskBoardFormatRequestBuilder.php | 57 ++-- .../Item/Details/DetailsRequestBuilder.php | 57 ++-- .../Item/PlannerTaskItemRequestBuilder.php | 57 ++-- .../ProgressTaskBoardFormatRequestBuilder.php | 57 ++-- .../Planner/Tasks/TasksRequestBuilder.php | 39 +-- ...vityBasedTimeoutPoliciesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...tyBasedTimeoutPolicyItemRequestBuilder.php | 57 ++-- .../AppliesTo/AppliesToRequestBuilder.php | 20 +- .../AppliesTo/Count/CountRequestBuilder.php | 22 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- ...dminConsentRequestPolicyRequestBuilder.php | 57 ++-- .../AppManagementPoliciesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AppManagementPolicyItemRequestBuilder.php | 57 ++-- .../AppliesTo/AppliesToRequestBuilder.php | 20 +- .../AppliesTo/Count/CountRequestBuilder.php | 22 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- ...uthenticationFlowsPolicyRequestBuilder.php | 57 ++-- ...tionMethodConfigurationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...nMethodConfigurationItemRequestBuilder.php | 57 ++-- ...henticationMethodsPolicyRequestBuilder.php | 57 ++-- ...ticationStrengthPoliciesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...cationStrengthPolicyItemRequestBuilder.php | 57 ++-- ...ombinationConfigurationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...inationConfigurationItemRequestBuilder.php | 57 ++-- ...pdateAllowedCombinationsRequestBuilder.php | 20 +- .../Item/Usage/UsageRequestBuilder.php | 20 +- .../AuthorizationPolicyRequestBuilder.php | 57 ++-- .../ClaimsMappingPoliciesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AppliesTo/AppliesToRequestBuilder.php | 20 +- .../AppliesTo/Count/CountRequestBuilder.php | 22 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../ClaimsMappingPolicyItemRequestBuilder.php | 57 ++-- ...onditionalAccessPoliciesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ditionalAccessPolicyItemRequestBuilder.php | 57 ++-- .../CrossTenantAccessPolicyRequestBuilder.php | 57 ++-- .../EscapedDefault/DefaultRequestBuilder.php | 61 ++-- ...efaultRequestBuilderGetQueryParameters.php | 2 +- .../ResetToSystemDefaultRequestBuilder.php | 19 +- .../Partners/Count/CountRequestBuilder.php | 22 +- ...urationPartnerTenantItemRequestBuilder.php | 57 ++-- .../IdentitySynchronizationRequestBuilder.php | 57 ++-- .../Partners/PartnersRequestBuilder.php | 39 +-- ...faultAppManagementPolicyRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../FeatureRolloutPoliciesRequestBuilder.php | 39 +-- .../AppliesTo/AppliesToRequestBuilder.php | 39 +-- .../AppliesTo/Count/CountRequestBuilder.php | 22 +- .../AppliesTo/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/AppliesTo/Ref/RefRequestBuilder.php | 38 +-- ...FeatureRolloutPolicyItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...meRealmDiscoveryPoliciesRequestBuilder.php | 39 +-- .../AppliesTo/AppliesToRequestBuilder.php | 20 +- .../AppliesTo/Count/CountRequestBuilder.php | 22 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- ...RealmDiscoveryPolicyItemRequestBuilder.php | 57 ++-- ...efaultsEnforcementPolicyRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Excludes/Count/CountRequestBuilder.php | 22 +- .../Item/Excludes/ExcludesRequestBuilder.php | 39 +-- ...ionGrantConditionSetItemRequestBuilder.php | 57 ++-- .../Includes/Count/CountRequestBuilder.php | 22 +- .../Item/Includes/IncludesRequestBuilder.php | 39 +-- ...ionGrantConditionSetItemRequestBuilder.php | 57 ++-- ...ermissionGrantPolicyItemRequestBuilder.php | 57 ++-- .../PermissionGrantPoliciesRequestBuilder.php | 39 +-- .../Policies/PoliciesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../EffectiveRulesRequestBuilder.php | 39 +-- ...ManagementPolicyRuleItemRequestBuilder.php | 57 ++-- .../Item/Rules/Count/CountRequestBuilder.php | 22 +- ...ManagementPolicyRuleItemRequestBuilder.php | 61 ++-- .../Item/Rules/RulesRequestBuilder.php | 39 +-- ...RoleManagementPolicyItemRequestBuilder.php | 57 ++-- .../RoleManagementPoliciesRequestBuilder.php | 43 ++- ...liciesRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/Policy/PolicyRequestBuilder.php | 20 +- ...mentPolicyAssignmentItemRequestBuilder.php | 61 ++-- ...ntItemRequestBuilderGetQueryParameters.php | 2 +- ...agementPolicyAssignmentsRequestBuilder.php | 43 ++- ...nmentsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../AppliesTo/AppliesToRequestBuilder.php | 20 +- .../AppliesTo/Count/CountRequestBuilder.php | 22 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../TokenIssuancePolicyItemRequestBuilder.php | 61 ++-- ...cyItemRequestBuilderGetQueryParameters.php | 2 +- .../TokenIssuancePoliciesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AppliesTo/AppliesToRequestBuilder.php | 20 +- .../AppliesTo/Count/CountRequestBuilder.php | 22 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../TokenLifetimePolicyItemRequestBuilder.php | 57 ++-- .../TokenLifetimePoliciesRequestBuilder.php | 39 +-- .../Privacy/PrivacyRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Approvers/ApproversRequestBuilder.php | 20 +- .../Approvers/Count/CountRequestBuilder.php | 22 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Approvers/Item/UserItemRequestBuilder.php | 20 +- .../CollaboratorsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/UserItemRequestBuilder.php | 20 +- .../GetFinalAttachmentRequestBuilder.php | 21 +- .../GetFinalReportRequestBuilder.php | 21 +- .../Item/Notes/Count/CountRequestBuilder.php | 22 +- .../Item/AuthoredNoteItemRequestBuilder.php | 57 ++-- .../Item/Notes/NotesRequestBuilder.php | 39 +-- ...SubjectRightsRequestItemRequestBuilder.php | 57 ++-- .../Item/Team/TeamRequestBuilder.php | 20 +- .../SubjectRightsRequestsRequestBuilder.php | 39 +-- .../AuthenticationMethodsRequestBuilder.php | 61 ++-- ...ethodsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...rRegistrationDetailsItemRequestBuilder.php | 57 ++-- .../UserRegistrationDetailsRequestBuilder.php | 39 +-- ...UsersRegisteredByFeatureRequestBuilder.php | 20 +- ...pesWithIncludedUserRolesRequestBuilder.php | 20 +- .../UsersRegisteredByMethodRequestBuilder.php | 20 +- ...pesWithIncludedUserRolesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...DailyPrintUsageByPrinterRequestBuilder.php | 39 +-- .../PrintUsageByPrinterItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../DailyPrintUsageByUserRequestBuilder.php | 39 +-- .../PrintUsageByUserItemRequestBuilder.php | 57 ++-- ...figurationDeviceActivityRequestBuilder.php | 20 +- ...onfigurationUserActivityRequestBuilder.php | 20 +- ...ActivityCountsWithPeriodRequestBuilder.php | 21 +- ...vityUserCountsWithPeriodRequestBuilder.php | 21 +- ...tivityUserDetailWithDateRequestBuilder.php | 21 +- ...vityUserDetailWithPeriodRequestBuilder.php | 21 +- ...AppsUserCountsWithPeriodRequestBuilder.php | 21 +- ...sageUserCountsWithPeriodRequestBuilder.php | 21 +- ...pUsageUserDetailWithDateRequestBuilder.php | 21 +- ...sageUserDetailWithPeriodRequestBuilder.php | 21 +- ...ionsUserCountsWithPeriodRequestBuilder.php | 21 +- ...tDateTimeWithEndDateTimeRequestBuilder.php | 20 +- ...formUserCountsWithPeriodRequestBuilder.php | 21 +- ...5AppUserCountsWithPeriodRequestBuilder.php | 21 +- ...365AppUserDetailWithDateRequestBuilder.php | 21 +- ...5AppUserDetailWithPeriodRequestBuilder.php | 21 +- ...boxUsageDetailWithPeriodRequestBuilder.php | 21 +- ...eMailboxCountsWithPeriodRequestBuilder.php | 21 +- ...sMailboxCountsWithPeriodRequestBuilder.php | 21 +- ...oxUsageStorageWithPeriodRequestBuilder.php | 21 +- ...ffice365ActivationCountsRequestBuilder.php | 21 +- ...365ActivationsUserCountsRequestBuilder.php | 21 +- ...365ActivationsUserDetailRequestBuilder.php | 21 +- ...tiveUserCountsWithPeriodRequestBuilder.php | 21 +- ...ActiveUserDetailWithDateRequestBuilder.php | 21 +- ...tiveUserDetailWithPeriodRequestBuilder.php | 21 +- ...ActivityCountsWithPeriodRequestBuilder.php | 21 +- ...psActivityDetailWithDateRequestBuilder.php | 21 +- ...ActivityDetailWithPeriodRequestBuilder.php | 21 +- ...vityFileCountsWithPeriodRequestBuilder.php | 21 +- ...ityGroupCountsWithPeriodRequestBuilder.php | 21 +- ...ctivityStorageWithPeriodRequestBuilder.php | 21 +- ...icesUserCountsWithPeriodRequestBuilder.php | 21 +- ...vityFileCountsWithPeriodRequestBuilder.php | 21 +- ...vityUserCountsWithPeriodRequestBuilder.php | 21 +- ...tivityUserDetailWithDateRequestBuilder.php | 21 +- ...vityUserDetailWithPeriodRequestBuilder.php | 21 +- ...eAccountCountsWithPeriodRequestBuilder.php | 21 +- ...ageAccountDetailWithDateRequestBuilder.php | 21 +- ...eAccountDetailWithPeriodRequestBuilder.php | 21 +- ...sageFileCountsWithPeriodRequestBuilder.php | 21 +- ...veUsageStorageWithPeriodRequestBuilder.php | 21 +- ...tDateTimeWithEndDateTimeRequestBuilder.php | 20 +- ...vityFileCountsWithPeriodRequestBuilder.php | 21 +- ...tActivityPagesWithPeriodRequestBuilder.php | 21 +- ...vityUserCountsWithPeriodRequestBuilder.php | 21 +- ...tivityUserDetailWithDateRequestBuilder.php | 21 +- ...vityUserDetailWithPeriodRequestBuilder.php | 21 +- ...tSiteUsageDetailWithDateRequestBuilder.php | 21 +- ...iteUsageDetailWithPeriodRequestBuilder.php | 21 +- ...sageFileCountsWithPeriodRequestBuilder.php | 21 +- ...SiteUsagePagesWithPeriodRequestBuilder.php | 21 +- ...sageSiteCountsWithPeriodRequestBuilder.php | 21 +- ...teUsageStorageWithPeriodRequestBuilder.php | 21 +- ...ActivityCountsWithPeriodRequestBuilder.php | 21 +- ...vityUserCountsWithPeriodRequestBuilder.php | 21 +- ...tivityUserDetailWithDateRequestBuilder.php | 21 +- ...vityUserDetailWithPeriodRequestBuilder.php | 21 +- ...tionUserCountsWithPeriodRequestBuilder.php | 21 +- ...sageUserCountsWithPeriodRequestBuilder.php | 21 +- ...eUsageUserDetailWithDateRequestBuilder.php | 21 +- ...sageUserDetailWithPeriodRequestBuilder.php | 21 +- ...ActivityCountsWithPeriodRequestBuilder.php | 21 +- ...tyMinuteCountsWithPeriodRequestBuilder.php | 21 +- ...vityUserCountsWithPeriodRequestBuilder.php | 21 +- ...ActivityCountsWithPeriodRequestBuilder.php | 21 +- ...tyMinuteCountsWithPeriodRequestBuilder.php | 21 +- ...vityUserCountsWithPeriodRequestBuilder.php | 21 +- ...ActivityCountsWithPeriodRequestBuilder.php | 21 +- ...tyMinuteCountsWithPeriodRequestBuilder.php | 21 +- ...vityUserCountsWithPeriodRequestBuilder.php | 21 +- ...tionUserCountsWithPeriodRequestBuilder.php | 21 +- ...sageUserCountsWithPeriodRequestBuilder.php | 21 +- ...eUsageUserDetailWithDateRequestBuilder.php | 21 +- ...sageUserDetailWithPeriodRequestBuilder.php | 21 +- ...ActivityCountsWithPeriodRequestBuilder.php | 21 +- ...amActivityDetailWithDateRequestBuilder.php | 21 +- ...ActivityDetailWithPeriodRequestBuilder.php | 21 +- ...ributionCountsWithPeriodRequestBuilder.php | 21 +- ...eamsTeamCountsWithPeriodRequestBuilder.php | 21 +- ...ActivityCountsWithPeriodRequestBuilder.php | 21 +- ...vityUserCountsWithPeriodRequestBuilder.php | 21 +- ...tivityUserDetailWithDateRequestBuilder.php | 21 +- ...vityUserDetailWithPeriodRequestBuilder.php | 21 +- ...tDateTimeWithEndDateTimeRequestBuilder.php | 20 +- ...ActivityCountsWithPeriodRequestBuilder.php | 21 +- ...vityUserCountsWithPeriodRequestBuilder.php | 21 +- ...tivityUserDetailWithDateRequestBuilder.php | 21 +- ...vityUserDetailWithPeriodRequestBuilder.php | 21 +- ...tionUserCountsWithPeriodRequestBuilder.php | 21 +- ...sageUserCountsWithPeriodRequestBuilder.php | 21 +- ...eUsageUserDetailWithDateRequestBuilder.php | 21 +- ...sageUserDetailWithPeriodRequestBuilder.php | 21 +- ...ActivityCountsWithPeriodRequestBuilder.php | 21 +- ...psActivityDetailWithDateRequestBuilder.php | 21 +- ...ActivityDetailWithPeriodRequestBuilder.php | 21 +- ...ityGroupCountsWithPeriodRequestBuilder.php | 21 +- ...EnrollmentFailureDetailsRequestBuilder.php | 20 +- ...pWithFilterWithSkipTokenRequestBuilder.php | 20 +- ...iceEnrollmentTopFailuresRequestBuilder.php | 20 +- ...entTopFailuresWithPeriodRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../PrintUsageByPrinterItemRequestBuilder.php | 57 ++-- ...nthlyPrintUsageByPrinterRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../PrintUsageByUserItemRequestBuilder.php | 57 ++-- .../MonthlyPrintUsageByUserRequestBuilder.php | 39 +-- .../Reports/ReportsRequestBuilder.php | 39 +-- ...imulationRepeatOffendersRequestBuilder.php | 20 +- ...onSimulationUserCoverageRequestBuilder.php | 20 +- ...tionTrainingUserCoverageRequestBuilder.php | 20 +- .../Security/SecurityRequestBuilder.php | 57 ++-- .../Directory/DirectoryRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- ...edRbacResourceActionItemRequestBuilder.php | 57 ++-- .../ResourceActionsRequestBuilder.php | 39 +-- ...bacResourceNamespaceItemRequestBuilder.php | 57 ++-- .../ResourceNamespacesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../ActivatedUsingRequestBuilder.php | 20 +- .../Item/AppScope/AppScopeRequestBuilder.php | 20 +- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- ...mentScheduleInstanceItemRequestBuilder.php | 57 ++-- ...ignmentScheduleInstancesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../ActivatedUsingRequestBuilder.php | 20 +- .../Item/AppScope/AppScopeRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- .../TargetScheduleRequestBuilder.php | 20 +- ...nmentScheduleRequestItemRequestBuilder.php | 57 ++-- ...signmentScheduleRequestsRequestBuilder.php | 43 ++- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../ActivatedUsingRequestBuilder.php | 20 +- .../Item/AppScope/AppScopeRequestBuilder.php | 20 +- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- ...leAssignmentScheduleItemRequestBuilder.php | 57 ++-- .../RoleAssignmentSchedulesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/AppScope/AppScopeRequestBuilder.php | 57 ++-- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- ...nifiedRoleAssignmentItemRequestBuilder.php | 57 ++-- .../RoleAssignmentsRequestBuilder.php | 43 ++- ...nmentsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../InheritsPermissionsFromRequestBuilder.php | 43 ++- ...nsFromRequestBuilderGetQueryParameters.php | 2 +- ...nifiedRoleDefinitionItemRequestBuilder.php | 61 ++-- ...onItemRequestBuilderGetQueryParameters.php | 2 +- ...nifiedRoleDefinitionItemRequestBuilder.php | 65 ++-- .../RoleDefinitionsRequestBuilder.php | 47 ++- ...itionsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Item/AppScope/AppScopeRequestBuilder.php | 20 +- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- ...lityScheduleInstanceItemRequestBuilder.php | 57 ++-- ...ibilityScheduleInstancesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Item/AppScope/AppScopeRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- .../TargetScheduleRequestBuilder.php | 20 +- ...ilityScheduleRequestItemRequestBuilder.php | 57 ++-- ...gibilityScheduleRequestsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Item/AppScope/AppScopeRequestBuilder.php | 20 +- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- ...eEligibilityScheduleItemRequestBuilder.php | 57 ++-- ...RoleEligibilitySchedulesRequestBuilder.php | 39 +-- .../EntitlementManagementRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- ...edRbacResourceActionItemRequestBuilder.php | 57 ++-- .../ResourceActionsRequestBuilder.php | 39 +-- ...bacResourceNamespaceItemRequestBuilder.php | 57 ++-- .../ResourceNamespacesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../ActivatedUsingRequestBuilder.php | 20 +- .../Item/AppScope/AppScopeRequestBuilder.php | 20 +- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- ...mentScheduleInstanceItemRequestBuilder.php | 57 ++-- ...ignmentScheduleInstancesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../ActivatedUsingRequestBuilder.php | 20 +- .../Item/AppScope/AppScopeRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- .../TargetScheduleRequestBuilder.php | 20 +- ...nmentScheduleRequestItemRequestBuilder.php | 57 ++-- ...signmentScheduleRequestsRequestBuilder.php | 43 ++- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../ActivatedUsingRequestBuilder.php | 20 +- .../Item/AppScope/AppScopeRequestBuilder.php | 20 +- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- ...leAssignmentScheduleItemRequestBuilder.php | 57 ++-- .../RoleAssignmentSchedulesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/AppScope/AppScopeRequestBuilder.php | 57 ++-- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- ...nifiedRoleAssignmentItemRequestBuilder.php | 57 ++-- .../RoleAssignmentsRequestBuilder.php | 43 ++- ...nmentsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../InheritsPermissionsFromRequestBuilder.php | 43 ++- ...nsFromRequestBuilderGetQueryParameters.php | 2 +- ...nifiedRoleDefinitionItemRequestBuilder.php | 61 ++-- ...onItemRequestBuilderGetQueryParameters.php | 2 +- ...nifiedRoleDefinitionItemRequestBuilder.php | 65 ++-- .../RoleDefinitionsRequestBuilder.php | 47 ++- ...itionsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Item/AppScope/AppScopeRequestBuilder.php | 20 +- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- ...lityScheduleInstanceItemRequestBuilder.php | 57 ++-- ...ibilityScheduleInstancesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Item/AppScope/AppScopeRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- .../TargetScheduleRequestBuilder.php | 20 +- ...ilityScheduleRequestItemRequestBuilder.php | 57 ++-- ...gibilityScheduleRequestsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ilterByCurrentUserWithOnRequestBuilder.php | 20 +- .../Item/AppScope/AppScopeRequestBuilder.php | 20 +- .../DirectoryScopeRequestBuilder.php | 20 +- .../Principal/PrincipalRequestBuilder.php | 20 +- .../RoleDefinitionRequestBuilder.php | 20 +- ...eEligibilityScheduleItemRequestBuilder.php | 57 ++-- ...RoleEligibilitySchedulesRequestBuilder.php | 39 +-- .../RoleManagementRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../SchemaExtensionItemRequestBuilder.php | 57 ++-- .../SchemaExtensionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ScopedRoleMembershipItemRequestBuilder.php | 57 ++-- .../ScopedRoleMembershipsRequestBuilder.php | 39 +-- .../Search/Query/QueryRequestBuilder.php | 20 +- src/Generated/Search/SearchRequestBuilder.php | 39 +-- .../Security/Alerts/AlertsRequestBuilder.php | 39 +-- .../Alerts/Count/CountRequestBuilder.php | 22 +- .../Alerts/Item/AlertItemRequestBuilder.php | 39 +-- .../Alerts_v2/Alerts_v2RequestBuilder.php | 39 +-- .../Alerts_v2/Count/CountRequestBuilder.php | 22 +- .../Item/AlertItemRequestBuilder.php | 57 ++-- .../Item/Comments/CommentsRequestBuilder.php | 20 +- .../Comments/Count/CountRequestBuilder.php | 22 +- .../AttackSimulationRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../EndUserNotificationsRequestBuilder.php | 44 ++- ...ationsRequestBuilderGetQueryParameters.php | 2 +- .../Details/Count/CountRequestBuilder.php | 22 +- .../Item/Details/DetailsRequestBuilder.php | 39 +-- ...erNotificationDetailItemRequestBuilder.php | 57 ++-- .../EndUserNotificationItemRequestBuilder.php | 61 ++-- ...onItemRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../Details/Count/CountRequestBuilder.php | 22 +- .../Item/Details/DetailsRequestBuilder.php | 43 ++- ...etailsRequestBuilderGetQueryParameters.php | 2 +- .../LandingPageDetailItemRequestBuilder.php | 61 ++-- ...ilItemRequestBuilderGetQueryParameters.php | 2 +- .../Item/LandingPageItemRequestBuilder.php | 61 ++-- ...geItemRequestBuilderGetQueryParameters.php | 2 +- .../LandingPagesRequestBuilder.php | 44 ++- ...gPagesRequestBuilderGetQueryParameters.php | 2 +- .../LoginPages/Count/CountRequestBuilder.php | 22 +- .../Item/LoginPageItemRequestBuilder.php | 61 ++-- ...geItemRequestBuilderGetQueryParameters.php | 2 +- .../LoginPages/LoginPagesRequestBuilder.php | 44 ++- ...nPagesRequestBuilderGetQueryParameters.php | 2 +- .../Operations/Count/CountRequestBuilder.php | 22 +- ...kSimulationOperationItemRequestBuilder.php | 62 ++-- ...onItemRequestBuilderGetQueryParameters.php | 2 +- .../Operations/OperationsRequestBuilder.php | 43 ++- ...ationsRequestBuilderGetQueryParameters.php | 2 +- .../Payloads/Count/CountRequestBuilder.php | 22 +- .../Item/PayloadItemRequestBuilder.php | 61 ++-- ...adItemRequestBuilderGetQueryParameters.php | 2 +- .../Payloads/PayloadsRequestBuilder.php | 44 ++- ...yloadsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/Runs/Count/CountRequestBuilder.php | 22 +- ...ulationAutomationRunItemRequestBuilder.php | 57 ++-- .../Item/Runs/RunsRequestBuilder.php | 39 +-- ...SimulationAutomationItemRequestBuilder.php | 57 ++-- .../SimulationAutomationsRequestBuilder.php | 39 +-- .../Simulations/Count/CountRequestBuilder.php | 22 +- .../LandingPage/LandingPageRequestBuilder.php | 24 +- ...ngPageRequestBuilderGetQueryParameters.php | 2 +- .../LoginPage/LoginPageRequestBuilder.php | 24 +- ...inPageRequestBuilderGetQueryParameters.php | 2 +- .../Item/Payload/PayloadRequestBuilder.php | 24 +- ...ayloadRequestBuilderGetQueryParameters.php | 2 +- .../Item/SimulationItemRequestBuilder.php | 67 ++-- .../Simulations/SimulationsRequestBuilder.php | 44 ++- .../Trainings/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- ...ainingLanguageDetailItemRequestBuilder.php | 61 ++-- ...ilItemRequestBuilderGetQueryParameters.php | 2 +- .../LanguageDetailsRequestBuilder.php | 43 ++- ...etailsRequestBuilderGetQueryParameters.php | 2 +- .../Item/TrainingItemRequestBuilder.php | 61 ++-- ...ngItemRequestBuilderGetQueryParameters.php | 2 +- .../Trainings/TrainingsRequestBuilder.php | 44 ++- ...iningsRequestBuilderGetQueryParameters.php | 2 +- .../Security/Cases/CasesRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../EdiscoveryCasesRequestBuilder.php | 39 +-- .../Custodians/Count/CountRequestBuilder.php | 22 +- .../Custodians/CustodiansRequestBuilder.php | 39 +-- .../EdiscoveryCustodianItemRequestBuilder.php | 57 ++-- .../LastIndexOperationRequestBuilder.php | 20 +- ...oftGraphSecurityActivateRequestBuilder.php | 19 +- ...ftGraphSecurityApplyHoldRequestBuilder.php | 19 +- ...softGraphSecurityReleaseRequestBuilder.php | 19 +- ...tGraphSecurityRemoveHoldRequestBuilder.php | 19 +- ...GraphSecurityUpdateIndexRequestBuilder.php | 19 +- .../SiteSources/Count/CountRequestBuilder.php | 22 +- .../Item/Site/SiteRequestBuilder.php | 20 +- .../Item/SiteSourceItemRequestBuilder.php | 57 ++-- .../SiteSources/SiteSourcesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/Group/GroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../UnifiedGroupSourceItemRequestBuilder.php | 57 ++-- .../UnifiedGroupSourcesRequestBuilder.php | 39 +-- .../UserSources/Count/CountRequestBuilder.php | 22 +- .../Item/UserSourceItemRequestBuilder.php | 57 ++-- .../UserSources/UserSourcesRequestBuilder.php | 39 +-- ...ftGraphSecurityApplyHoldRequestBuilder.php | 19 +- ...tGraphSecurityRemoveHoldRequestBuilder.php | 19 +- .../Item/EdiscoveryCaseItemRequestBuilder.php | 57 ++-- ...rosoftGraphSecurityCloseRequestBuilder.php | 19 +- ...osoftGraphSecurityReopenRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../DataSource/DataSourceRequestBuilder.php | 57 ++-- ...ncustodialDataSourceItemRequestBuilder.php | 57 ++-- .../LastIndexOperationRequestBuilder.php | 20 +- ...ftGraphSecurityApplyHoldRequestBuilder.php | 19 +- ...softGraphSecurityReleaseRequestBuilder.php | 19 +- ...tGraphSecurityRemoveHoldRequestBuilder.php | 19 +- ...GraphSecurityUpdateIndexRequestBuilder.php | 19 +- ...ftGraphSecurityApplyHoldRequestBuilder.php | 19 +- ...tGraphSecurityRemoveHoldRequestBuilder.php | 19 +- .../NoncustodialDataSourcesRequestBuilder.php | 39 +-- .../Operations/Count/CountRequestBuilder.php | 22 +- .../Item/CaseOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../ReviewSets/Count/CountRequestBuilder.php | 22 +- .../EdiscoveryReviewSetItemRequestBuilder.php | 57 ++-- ...phSecurityAddToReviewSetRequestBuilder.php | 19 +- ...osoftGraphSecurityExportRequestBuilder.php | 19 +- .../Queries/Count/CountRequestBuilder.php | 22 +- ...coveryReviewSetQueryItemRequestBuilder.php | 57 ++-- ...ftGraphSecurityApplyTagsRequestBuilder.php | 19 +- ...osoftGraphSecurityExportRequestBuilder.php | 19 +- .../Item/Queries/QueriesRequestBuilder.php | 39 +-- .../ReviewSets/ReviewSetsRequestBuilder.php | 39 +-- .../Searches/Count/CountRequestBuilder.php | 22 +- .../AddToReviewSetOperationRequestBuilder.php | 20 +- .../AdditionalSourcesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/DataSourceItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../CustodianSourcesRequestBuilder.php | 20 +- .../Item/DataSourceItemRequestBuilder.php | 38 +-- .../EdiscoverySearchItemRequestBuilder.php | 57 ++-- ...imateStatisticsOperationRequestBuilder.php | 20 +- ...curityEstimateStatisticsRequestBuilder.php | 19 +- ...ftGraphSecurityPurgeDataRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- ...ncustodialDataSourceItemRequestBuilder.php | 38 +-- .../NoncustodialSourcesRequestBuilder.php | 20 +- .../Item/Searches/SearchesRequestBuilder.php | 39 +-- ...phSecurityResetToDefaultRequestBuilder.php | 19 +- .../Item/Settings/SettingsRequestBuilder.php | 57 ++-- .../Item/Tags/Count/CountRequestBuilder.php | 22 +- .../ChildTags/ChildTagsRequestBuilder.php | 20 +- .../ChildTags/Count/CountRequestBuilder.php | 22 +- .../EdiscoveryReviewTagItemRequestBuilder.php | 20 +- .../EdiscoveryReviewTagItemRequestBuilder.php | 57 ++-- .../Tags/Item/Parent/ParentRequestBuilder.php | 20 +- ...GraphSecurityAsHierarchyRequestBuilder.php | 20 +- .../Item/Tags/TagsRequestBuilder.php | 39 +-- .../Incidents/Count/CountRequestBuilder.php | 22 +- .../Incidents/IncidentsRequestBuilder.php | 39 +-- .../Item/Alerts/AlertsRequestBuilder.php | 20 +- .../Item/Alerts/Count/CountRequestBuilder.php | 22 +- .../Alerts/Item/AlertItemRequestBuilder.php | 20 +- .../Item/Comments/CommentsRequestBuilder.php | 20 +- .../Comments/Count/CountRequestBuilder.php | 22 +- .../Item/IncidentItemRequestBuilder.php | 57 ++-- ...hSecurityRunHuntingQueryRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...eScoreControlProfileItemRequestBuilder.php | 57 ++-- ...cureScoreControlProfilesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/SecureScoreItemRequestBuilder.php | 57 ++-- .../SecureScoresRequestBuilder.php | 39 +-- .../Security/SecurityRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Approvers/ApproversRequestBuilder.php | 20 +- .../Approvers/Count/CountRequestBuilder.php | 22 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Approvers/Item/UserItemRequestBuilder.php | 20 +- .../CollaboratorsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/UserItemRequestBuilder.php | 20 +- .../GetFinalAttachmentRequestBuilder.php | 21 +- .../GetFinalReportRequestBuilder.php | 21 +- .../Item/Notes/Count/CountRequestBuilder.php | 22 +- .../Item/AuthoredNoteItemRequestBuilder.php | 57 ++-- .../Item/Notes/NotesRequestBuilder.php | 39 +-- ...SubjectRightsRequestItemRequestBuilder.php | 57 ++-- .../Item/Team/TeamRequestBuilder.php | 20 +- .../SubjectRightsRequestsRequestBuilder.php | 39 +-- .../ArticleIndicatorsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ArticleIndicatorItemRequestBuilder.php | 57 ++-- .../Item/Artifact/ArtifactRequestBuilder.php | 20 +- .../Articles/ArticlesRequestBuilder.php | 39 +-- .../Articles/Count/CountRequestBuilder.php | 22 +- .../Item/ArticleItemRequestBuilder.php | 57 ++-- .../Indicators/Count/CountRequestBuilder.php | 22 +- .../Indicators/IndicatorsRequestBuilder.php | 20 +- .../ArticleIndicatorItemRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../HostComponentsRequestBuilder.php | 39 +-- .../Item/Host/HostRequestBuilder.php | 20 +- .../Item/HostComponentItemRequestBuilder.php | 57 ++-- .../HostCookies/Count/CountRequestBuilder.php | 22 +- .../HostCookies/HostCookiesRequestBuilder.php | 39 +-- .../Item/Host/HostRequestBuilder.php | 20 +- .../Item/HostCookieItemRequestBuilder.php | 57 ++-- .../HostPairs/Count/CountRequestBuilder.php | 22 +- .../HostPairs/HostPairsRequestBuilder.php | 39 +-- .../ChildHost/ChildHostRequestBuilder.php | 20 +- .../Item/HostPairItemRequestBuilder.php | 57 ++-- .../ParentHost/ParentHostRequestBuilder.php | 20 +- .../HostPorts}/Count/CountRequestBuilder.php | 26 +- .../CountRequestBuilderGetQueryParameters.php | 12 +- ...tRequestBuilderGetRequestConfiguration.php | 7 +- .../HostPorts/HostPortsRequestBuilder.php | 135 ++++++++ ...tPortsRequestBuilderGetQueryParameters.php | 82 +++++ ...sRequestBuilderGetRequestConfiguration.php | 45 +++ ...RequestBuilderPostRequestConfiguration.php | 22 ++ .../Item/Host/HostRequestBuilder.php | 78 +++++ .../HostRequestBuilderGetQueryParameters.php | 34 ++ ...tRequestBuilderGetRequestConfiguration.php | 39 +++ .../Item/HostPortItemRequestBuilder.php | 164 ++++++++++ ...questBuilderDeleteRequestConfiguration.php | 22 ++ ...rtItemRequestBuilderGetQueryParameters.php | 34 ++ ...mRequestBuilderGetRequestConfiguration.php | 39 +++ ...equestBuilderPatchRequestConfiguration.php | 22 ++ ...MostRecentSslCertificateRequestBuilder.php | 78 +++++ ...ficateRequestBuilderGetQueryParameters.php | 34 ++ ...eRequestBuilderGetRequestConfiguration.php | 39 +++ .../Count/CountRequestBuilder.php | 22 +- .../HostSslCertificatesRequestBuilder.php | 39 +-- .../Item/Host/HostRequestBuilder.php | 20 +- .../HostSslCertificateItemRequestBuilder.php | 57 ++-- .../SslCertificateRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../HostTrackersRequestBuilder.php | 39 +-- .../Item/Host/HostRequestBuilder.php | 20 +- .../Item/HostTrackerItemRequestBuilder.php | 57 ++-- .../Hosts/Count/CountRequestBuilder.php | 22 +- .../Hosts/HostsRequestBuilder.php | 39 +-- .../ChildHostPairsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/HostPairItemRequestBuilder.php | 24 +- ...irItemRequestBuilderGetQueryParameters.php | 2 +- .../Components/ComponentsRequestBuilder.php | 20 +- .../Components/Count/CountRequestBuilder.php | 22 +- .../Item/HostComponentItemRequestBuilder.php | 20 +- .../Item/Cookies/CookiesRequestBuilder.php | 20 +- .../Cookies/Count/CountRequestBuilder.php | 22 +- .../Item/HostCookieItemRequestBuilder.php | 20 +- .../Hosts/Item/HostItemRequestBuilder.php | 65 ++-- .../HostPairs/Count/CountRequestBuilder.php | 22 +- .../HostPairs/HostPairsRequestBuilder.php | 20 +- .../Item/HostPairItemRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/HostPairItemRequestBuilder.php | 20 +- .../ParentHostPairsRequestBuilder.php | 20 +- .../PassiveDns/Count/CountRequestBuilder.php | 22 +- .../PassiveDnsRecordItemRequestBuilder.php | 20 +- .../PassiveDns/PassiveDnsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../PassiveDnsRecordItemRequestBuilder.php | 20 +- .../PassiveDnsReverseRequestBuilder.php | 20 +- .../Item/Ports/Count/CountRequestBuilder.php | 79 +++++ .../CountRequestBuilderGetQueryParameters.php | 34 ++ ...tRequestBuilderGetRequestConfiguration.php | 39 +++ .../Ports/Item/HostPortItemRequestBuilder.php | 78 +++++ ...rtItemRequestBuilderGetQueryParameters.php | 34 ++ ...mRequestBuilderGetRequestConfiguration.php | 39 +++ .../Hosts/Item/Ports/PortsRequestBuilder.php | 99 ++++++ .../PortsRequestBuilderGetQueryParameters.php | 82 +++++ ...sRequestBuilderGetRequestConfiguration.php | 45 +++ .../Reputation/ReputationRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostSslCertificateItemRequestBuilder.php | 20 +- .../SslCertificatesRequestBuilder.php | 20 +- .../Subdomains/Count/CountRequestBuilder.php | 22 +- .../Item/SubdomainItemRequestBuilder.php | 20 +- .../Subdomains/SubdomainsRequestBuilder.php | 20 +- .../Trackers/Count/CountRequestBuilder.php | 22 +- .../Item/HostTrackerItemRequestBuilder.php | 20 +- .../Item/Trackers/TrackersRequestBuilder.php | 20 +- .../Hosts/Item/Whois/WhoisRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../IntelProfilesRequestBuilder.php | 39 +-- .../Indicators/Count/CountRequestBuilder.php | 22 +- .../Indicators/IndicatorsRequestBuilder.php | 20 +- ...enceProfileIndicatorItemRequestBuilder.php | 20 +- .../IntelligenceProfileItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...ligenceProfileIndicatorsRequestBuilder.php | 39 +-- .../Item/Artifact/ArtifactRequestBuilder.php | 20 +- ...enceProfileIndicatorItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/Artifact/ArtifactRequestBuilder.php | 20 +- .../ParentHost/ParentHostRequestBuilder.php | 20 +- .../PassiveDnsRecordItemRequestBuilder.php | 57 ++-- .../PassiveDnsRecordsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/HostItemRequestBuilder.php | 20 +- .../RelatedHostsRequestBuilder.php | 20 +- .../Item/SslCertificateItemRequestBuilder.php | 57 ++-- .../SslCertificatesRequestBuilder.php | 39 +-- .../Subdomains/Count/CountRequestBuilder.php | 22 +- .../Item/Host/HostRequestBuilder.php | 20 +- .../Item/SubdomainItemRequestBuilder.php | 57 ++-- .../Subdomains/SubdomainsRequestBuilder.php | 39 +-- .../ThreatIntelligenceRequestBuilder.php | 65 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/Articles/ArticlesRequestBuilder.php | 20 +- .../Articles/Count/CountRequestBuilder.php | 22 +- .../Item/ArticleItemRequestBuilder.php | 20 +- .../Components/ComponentsRequestBuilder.php | 39 +-- .../Components/Count/CountRequestBuilder.php | 22 +- ...lnerabilityComponentItemRequestBuilder.php | 57 ++-- .../Item/VulnerabilityItemRequestBuilder.php | 57 ++-- .../VulnerabilitiesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/Host/HostRequestBuilder.php | 20 +- .../WhoisHistoryRecordItemRequestBuilder.php | 57 ++-- .../WhoisHistoryRecordsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../History/Count/CountRequestBuilder.php | 22 +- .../Item/History/HistoryRequestBuilder.php | 20 +- .../WhoisHistoryRecordItemRequestBuilder.php | 20 +- .../Item/Host/HostRequestBuilder.php | 20 +- .../Item/WhoisRecordItemRequestBuilder.php | 57 ++-- .../WhoisRecordsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../RetentionEventTypeItemRequestBuilder.php | 57 ++-- .../RetentionEventTypesRequestBuilder.php | 39 +-- .../TriggerTypesRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/RetentionEventItemRequestBuilder.php | 57 ++-- .../RetentionEventTypeRequestBuilder.php | 20 +- .../RetentionEventsRequestBuilder.php | 39 +-- .../Triggers/TriggersRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../GetByIds/GetByIdsRequestBuilder.php | 20 +- .../Item/AddKey/AddKeyRequestBuilder.php | 20 +- .../AddPassword/AddPasswordRequestBuilder.php | 20 +- ...dTokenSigningCertificateRequestBuilder.php | 20 +- .../AppManagementPoliciesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../AppManagementPolicyItemRequestBuilder.php | 38 +-- .../AppRoleAssignedToRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AppRoleAssignmentItemRequestBuilder.php | 57 ++-- .../AppRoleAssignmentsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AppRoleAssignmentItemRequestBuilder.php | 57 ++-- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- .../ClaimsMappingPoliciesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../Ref/RefRequestBuilder.php | 38 +-- .../Count/CountRequestBuilder.php | 22 +- .../CreatedObjectsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...ermissionClassificationsRequestBuilder.php | 39 +-- ...issionClassificationItemRequestBuilder.php | 57 ++-- .../Endpoints/Count/CountRequestBuilder.php | 22 +- .../Endpoints/EndpointsRequestBuilder.php | 39 +-- .../Item/EndpointItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...ratedIdentityCredentialsRequestBuilder.php | 39 +-- ...edIdentityCredentialItemRequestBuilder.php | 57 ++-- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...meRealmDiscoveryPoliciesRequestBuilder.php | 20 +- .../Item/Ref/RefRequestBuilder.php | 19 +- .../Ref/RefRequestBuilder.php | 38 +-- .../MemberOf/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphDirectoryRoleRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphDirectoryRoleRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Item/MemberOf/MemberOfRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...Auth2PermissionGrantItemRequestBuilder.php | 20 +- .../Oauth2PermissionGrantsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphApplicationRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphEndpointRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphEndpointRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../OwnedObjectsRequestBuilder.php | 20 +- .../Item/Owners/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphEndpointRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/Count/CountRequestBuilder.php | 22 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../GraphEndpointRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../Owners/Item/Ref/RefRequestBuilder.php | 19 +- .../Item/Owners/OwnersRequestBuilder.php | 20 +- .../Item/Owners/Ref/RefRequestBuilder.php | 38 +-- ...topSecurityConfigurationRequestBuilder.php | 158 ++++++++++ ...questBuilderDeleteRequestConfiguration.php | 22 ++ ...rationRequestBuilderGetQueryParameters.php | 34 ++ ...nRequestBuilderGetRequestConfiguration.php | 39 +++ ...equestBuilderPatchRequestConfiguration.php | 22 ++ .../Count/CountRequestBuilder.php | 79 +++++ .../CountRequestBuilderGetQueryParameters.php | 34 ++ ...tRequestBuilderGetRequestConfiguration.php | 39 +++ .../TargetDeviceGroupItemRequestBuilder.php | 150 +++++++++ ...questBuilderDeleteRequestConfiguration.php | 22 ++ ...upItemRequestBuilderGetQueryParameters.php | 34 ++ ...mRequestBuilderGetRequestConfiguration.php | 39 +++ ...equestBuilderPatchRequestConfiguration.php | 22 ++ .../TargetDeviceGroupsRequestBuilder.php | 137 ++++++++ ...GroupsRequestBuilderGetQueryParameters.php | 82 +++++ ...sRequestBuilderGetRequestConfiguration.php | 45 +++ ...RequestBuilderPostRequestConfiguration.php | 22 ++ .../RemoveKey/RemoveKeyRequestBuilder.php | 19 +- .../RemovePasswordRequestBuilder.php | 19 +- .../Item/Restore/RestoreRequestBuilder.php | 20 +- .../ServicePrincipalItemRequestBuilder.php | 65 ++-- .../AcquireAccessTokenRequestBuilder.php | 23 +- .../Jobs/Count/CountRequestBuilder.php | 22 +- .../Jobs/Item/Pause/PauseRequestBuilder.php | 19 +- .../ProvisionOnDemandRequestBuilder.php | 20 +- .../Item/Restart/RestartRequestBuilder.php | 19 +- .../Directories/Count/CountRequestBuilder.php | 22 +- .../Directories/DirectoriesRequestBuilder.php | 39 +-- .../DirectoryDefinitionItemRequestBuilder.php | 57 ++-- .../Item/Discover/DiscoverRequestBuilder.php | 20 +- .../FilterOperatorsRequestBuilder.php | 20 +- .../Functions/FunctionsRequestBuilder.php | 20 +- .../ParseExpressionRequestBuilder.php | 24 +- .../Jobs/Item/Schema/SchemaRequestBuilder.php | 57 ++-- .../Jobs/Item/Start/StartRequestBuilder.php | 19 +- .../SynchronizationJobItemRequestBuilder.php | 57 ++-- .../ValidateCredentialsRequestBuilder.php | 19 +- .../Jobs/JobsRequestBuilder.php | 39 +-- .../ValidateCredentialsRequestBuilder.php | 19 +- .../Secrets/Count/CountRequestBuilder.php | 22 +- .../Secrets/SecretsRequestBuilder.php | 20 +- .../SynchronizationRequestBuilder.php | 61 ++-- ...zationRequestBuilderGetQueryParameters.php | 2 +- .../Templates/Count/CountRequestBuilder.php | 22 +- .../Directories/Count/CountRequestBuilder.php | 22 +- .../Directories/DirectoriesRequestBuilder.php | 39 +-- .../DirectoryDefinitionItemRequestBuilder.php | 57 ++-- .../Item/Discover/DiscoverRequestBuilder.php | 20 +- .../FilterOperatorsRequestBuilder.php | 20 +- .../Functions/FunctionsRequestBuilder.php | 20 +- .../ParseExpressionRequestBuilder.php | 24 +- .../Item/Schema/SchemaRequestBuilder.php | 57 ++-- ...chronizationTemplateItemRequestBuilder.php | 57 ++-- .../Templates/TemplatesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../TokenIssuancePolicyItemRequestBuilder.php | 20 +- .../TokenIssuancePoliciesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../TokenLifetimePolicyItemRequestBuilder.php | 20 +- .../TokenLifetimePoliciesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphDirectoryRoleRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphDirectoryRoleRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../TransitiveMemberOfRequestBuilder.php | 20 +- .../ServicePrincipalsRequestBuilder.php | 39 +-- .../ValidatePropertiesRequestBuilder.php | 19 +- ...rvicePrincipalsWithAppIdRequestBuilder.php | 57 ++-- .../Shares/Count/CountRequestBuilder.php | 22 +- .../CreatedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Content/ContentRequestBuilder.php | 42 ++- .../DriveItem/DriveItemRequestBuilder.php | 20 +- .../Columns/ColumnsRequestBuilder.php | 39 +-- .../Columns/Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 57 ++-- .../SourceColumnRequestBuilder.php | 20 +- .../AddCopy/AddCopyRequestBuilder.php | 20 +- ...ddCopyFromContentTypeHubRequestBuilder.php | 20 +- .../ContentTypesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ompatibleHubContentTypesRequestBuilder.php | 20 +- .../AssociateWithHubSitesRequestBuilder.php | 19 +- .../Item/Base/EscapedBaseRequestBuilder.php | 20 +- .../BaseTypes/BaseTypesRequestBuilder.php | 20 +- .../BaseTypes/Count/CountRequestBuilder.php | 22 +- .../Item/ContentTypeItemRequestBuilder.php | 20 +- .../ColumnLinks/ColumnLinksRequestBuilder.php | 39 +-- .../ColumnLinks/Count/CountRequestBuilder.php | 22 +- .../Item/ColumnLinkItemRequestBuilder.php | 57 ++-- .../ColumnPositionsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 20 +- .../Item/Columns/ColumnsRequestBuilder.php | 39 +-- .../Columns/Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 57 ++-- .../SourceColumnRequestBuilder.php | 20 +- .../Item/ContentTypeItemRequestBuilder.php | 57 ++-- ...ToDefaultContentLocationRequestBuilder.php | 19 +- .../IsPublished/IsPublishedRequestBuilder.php | 20 +- .../Item/Publish/PublishRequestBuilder.php | 19 +- .../Unpublish/UnpublishRequestBuilder.php | 19 +- .../CreatedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../EscapedList/Drive/DriveRequestBuilder.php | 20 +- .../Analytics/AnalyticsRequestBuilder.php | 20 +- .../CreatedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../DocumentSetVersionsRequestBuilder.php | 39 +-- .../DocumentSetVersionItemRequestBuilder.php | 57 ++-- .../Item/Fields/FieldsRequestBuilder.php | 57 ++-- .../Item/Restore/RestoreRequestBuilder.php | 19 +- .../Content/ContentRequestBuilder.php | 42 ++- .../DriveItem/DriveItemRequestBuilder.php | 20 +- .../Item/Fields/FieldsRequestBuilder.php | 57 ++-- .../GetActivitiesByIntervalRequestBuilder.php | 20 +- ...hEndDateTimeWithIntervalRequestBuilder.php | 20 +- .../LastModifiedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Items/Item/ListItemItemRequestBuilder.php | 57 ++-- .../Versions/Count/CountRequestBuilder.php | 22 +- .../Item/Fields/FieldsRequestBuilder.php | 57 ++-- .../ListItemVersionItemRequestBuilder.php | 57 ++-- .../RestoreVersionRequestBuilder.php | 19 +- .../Item/Versions/VersionsRequestBuilder.php | 39 +-- .../EscapedList/Items/ItemsRequestBuilder.php | 39 +-- .../LastModifiedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/EscapedList/ListRequestBuilder.php | 57 ++-- .../Operations/Count/CountRequestBuilder.php | 22 +- ...LongRunningOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Reauthorize/ReauthorizeRequestBuilder.php | 19 +- .../Item/SubscriptionItemRequestBuilder.php | 57 ++-- .../SubscriptionsRequestBuilder.php | 39 +-- .../Item/Items/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../Item/DriveItemItemRequestBuilder.php | 20 +- .../Shares/Item/Items/ItemsRequestBuilder.php | 20 +- .../LastModifiedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/ListItem/ListItemRequestBuilder.php | 20 +- .../Permission/Grant/GrantRequestBuilder.php | 20 +- .../Permission/PermissionRequestBuilder.php | 57 ++-- .../Root/Content/ContentRequestBuilder.php | 42 ++- .../Shares/Item/Root/RootRequestBuilder.php | 20 +- .../SharedDriveItemItemRequestBuilder.php | 57 ++-- .../Shares/Item/Site/SiteRequestBuilder.php | 20 +- src/Generated/Shares/SharesRequestBuilder.php | 39 +-- src/Generated/Sites/Add/AddRequestBuilder.php | 20 +- .../Sites/Count/CountRequestBuilder.php | 22 +- .../Sites/Delta/DeltaGetResponse.php | 72 +++++ .../Sites/Delta/DeltaRequestBuilder.php | 77 +++++ .../DeltaRequestBuilderGetQueryParameters.php | 74 +++++ ...aRequestBuilderGetRequestConfiguration.php | 44 +++ .../GetAllSites/GetAllSitesRequestBuilder.php | 20 +- .../AllTime/AllTimeRequestBuilder.php | 20 +- .../Analytics/AnalyticsRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Activities/ActivitiesRequestBuilder.php | 39 +-- .../Activities/Count/CountRequestBuilder.php | 22 +- .../Content/ContentRequestBuilder.php | 42 ++- .../DriveItem/DriveItemRequestBuilder.php | 20 +- .../Item/ItemActivityItemRequestBuilder.php | 57 ++-- .../ItemActivityStatItemRequestBuilder.php | 57 ++-- .../ItemActivityStatsRequestBuilder.php | 39 +-- .../LastSevenDaysRequestBuilder.php | 20 +- .../Item/Columns/ColumnsRequestBuilder.php | 39 +-- .../Columns/Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 57 ++-- .../SourceColumnRequestBuilder.php | 20 +- .../AddCopy/AddCopyRequestBuilder.php | 20 +- ...ddCopyFromContentTypeHubRequestBuilder.php | 20 +- .../ContentTypesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ompatibleHubContentTypesRequestBuilder.php | 20 +- .../AssociateWithHubSitesRequestBuilder.php | 19 +- .../Item/Base/EscapedBaseRequestBuilder.php | 20 +- .../BaseTypes/BaseTypesRequestBuilder.php | 20 +- .../BaseTypes/Count/CountRequestBuilder.php | 22 +- .../Item/ContentTypeItemRequestBuilder.php | 20 +- .../ColumnLinks/ColumnLinksRequestBuilder.php | 39 +-- .../ColumnLinks/Count/CountRequestBuilder.php | 22 +- .../Item/ColumnLinkItemRequestBuilder.php | 57 ++-- .../ColumnPositionsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 20 +- .../Item/Columns/ColumnsRequestBuilder.php | 39 +-- .../Columns/Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 57 ++-- .../SourceColumnRequestBuilder.php | 20 +- .../Item/ContentTypeItemRequestBuilder.php | 57 ++-- ...ToDefaultContentLocationRequestBuilder.php | 19 +- .../IsPublished/IsPublishedRequestBuilder.php | 20 +- .../Item/Publish/PublishRequestBuilder.php | 19 +- .../Unpublish/UnpublishRequestBuilder.php | 19 +- .../CreatedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Sites/Item/Drive/DriveRequestBuilder.php | 20 +- .../Item/Drives/Count/CountRequestBuilder.php | 22 +- .../Item/Drives/DrivesRequestBuilder.php | 20 +- .../Drives/Item/DriveItemRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ExternalColumnsRequestBuilder.php | 20 +- .../ColumnDefinitionItemRequestBuilder.php | 20 +- .../GetActivitiesByIntervalRequestBuilder.php | 20 +- ...hEndDateTimeWithIntervalRequestBuilder.php | 20 +- ...ntTypesForListWithListIdRequestBuilder.php | 20 +- .../GetByPathWithPathRequestBuilder.php | 20 +- .../Item/Items/Count/CountRequestBuilder.php | 22 +- .../Items/Item/BaseItemItemRequestBuilder.php | 20 +- .../Sites/Item/Items/ItemsRequestBuilder.php | 20 +- .../LastModifiedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Lists/Count/CountRequestBuilder.php | 22 +- .../Item/Columns/ColumnsRequestBuilder.php | 39 +-- .../Columns/Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 57 ++-- .../SourceColumnRequestBuilder.php | 20 +- .../AddCopy/AddCopyRequestBuilder.php | 20 +- ...ddCopyFromContentTypeHubRequestBuilder.php | 20 +- .../ContentTypesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...ompatibleHubContentTypesRequestBuilder.php | 20 +- .../AssociateWithHubSitesRequestBuilder.php | 19 +- .../Item/Base/EscapedBaseRequestBuilder.php | 20 +- .../BaseTypes/BaseTypesRequestBuilder.php | 20 +- .../BaseTypes/Count/CountRequestBuilder.php | 22 +- .../Item/ContentTypeItemRequestBuilder.php | 20 +- .../ColumnLinks/ColumnLinksRequestBuilder.php | 39 +-- .../ColumnLinks/Count/CountRequestBuilder.php | 22 +- .../Item/ColumnLinkItemRequestBuilder.php | 57 ++-- .../ColumnPositionsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 20 +- .../Item/Columns/ColumnsRequestBuilder.php | 39 +-- .../Columns/Count/CountRequestBuilder.php | 22 +- .../ColumnDefinitionItemRequestBuilder.php | 57 ++-- .../SourceColumnRequestBuilder.php | 20 +- .../Item/ContentTypeItemRequestBuilder.php | 57 ++-- ...ToDefaultContentLocationRequestBuilder.php | 19 +- .../IsPublished/IsPublishedRequestBuilder.php | 20 +- .../Item/Publish/PublishRequestBuilder.php | 19 +- .../Unpublish/UnpublishRequestBuilder.php | 19 +- .../CreatedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Lists/Item/Drive/DriveRequestBuilder.php | 20 +- .../Analytics/AnalyticsRequestBuilder.php | 20 +- .../CreatedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../DocumentSetVersionsRequestBuilder.php | 39 +-- .../DocumentSetVersionItemRequestBuilder.php | 57 ++-- .../Item/Fields/FieldsRequestBuilder.php | 57 ++-- .../Item/Restore/RestoreRequestBuilder.php | 19 +- .../Content/ContentRequestBuilder.php | 42 ++- .../DriveItem/DriveItemRequestBuilder.php | 20 +- .../Item/Fields/FieldsRequestBuilder.php | 57 ++-- .../GetActivitiesByIntervalRequestBuilder.php | 20 +- ...hEndDateTimeWithIntervalRequestBuilder.php | 20 +- .../LastModifiedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Items/Item/ListItemItemRequestBuilder.php | 57 ++-- .../Versions/Count/CountRequestBuilder.php | 22 +- .../Item/Fields/FieldsRequestBuilder.php | 57 ++-- .../ListItemVersionItemRequestBuilder.php | 57 ++-- .../RestoreVersionRequestBuilder.php | 19 +- .../Item/Versions/VersionsRequestBuilder.php | 39 +-- .../Lists/Item/Items/ItemsRequestBuilder.php | 39 +-- .../LastModifiedByUserRequestBuilder.php | 20 +- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Lists/Item/ListItemRequestBuilder.php | 63 ++-- ...stItemRequestBuilderGetQueryParameters.php | 2 +- .../Operations/Count/CountRequestBuilder.php | 22 +- ...LongRunningOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Reauthorize/ReauthorizeRequestBuilder.php | 19 +- .../Item/SubscriptionItemRequestBuilder.php | 57 ++-- .../SubscriptionsRequestBuilder.php | 39 +-- .../Sites/Item/Lists/ListsRequestBuilder.php | 39 +-- .../Notebooks/Count/CountRequestBuilder.php | 22 +- .../GetNotebookFromWebUrlRequestBuilder.php | 20 +- ...IncludePersonalNotebooksRequestBuilder.php | 20 +- .../CopyNotebookRequestBuilder.php | 20 +- .../Item/NotebookItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/SectionGroupItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/SectionGroupItemRequestBuilder.php | 20 +- .../SectionGroupsRequestBuilder.php | 20 +- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/Sections/SectionsRequestBuilder.php | 39 +-- .../SectionGroupsRequestBuilder.php | 39 +-- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/Sections/SectionsRequestBuilder.php | 39 +-- .../Notebooks/NotebooksRequestBuilder.php | 39 +-- .../Item/Onenote/OnenoteRequestBuilder.php | 57 ++-- .../Operations/Count/CountRequestBuilder.php | 22 +- .../OnenoteOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Onenote/Pages/PagesRequestBuilder.php | 39 +-- .../Resources/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../OnenoteResourceItemRequestBuilder.php | 57 ++-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/SectionGroupItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/SectionGroupItemRequestBuilder.php | 20 +- .../SectionGroupsRequestBuilder.php | 20 +- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/Sections/SectionsRequestBuilder.php | 39 +-- .../SectionGroupsRequestBuilder.php | 39 +-- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Sections/SectionsRequestBuilder.php | 39 +-- .../Operations/Count/CountRequestBuilder.php | 22 +- ...LongRunningOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Permissions/Count/CountRequestBuilder.php | 22 +- .../Item/Grant/GrantRequestBuilder.php | 20 +- .../Item/PermissionItemRequestBuilder.php | 57 ++-- .../Permissions/PermissionsRequestBuilder.php | 39 +-- .../Sites/Item/SiteItemRequestBuilder.php | 39 +-- .../Item/Sites/Count/CountRequestBuilder.php | 22 +- .../Sites/Item/SiteItemRequestBuilder.php | 20 +- .../Sites/Item/Sites/SitesRequestBuilder.php | 20 +- .../Groups/Count/CountRequestBuilder.php | 22 +- .../TermStore/Groups/GroupsRequestBuilder.php | 39 +-- .../Groups/Item/GroupItemRequestBuilder.php | 57 ++-- .../Item/Sets/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../ParentGroup/ParentGroupRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Sets/Item/SetItemRequestBuilder.php | 57 ++-- .../Item/Terms/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Terms/Item/Set/SetRequestBuilder.php | 20 +- .../Terms/Item/TermItemRequestBuilder.php | 57 ++-- .../Sets/Item/Terms/TermsRequestBuilder.php | 39 +-- .../Groups/Item/Sets/SetsRequestBuilder.php | 39 +-- .../Sets/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../ParentGroup/ParentGroupRequestBuilder.php | 57 ++-- .../Sets/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Sets/Item/SetItemRequestBuilder.php | 57 ++-- .../Item/Terms/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Terms/Item/Set/SetRequestBuilder.php | 20 +- .../Terms/Item/TermItemRequestBuilder.php | 57 ++-- .../Sets/Item/Terms/TermsRequestBuilder.php | 39 +-- .../ParentGroup/Sets/SetsRequestBuilder.php | 39 +-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Sets/Item/SetItemRequestBuilder.php | 57 ++-- .../Item/Terms/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Terms/Item/Set/SetRequestBuilder.php | 20 +- .../Terms/Item/TermItemRequestBuilder.php | 57 ++-- .../Sets/Item/Terms/TermsRequestBuilder.php | 39 +-- .../TermStore/Sets/SetsRequestBuilder.php | 39 +-- .../TermStore/TermStoreRequestBuilder.php | 57 ++-- .../TermStores/Count/CountRequestBuilder.php | 22 +- .../Item/Groups/Count/CountRequestBuilder.php | 22 +- .../Item/Groups/GroupsRequestBuilder.php | 39 +-- .../Groups/Item/GroupItemRequestBuilder.php | 57 ++-- .../Item/Sets/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../ParentGroup/ParentGroupRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Sets/Item/SetItemRequestBuilder.php | 57 ++-- .../Item/Terms/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Terms/Item/Set/SetRequestBuilder.php | 20 +- .../Terms/Item/TermItemRequestBuilder.php | 57 ++-- .../Sets/Item/Terms/TermsRequestBuilder.php | 39 +-- .../Groups/Item/Sets/SetsRequestBuilder.php | 39 +-- .../Item/Sets/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../ParentGroup/ParentGroupRequestBuilder.php | 57 ++-- .../Sets/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Sets/Item/SetItemRequestBuilder.php | 57 ++-- .../Item/Terms/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Terms/Item/Set/SetRequestBuilder.php | 20 +- .../Terms/Item/TermItemRequestBuilder.php | 57 ++-- .../Sets/Item/Terms/TermsRequestBuilder.php | 39 +-- .../ParentGroup/Sets/SetsRequestBuilder.php | 39 +-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Sets/Item/SetItemRequestBuilder.php | 57 ++-- .../Item/Terms/Count/CountRequestBuilder.php | 22 +- .../Item/Children/ChildrenRequestBuilder.php | 39 +-- .../Children/Count/CountRequestBuilder.php | 22 +- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Children/Item/Set/SetRequestBuilder.php | 20 +- .../Children/Item/TermItemRequestBuilder.php | 57 ++-- .../Relations/Count/CountRequestBuilder.php | 22 +- .../Item/FromTerm/FromTermRequestBuilder.php | 20 +- .../Item/RelationItemRequestBuilder.php | 57 ++-- .../Relations/Item/Set/SetRequestBuilder.php | 20 +- .../Item/ToTerm/ToTermRequestBuilder.php | 20 +- .../Relations/RelationsRequestBuilder.php | 39 +-- .../Item/Terms/Item/Set/SetRequestBuilder.php | 20 +- .../Terms/Item/TermItemRequestBuilder.php | 57 ++-- .../Sets/Item/Terms/TermsRequestBuilder.php | 39 +-- .../Item/Sets/SetsRequestBuilder.php | 39 +-- .../Item/StoreItemRequestBuilder.php | 57 ++-- .../TermStores/TermStoresRequestBuilder.php | 39 +-- .../Sites/Remove/RemoveRequestBuilder.php | 20 +- src/Generated/Sites/SitesRequestBuilder.php | 34 +- .../SitesRequestBuilderGetQueryParameters.php | 2 +- .../BookingBusinessesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AppointmentsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../BookingAppointmentItemRequestBuilder.php | 57 ++-- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../BookingBusinessItemRequestBuilder.php | 57 ++-- .../CalendarViewRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../BookingAppointmentItemRequestBuilder.php | 57 ++-- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../CustomQuestionsRequestBuilder.php | 39 +-- ...ookingCustomQuestionItemRequestBuilder.php | 57 ++-- .../Customers/Count/CountRequestBuilder.php | 22 +- .../Customers/CustomersRequestBuilder.php | 39 +-- .../BookingCustomerBaseItemRequestBuilder.php | 57 ++-- .../GetStaffAvailabilityRequestBuilder.php | 20 +- .../Item/Publish/PublishRequestBuilder.php | 19 +- .../Services/Count/CountRequestBuilder.php | 22 +- .../Item/BookingServiceItemRequestBuilder.php | 57 ++-- .../Item/Services/ServicesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...okingStaffMemberBaseItemRequestBuilder.php | 57 ++-- .../StaffMembersRequestBuilder.php | 39 +-- .../Unpublish/UnpublishRequestBuilder.php | 19 +- .../BookingCurrenciesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../BookingCurrencyItemRequestBuilder.php | 57 ++-- .../Solutions/SolutionsRequestBuilder.php | 39 +-- .../Item/SubscribedSkuItemRequestBuilder.php | 57 ++-- .../SubscribedSkusRequestBuilder.php | 39 +-- .../Reauthorize/ReauthorizeRequestBuilder.php | 19 +- .../Item/SubscriptionItemRequestBuilder.php | 57 ++-- .../SubscriptionsRequestBuilder.php | 39 +-- .../Teams/Count/CountRequestBuilder.php | 22 +- .../GetAllMessagesRequestBuilder.php | 20 +- .../AllChannels/AllChannelsRequestBuilder.php | 20 +- .../AllChannels/Count/CountRequestBuilder.php | 22 +- .../Item/ChannelItemRequestBuilder.php | 20 +- .../Item/Archive/ArchiveRequestBuilder.php | 19 +- .../Item/Channels/ChannelsRequestBuilder.php | 39 +-- .../Channels/Count/CountRequestBuilder.php | 22 +- .../GetAllMessagesRequestBuilder.php | 20 +- .../Item/ChannelItemRequestBuilder.php | 57 ++-- .../CompleteMigrationRequestBuilder.php | 19 +- ...palNameUserPrincipalNameRequestBuilder.php | 20 +- .../Content/ContentRequestBuilder.php | 42 ++- .../FilesFolder/FilesFolderRequestBuilder.php | 20 +- .../Item/Members/Add/AddRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 63 ++-- .../Item/Members/MembersRequestBuilder.php | 39 +-- .../Messages/Count/CountRequestBuilder.php | 22 +- .../Messages/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Replies/Count/CountRequestBuilder.php | 22 +- .../Replies/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Replies/RepliesRequestBuilder.php | 39 +-- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Messages/MessagesRequestBuilder.php | 45 ++- .../ProvisionEmailRequestBuilder.php | 20 +- .../RemoveEmail/RemoveEmailRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../AllowedMembersRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 20 +- ...dWithChannelTeamInfoItemRequestBuilder.php | 57 ++-- .../Item/Team/TeamRequestBuilder.php | 20 +- .../SharedWithTeamsRequestBuilder.php | 39 +-- .../Item/Tabs/Count/CountRequestBuilder.php | 22 +- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../Tabs/Item/TeamsTabItemRequestBuilder.php | 57 ++-- .../Channels/Item/Tabs/TabsRequestBuilder.php | 39 +-- .../CompleteMigrationRequestBuilder.php | 19 +- .../Item/EscapedClone/CloneRequestBuilder.php | 19 +- .../Teams/Item/Group/GroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../IncomingChannelsRequestBuilder.php | 20 +- .../Item/ChannelItemRequestBuilder.php | 38 +-- .../Count/CountRequestBuilder.php | 22 +- .../InstalledAppsRequestBuilder.php | 39 +-- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../TeamsAppDefinitionRequestBuilder.php | 20 +- ...TeamsAppInstallationItemRequestBuilder.php | 57 ++-- .../Item/Upgrade/UpgradeRequestBuilder.php | 19 +- .../Item/Members/Add/AddRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 57 ++-- .../Item/Members/MembersRequestBuilder.php | 39 +-- .../Operations/Count/CountRequestBuilder.php | 22 +- .../TeamsAsyncOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...cificPermissionGrantItemRequestBuilder.php | 57 ++-- .../PermissionGrantsRequestBuilder.php | 43 ++- ...GrantsRequestBuilderGetQueryParameters.php | 2 +- .../Teams/Item/Photo/PhotoRequestBuilder.php | 43 ++- .../PhotoRequestBuilderGetQueryParameters.php | 2 +- .../Photo/Value/ContentRequestBuilder.php | 43 ++- .../CompleteMigrationRequestBuilder.php | 19 +- ...palNameUserPrincipalNameRequestBuilder.php | 20 +- .../Content/ContentRequestBuilder.php | 42 ++- .../FilesFolder/FilesFolderRequestBuilder.php | 20 +- .../Members/Add/AddRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 63 ++-- .../Members/MembersRequestBuilder.php | 39 +-- .../Messages/Count/CountRequestBuilder.php | 22 +- .../Messages/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Replies/Count/CountRequestBuilder.php | 22 +- .../Replies/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Replies/RepliesRequestBuilder.php | 39 +-- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Messages/MessagesRequestBuilder.php | 45 ++- .../PrimaryChannelRequestBuilder.php | 57 ++-- .../ProvisionEmailRequestBuilder.php | 20 +- .../RemoveEmail/RemoveEmailRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../AllowedMembersRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 20 +- ...dWithChannelTeamInfoItemRequestBuilder.php | 57 ++-- .../Item/Team/TeamRequestBuilder.php | 20 +- .../SharedWithTeamsRequestBuilder.php | 39 +-- .../Tabs/Count/CountRequestBuilder.php | 22 +- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../Tabs/Item/TeamsTabItemRequestBuilder.php | 57 ++-- .../Tabs/TabsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../OfferShiftRequestItemRequestBuilder.php | 57 ++-- .../OfferShiftRequestsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...enShiftChangeRequestItemRequestBuilder.php | 57 ++-- .../OpenShiftChangeRequestsRequestBuilder.php | 39 +-- .../OpenShifts/Count/CountRequestBuilder.php | 22 +- .../Item/OpenShiftItemRequestBuilder.php | 57 ++-- .../OpenShifts/OpenShiftsRequestBuilder.php | 39 +-- .../Item/Schedule/ScheduleRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../SchedulingGroupItemRequestBuilder.php | 57 ++-- .../SchedulingGroupsRequestBuilder.php | 39 +-- .../Schedule/Share/ShareRequestBuilder.php | 19 +- .../Shifts/Count/CountRequestBuilder.php | 22 +- .../Shifts/Item/ShiftItemRequestBuilder.php | 57 ++-- .../Schedule/Shifts/ShiftsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...pShiftsChangeRequestItemRequestBuilder.php | 57 ++-- ...SwapShiftsChangeRequestsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/TimeOffReasonItemRequestBuilder.php | 57 ++-- .../TimeOffReasonsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/TimeOffRequestItemRequestBuilder.php | 57 ++-- .../TimeOffRequestsRequestBuilder.php | 39 +-- .../TimesOff/Count/CountRequestBuilder.php | 22 +- .../Item/TimeOffItemRequestBuilder.php | 57 ++-- .../TimesOff/TimesOffRequestBuilder.php | 39 +-- ...SendActivityNotificationRequestBuilder.php | 19 +- .../Item/Tags/Count/CountRequestBuilder.php | 22 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../TeamworkTagMemberItemRequestBuilder.php | 57 ++-- .../Item/Members/MembersRequestBuilder.php | 39 +-- .../Item/TeamworkTagItemRequestBuilder.php | 57 ++-- .../Teams/Item/Tags/TagsRequestBuilder.php | 39 +-- .../Teams/Item/TeamItemRequestBuilder.php | 57 ++-- .../Item/Template/TemplateRequestBuilder.php | 20 +- .../Unarchive/UnarchiveRequestBuilder.php | 19 +- src/Generated/Teams/TeamsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/TeamsTemplateItemRequestBuilder.php | 57 ++-- .../TeamsTemplatesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../DeletedTeamsRequestBuilder.php | 39 +-- .../GetAllMessagesRequestBuilder.php | 20 +- .../Item/Channels/ChannelsRequestBuilder.php | 39 +-- .../Channels/Count/CountRequestBuilder.php | 22 +- .../GetAllMessagesRequestBuilder.php | 20 +- .../Item/ChannelItemRequestBuilder.php | 57 ++-- .../CompleteMigrationRequestBuilder.php | 19 +- ...palNameUserPrincipalNameRequestBuilder.php | 20 +- .../Content/ContentRequestBuilder.php | 42 ++- .../FilesFolder/FilesFolderRequestBuilder.php | 20 +- .../Item/Members/Add/AddRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 63 ++-- .../Item/Members/MembersRequestBuilder.php | 39 +-- .../Messages/Count/CountRequestBuilder.php | 22 +- .../Messages/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Replies/Count/CountRequestBuilder.php | 22 +- .../Replies/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Replies/RepliesRequestBuilder.php | 39 +-- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Messages/MessagesRequestBuilder.php | 45 ++- .../ProvisionEmailRequestBuilder.php | 20 +- .../RemoveEmail/RemoveEmailRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../AllowedMembersRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 20 +- ...dWithChannelTeamInfoItemRequestBuilder.php | 57 ++-- .../Item/Team/TeamRequestBuilder.php | 20 +- .../SharedWithTeamsRequestBuilder.php | 39 +-- .../Item/Tabs/Count/CountRequestBuilder.php | 22 +- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../Tabs/Item/TeamsTabItemRequestBuilder.php | 57 ++-- .../Channels/Item/Tabs/TabsRequestBuilder.php | 39 +-- .../Item/DeletedTeamItemRequestBuilder.php | 57 ++-- ...NotificationToRecipientsRequestBuilder.php | 19 +- .../TeamsAppSettingsRequestBuilder.php | 57 ++-- .../Teamwork/TeamworkRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...WorkforceIntegrationItemRequestBuilder.php | 57 ++-- .../WorkforceIntegrationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../DelegatedAdminCustomersRequestBuilder.php | 39 +-- ...legatedAdminCustomerItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...viceManagementDetailItemRequestBuilder.php | 57 ++-- ...ServiceManagementDetailsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...egatedAdminRelationshipsRequestBuilder.php | 39 +-- .../AccessAssignmentsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...dminAccessAssignmentItemRequestBuilder.php | 57 ++-- ...tedAdminRelationshipItemRequestBuilder.php | 61 ++-- .../Operations/Count/CountRequestBuilder.php | 22 +- ...elationshipOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Requests/Count/CountRequestBuilder.php | 22 +- ...nRelationshipRequestItemRequestBuilder.php | 57 ++-- .../Item/Requests/RequestsRequestBuilder.php | 39 +-- ...DomainNameWithDomainNameRequestBuilder.php | 20 +- ...onByTenantIdWithTenantIdRequestBuilder.php | 20 +- .../TenantRelationshipsRequestBuilder.php | 39 +-- .../Users/Count/CountRequestBuilder.php | 22 +- .../Users/Delta/DeltaRequestBuilder.php | 20 +- ...lableExtensionPropertiesRequestBuilder.php | 20 +- .../Users/GetByIds/GetByIdsRequestBuilder.php | 20 +- .../Activities/ActivitiesRequestBuilder.php | 39 +-- .../Activities/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../HistoryItemsRequestBuilder.php | 39 +-- .../Item/Activity/ActivityRequestBuilder.php | 20 +- .../ActivityHistoryItemItemRequestBuilder.php | 57 ++-- .../Item/UserActivityItemRequestBuilder.php | 57 ++-- .../Recent/RecentRequestBuilder.php | 20 +- .../AgreementAcceptancesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../AgreementAcceptanceItemRequestBuilder.php | 20 +- .../AppRoleAssignmentsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AppRoleAssignmentItemRequestBuilder.php | 57 ++-- .../AssignLicenseRequestBuilder.php | 20 +- .../AuthenticationRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../EmailMethodsRequestBuilder.php | 39 +-- ...AuthenticationMethodItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Fido2MethodsRequestBuilder.php | 20 +- ...AuthenticationMethodItemRequestBuilder.php | 38 +-- .../Methods/Count/CountRequestBuilder.php | 22 +- ...AuthenticationMethodItemRequestBuilder.php | 39 +-- .../ResetPasswordRequestBuilder.php | 24 +- .../Methods/MethodsRequestBuilder.php | 43 ++- ...ethodsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/Device/DeviceRequestBuilder.php | 20 +- ...AuthenticationMethodItemRequestBuilder.php | 38 +-- ...softAuthenticatorMethodsRequestBuilder.php | 20 +- .../Operations/Count/CountRequestBuilder.php | 22 +- ...LongRunningOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...AuthenticationMethodItemRequestBuilder.php | 20 +- .../PasswordMethodsRequestBuilder.php | 43 ++- ...ethodsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../DisableSmsSignInRequestBuilder.php | 19 +- .../EnableSmsSignInRequestBuilder.php | 19 +- ...AuthenticationMethodItemRequestBuilder.php | 61 ++-- ...odItemRequestBuilderGetQueryParameters.php | 2 +- .../PhoneMethodsRequestBuilder.php | 43 ++- ...ethodsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- ...AuthenticationMethodItemRequestBuilder.php | 38 +-- .../SoftwareOathMethodsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...AuthenticationMethodItemRequestBuilder.php | 38 +-- ...mporaryAccessPassMethodsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/Device/DeviceRequestBuilder.php | 20 +- ...AuthenticationMethodItemRequestBuilder.php | 38 +-- ...sHelloForBusinessMethodsRequestBuilder.php | 20 +- ...ndarSharingRolesWithUserRequestBuilder.php | 20 +- .../CalendarPermissionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../CalendarPermissionItemRequestBuilder.php | 57 ++-- .../Item/Calendar/CalendarRequestBuilder.php | 39 +-- .../CalendarViewRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Instances/Count/CountRequestBuilder.php | 22 +- .../Instances/Delta/DeltaRequestBuilder.php | 20 +- .../Instances/InstancesRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../Events/Count/CountRequestBuilder.php | 22 +- .../Events/Delta/DeltaRequestBuilder.php | 20 +- .../Calendar/Events/EventsRequestBuilder.php | 39 +-- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Events/Item/EventItemRequestBuilder.php | 57 ++-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Instances/Count/CountRequestBuilder.php | 22 +- .../Instances/Delta/DeltaRequestBuilder.php | 20 +- .../Instances/InstancesRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../GetSchedule/GetScheduleRequestBuilder.php | 20 +- .../CalendarGroupsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/CalendarGroupItemRequestBuilder.php | 57 ++-- .../Calendars/CalendarsRequestBuilder.php | 39 +-- .../Calendars/Count/CountRequestBuilder.php | 22 +- ...ndarSharingRolesWithUserRequestBuilder.php | 20 +- .../Item/CalendarItemRequestBuilder.php | 57 ++-- .../CalendarPermissionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../CalendarPermissionItemRequestBuilder.php | 57 ++-- .../CalendarViewRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Instances/Count/CountRequestBuilder.php | 22 +- .../Instances/Delta/DeltaRequestBuilder.php | 20 +- .../Instances/InstancesRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../Item/Events/Count/CountRequestBuilder.php | 22 +- .../Item/Events/Delta/DeltaRequestBuilder.php | 20 +- .../Item/Events/EventsRequestBuilder.php | 39 +-- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Events/Item/EventItemRequestBuilder.php | 57 ++-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Instances/Count/CountRequestBuilder.php | 22 +- .../Instances/Delta/DeltaRequestBuilder.php | 20 +- .../Instances/InstancesRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../GetSchedule/GetScheduleRequestBuilder.php | 20 +- .../CalendarViewRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Instances/Count/CountRequestBuilder.php | 22 +- .../Instances/Delta/DeltaRequestBuilder.php | 20 +- .../Instances/InstancesRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../Calendars/CalendarsRequestBuilder.php | 39 +-- .../Calendars/Count/CountRequestBuilder.php | 22 +- ...ndarSharingRolesWithUserRequestBuilder.php | 20 +- .../Item/CalendarItemRequestBuilder.php | 57 ++-- .../CalendarPermissionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../CalendarPermissionItemRequestBuilder.php | 57 ++-- .../CalendarViewRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Instances/Count/CountRequestBuilder.php | 22 +- .../Instances/Delta/DeltaRequestBuilder.php | 20 +- .../Instances/InstancesRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../Item/Events/Count/CountRequestBuilder.php | 22 +- .../Item/Events/Delta/DeltaRequestBuilder.php | 20 +- .../Item/Events/EventsRequestBuilder.php | 39 +-- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Events/Item/EventItemRequestBuilder.php | 57 ++-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Instances/Count/CountRequestBuilder.php | 22 +- .../Instances/Delta/DeltaRequestBuilder.php | 20 +- .../Instances/InstancesRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../GetSchedule/GetScheduleRequestBuilder.php | 20 +- .../ChangePasswordRequestBuilder.php | 19 +- .../Users/Item/Chats/ChatsRequestBuilder.php | 39 +-- .../Item/Chats/Count/CountRequestBuilder.php | 22 +- .../GetAllMessagesRequestBuilder.php | 20 +- .../Chats/Item/ChatItemRequestBuilder.php | 57 ++-- .../HideForUser/HideForUserRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../InstalledAppsRequestBuilder.php | 39 +-- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../TeamsAppDefinitionRequestBuilder.php | 20 +- ...TeamsAppInstallationItemRequestBuilder.php | 57 ++-- .../Item/Upgrade/UpgradeRequestBuilder.php | 19 +- .../LastMessagePreviewRequestBuilder.php | 57 ++-- .../MarkChatReadForUserRequestBuilder.php | 19 +- .../MarkChatUnreadForUserRequestBuilder.php | 19 +- .../Item/Members/Add/AddRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 57 ++-- .../Item/Members/MembersRequestBuilder.php | 39 +-- .../Messages/Count/CountRequestBuilder.php | 22 +- .../Messages/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Replies/Count/CountRequestBuilder.php | 22 +- .../Replies/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Replies/RepliesRequestBuilder.php | 39 +-- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Messages/MessagesRequestBuilder.php | 45 ++- .../Count/CountRequestBuilder.php | 22 +- ...cificPermissionGrantItemRequestBuilder.php | 57 ++-- .../PermissionGrantsRequestBuilder.php | 43 ++- ...GrantsRequestBuilderGetQueryParameters.php | 2 +- .../Count/CountRequestBuilder.php | 22 +- .../Item/Message/MessageRequestBuilder.php | 20 +- ...innedChatMessageInfoItemRequestBuilder.php | 57 ++-- .../PinnedMessagesRequestBuilder.php | 39 +-- ...SendActivityNotificationRequestBuilder.php | 19 +- .../Item/Tabs/Count/CountRequestBuilder.php | 22 +- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../Tabs/Item/TeamsTabItemRequestBuilder.php | 57 ++-- .../Chats/Item/Tabs/TabsRequestBuilder.php | 39 +-- .../UnhideForUserRequestBuilder.php | 19 +- .../CheckMemberGroupsRequestBuilder.php | 24 +- .../CheckMemberObjectsRequestBuilder.php | 20 +- .../ContactFoldersRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../ChildFoldersRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../Item/ContactFolderItemRequestBuilder.php | 57 ++-- .../Item/Contacts/ContactsRequestBuilder.php | 39 +-- .../Contacts/Count/CountRequestBuilder.php | 22 +- .../Contacts/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ContactItemRequestBuilder.php | 57 ++-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Photo/PhotoRequestBuilder.php | 39 +-- .../Photo/Value/ContentRequestBuilder.php | 43 ++- .../Item/ContactFolderItemRequestBuilder.php | 57 ++-- .../Item/Contacts/ContactsRequestBuilder.php | 39 +-- .../Contacts/Count/CountRequestBuilder.php | 22 +- .../Contacts/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ContactItemRequestBuilder.php | 57 ++-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Photo/PhotoRequestBuilder.php | 39 +-- .../Photo/Value/ContentRequestBuilder.php | 43 ++- .../Item/Contacts/ContactsRequestBuilder.php | 39 +-- .../Contacts/Count/CountRequestBuilder.php | 22 +- .../Contacts/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ContactItemRequestBuilder.php | 57 ++-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Photo/PhotoRequestBuilder.php | 39 +-- .../Photo/Value/ContentRequestBuilder.php | 43 ++- .../Count/CountRequestBuilder.php | 22 +- .../CreatedObjectsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...entTroubleshootingEventsRequestBuilder.php | 39 +-- ...TroubleshootingEventItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../DirectReportsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../GraphUser/Count/CountRequestBuilder.php | 22 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphOrgContactRequestBuilder.php | 20 +- .../GraphUser/GraphUserRequestBuilder.php | 20 +- .../Users/Item/Drive/DriveRequestBuilder.php | 20 +- .../Item/Drives/Count/CountRequestBuilder.php | 22 +- .../Item/Drives/DrivesRequestBuilder.php | 20 +- .../Drives/Item/DriveItemRequestBuilder.php | 20 +- .../EmployeeExperienceRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...arningCourseActivityItemRequestBuilder.php | 20 +- ...LearningCourseActivitiesRequestBuilder.php | 20 +- .../Item/Events/Count/CountRequestBuilder.php | 22 +- .../Item/Events/Delta/DeltaRequestBuilder.php | 20 +- .../Item/Events/EventsRequestBuilder.php | 39 +-- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Events/Item/EventItemRequestBuilder.php | 57 ++-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Instances/Count/CountRequestBuilder.php | 22 +- .../Instances/Delta/DeltaRequestBuilder.php | 20 +- .../Instances/InstancesRequestBuilder.php | 20 +- .../Item/Accept/AcceptRequestBuilder.php | 19 +- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Item/Calendar/CalendarRequestBuilder.php | 20 +- .../Item/Cancel/CancelRequestBuilder.php | 19 +- .../Item/Decline/DeclineRequestBuilder.php | 19 +- .../DismissReminderRequestBuilder.php | 19 +- .../Item/EventItemRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- .../SnoozeReminderRequestBuilder.php | 19 +- .../TentativelyAcceptRequestBuilder.php | 19 +- ...viceAndAppManagementDataRequestBuilder.php | 20 +- ...ementDataWithSkipWithTopRequestBuilder.php | 20 +- .../ExportPersonalDataRequestBuilder.php | 19 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../FindMeetingTimesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../FollowedSitesRequestBuilder.php | 20 +- .../Item/SiteItemRequestBuilder.php | 20 +- .../GetMailTips/GetMailTipsRequestBuilder.php | 20 +- ...gedAppDiagnosticStatusesRequestBuilder.php | 20 +- .../GetManagedAppPoliciesRequestBuilder.php | 20 +- ...edDevicesWithAppFailuresRequestBuilder.php | 20 +- .../GetMemberGroupsRequestBuilder.php | 20 +- .../GetMemberObjectsRequestBuilder.php | 20 +- .../InferenceClassificationRequestBuilder.php | 39 +-- .../Overrides/Count/CountRequestBuilder.php | 22 +- ...assificationOverrideItemRequestBuilder.php | 57 ++-- .../Overrides/OverridesRequestBuilder.php | 39 +-- .../Item/Insights/InsightsRequestBuilder.php | 57 ++-- .../Shared/Count/CountRequestBuilder.php | 22 +- .../LastSharedMethodRequestBuilder.php | 20 +- .../Item/Resource/ResourceRequestBuilder.php | 20 +- .../Item/SharedInsightItemRequestBuilder.php | 57 ++-- .../Insights/Shared/SharedRequestBuilder.php | 39 +-- .../Trending/Count/CountRequestBuilder.php | 22 +- .../Item/Resource/ResourceRequestBuilder.php | 20 +- .../Item/TrendingItemRequestBuilder.php | 57 ++-- .../Trending/TrendingRequestBuilder.php | 39 +-- .../Used/Count/CountRequestBuilder.php | 22 +- .../Item/Resource/ResourceRequestBuilder.php | 20 +- .../Item/UsedInsightItemRequestBuilder.php | 57 ++-- .../Item/Insights/Used/UsedRequestBuilder.php | 39 +-- .../JoinedTeams/Count/CountRequestBuilder.php | 22 +- .../GetAllMessagesRequestBuilder.php | 20 +- .../AllChannels/AllChannelsRequestBuilder.php | 20 +- .../AllChannels/Count/CountRequestBuilder.php | 22 +- .../Item/ChannelItemRequestBuilder.php | 20 +- .../Item/Archive/ArchiveRequestBuilder.php | 19 +- .../Item/Channels/ChannelsRequestBuilder.php | 39 +-- .../Channels/Count/CountRequestBuilder.php | 22 +- .../GetAllMessagesRequestBuilder.php | 20 +- .../Item/ChannelItemRequestBuilder.php | 57 ++-- .../CompleteMigrationRequestBuilder.php | 19 +- ...palNameUserPrincipalNameRequestBuilder.php | 20 +- .../Content/ContentRequestBuilder.php | 42 ++- .../FilesFolder/FilesFolderRequestBuilder.php | 20 +- .../Item/Members/Add/AddRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 63 ++-- .../Item/Members/MembersRequestBuilder.php | 39 +-- .../Messages/Count/CountRequestBuilder.php | 22 +- .../Messages/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Replies/Count/CountRequestBuilder.php | 22 +- .../Replies/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Replies/RepliesRequestBuilder.php | 39 +-- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Messages/MessagesRequestBuilder.php | 45 ++- .../ProvisionEmailRequestBuilder.php | 20 +- .../RemoveEmail/RemoveEmailRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../AllowedMembersRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 20 +- ...dWithChannelTeamInfoItemRequestBuilder.php | 57 ++-- .../Item/Team/TeamRequestBuilder.php | 20 +- .../SharedWithTeamsRequestBuilder.php | 39 +-- .../Item/Tabs/Count/CountRequestBuilder.php | 22 +- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../Tabs/Item/TeamsTabItemRequestBuilder.php | 57 ++-- .../Channels/Item/Tabs/TabsRequestBuilder.php | 39 +-- .../CompleteMigrationRequestBuilder.php | 19 +- .../Item/EscapedClone/CloneRequestBuilder.php | 19 +- .../Item/Group/GroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../IncomingChannelsRequestBuilder.php | 20 +- .../Item/ChannelItemRequestBuilder.php | 38 +-- .../Count/CountRequestBuilder.php | 22 +- .../InstalledAppsRequestBuilder.php | 39 +-- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../TeamsAppDefinitionRequestBuilder.php | 20 +- ...TeamsAppInstallationItemRequestBuilder.php | 57 ++-- .../Item/Upgrade/UpgradeRequestBuilder.php | 19 +- .../Item/Members/Add/AddRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 57 ++-- .../Item/Members/MembersRequestBuilder.php | 39 +-- .../Operations/Count/CountRequestBuilder.php | 22 +- .../TeamsAsyncOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...cificPermissionGrantItemRequestBuilder.php | 57 ++-- .../PermissionGrantsRequestBuilder.php | 43 ++- ...GrantsRequestBuilderGetQueryParameters.php | 2 +- .../Item/Photo/PhotoRequestBuilder.php | 43 ++- .../PhotoRequestBuilderGetQueryParameters.php | 2 +- .../Photo/Value/ContentRequestBuilder.php | 43 ++- .../CompleteMigrationRequestBuilder.php | 19 +- ...palNameUserPrincipalNameRequestBuilder.php | 20 +- .../Content/ContentRequestBuilder.php | 42 ++- .../FilesFolder/FilesFolderRequestBuilder.php | 20 +- .../Members/Add/AddRequestBuilder.php | 20 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 63 ++-- .../Members/MembersRequestBuilder.php | 39 +-- .../Messages/Count/CountRequestBuilder.php | 22 +- .../Messages/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Replies/Count/CountRequestBuilder.php | 22 +- .../Replies/Delta/DeltaRequestBuilder.php | 20 +- .../Item/ChatMessageItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../HostedContentsRequestBuilder.php | 43 ++- ...ntentsRequestBuilderGetQueryParameters.php | 2 +- ...MessageHostedContentItemRequestBuilder.php | 57 ++-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Item/Replies/RepliesRequestBuilder.php | 39 +-- .../SetReaction/SetReactionRequestBuilder.php | 19 +- .../SoftDelete/SoftDeleteRequestBuilder.php | 19 +- .../UndoSoftDeleteRequestBuilder.php | 19 +- .../UnsetReactionRequestBuilder.php | 19 +- .../Messages/MessagesRequestBuilder.php | 45 ++- .../PrimaryChannelRequestBuilder.php | 57 ++-- .../ProvisionEmailRequestBuilder.php | 20 +- .../RemoveEmail/RemoveEmailRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../AllowedMembersRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../ConversationMemberItemRequestBuilder.php | 20 +- ...dWithChannelTeamInfoItemRequestBuilder.php | 57 ++-- .../Item/Team/TeamRequestBuilder.php | 20 +- .../SharedWithTeamsRequestBuilder.php | 39 +-- .../Tabs/Count/CountRequestBuilder.php | 22 +- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../Tabs/Item/TeamsTabItemRequestBuilder.php | 57 ++-- .../Tabs/TabsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../OfferShiftRequestItemRequestBuilder.php | 57 ++-- .../OfferShiftRequestsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...enShiftChangeRequestItemRequestBuilder.php | 57 ++-- .../OpenShiftChangeRequestsRequestBuilder.php | 39 +-- .../OpenShifts/Count/CountRequestBuilder.php | 22 +- .../Item/OpenShiftItemRequestBuilder.php | 57 ++-- .../OpenShifts/OpenShiftsRequestBuilder.php | 39 +-- .../Item/Schedule/ScheduleRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../SchedulingGroupItemRequestBuilder.php | 57 ++-- .../SchedulingGroupsRequestBuilder.php | 39 +-- .../Schedule/Share/ShareRequestBuilder.php | 19 +- .../Shifts/Count/CountRequestBuilder.php | 22 +- .../Shifts/Item/ShiftItemRequestBuilder.php | 57 ++-- .../Schedule/Shifts/ShiftsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...pShiftsChangeRequestItemRequestBuilder.php | 57 ++-- ...SwapShiftsChangeRequestsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/TimeOffReasonItemRequestBuilder.php | 57 ++-- .../TimeOffReasonsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/TimeOffRequestItemRequestBuilder.php | 57 ++-- .../TimeOffRequestsRequestBuilder.php | 39 +-- .../TimesOff/Count/CountRequestBuilder.php | 22 +- .../Item/TimeOffItemRequestBuilder.php | 57 ++-- .../TimesOff/TimesOffRequestBuilder.php | 39 +-- ...SendActivityNotificationRequestBuilder.php | 19 +- .../Item/Tags/Count/CountRequestBuilder.php | 22 +- .../Members/Count/CountRequestBuilder.php | 22 +- .../TeamworkTagMemberItemRequestBuilder.php | 57 ++-- .../Item/Members/MembersRequestBuilder.php | 39 +-- .../Item/TeamworkTagItemRequestBuilder.php | 57 ++-- .../Item/Tags/TagsRequestBuilder.php | 39 +-- .../Item/TeamItemRequestBuilder.php | 57 ++-- .../Item/Template/TemplateRequestBuilder.php | 20 +- .../Unarchive/UnarchiveRequestBuilder.php | 19 +- .../JoinedTeams/JoinedTeamsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/LicenseDetailsItemRequestBuilder.php | 57 ++-- .../LicenseDetailsRequestBuilder.php | 39 +-- .../MailFolders/Count/CountRequestBuilder.php | 22 +- .../MailFolders/Delta/DeltaRequestBuilder.php | 20 +- .../ChildFoldersRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Delta/DeltaRequestBuilder.php | 20 +- .../Item/Copy/CopyRequestBuilder.php | 20 +- .../Item/MailFolderItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/MessageRuleItemRequestBuilder.php | 57 ++-- .../MessageRulesRequestBuilder.php | 39 +-- .../Messages/Count/CountRequestBuilder.php | 22 +- .../Messages/Delta/DeltaRequestBuilder.php | 20 +- .../Attachments/AttachmentsRequestBuilder.php | 45 ++- ...hmentsRequestBuilderGetQueryParameters.php | 2 +- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Messages/Item/Copy/CopyRequestBuilder.php | 20 +- .../CreateForwardRequestBuilder.php | 20 +- .../CreateReply/CreateReplyRequestBuilder.php | 20 +- .../CreateReplyAllRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Item/MessageItemRequestBuilder.php | 57 ++-- .../Messages/Item/Move/MoveRequestBuilder.php | 20 +- .../Item/Reply/ReplyRequestBuilder.php | 19 +- .../Item/ReplyAll/ReplyAllRequestBuilder.php | 19 +- .../Messages/Item/Send/SendRequestBuilder.php | 19 +- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Item/Messages/MessagesRequestBuilder.php | 39 +-- .../Item/Move/MoveRequestBuilder.php | 20 +- .../Item/Copy/CopyRequestBuilder.php | 20 +- .../Item/MailFolderItemRequestBuilder.php | 63 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/MessageRuleItemRequestBuilder.php | 57 ++-- .../MessageRulesRequestBuilder.php | 39 +-- .../Messages/Count/CountRequestBuilder.php | 22 +- .../Messages/Delta/DeltaRequestBuilder.php | 20 +- .../Attachments/AttachmentsRequestBuilder.php | 45 ++- ...hmentsRequestBuilderGetQueryParameters.php | 2 +- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Messages/Item/Copy/CopyRequestBuilder.php | 20 +- .../CreateForwardRequestBuilder.php | 20 +- .../CreateReply/CreateReplyRequestBuilder.php | 20 +- .../CreateReplyAllRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Item/MessageItemRequestBuilder.php | 57 ++-- .../Messages/Item/Move/MoveRequestBuilder.php | 20 +- .../Item/Reply/ReplyRequestBuilder.php | 19 +- .../Item/ReplyAll/ReplyAllRequestBuilder.php | 19 +- .../Messages/Item/Send/SendRequestBuilder.php | 19 +- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Item/Messages/MessagesRequestBuilder.php | 39 +-- .../Item/Move/MoveRequestBuilder.php | 20 +- .../MailFolders/MailFoldersRequestBuilder.php | 39 +-- .../MailboxSettingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- ...nagedAppRegistrationItemRequestBuilder.php | 20 +- .../ManagedAppRegistrationsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../BypassActivationLockRequestBuilder.php | 19 +- .../CleanWindowsDeviceRequestBuilder.php | 19 +- ...serFromSharedAppleDeviceRequestBuilder.php | 19 +- .../DeviceCategoryRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...ceCompliancePolicyStatesRequestBuilder.php | 39 +-- ...ompliancePolicyStateItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- ...eviceConfigurationStatesRequestBuilder.php | 39 +-- ...ceConfigurationStateItemRequestBuilder.php | 57 ++-- .../DisableLostModeRequestBuilder.php | 19 +- .../LocateDeviceRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../CreateDownloadUrlRequestBuilder.php | 20 +- ...ogCollectionResponseItemRequestBuilder.php | 57 ++-- .../LogCollectionRequestsRequestBuilder.php | 39 +-- ...redAppleDeviceActiveUserRequestBuilder.php | 19 +- .../Item/ManagedDeviceItemRequestBuilder.php | 57 ++-- .../RebootNow/RebootNowRequestBuilder.php | 19 +- .../RecoverPasscodeRequestBuilder.php | 19 +- .../RemoteLock/RemoteLockRequestBuilder.php | 19 +- .../RequestRemoteAssistanceRequestBuilder.php | 19 +- .../ResetPasscodeRequestBuilder.php | 19 +- .../Item/Retire/RetireRequestBuilder.php | 19 +- .../Item/ShutDown/ShutDownRequestBuilder.php | 19 +- .../SyncDevice/SyncDeviceRequestBuilder.php | 19 +- ...dateWindowsDeviceAccountRequestBuilder.php | 19 +- .../Item/Users/UsersRequestBuilder.php | 20 +- .../WindowsDefenderScanRequestBuilder.php | 19 +- ...DefenderUpdateSignaturesRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../DetectedMalwareStateRequestBuilder.php | 39 +-- ...wsDeviceMalwareStateItemRequestBuilder.php | 57 ++-- .../WindowsProtectionStateRequestBuilder.php | 57 ++-- .../Item/Wipe/WipeRequestBuilder.php | 19 +- .../ManagedDevicesRequestBuilder.php | 39 +-- .../Item/Manager/ManagerRequestBuilder.php | 38 +-- .../Item/Manager/Ref/RefRequestBuilder.php | 58 ++-- .../MemberOf/Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphDirectoryRoleRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphDirectoryRoleRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Item/MemberOf/MemberOfRequestBuilder.php | 20 +- .../Messages/Count/CountRequestBuilder.php | 22 +- .../Messages/Delta/DeltaRequestBuilder.php | 20 +- .../Attachments/AttachmentsRequestBuilder.php | 45 ++- ...hmentsRequestBuilderGetQueryParameters.php | 2 +- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentItemRequestBuilder.php | 38 +-- .../Messages/Item/Copy/CopyRequestBuilder.php | 20 +- .../CreateForwardRequestBuilder.php | 20 +- .../CreateReply/CreateReplyRequestBuilder.php | 20 +- .../CreateReplyAllRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Forward/ForwardRequestBuilder.php | 19 +- .../Item/MessageItemRequestBuilder.php | 69 ++-- .../Messages/Item/Move/MoveRequestBuilder.php | 20 +- .../Item/Reply/ReplyRequestBuilder.php | 19 +- .../Item/ReplyAll/ReplyAllRequestBuilder.php | 19 +- .../Messages/Item/Send/SendRequestBuilder.php | 19 +- .../Item/Value/ContentRequestBuilder.php | 45 ++- .../Item/Messages/MessagesRequestBuilder.php | 47 ++- .../Count/CountRequestBuilder.php | 22 +- ...Auth2PermissionGrantItemRequestBuilder.php | 20 +- .../Oauth2PermissionGrantsRequestBuilder.php | 20 +- .../Notebooks/Count/CountRequestBuilder.php | 22 +- .../GetNotebookFromWebUrlRequestBuilder.php | 20 +- ...IncludePersonalNotebooksRequestBuilder.php | 20 +- .../CopyNotebookRequestBuilder.php | 20 +- .../Item/NotebookItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/SectionGroupItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/SectionGroupItemRequestBuilder.php | 20 +- .../SectionGroupsRequestBuilder.php | 20 +- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/Sections/SectionsRequestBuilder.php | 39 +-- .../SectionGroupsRequestBuilder.php | 39 +-- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/Sections/SectionsRequestBuilder.php | 39 +-- .../Notebooks/NotebooksRequestBuilder.php | 39 +-- .../Item/Onenote/OnenoteRequestBuilder.php | 57 ++-- .../Operations/Count/CountRequestBuilder.php | 22 +- .../OnenoteOperationItemRequestBuilder.php | 57 ++-- .../Operations/OperationsRequestBuilder.php | 39 +-- .../Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Onenote/Pages/PagesRequestBuilder.php | 39 +-- .../Resources/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../OnenoteResourceItemRequestBuilder.php | 57 ++-- .../Resources/ResourcesRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/SectionGroupItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/SectionGroupItemRequestBuilder.php | 20 +- .../SectionGroupsRequestBuilder.php | 20 +- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Item/Sections/SectionsRequestBuilder.php | 39 +-- .../SectionGroupsRequestBuilder.php | 39 +-- .../Sections/Count/CountRequestBuilder.php | 22 +- .../CopyToNotebookRequestBuilder.php | 20 +- .../CopyToSectionGroupRequestBuilder.php | 20 +- .../Item/OnenoteSectionItemRequestBuilder.php | 57 ++-- .../Item/Pages/Count/CountRequestBuilder.php | 22 +- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../CopyToSectionRequestBuilder.php | 20 +- .../Item/OnenotePageItemRequestBuilder.php | 57 ++-- .../OnenotePatchContentRequestBuilder.php | 19 +- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionRequestBuilder.php | 20 +- .../Item/Preview/PreviewRequestBuilder.php | 20 +- .../Item/Pages/PagesRequestBuilder.php | 39 +-- .../ParentNotebookRequestBuilder.php | 20 +- .../ParentSectionGroupRequestBuilder.php | 20 +- .../Sections/SectionsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../CreateOrGet/CreateOrGetRequestBuilder.php | 20 +- .../AttendanceReportsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AttendanceRecordsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AttendanceRecordItemRequestBuilder.php | 57 ++-- ...tingAttendanceReportItemRequestBuilder.php | 57 ++-- .../AttendeeReportRequestBuilder.php | 43 ++- ...ualAppointmentJoinWebUrlRequestBuilder.php | 20 +- .../Item/OnlineMeetingItemRequestBuilder.php | 57 ++-- .../Transcripts/Count/CountRequestBuilder.php | 22 +- .../Item/CallTranscriptItemRequestBuilder.php | 57 ++-- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../MetadataContentRequestBuilder.php | 43 ++- .../Transcripts/TranscriptsRequestBuilder.php | 39 +-- .../OnlineMeetingsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../OutlookCategoryItemRequestBuilder.php | 57 ++-- .../MasterCategoriesRequestBuilder.php | 39 +-- .../Item/Outlook/OutlookRequestBuilder.php | 20 +- .../SupportedLanguagesRequestBuilder.php | 20 +- .../SupportedTimeZonesRequestBuilder.php | 20 +- ...onesWithTimeZoneStandardRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../GraphDevice/Count/CountRequestBuilder.php | 22 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphEndpointRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphEndpointRequestBuilder.php | 20 +- .../OwnedDevicesRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphApplicationRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../GraphServicePrincipalRequestBuilder.php | 20 +- .../OwnedObjectsRequestBuilder.php | 20 +- .../Item/People/Count/CountRequestBuilder.php | 22 +- .../People/Item/PersonItemRequestBuilder.php | 20 +- .../Item/People/PeopleRequestBuilder.php | 20 +- .../Users/Item/Photo/PhotoRequestBuilder.php | 61 ++-- .../PhotoRequestBuilderGetQueryParameters.php | 2 +- .../Photo/Value/ContentRequestBuilder.php | 43 ++- .../Item/ProfilePhotoItemRequestBuilder.php | 20 +- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../Item/Photos/PhotosRequestBuilder.php | 30 +- ...PhotosRequestBuilderGetQueryParameters.php | 10 +- ...sRequestBuilderGetRequestConfiguration.php | 5 +- .../Item/Planner/PlannerRequestBuilder.php | 57 ++-- .../Plans/Count/CountRequestBuilder.php | 22 +- .../Item/Buckets/BucketsRequestBuilder.php | 39 +-- .../Buckets/Count/CountRequestBuilder.php | 22 +- .../Item/PlannerBucketItemRequestBuilder.php | 57 ++-- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- ...ssignedToTaskBoardFormatRequestBuilder.php | 57 ++-- .../BucketTaskBoardFormatRequestBuilder.php | 57 ++-- .../Item/Details/DetailsRequestBuilder.php | 57 ++-- .../Item/PlannerTaskItemRequestBuilder.php | 57 ++-- .../ProgressTaskBoardFormatRequestBuilder.php | 57 ++-- .../Item/Tasks/TasksRequestBuilder.php | 39 +-- .../Item/Details/DetailsRequestBuilder.php | 57 ++-- .../Item/PlannerPlanItemRequestBuilder.php | 57 ++-- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- ...ssignedToTaskBoardFormatRequestBuilder.php | 57 ++-- .../BucketTaskBoardFormatRequestBuilder.php | 57 ++-- .../Item/Details/DetailsRequestBuilder.php | 57 ++-- .../Item/PlannerTaskItemRequestBuilder.php | 57 ++-- .../ProgressTaskBoardFormatRequestBuilder.php | 57 ++-- .../Plans/Item/Tasks/TasksRequestBuilder.php | 39 +-- .../Planner/Plans/PlansRequestBuilder.php | 39 +-- .../Tasks/Count/CountRequestBuilder.php | 22 +- ...ssignedToTaskBoardFormatRequestBuilder.php | 57 ++-- .../BucketTaskBoardFormatRequestBuilder.php | 57 ++-- .../Item/Details/DetailsRequestBuilder.php | 57 ++-- .../Item/PlannerTaskItemRequestBuilder.php | 57 ++-- .../ProgressTaskBoardFormatRequestBuilder.php | 57 ++-- .../Planner/Tasks/TasksRequestBuilder.php | 39 +-- .../ClearPresenceRequestBuilder.php | 19 +- ...earUserPreferredPresenceRequestBuilder.php | 19 +- .../Item/Presence/PresenceRequestBuilder.php | 57 ++-- .../SetPresence/SetPresenceRequestBuilder.php | 19 +- .../SetStatusMessageRequestBuilder.php | 19 +- ...SetUserPreferredPresenceRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../GraphDevice/Count/CountRequestBuilder.php | 22 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphEndpointRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphAppRoleAssignmentRequestBuilder.php | 20 +- .../GraphDevice/GraphDeviceRequestBuilder.php | 20 +- .../GraphEndpointRequestBuilder.php | 20 +- .../RegisteredDevicesRequestBuilder.php | 20 +- ...tDateTimeWithEndDateTimeRequestBuilder.php | 20 +- ...AllDevicesFromManagementRequestBuilder.php | 19 +- ...processLicenseAssignmentRequestBuilder.php | 24 +- .../Item/Restore/RestoreRequestBuilder.php | 20 +- ...RetryServiceProvisioningRequestBuilder.php | 19 +- .../RevokeSignInSessionsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- ...ScopedRoleMembershipItemRequestBuilder.php | 57 ++-- .../ScopedRoleMemberOfRequestBuilder.php | 39 +-- .../Item/SendMail/SendMailRequestBuilder.php | 19 +- .../Count/CountRequestBuilder.php | 22 +- ...erviceProvisioningErrorsRequestBuilder.php | 20 +- .../Item/Settings/SettingsRequestBuilder.php | 57 ++-- .../ShiftPreferencesRequestBuilder.php | 57 ++-- .../AssociatedTeamsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../AssociatedTeamInfoItemRequestBuilder.php | 57 ++-- .../Item/Team/TeamRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../InstalledAppsRequestBuilder.php | 39 +-- .../Item/Chat/ChatRequestBuilder.php | 20 +- .../Item/TeamsApp/TeamsAppRequestBuilder.php | 20 +- .../TeamsAppDefinitionRequestBuilder.php | 20 +- ...TeamsAppInstallationItemRequestBuilder.php | 57 ++-- ...SendActivityNotificationRequestBuilder.php | 19 +- .../Item/Teamwork/TeamworkRequestBuilder.php | 57 ++-- .../Todo/Lists/Count/CountRequestBuilder.php | 22 +- .../Todo/Lists/Delta/DeltaRequestBuilder.php | 20 +- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Item/Tasks/Count/CountRequestBuilder.php | 22 +- .../Item/Tasks/Delta/DeltaRequestBuilder.php | 20 +- .../AttachmentSessionsRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../AttachmentSessionItemRequestBuilder.php | 57 ++-- .../Item/Content/ContentRequestBuilder.php | 42 ++- .../Attachments/AttachmentsRequestBuilder.php | 39 +-- .../Attachments/Count/CountRequestBuilder.php | 22 +- .../CreateUploadSessionRequestBuilder.php | 20 +- .../Item/AttachmentBaseItemRequestBuilder.php | 38 +-- .../Item/Value/ContentRequestBuilder.php | 43 ++- .../ChecklistItemsRequestBuilder.php | 39 +-- .../Count/CountRequestBuilder.php | 22 +- .../Item/ChecklistItemItemRequestBuilder.php | 57 ++-- .../Extensions/Count/CountRequestBuilder.php | 22 +- .../Extensions/ExtensionsRequestBuilder.php | 39 +-- .../Item/ExtensionItemRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Item/LinkedResourceItemRequestBuilder.php | 57 ++-- .../LinkedResourcesRequestBuilder.php | 39 +-- .../Tasks/Item/TodoTaskItemRequestBuilder.php | 57 ++-- .../Lists/Item/Tasks/TasksRequestBuilder.php | 39 +-- .../Item/TodoTaskListItemRequestBuilder.php | 57 ++-- .../Item/Todo/Lists/ListsRequestBuilder.php | 39 +-- .../Users/Item/Todo/TodoRequestBuilder.php | 57 ++-- .../Count/CountRequestBuilder.php | 22 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../Count/CountRequestBuilder.php | 22 +- .../GraphDirectoryRoleRequestBuilder.php | 20 +- .../GraphGroup/Count/CountRequestBuilder.php | 22 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../DirectoryObjectItemRequestBuilder.php | 20 +- .../GraphAdministrativeUnitRequestBuilder.php | 20 +- .../GraphDirectoryRoleRequestBuilder.php | 20 +- .../GraphGroup/GraphGroupRequestBuilder.php | 20 +- .../TransitiveMemberOfRequestBuilder.php | 20 +- .../TranslateExchangeIdsRequestBuilder.php | 20 +- .../Users/Item/UserItemRequestBuilder.php | 75 ++--- ...erItemRequestBuilderGetQueryParameters.php | 2 +- ...RegistrationsByDeviceTagRequestBuilder.php | 19 +- src/Generated/Users/UsersRequestBuilder.php | 45 ++- .../ValidatePropertiesRequestBuilder.php | 19 +- src/Generated/kiota-lock.json | 12 +- 7929 files changed, 104249 insertions(+), 134529 deletions(-) rename src/Generated/{Users/Item/Photos => Directory/DeviceLocalCredentials}/Count/CountRequestBuilder.php (80%) rename src/Generated/{Users/Item/Photos => Directory/DeviceLocalCredentials}/Count/CountRequestBuilderGetQueryParameters.php (55%) rename src/Generated/{Users/Item/Photos => Directory/DeviceLocalCredentials}/Count/CountRequestBuilderGetRequestConfiguration.php (86%) create mode 100644 src/Generated/Directory/DeviceLocalCredentials/DeviceLocalCredentialsRequestBuilder.php create mode 100644 src/Generated/Directory/DeviceLocalCredentials/DeviceLocalCredentialsRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/Directory/DeviceLocalCredentials/DeviceLocalCredentialsRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/Directory/DeviceLocalCredentials/DeviceLocalCredentialsRequestBuilderPostRequestConfiguration.php create mode 100644 src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilder.php create mode 100644 src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderDeleteRequestConfiguration.php create mode 100644 src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderPatchRequestConfiguration.php create mode 100644 src/Generated/Groups/Item/Sites/Delta/DeltaGetResponse.php create mode 100644 src/Generated/Groups/Item/Sites/Delta/DeltaRequestBuilder.php create mode 100644 src/Generated/Groups/Item/Sites/Delta/DeltaRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/Groups/Item/Sites/Delta/DeltaRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/Models/AzureCommunicationServicesUserIdentity.php create mode 100644 src/Generated/Models/ChannelSummary.php create mode 100644 src/Generated/Models/CommunicationsApplicationIdentity.php create mode 100644 src/Generated/Models/CommunicationsApplicationInstanceIdentity.php create mode 100644 src/Generated/Models/CommunicationsEncryptedIdentity.php create mode 100644 src/Generated/Models/CommunicationsGuestIdentity.php create mode 100644 src/Generated/Models/CommunicationsIdentitySet.php create mode 100644 src/Generated/Models/CommunicationsPhoneIdentity.php create mode 100644 src/Generated/Models/CommunicationsUserIdentity.php create mode 100644 src/Generated/Models/DeviceLocalCredential.php create mode 100644 src/Generated/Models/DeviceLocalCredentialInfo.php create mode 100644 src/Generated/Models/DeviceLocalCredentialInfoCollectionResponse.php create mode 100644 src/Generated/Models/RemoteDesktopSecurityConfiguration.php create mode 100644 src/Generated/Models/Security/HostPort.php create mode 100644 src/Generated/Models/Security/HostPortBanner.php create mode 100644 src/Generated/Models/Security/HostPortCollectionResponse.php create mode 100644 src/Generated/Models/Security/HostPortComponent.php create mode 100644 src/Generated/Models/Security/HostPortProtocol.php create mode 100644 src/Generated/Models/Security/HostPortStatus.php create mode 100644 src/Generated/Models/Security/KubernetesSecretEvidence.php create mode 100644 src/Generated/Models/TargetDeviceGroup.php create mode 100644 src/Generated/Models/TargetDeviceGroupCollectionResponse.php rename src/Generated/{Groups/Item/Photos => Security/ThreatIntelligence/HostPorts}/Count/CountRequestBuilder.php (80%) rename src/Generated/{Groups/Item/Photos => Security/ThreatIntelligence/HostPorts}/Count/CountRequestBuilderGetQueryParameters.php (55%) rename src/Generated/{Groups/Item/Photos => Security/ThreatIntelligence/HostPorts}/Count/CountRequestBuilderGetRequestConfiguration.php (86%) create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/HostPortsRequestBuilder.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/HostPortsRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/HostPortsRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/HostPortsRequestBuilderPostRequestConfiguration.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/Item/Host/HostRequestBuilder.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/Item/Host/HostRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/Item/Host/HostRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilder.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderDeleteRequestConfiguration.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderPatchRequestConfiguration.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/Item/MostRecentSslCertificate/MostRecentSslCertificateRequestBuilder.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/Item/MostRecentSslCertificate/MostRecentSslCertificateRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/Security/ThreatIntelligence/HostPorts/Item/MostRecentSslCertificate/MostRecentSslCertificateRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Count/CountRequestBuilder.php create mode 100644 src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Count/CountRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Count/CountRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Item/HostPortItemRequestBuilder.php create mode 100644 src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Item/HostPortItemRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Item/HostPortItemRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/PortsRequestBuilder.php create mode 100644 src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/PortsRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/PortsRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilder.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderDeleteRequestConfiguration.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderPatchRequestConfiguration.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Count/CountRequestBuilder.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Count/CountRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Count/CountRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilder.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderDeleteRequestConfiguration.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderPatchRequestConfiguration.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilder.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilderGetRequestConfiguration.php create mode 100644 src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilderPostRequestConfiguration.php create mode 100644 src/Generated/Sites/Delta/DeltaGetResponse.php create mode 100644 src/Generated/Sites/Delta/DeltaRequestBuilder.php create mode 100644 src/Generated/Sites/Delta/DeltaRequestBuilderGetQueryParameters.php create mode 100644 src/Generated/Sites/Delta/DeltaRequestBuilderGetRequestConfiguration.php diff --git a/src/Generated/Admin/AdminRequestBuilder.php b/src/Generated/Admin/AdminRequestBuilder.php index 4a0292d971c..c67f8e6dd5f 100644 --- a/src/Generated/Admin/AdminRequestBuilder.php +++ b/src/Generated/Admin/AdminRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\Edge\EdgeRequestBuilder; use Microsoft\Graph\Generated\Admin\People\PeopleRequestBuilder; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\ServiceAnnouncementRequestBuilder; @@ -66,38 +65,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get admin * @param AdminRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AdminRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Admin::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Admin::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update admin * @param Admin $body The request body * @param AdminRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Admin $body, ?AdminRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Admin::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Admin::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?AdminRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?AdminRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPatchRequestInformation(Admin $body, ?AdminRequestBuilderPatch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/Edge/EdgeRequestBuilder.php b/src/Generated/Admin/Edge/EdgeRequestBuilder.php index 51094104227..aad07f162a4 100644 --- a/src/Generated/Admin/Edge/EdgeRequestBuilder.php +++ b/src/Generated/Admin/Edge/EdgeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\Edge\InternetExplorerMode\InternetExplorerModeRequestBuilder; use Microsoft\Graph\Generated\Models\Edge; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property edge for admin * @param EdgeRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EdgeRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A container for Microsoft Edge resources. Read-only. * @param EdgeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EdgeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Edge::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Edge::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property edge in admin * @param Edge $body The request body * @param EdgeRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Edge $body, ?EdgeRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Edge::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Edge::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?EdgeRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?EdgeRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?EdgeRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Edge $body, ?EdgeRequestBuilderPatchRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/Edge/InternetExplorerMode/InternetExplorerModeRequestBuilder.php b/src/Generated/Admin/Edge/InternetExplorerMode/InternetExplorerModeRequestBuilder.php index 6736a7ebec6..d3447e0dbf8 100644 --- a/src/Generated/Admin/Edge/InternetExplorerMode/InternetExplorerModeRequestBuilder.php +++ b/src/Generated/Admin/Edge/InternetExplorerMode/InternetExplorerModeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\Edge\InternetExplorerMode\SiteLists\SiteListsRequestBuilder; use Microsoft\Graph\Generated\Models\InternetExplorerMode; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property internetExplorerMode for admin * @param InternetExplorerModeRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?InternetExplorerModeRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A container for Internet Explorer mode resources. * @param InternetExplorerModeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InternetExplorerModeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InternetExplorerMode::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InternetExplorerMode::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property internetExplorerMode in admin * @param InternetExplorerMode $body The request body * @param InternetExplorerModeRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(InternetExplorerMode $body, ?InternetExplorerModeRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InternetExplorerMode::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InternetExplorerMode::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?InternetExplorerModeRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?InternetExplorerModeRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?InternetExplorerModeRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(InternetExplorerMode $body, ?InternetE $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Count/CountRequestBuilder.php b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Count/CountRequestBuilder.php index 78968ab228b..ddbdf03c301 100644 --- a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Count/CountRequestBuilder.php +++ b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/BrowserSiteListItemRequestBuilder.php b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/BrowserSiteListItemRequestBuilder.php index 14623bd8899..1b64027f350 100644 --- a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/BrowserSiteListItemRequestBuilder.php +++ b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/BrowserSiteListItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\Edge\InternetExplorerMode\SiteLists\Item\Publish\PublishRequestBuilder; use Microsoft\Graph\Generated\Admin\Edge\InternetExplorerMode\SiteLists\Item\SharedCookies\SharedCookiesRequestBuilder; use Microsoft\Graph\Generated\Admin\Edge\InternetExplorerMode\SiteLists\Item\Sites\SitesRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a browserSiteList object. This API is available in the following national cloud deployments. * @param BrowserSiteListItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/internetexplorermode-delete-sitelists?view=graph-rest-1.0 Find more info here */ public function delete(?BrowserSiteListItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a browserSiteList that contains browserSite and browserSharedCookie resources. This API is available in the following national cloud deployments. * @param BrowserSiteListItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/browsersitelist-get?view=graph-rest-1.0 Find more info here */ public function get(?BrowserSiteListItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BrowserSiteList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BrowserSiteList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a browserSiteList object. This API is available in the following national cloud deployments. * @param BrowserSiteList $body The request body * @param BrowserSiteListItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/browsersitelist-update?view=graph-rest-1.0 Find more info here */ public function patch(BrowserSiteList $body, ?BrowserSiteListItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BrowserSiteList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BrowserSiteList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?BrowserSiteListItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?BrowserSiteListItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?BrowserSiteListItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(BrowserSiteList $body, ?BrowserSiteLis $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Publish/PublishRequestBuilder.php b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Publish/PublishRequestBuilder.php index a2b032d6f3a..9876c0418d5 100644 --- a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Publish/PublishRequestBuilder.php +++ b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Publish/PublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BrowserSiteList; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Publish the specified browserSiteList for devices to download. This API is available in the following national cloud deployments. * @param PublishPostRequestBody $body The request body * @param PublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/browsersitelist-publish?view=graph-rest-1.0 Find more info here */ public function post(PublishPostRequestBody $body, ?PublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BrowserSiteList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BrowserSiteList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(PublishPostRequestBody $body, ?PublishR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/SharedCookies/Count/CountRequestBuilder.php b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/SharedCookies/Count/CountRequestBuilder.php index 160f073e588..056015fdf33 100644 --- a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/SharedCookies/Count/CountRequestBuilder.php +++ b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/SharedCookies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/SharedCookies/Item/BrowserSharedCookieItemRequestBuilder.php b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/SharedCookies/Item/BrowserSharedCookieItemRequestBuilder.php index 8bf5d21c4cb..98eb4eeaed7 100644 --- a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/SharedCookies/Item/BrowserSharedCookieItemRequestBuilder.php +++ b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/SharedCookies/Item/BrowserSharedCookieItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BrowserSharedCookie; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a browserSharedCookie from a browserSiteList. This API is available in the following national cloud deployments. * @param BrowserSharedCookieItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/browsersitelist-delete-sharedcookies?view=graph-rest-1.0 Find more info here */ public function delete(?BrowserSharedCookieItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a session cookie that can be shared between a Microsoft Edge process and an Internet Explorer process, while using Internet Explorer mode. This API is available in the following national cloud deployments. * @param BrowserSharedCookieItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/browsersharedcookie-get?view=graph-rest-1.0 Find more info here */ public function get(?BrowserSharedCookieItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BrowserSharedCookie::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BrowserSharedCookie::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a browserSharedCookie object. This API is available in the following national cloud deployments. * @param BrowserSharedCookie $body The request body * @param BrowserSharedCookieItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/browsersharedcookie-update?view=graph-rest-1.0 Find more info here */ public function patch(BrowserSharedCookie $body, ?BrowserSharedCookieItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BrowserSharedCookie::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BrowserSharedCookie::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?BrowserSharedCookieItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?BrowserSharedCookieItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?BrowserSharedCookieItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(BrowserSharedCookie $body, ?BrowserSha $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/SharedCookies/SharedCookiesRequestBuilder.php b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/SharedCookies/SharedCookiesRequestBuilder.php index cfa83d27e76..a7cec456501 100644 --- a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/SharedCookies/SharedCookiesRequestBuilder.php +++ b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/SharedCookies/SharedCookiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\Edge\InternetExplorerMode\SiteLists\Item\SharedCookies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Admin\Edge\InternetExplorerMode\SiteLists\Item\SharedCookies\Item\BrowserSharedCookieItemRequestBuilder; use Microsoft\Graph\Generated\Models\BrowserSharedCookie; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the browserSharedCookie objects and their properties. This API is available in the following national cloud deployments. * @param SharedCookiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/browsersitelist-list-sharedcookies?view=graph-rest-1.0 Find more info here */ public function get(?SharedCookiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BrowserSharedCookieCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BrowserSharedCookieCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new browserSharedCookie object in a browserSiteList. This API is available in the following national cloud deployments. * @param BrowserSharedCookie $body The request body * @param SharedCookiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/browsersitelist-post-sharedcookies?view=graph-rest-1.0 Find more info here */ public function post(BrowserSharedCookie $body, ?SharedCookiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BrowserSharedCookie::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BrowserSharedCookie::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SharedCookiesRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SharedCookiesRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(BrowserSharedCookie $body, ?SharedCooki $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Sites/Count/CountRequestBuilder.php b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Sites/Count/CountRequestBuilder.php index 55e038eb59f..6760e32ea50 100644 --- a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Sites/Count/CountRequestBuilder.php +++ b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Sites/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Sites/Item/BrowserSiteItemRequestBuilder.php b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Sites/Item/BrowserSiteItemRequestBuilder.php index b7ddd604ee0..6ca10e8a3a2 100644 --- a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Sites/Item/BrowserSiteItemRequestBuilder.php +++ b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Sites/Item/BrowserSiteItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BrowserSite; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a browserSite from a browserSiteList. This API is available in the following national cloud deployments. * @param BrowserSiteItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/browsersitelist-delete-sites?view=graph-rest-1.0 Find more info here */ public function delete(?BrowserSiteItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a browserSite that resides on a browserSiteList. This API is available in the following national cloud deployments. * @param BrowserSiteItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/browsersite-get?view=graph-rest-1.0 Find more info here */ public function get(?BrowserSiteItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BrowserSite::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BrowserSite::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a browserSite object. This API is available in the following national cloud deployments. * @param BrowserSite $body The request body * @param BrowserSiteItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/browsersite-update?view=graph-rest-1.0 Find more info here */ public function patch(BrowserSite $body, ?BrowserSiteItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BrowserSite::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BrowserSite::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?BrowserSiteItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?BrowserSiteItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?BrowserSiteItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(BrowserSite $body, ?BrowserSiteItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Sites/SitesRequestBuilder.php b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Sites/SitesRequestBuilder.php index 55fa8bec7b3..1e552fe9205 100644 --- a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Sites/SitesRequestBuilder.php +++ b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/Item/Sites/SitesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\Edge\InternetExplorerMode\SiteLists\Item\Sites\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Admin\Edge\InternetExplorerMode\SiteLists\Item\Sites\Item\BrowserSiteItemRequestBuilder; use Microsoft\Graph\Generated\Models\BrowserSite; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the browserSite objects and their properties. This API is available in the following national cloud deployments. * @param SitesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/browsersitelist-list-sites?view=graph-rest-1.0 Find more info here */ public function get(?SitesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BrowserSiteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BrowserSiteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new browserSite object in a browserSiteList. This API is available in the following national cloud deployments. * @param BrowserSite $body The request body * @param SitesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/browsersitelist-post-sites?view=graph-rest-1.0 Find more info here */ public function post(BrowserSite $body, ?SitesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BrowserSite::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BrowserSite::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SitesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SitesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(BrowserSite $body, ?SitesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/SiteListsRequestBuilder.php b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/SiteListsRequestBuilder.php index c7d1a8cc70d..dba1778994e 100644 --- a/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/SiteListsRequestBuilder.php +++ b/src/Generated/Admin/Edge/InternetExplorerMode/SiteLists/SiteListsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\Edge\InternetExplorerMode\SiteLists\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Admin\Edge\InternetExplorerMode\SiteLists\Item\BrowserSiteListItemRequestBuilder; use Microsoft\Graph\Generated\Models\BrowserSiteList; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the browserSiteList objects and their properties. This API is available in the following national cloud deployments. * @param SiteListsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/internetexplorermode-list-sitelists?view=graph-rest-1.0 Find more info here */ public function get(?SiteListsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BrowserSiteListCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BrowserSiteListCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new browserSiteList object to support Internet Explorer mode. This API is available in the following national cloud deployments. * @param BrowserSiteList $body The request body * @param SiteListsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/internetexplorermode-post-sitelists?view=graph-rest-1.0 Find more info here */ public function post(BrowserSiteList $body, ?SiteListsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BrowserSiteList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BrowserSiteList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SiteListsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SiteListsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(BrowserSiteList $body, ?SiteListsReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/People/PeopleRequestBuilder.php b/src/Generated/Admin/People/PeopleRequestBuilder.php index f621178533d..c176005922e 100644 --- a/src/Generated/Admin/People/PeopleRequestBuilder.php +++ b/src/Generated/Admin/People/PeopleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\People\ProfileCardProperties\ProfileCardPropertiesRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PeopleAdminSettings; @@ -42,38 +41,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get people from admin * @param PeopleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PeopleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PeopleAdminSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PeopleAdminSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property people in admin * @param PeopleAdminSettings $body The request body * @param PeopleRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PeopleAdminSettings $body, ?PeopleRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PeopleAdminSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PeopleAdminSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -86,7 +79,6 @@ public function toGetRequestInformation(?PeopleRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -94,6 +86,7 @@ public function toGetRequestInformation(?PeopleRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -108,11 +101,11 @@ public function toPatchRequestInformation(PeopleAdminSettings $body, ?PeopleRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/People/ProfileCardProperties/Count/CountRequestBuilder.php b/src/Generated/Admin/People/ProfileCardProperties/Count/CountRequestBuilder.php index 4572c80ef45..94692d8d165 100644 --- a/src/Generated/Admin/People/ProfileCardProperties/Count/CountRequestBuilder.php +++ b/src/Generated/Admin/People/ProfileCardProperties/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Admin/People/ProfileCardProperties/Item/ProfileCardPropertyItemRequestBuilder.php b/src/Generated/Admin/People/ProfileCardProperties/Item/ProfileCardPropertyItemRequestBuilder.php index 5eebdec8eb8..782aed3f52f 100644 --- a/src/Generated/Admin/People/ProfileCardProperties/Item/ProfileCardPropertyItemRequestBuilder.php +++ b/src/Generated/Admin/People/ProfileCardProperties/Item/ProfileCardPropertyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProfileCardProperty; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property profileCardProperties for admin * @param ProfileCardPropertyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ProfileCardPropertyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get profileCardProperties from admin * @param ProfileCardPropertyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ProfileCardPropertyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfileCardProperty::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfileCardProperty::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property profileCardProperties in admin * @param ProfileCardProperty $body The request body * @param ProfileCardPropertyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ProfileCardProperty $body, ?ProfileCardPropertyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfileCardProperty::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfileCardProperty::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ProfileCardPropertyItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ProfileCardPropertyItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ProfileCardPropertyItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ProfileCardProperty $body, ?ProfileCar $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/People/ProfileCardProperties/ProfileCardPropertiesRequestBuilder.php b/src/Generated/Admin/People/ProfileCardProperties/ProfileCardPropertiesRequestBuilder.php index 9ee4894f591..b1da2e09722 100644 --- a/src/Generated/Admin/People/ProfileCardProperties/ProfileCardPropertiesRequestBuilder.php +++ b/src/Generated/Admin/People/ProfileCardProperties/ProfileCardPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\People\ProfileCardProperties\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Admin\People\ProfileCardProperties\Item\ProfileCardPropertyItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get profileCardProperties from admin * @param ProfileCardPropertiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ProfileCardPropertiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfileCardPropertyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfileCardPropertyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to profileCardProperties for admin * @param ProfileCardProperty $body The request body * @param ProfileCardPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ProfileCardProperty $body, ?ProfileCardPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfileCardProperty::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfileCardProperty::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ProfileCardPropertiesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ProfileCardPropertiesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ProfileCardProperty $body, ?ProfileCard $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Count/CountRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Count/CountRequestBuilder.php index a56c45b7c3a..919cd1a9f93 100644 --- a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Count/CountRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/HealthOverviewsRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/HealthOverviewsRequestBuilder.php index ce5ef09ce0f..b3d81a4e9d9 100644 --- a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/HealthOverviewsRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/HealthOverviewsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\HealthOverviews\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\HealthOverviews\Item\ServiceHealthItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the serviceHealth resources from the healthOverviews navigation property. This operation provides the health report of all subscribed services for a tenant. This API is available in the following national cloud deployments. * @param HealthOverviewsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceannouncement-list-healthoverviews?view=graph-rest-1.0 Find more info here */ public function get(?HealthOverviewsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to healthOverviews for admin * @param ServiceHealth $body The request body * @param HealthOverviewsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ServiceHealth $body, ?HealthOverviewsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealth::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealth::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HealthOverviewsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HealthOverviewsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ServiceHealth $body, ?HealthOverviewsRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/Count/CountRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/Count/CountRequestBuilder.php index 1d5cdc5fb1e..02396514c98 100644 --- a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/Count/CountRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/IssuesRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/IssuesRequestBuilder.php index ac7750eae2a..897dc323160 100644 --- a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/IssuesRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/IssuesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\HealthOverviews\Item\Issues\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\HealthOverviews\Item\Issues\Item\ServiceHealthIssueItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A collection of issues that happened on the service, with detailed information for each issue. * @param IssuesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IssuesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssueCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssueCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to issues for admin * @param ServiceHealthIssue $body The request body * @param IssuesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ServiceHealthIssue $body, ?IssuesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssue::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssue::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?IssuesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?IssuesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ServiceHealthIssue $body, ?IssuesReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/Item/IncidentReport/IncidentReportRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/Item/IncidentReport/IncidentReportRequestBuilder.php index d81118bc1a6..2ac7946d2aa 100644 --- a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/Item/IncidentReport/IncidentReportRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/Item/IncidentReport/IncidentReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function incidentReport * @param IncidentReportRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IncidentReportRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -63,6 +61,7 @@ public function toGetRequestInformation(?IncidentReportRequestBuilderGetRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/Item/ServiceHealthIssueItemRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/Item/ServiceHealthIssueItemRequestBuilder.php index 063644e44a6..cf1d53d7f7f 100644 --- a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/Item/ServiceHealthIssueItemRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/Issues/Item/ServiceHealthIssueItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\HealthOverviews\Item\Issues\Item\IncidentReport\IncidentReportRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceHealthIssue; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property issues for admin * @param ServiceHealthIssueItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ServiceHealthIssueItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of issues that happened on the service, with detailed information for each issue. * @param ServiceHealthIssueItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceHealthIssueItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssue::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssue::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property issues in admin * @param ServiceHealthIssue $body The request body * @param ServiceHealthIssueItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ServiceHealthIssue $body, ?ServiceHealthIssueItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssue::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssue::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ServiceHealthIssueItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ServiceHealthIssueItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ServiceHealthIssueItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ServiceHealthIssue $body, ?ServiceHeal $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/ServiceHealthItemRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/ServiceHealthItemRequestBuilder.php index 9f742196695..13901baee81 100644 --- a/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/ServiceHealthItemRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/HealthOverviews/Item/ServiceHealthItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\HealthOverviews\Item\Issues\IssuesRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceHealth; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property healthOverviews for admin * @param ServiceHealthItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ServiceHealthItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a serviceHealth object. This operation provides the health information of a specified service for a tenant. This API is available in the following national cloud deployments. * @param ServiceHealthItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/servicehealth-get?view=graph-rest-1.0 Find more info here */ public function get(?ServiceHealthItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealth::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealth::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property healthOverviews in admin * @param ServiceHealth $body The request body * @param ServiceHealthItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ServiceHealth $body, ?ServiceHealthItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealth::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealth::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ServiceHealthItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ServiceHealthItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ServiceHealthItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ServiceHealth $body, ?ServiceHealthIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Issues/Count/CountRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Issues/Count/CountRequestBuilder.php index 87d16d3098c..b5b085ab677 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Issues/Count/CountRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Issues/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Issues/IssuesRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Issues/IssuesRequestBuilder.php index e936e7c430e..faf2123b2a2 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Issues/IssuesRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Issues/IssuesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\Issues\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\Issues\Item\ServiceHealthIssueItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve serviceHealthIssue resources from the issues navigation property. This operation retrieves information about all service health issues that exist for the tenant. This API is available in the following national cloud deployments. * @param IssuesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceannouncement-list-issues?view=graph-rest-1.0 Find more info here */ public function get(?IssuesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssueCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssueCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to issues for admin * @param ServiceHealthIssue $body The request body * @param IssuesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ServiceHealthIssue $body, ?IssuesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssue::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssue::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?IssuesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?IssuesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ServiceHealthIssue $body, ?IssuesReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Issues/Item/IncidentReport/IncidentReportRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Issues/Item/IncidentReport/IncidentReportRequestBuilder.php index e51d0cdfb83..acbe5f17ad3 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Issues/Item/IncidentReport/IncidentReportRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Issues/Item/IncidentReport/IncidentReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function incidentReport * @param IncidentReportRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IncidentReportRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -63,6 +61,7 @@ public function toGetRequestInformation(?IncidentReportRequestBuilderGetRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Issues/Item/ServiceHealthIssueItemRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Issues/Item/ServiceHealthIssueItemRequestBuilder.php index aec0557f099..83496477cf4 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Issues/Item/ServiceHealthIssueItemRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Issues/Item/ServiceHealthIssueItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\Issues\Item\IncidentReport\IncidentReportRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceHealthIssue; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property issues for admin * @param ServiceHealthIssueItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ServiceHealthIssueItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a serviceHealthIssue object. This operation retrieves a specified service health issue for tenant. The operation returns an error if the issue does not exist for the tenant. This API is available in the following national cloud deployments. * @param ServiceHealthIssueItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/servicehealthissue-get?view=graph-rest-1.0 Find more info here */ public function get(?ServiceHealthIssueItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssue::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssue::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property issues in admin * @param ServiceHealthIssue $body The request body * @param ServiceHealthIssueItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ServiceHealthIssue $body, ?ServiceHealthIssueItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssue::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceHealthIssue::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ServiceHealthIssueItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ServiceHealthIssueItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ServiceHealthIssueItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ServiceHealthIssue $body, ?ServiceHeal $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/Archive/ArchiveRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/Archive/ArchiveRequestBuilder.php index 3b81f30b42f..209e04bb032 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/Archive/ArchiveRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/Archive/ArchiveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Archive a list of serviceUpdateMessages for the signed in user. This API is available in the following national cloud deployments. * @param ArchivePostRequestBody $body The request body * @param ArchiveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceupdatemessage-archive?view=graph-rest-1.0 Find more info here */ public function post(ArchivePostRequestBody $body, ?ArchiveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ArchivePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ArchivePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ArchivePostRequestBody $body, ?ArchiveR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/Count/CountRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/Count/CountRequestBuilder.php index 35776b4c182..432e14a0e20 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/Count/CountRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/Favorite/FavoriteRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/Favorite/FavoriteRequestBuilder.php index 0f8f06a6836..1f44669f84d 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/Favorite/FavoriteRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/Favorite/FavoriteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Change the status of a list of serviceUpdateMessages to favorite for the signed in user. This API is available in the following national cloud deployments. * @param FavoritePostRequestBody $body The request body * @param FavoriteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceupdatemessage-favorite?view=graph-rest-1.0 Find more info here */ public function post(FavoritePostRequestBody $body, ?FavoriteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FavoritePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FavoritePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(FavoritePostRequestBody $body, ?Favorit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/AttachmentsRequestBuilder.php index d3fee1a6357..89a2a4367a1 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\Messages\Item\Attachments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\Messages\Item\Attachments\Item\ServiceAnnouncementAttachmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of attachments associated with a service message. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceupdatemessage-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncementAttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncementAttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to attachments for admin * @param ServiceAnnouncementAttachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ServiceAnnouncementAttachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncementAttachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncementAttachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ServiceAnnouncementAttachment $body, ?A $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/Count/CountRequestBuilder.php index 008018141e6..29327b74c61 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/Item/Content/ContentRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/Item/Content/ContentRequestBuilder.php index 55722c24de8..8aedbb03778 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceAnnouncementAttachment; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The attachment content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceupdatemessage-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The attachment content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncementAttachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncementAttachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/Item/ServiceAnnouncementAttachmentItemRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/Item/ServiceAnnouncementAttachmentItemRequestBuilder.php index 235f62b3187..65aeae72bc3 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/Item/ServiceAnnouncementAttachmentItemRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/Item/Attachments/Item/ServiceAnnouncementAttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\Messages\Item\Attachments\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceAnnouncementAttachment; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attachments for admin * @param ServiceAnnouncementAttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ServiceAnnouncementAttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a serviceAnnouncementAttachment object. This API is available in the following national cloud deployments. * @param ServiceAnnouncementAttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceannouncementattachment-get?view=graph-rest-1.0 Find more info here */ public function get(?ServiceAnnouncementAttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncementAttachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncementAttachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property attachments in admin * @param ServiceAnnouncementAttachment $body The request body * @param ServiceAnnouncementAttachmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ServiceAnnouncementAttachment $body, ?ServiceAnnouncementAttachmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncementAttachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncementAttachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ServiceAnnouncementAttachmentItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ServiceAnnouncementAttachmentItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ServiceAnnouncementAttachmentItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ServiceAnnouncementAttachment $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/Item/AttachmentsArchive/AttachmentsArchiveRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/Item/AttachmentsArchive/AttachmentsArchiveRequestBuilder.php index 34b9ab891d8..c5a7e08bb9d 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/Item/AttachmentsArchive/AttachmentsArchiveRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/Item/AttachmentsArchive/AttachmentsArchiveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The zip file that contains all attachments for a message. * @param AttachmentsArchiveRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceannouncement-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsArchiveRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The zip file that contains all attachments for a message. * @param StreamInterface $body Binary request body * @param AttachmentsArchiveRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?AttachmentsArchiveRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?AttachmentsArchiveRequestBuilderGetRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?AttachmentsArchi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/Item/ServiceUpdateMessageItemRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/Item/ServiceUpdateMessageItemRequestBuilder.php index a6ef8219ee1..b912ebd5437 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/Item/ServiceUpdateMessageItemRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/Item/ServiceUpdateMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\Messages\Item\Attachments\AttachmentsRequestBuilder; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\Messages\Item\AttachmentsArchive\AttachmentsArchiveRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property messages for admin * @param ServiceUpdateMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ServiceUpdateMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a serviceUpdateMessage object. This operation retrieves a specified service update message for the tenant. The operation returns an error if the message does not exist for the tenant. This API is available in the following national cloud deployments. * @param ServiceUpdateMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceupdatemessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ServiceUpdateMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceUpdateMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceUpdateMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property messages in admin * @param ServiceUpdateMessage $body The request body * @param ServiceUpdateMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ServiceUpdateMessage $body, ?ServiceUpdateMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceUpdateMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceUpdateMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?ServiceUpdateMessageItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?ServiceUpdateMessageItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?ServiceUpdateMessageItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(ServiceUpdateMessage $body, ?ServiceUp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/MarkRead/MarkReadRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/MarkRead/MarkReadRequestBuilder.php index e096bce2c06..256e862cc07 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/MarkRead/MarkReadRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/MarkRead/MarkReadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Mark a list of serviceUpdateMessages as read for the signed in user. This API is available in the following national cloud deployments. * @param MarkReadPostRequestBody $body The request body * @param MarkReadRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceupdatemessage-markread?view=graph-rest-1.0 Find more info here */ public function post(MarkReadPostRequestBody $body, ?MarkReadRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MarkReadPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MarkReadPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MarkReadPostRequestBody $body, ?MarkRea $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/MarkUnread/MarkUnreadRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/MarkUnread/MarkUnreadRequestBuilder.php index 5f1e341baf6..fdce90e303e 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/MarkUnread/MarkUnreadRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/MarkUnread/MarkUnreadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Mark a list of serviceUpdateMessages as unread for the signed in user. This API is available in the following national cloud deployments. * @param MarkUnreadPostRequestBody $body The request body * @param MarkUnreadRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceupdatemessage-markunread?view=graph-rest-1.0 Find more info here */ public function post(MarkUnreadPostRequestBody $body, ?MarkUnreadRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MarkUnreadPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MarkUnreadPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MarkUnreadPostRequestBody $body, ?MarkU $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/MessagesRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/MessagesRequestBuilder.php index c018fa4b2b6..f745a0bf6f9 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/MessagesRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/MessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\Messages\Archive\ArchiveRequestBuilder; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\Messages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\Messages\Favorite\FavoriteRequestBuilder; @@ -103,39 +102,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the serviceUpdateMessage resources from the messages navigation property. This operation retrieves all service update messages that exist for the tenant. This API is available in the following national cloud deployments. * @param MessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceannouncement-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?MessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceUpdateMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceUpdateMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to messages for admin * @param ServiceUpdateMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ServiceUpdateMessage $body, ?MessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceUpdateMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceUpdateMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,7 +141,6 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -156,6 +148,7 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -170,11 +163,11 @@ public function toPostRequestInformation(ServiceUpdateMessage $body, ?MessagesRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/Unarchive/UnarchiveRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/Unarchive/UnarchiveRequestBuilder.php index 3b4b7022730..1ebd0ad3871 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/Unarchive/UnarchiveRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/Unarchive/UnarchiveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Unarchive a list of serviceUpdateMessages for the signed in user. This API is available in the following national cloud deployments. * @param UnarchivePostRequestBody $body The request body * @param UnarchiveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceupdatemessage-unarchive?view=graph-rest-1.0 Find more info here */ public function post(UnarchivePostRequestBody $body, ?UnarchiveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnarchivePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnarchivePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(UnarchivePostRequestBody $body, ?Unarch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/Messages/Unfavorite/UnfavoriteRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/Messages/Unfavorite/UnfavoriteRequestBuilder.php index 1e3e70cf0db..836bd54c995 100644 --- a/src/Generated/Admin/ServiceAnnouncement/Messages/Unfavorite/UnfavoriteRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/Messages/Unfavorite/UnfavoriteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Remove the favorite status of serviceUpdateMessages for the signed in user. This API is available in the following national cloud deployments. * @param UnfavoritePostRequestBody $body The request body * @param UnfavoriteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceupdatemessage-unfavorite?view=graph-rest-1.0 Find more info here */ public function post(UnfavoritePostRequestBody $body, ?UnfavoriteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnfavoritePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnfavoritePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(UnfavoritePostRequestBody $body, ?Unfav $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/ServiceAnnouncement/ServiceAnnouncementRequestBuilder.php b/src/Generated/Admin/ServiceAnnouncement/ServiceAnnouncementRequestBuilder.php index a7c2327b238..07ec0be2e28 100644 --- a/src/Generated/Admin/ServiceAnnouncement/ServiceAnnouncementRequestBuilder.php +++ b/src/Generated/Admin/ServiceAnnouncement/ServiceAnnouncementRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\HealthOverviews\HealthOverviewsRequestBuilder; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\Issues\IssuesRequestBuilder; use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\Messages\MessagesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property serviceAnnouncement for admin * @param ServiceAnnouncementRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ServiceAnnouncementRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A container for service communications resources. Read-only. * @param ServiceAnnouncementRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceAnnouncementRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property serviceAnnouncement in admin * @param ServiceAnnouncement $body The request body * @param ServiceAnnouncementRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ServiceAnnouncement $body, ?ServiceAnnouncementRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceAnnouncement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?ServiceAnnouncementRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?ServiceAnnouncementRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?ServiceAnnouncementRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(ServiceAnnouncement $body, ?ServiceAnn $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/Sharepoint/Settings/SettingsRequestBuilder.php b/src/Generated/Admin/Sharepoint/Settings/SettingsRequestBuilder.php index 44073e80e92..45f1f1a55f2 100644 --- a/src/Generated/Admin/Sharepoint/Settings/SettingsRequestBuilder.php +++ b/src/Generated/Admin/Sharepoint/Settings/SettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharepointSettings; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property settings for admin * @param SettingsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SettingsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the tenant-level settings for SharePoint and OneDrive. This API is available in the following national cloud deployments. * @param SettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharepointsettings-get?view=graph-rest-1.0 Find more info here */ public function get(?SettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharepointSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharepointSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update one or more tenant-level settings for SharePoint and OneDrive. This API is available in the following national cloud deployments. * @param SharepointSettings $body The request body * @param SettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharepointsettings-update?view=graph-rest-1.0 Find more info here */ public function patch(SharepointSettings $body, ?SettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharepointSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharepointSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?SettingsRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?SettingsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?SettingsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(SharepointSettings $body, ?SettingsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Admin/Sharepoint/SharepointRequestBuilder.php b/src/Generated/Admin/Sharepoint/SharepointRequestBuilder.php index 41e8fa45240..2021a193ece 100644 --- a/src/Generated/Admin/Sharepoint/SharepointRequestBuilder.php +++ b/src/Generated/Admin/Sharepoint/SharepointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Admin\Sharepoint\Settings\SettingsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Sharepoint; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sharepoint for admin * @param SharepointRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SharepointRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get sharepoint from admin * @param SharepointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SharepointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Sharepoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Sharepoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sharepoint in admin * @param Sharepoint $body The request body * @param SharepointRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Sharepoint $body, ?SharepointRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Sharepoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Sharepoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?SharepointRequestBuilderDeleteReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?SharepointRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?SharepointRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Sharepoint $body, ?SharepointRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AgreementAcceptances/AgreementAcceptancesRequestBuilder.php b/src/Generated/AgreementAcceptances/AgreementAcceptancesRequestBuilder.php index 43a11b5b224..651a278310a 100644 --- a/src/Generated/AgreementAcceptances/AgreementAcceptancesRequestBuilder.php +++ b/src/Generated/AgreementAcceptances/AgreementAcceptancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\AgreementAcceptances\Item\AgreementAcceptanceItemRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementAcceptance; use Microsoft\Graph\Generated\Models\AgreementAcceptanceCollectionResponse; @@ -47,38 +46,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from agreementAcceptances * @param AgreementAcceptancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementAcceptancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to agreementAcceptances * @param AgreementAcceptance $body The request body * @param AgreementAcceptancesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AgreementAcceptance $body, ?AgreementAcceptancesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -91,7 +84,6 @@ public function toGetRequestInformation(?AgreementAcceptancesRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -99,6 +91,7 @@ public function toGetRequestInformation(?AgreementAcceptancesRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -113,11 +106,11 @@ public function toPostRequestInformation(AgreementAcceptance $body, ?AgreementAc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AgreementAcceptances/Item/AgreementAcceptanceItemRequestBuilder.php b/src/Generated/AgreementAcceptances/Item/AgreementAcceptanceItemRequestBuilder.php index 2a90436e51d..f57c2a1c525 100644 --- a/src/Generated/AgreementAcceptances/Item/AgreementAcceptanceItemRequestBuilder.php +++ b/src/Generated/AgreementAcceptances/Item/AgreementAcceptanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AgreementAcceptance; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from agreementAcceptances * @param AgreementAcceptanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AgreementAcceptanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entity from agreementAcceptances by key * @param AgreementAcceptanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementAcceptanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in agreementAcceptances * @param AgreementAcceptance $body The request body * @param AgreementAcceptanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementAcceptance $body, ?AgreementAcceptanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AgreementAcceptanceItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AgreementAcceptanceItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AgreementAcceptanceItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AgreementAcceptance $body, ?AgreementA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/AgreementsRequestBuilder.php b/src/Generated/Agreements/AgreementsRequestBuilder.php index f07daa5a1c0..af3b7a7db44 100644 --- a/src/Generated/Agreements/AgreementsRequestBuilder.php +++ b/src/Generated/Agreements/AgreementsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Agreements\Item\AgreementItemRequestBuilder; use Microsoft\Graph\Generated\Models\Agreement; use Microsoft\Graph\Generated\Models\AgreementCollectionResponse; @@ -47,38 +46,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from agreements * @param AgreementsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to agreements * @param Agreement $body The request body * @param AgreementsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Agreement $body, ?AgreementsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Agreement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Agreement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -91,7 +84,6 @@ public function toGetRequestInformation(?AgreementsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -99,6 +91,7 @@ public function toGetRequestInformation(?AgreementsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -113,11 +106,11 @@ public function toPostRequestInformation(Agreement $body, ?AgreementsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/Acceptances/AcceptancesRequestBuilder.php b/src/Generated/Agreements/Item/Acceptances/AcceptancesRequestBuilder.php index 61d53366735..2f1595cb3f6 100644 --- a/src/Generated/Agreements/Item/Acceptances/AcceptancesRequestBuilder.php +++ b/src/Generated/Agreements/Item/Acceptances/AcceptancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Agreements\Item\Acceptances\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Agreements\Item\Acceptances\Item\AgreementAcceptanceItemRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementAcceptance; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the details about the acceptance records for a specific agreement. This API is available in the following national cloud deployments. * @param AcceptancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/agreement-list-acceptances?view=graph-rest-1.0 Find more info here */ public function get(?AcceptancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to acceptances for agreements * @param AgreementAcceptance $body The request body * @param AcceptancesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AgreementAcceptance $body, ?AcceptancesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?AcceptancesRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?AcceptancesRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AgreementAcceptance $body, ?Acceptances $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/Acceptances/Count/CountRequestBuilder.php b/src/Generated/Agreements/Item/Acceptances/Count/CountRequestBuilder.php index 245c172804c..d778f3b867b 100644 --- a/src/Generated/Agreements/Item/Acceptances/Count/CountRequestBuilder.php +++ b/src/Generated/Agreements/Item/Acceptances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/Acceptances/Item/AgreementAcceptanceItemRequestBuilder.php b/src/Generated/Agreements/Item/Acceptances/Item/AgreementAcceptanceItemRequestBuilder.php index 4bc7e185dd0..dbc64b55927 100644 --- a/src/Generated/Agreements/Item/Acceptances/Item/AgreementAcceptanceItemRequestBuilder.php +++ b/src/Generated/Agreements/Item/Acceptances/Item/AgreementAcceptanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AgreementAcceptance; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property acceptances for agreements * @param AgreementAcceptanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AgreementAcceptanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Information about acceptances of this agreement. * @param AgreementAcceptanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementAcceptanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property acceptances in agreements * @param AgreementAcceptance $body The request body * @param AgreementAcceptanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementAcceptance $body, ?AgreementAcceptanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AgreementAcceptanceItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AgreementAcceptanceItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AgreementAcceptanceItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AgreementAcceptance $body, ?AgreementA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/AgreementItemRequestBuilder.php b/src/Generated/Agreements/Item/AgreementItemRequestBuilder.php index 825ca718ef8..c5a4a8edac8 100644 --- a/src/Generated/Agreements/Item/AgreementItemRequestBuilder.php +++ b/src/Generated/Agreements/Item/AgreementItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Agreements\Item\Acceptances\AcceptancesRequestBuilder; use Microsoft\Graph\Generated\Agreements\Item\File\FileRequestBuilder; use Microsoft\Graph\Generated\Agreements\Item\Files\FilesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from agreements * @param AgreementItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AgreementItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entity from agreements by key * @param AgreementItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Agreement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Agreement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in agreements * @param Agreement $body The request body * @param AgreementItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Agreement $body, ?AgreementItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Agreement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Agreement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?AgreementItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?AgreementItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?AgreementItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Agreement $body, ?AgreementItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/File/FileRequestBuilder.php b/src/Generated/Agreements/Item/File/FileRequestBuilder.php index 5753e62d4a5..d01a6c4650e 100644 --- a/src/Generated/Agreements/Item/File/FileRequestBuilder.php +++ b/src/Generated/Agreements/Item/File/FileRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Agreements\Item\File\Localizations\LocalizationsRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFile; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property file for agreements * @param FileRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FileRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the details of an agreement file, including the language and version information. The default file can have multiple versions, each with its own language, that can be retrieved by specifying the Accept-Language header. This API is available in the following national cloud deployments. * @param FileRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/agreementfile-get?view=graph-rest-1.0 Find more info here */ public function get(?FileRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property file in agreements * @param AgreementFile $body The request body * @param FileRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementFile $body, ?FileRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?FileRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?FileRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?FileRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(AgreementFile $body, ?FileRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/File/Localizations/Count/CountRequestBuilder.php b/src/Generated/Agreements/Item/File/Localizations/Count/CountRequestBuilder.php index 709f6d73e04..4487cd248db 100644 --- a/src/Generated/Agreements/Item/File/Localizations/Count/CountRequestBuilder.php +++ b/src/Generated/Agreements/Item/File/Localizations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/File/Localizations/Item/AgreementFileLocalizationItemRequestBuilder.php b/src/Generated/Agreements/Item/File/Localizations/Item/AgreementFileLocalizationItemRequestBuilder.php index f9f555da00a..f0ae8ef9b24 100644 --- a/src/Generated/Agreements/Item/File/Localizations/Item/AgreementFileLocalizationItemRequestBuilder.php +++ b/src/Generated/Agreements/Item/File/Localizations/Item/AgreementFileLocalizationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Agreements\Item\File\Localizations\Item\Versions\VersionsRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFileLocalization; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property localizations for agreements * @param AgreementFileLocalizationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AgreementFileLocalizationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The localized version of the terms of use agreement files attached to the agreement. * @param AgreementFileLocalizationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementFileLocalizationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property localizations in agreements * @param AgreementFileLocalization $body The request body * @param AgreementFileLocalizationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementFileLocalization $body, ?AgreementFileLocalizationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AgreementFileLocalizationItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AgreementFileLocalizationItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AgreementFileLocalizationItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AgreementFileLocalization $body, ?Agre $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/File/Localizations/Item/Versions/Count/CountRequestBuilder.php b/src/Generated/Agreements/Item/File/Localizations/Item/Versions/Count/CountRequestBuilder.php index c15473b1deb..2326a795ac4 100644 --- a/src/Generated/Agreements/Item/File/Localizations/Item/Versions/Count/CountRequestBuilder.php +++ b/src/Generated/Agreements/Item/File/Localizations/Item/Versions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php b/src/Generated/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php index f7e38c7cf49..d35935ec77e 100644 --- a/src/Generated/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php +++ b/src/Generated/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AgreementFileVersion; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property versions for agreements * @param AgreementFileVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AgreementFileVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param AgreementFileVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementFileVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property versions in agreements * @param AgreementFileVersion $body The request body * @param AgreementFileVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementFileVersion $body, ?AgreementFileVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,11 +90,12 @@ public function toDeleteRequestInformation(?AgreementFileVersionItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param AgreementFileVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AgreementFileVersionItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AgreementFileVersionItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AgreementFileVersion $body, ?Agreement $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php b/src/Generated/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php index b5018c6a05a..c65251a1380 100644 --- a/src/Generated/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. */ class AgreementFileVersionItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilder.php b/src/Generated/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilder.php index 6e5c28fc458..bb1577be3bd 100644 --- a/src/Generated/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilder.php +++ b/src/Generated/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Agreements\Item\File\Localizations\Item\Versions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Agreements\Item\File\Localizations\Item\Versions\Item\AgreementFileVersionItemRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFileVersion; @@ -53,44 +52,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?VersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to versions for agreements * @param AgreementFileVersion $body The request body * @param VersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AgreementFileVersion $body, ?VersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +92,6 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AgreementFileVersion $body, ?VersionsRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilderGetQueryParameters.php b/src/Generated/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilderGetQueryParameters.php index 72150dfd785..06cfe63ce26 100644 --- a/src/Generated/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. */ class VersionsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Agreements/Item/File/Localizations/LocalizationsRequestBuilder.php b/src/Generated/Agreements/Item/File/Localizations/LocalizationsRequestBuilder.php index cf0622e7249..95cc6224c4a 100644 --- a/src/Generated/Agreements/Item/File/Localizations/LocalizationsRequestBuilder.php +++ b/src/Generated/Agreements/Item/File/Localizations/LocalizationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Agreements\Item\File\Localizations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Agreements\Item\File\Localizations\Item\AgreementFileLocalizationItemRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFileLocalization; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the default and localized agreement files. This API is available in the following national cloud deployments. * @param LocalizationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/agreementfile-list-localizations?view=graph-rest-1.0 Find more info here */ public function get(?LocalizationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to localizations for agreements * @param AgreementFileLocalization $body The request body * @param LocalizationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AgreementFileLocalization $body, ?LocalizationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?LocalizationsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?LocalizationsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AgreementFileLocalization $body, ?Local $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/Files/Count/CountRequestBuilder.php b/src/Generated/Agreements/Item/Files/Count/CountRequestBuilder.php index c9e1f11e0d8..12b8431b452 100644 --- a/src/Generated/Agreements/Item/Files/Count/CountRequestBuilder.php +++ b/src/Generated/Agreements/Item/Files/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/Files/FilesRequestBuilder.php b/src/Generated/Agreements/Item/Files/FilesRequestBuilder.php index e5b190e5314..82bdd7b6734 100644 --- a/src/Generated/Agreements/Item/Files/FilesRequestBuilder.php +++ b/src/Generated/Agreements/Item/Files/FilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Agreements\Item\Files\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Agreements\Item\Files\Item\AgreementFileLocalizationItemRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFileLocalization; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * PDFs linked to this agreement. This property is in the process of being deprecated. Use the file property instead. Supports $expand. * @param FilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new localized agreement file. This API is available in the following national cloud deployments. * @param AgreementFileLocalization $body The request body * @param FilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/agreement-post-files?view=graph-rest-1.0 Find more info here */ public function post(AgreementFileLocalization $body, ?FilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AgreementFileLocalization $body, ?Files $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/Files/Item/AgreementFileLocalizationItemRequestBuilder.php b/src/Generated/Agreements/Item/Files/Item/AgreementFileLocalizationItemRequestBuilder.php index 727049f32d2..89ce1b0eb38 100644 --- a/src/Generated/Agreements/Item/Files/Item/AgreementFileLocalizationItemRequestBuilder.php +++ b/src/Generated/Agreements/Item/Files/Item/AgreementFileLocalizationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Agreements\Item\Files\Item\Versions\VersionsRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFileLocalization; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property files for agreements * @param AgreementFileLocalizationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AgreementFileLocalizationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * PDFs linked to this agreement. This property is in the process of being deprecated. Use the file property instead. Supports $expand. * @param AgreementFileLocalizationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementFileLocalizationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property files in agreements * @param AgreementFileLocalization $body The request body * @param AgreementFileLocalizationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementFileLocalization $body, ?AgreementFileLocalizationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AgreementFileLocalizationItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AgreementFileLocalizationItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AgreementFileLocalizationItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AgreementFileLocalization $body, ?Agre $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/Files/Item/Versions/Count/CountRequestBuilder.php b/src/Generated/Agreements/Item/Files/Item/Versions/Count/CountRequestBuilder.php index 41ed50a906e..cdaef4467c0 100644 --- a/src/Generated/Agreements/Item/Files/Item/Versions/Count/CountRequestBuilder.php +++ b/src/Generated/Agreements/Item/Files/Item/Versions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php b/src/Generated/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php index 09a10261ab7..11326dbc388 100644 --- a/src/Generated/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php +++ b/src/Generated/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AgreementFileVersion; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property versions for agreements * @param AgreementFileVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AgreementFileVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param AgreementFileVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementFileVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property versions in agreements * @param AgreementFileVersion $body The request body * @param AgreementFileVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementFileVersion $body, ?AgreementFileVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,11 +90,12 @@ public function toDeleteRequestInformation(?AgreementFileVersionItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param AgreementFileVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AgreementFileVersionItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AgreementFileVersionItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AgreementFileVersion $body, ?Agreement $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php b/src/Generated/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php index 39e621ee383..8eabcef868f 100644 --- a/src/Generated/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. */ class AgreementFileVersionItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Agreements/Item/Files/Item/Versions/VersionsRequestBuilder.php b/src/Generated/Agreements/Item/Files/Item/Versions/VersionsRequestBuilder.php index fede6097ce5..75070c9919a 100644 --- a/src/Generated/Agreements/Item/Files/Item/Versions/VersionsRequestBuilder.php +++ b/src/Generated/Agreements/Item/Files/Item/Versions/VersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Agreements\Item\Files\Item\Versions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Agreements\Item\Files\Item\Versions\Item\AgreementFileVersionItemRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFileVersion; @@ -53,44 +52,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?VersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to versions for agreements * @param AgreementFileVersion $body The request body * @param VersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AgreementFileVersion $body, ?VersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +92,6 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AgreementFileVersion $body, ?VersionsRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Agreements/Item/Files/Item/Versions/VersionsRequestBuilderGetQueryParameters.php b/src/Generated/Agreements/Item/Files/Item/Versions/VersionsRequestBuilderGetQueryParameters.php index 946bace36ab..443303a8b7d 100644 --- a/src/Generated/Agreements/Item/Files/Item/Versions/VersionsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Agreements/Item/Files/Item/Versions/VersionsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. */ class VersionsRequestBuilderGetQueryParameters { diff --git a/src/Generated/AppCatalogs/AppCatalogsRequestBuilder.php b/src/Generated/AppCatalogs/AppCatalogsRequestBuilder.php index 536572c970e..cf0f4617ff4 100644 --- a/src/Generated/AppCatalogs/AppCatalogsRequestBuilder.php +++ b/src/Generated/AppCatalogs/AppCatalogsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\AppCatalogs\TeamsApps\TeamsAppsRequestBuilder; use Microsoft\Graph\Generated\Models\AppCatalogs; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,38 +41,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get appCatalogs * @param AppCatalogsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppCatalogsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppCatalogs::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppCatalogs::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update appCatalogs * @param AppCatalogs $body The request body * @param AppCatalogsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AppCatalogs $body, ?AppCatalogsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppCatalogs::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppCatalogs::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -86,7 +79,6 @@ public function toGetRequestInformation(?AppCatalogsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -94,6 +86,7 @@ public function toGetRequestInformation(?AppCatalogsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -108,11 +101,11 @@ public function toPatchRequestInformation(AppCatalogs $body, ?AppCatalogsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AppCatalogs/TeamsApps/Count/CountRequestBuilder.php b/src/Generated/AppCatalogs/TeamsApps/Count/CountRequestBuilder.php index 8c7ce62d8ef..40c076bd8ee 100644 --- a/src/Generated/AppCatalogs/TeamsApps/Count/CountRequestBuilder.php +++ b/src/Generated/AppCatalogs/TeamsApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/AppDefinitionsRequestBuilder.php b/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/AppDefinitionsRequestBuilder.php index c385ef10174..4f27d498ca5 100644 --- a/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/AppDefinitionsRequestBuilder.php +++ b/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/AppDefinitionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\AppCatalogs\TeamsApps\Item\AppDefinitions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\AppCatalogs\TeamsApps\Item\AppDefinitions\Item\TeamsAppDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The details for each version of the app. * @param AppDefinitionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppDefinitionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an app previously published to the Microsoft Teams app catalog. To update an app, the distributionMethod property for the app must be set to organization. This API specifically updates an app published to your organization's app catalog (the tenant app catalog). This API is available in the following national cloud deployments. * @param TeamsAppDefinition $body The request body * @param AppDefinitionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamsapp-update?view=graph-rest-1.0 Find more info here */ public function post(TeamsAppDefinition $body, ?AppDefinitionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?AppDefinitionsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?AppDefinitionsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(TeamsAppDefinition $body, ?AppDefinitio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/Count/CountRequestBuilder.php b/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/Count/CountRequestBuilder.php index 9be18784020..06eeadfdef9 100644 --- a/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/Count/CountRequestBuilder.php +++ b/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/Item/Bot/BotRequestBuilder.php b/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/Item/Bot/BotRequestBuilder.php index 31a5c9c0440..d953ce4a160 100644 --- a/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/Item/Bot/BotRequestBuilder.php +++ b/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/Item/Bot/BotRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamworkBot; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property bot for appCatalogs * @param BotRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?BotRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the bot associated with a specific definition of the TeamsApp. This API is available in the following national cloud deployments. * @param BotRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworkbot-get?view=graph-rest-1.0 Find more info here */ public function get(?BotRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkBot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkBot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property bot in appCatalogs * @param TeamworkBot $body The request body * @param BotRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamworkBot $body, ?BotRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkBot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkBot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?BotRequestBuilderDeleteRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?BotRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?BotRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(TeamworkBot $body, ?BotRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/Item/TeamsAppDefinitionItemRequestBuilder.php b/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/Item/TeamsAppDefinitionItemRequestBuilder.php index dea313e9084..ebf13bbce20 100644 --- a/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/Item/TeamsAppDefinitionItemRequestBuilder.php +++ b/src/Generated/AppCatalogs/TeamsApps/Item/AppDefinitions/Item/TeamsAppDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\AppCatalogs\TeamsApps\Item\AppDefinitions\Item\Bot\BotRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppDefinition; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property appDefinitions for appCatalogs * @param TeamsAppDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TeamsAppDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The details for each version of the app. * @param TeamsAppDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Publish an app to the Microsoft Teams app catalog.Specifically, this API publishes the app to your organization's catalog (the tenant app catalog);the created resource has a distributionMethod property value of organization. The requiresReview property allows any user to submit an app for review by an administrator. Admins can approve or reject these apps via this API or the Microsoft Teams admin center. This API is available in the following national cloud deployments. * @param TeamsAppDefinition $body The request body * @param TeamsAppDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamsapp-publish?view=graph-rest-1.0 Find more info here */ public function patch(TeamsAppDefinition $body, ?TeamsAppDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?TeamsAppDefinitionItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?TeamsAppDefinitionItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?TeamsAppDefinitionItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(TeamsAppDefinition $body, ?TeamsAppDef $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AppCatalogs/TeamsApps/Item/TeamsAppItemRequestBuilder.php b/src/Generated/AppCatalogs/TeamsApps/Item/TeamsAppItemRequestBuilder.php index 5faa53b6f53..0b504dbc56c 100644 --- a/src/Generated/AppCatalogs/TeamsApps/Item/TeamsAppItemRequestBuilder.php +++ b/src/Generated/AppCatalogs/TeamsApps/Item/TeamsAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\AppCatalogs\TeamsApps\Item\AppDefinitions\AppDefinitionsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; @@ -40,63 +39,54 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * This API is available in the following national cloud deployments. + * Delete an app from an organization's app catalog (the tenant app catalog). To delete an app, the distributionMethod property for the app must be set to organization. You can also use this API to remove a submitted app from the review process. This API is available in the following national cloud deployments. * @param TeamsAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamsapp-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get teamsApps from appCatalogs * @param TeamsAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property teamsApps in appCatalogs * @param TeamsApp $body The request body * @param TeamsAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamsApp $body, ?TeamsAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * This API is available in the following national cloud deployments. + * Delete an app from an organization's app catalog (the tenant app catalog). To delete an app, the distributionMethod property for the app must be set to organization. You can also use this API to remove a submitted app from the review process. This API is available in the following national cloud deployments. * @param TeamsAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?TeamsAppItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?TeamsAppItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?TeamsAppItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(TeamsApp $body, ?TeamsAppItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AppCatalogs/TeamsApps/TeamsAppsRequestBuilder.php b/src/Generated/AppCatalogs/TeamsApps/TeamsAppsRequestBuilder.php index 18e04fcf474..a3d8c73c004 100644 --- a/src/Generated/AppCatalogs/TeamsApps/TeamsAppsRequestBuilder.php +++ b/src/Generated/AppCatalogs/TeamsApps/TeamsAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\AppCatalogs\TeamsApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\AppCatalogs\TeamsApps\Item\TeamsAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List apps from the Microsoft Teams app catalog.This includes apps from the Microsoft Teams store, as well as apps from your organization's app catalog (the tenant app catalog). To get apps from your organization's app catalog only, specify organization as the distributionMethod in the request. This API is available in the following national cloud deployments. * @param TeamsAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/appcatalogs-list-teamsapps?view=graph-rest-1.0 Find more info here */ public function get(?TeamsAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Publish an app to the Microsoft Teams app catalog.Specifically, this API publishes the app to your organization's catalog (the tenant app catalog);the created resource has a distributionMethod property value of organization. The requiresReview property allows any user to submit an app for review by an administrator. Admins can approve or reject these apps via this API or the Microsoft Teams admin center. This API is available in the following national cloud deployments. * @param TeamsApp $body The request body * @param TeamsAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamsapp-publish?view=graph-rest-1.0 Find more info here */ public function post(TeamsApp $body, ?TeamsAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TeamsAppsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TeamsAppsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsApp $body, ?TeamsAppsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ApplicationTemplates/ApplicationTemplatesRequestBuilder.php b/src/Generated/ApplicationTemplates/ApplicationTemplatesRequestBuilder.php index 08be05e7ea7..85054e4515d 100644 --- a/src/Generated/ApplicationTemplates/ApplicationTemplatesRequestBuilder.php +++ b/src/Generated/ApplicationTemplates/ApplicationTemplatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\ApplicationTemplates\Count\CountRequestBuilder; use Microsoft\Graph\Generated\ApplicationTemplates\Item\ApplicationTemplateItemRequestBuilder; use Microsoft\Graph\Generated\Models\ApplicationTemplateCollectionResponse; @@ -52,26 +51,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve a list of applicationTemplate objects from the Azure AD application gallery. This API is available in the following national cloud deployments. + * Retrieve a list of applicationTemplate objects from the Microsoft Entra application gallery. This API is available in the following national cloud deployments. * @param ApplicationTemplatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/applicationtemplate-list?view=graph-rest-1.0 Find more info here */ public function get(?ApplicationTemplatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplicationTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplicationTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve a list of applicationTemplate objects from the Azure AD application gallery. This API is available in the following national cloud deployments. + * Retrieve a list of applicationTemplate objects from the Microsoft Entra application gallery. This API is available in the following national cloud deployments. * @param ApplicationTemplatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -80,7 +76,6 @@ public function toGetRequestInformation(?ApplicationTemplatesRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?ApplicationTemplatesRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ApplicationTemplates/ApplicationTemplatesRequestBuilderGetQueryParameters.php b/src/Generated/ApplicationTemplates/ApplicationTemplatesRequestBuilderGetQueryParameters.php index 39f9b2b2a30..1fcdda59cdd 100644 --- a/src/Generated/ApplicationTemplates/ApplicationTemplatesRequestBuilderGetQueryParameters.php +++ b/src/Generated/ApplicationTemplates/ApplicationTemplatesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve a list of applicationTemplate objects from the Azure AD application gallery. This API is available in the following national cloud deployments. + * Retrieve a list of applicationTemplate objects from the Microsoft Entra application gallery. This API is available in the following national cloud deployments. */ class ApplicationTemplatesRequestBuilderGetQueryParameters { diff --git a/src/Generated/ApplicationTemplates/Count/CountRequestBuilder.php b/src/Generated/ApplicationTemplates/Count/CountRequestBuilder.php index 23f0a04e911..cc0fdcbf8d2 100644 --- a/src/Generated/ApplicationTemplates/Count/CountRequestBuilder.php +++ b/src/Generated/ApplicationTemplates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ApplicationTemplates/Item/ApplicationTemplateItemRequestBuilder.php b/src/Generated/ApplicationTemplates/Item/ApplicationTemplateItemRequestBuilder.php index cc43bdb5121..3884526a8fe 100644 --- a/src/Generated/ApplicationTemplates/Item/ApplicationTemplateItemRequestBuilder.php +++ b/src/Generated/ApplicationTemplates/Item/ApplicationTemplateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\ApplicationTemplates\Item\Instantiate\InstantiateRequestBuilder; use Microsoft\Graph\Generated\Models\ApplicationTemplate; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,20 +41,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties of an applicationTemplate object. This API is available in the following national cloud deployments. * @param ApplicationTemplateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/applicationtemplate-get?view=graph-rest-1.0 Find more info here */ public function get(?ApplicationTemplateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplicationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplicationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -68,7 +64,6 @@ public function toGetRequestInformation(?ApplicationTemplateItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -76,6 +71,7 @@ public function toGetRequestInformation(?ApplicationTemplateItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ApplicationTemplates/Item/Instantiate/InstantiateRequestBuilder.php b/src/Generated/ApplicationTemplates/Item/Instantiate/InstantiateRequestBuilder.php index 9fd7e43a81b..6e7aded8fb6 100644 --- a/src/Generated/ApplicationTemplates/Item/Instantiate/InstantiateRequestBuilder.php +++ b/src/Generated/ApplicationTemplates/Item/Instantiate/InstantiateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ApplicationServicePrincipal; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,27 +31,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Add an instance of an application from the Azure AD application gallery into your directory. You can also use this API to instantiate non-gallery apps. Use the following ID for the applicationTemplate object: 8adf8e6e-67b2-4cf2-a259-e3dc5476c621. This API is available in the following national cloud deployments. + * Add an instance of an application from the Microsoft Entra application gallery into your directory. You can also use this API to instantiate non-gallery apps. Use the following ID for the applicationTemplate object: 8adf8e6e-67b2-4cf2-a259-e3dc5476c621. This API is available in the following national cloud deployments. * @param InstantiatePostRequestBody $body The request body * @param InstantiateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/applicationtemplate-instantiate?view=graph-rest-1.0 Find more info here */ public function post(InstantiatePostRequestBody $body, ?InstantiateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplicationServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplicationServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Add an instance of an application from the Azure AD application gallery into your directory. You can also use this API to instantiate non-gallery apps. Use the following ID for the applicationTemplate object: 8adf8e6e-67b2-4cf2-a259-e3dc5476c621. This API is available in the following national cloud deployments. + * Add an instance of an application from the Microsoft Entra application gallery into your directory. You can also use this API to instantiate non-gallery apps. Use the following ID for the applicationTemplate object: 8adf8e6e-67b2-4cf2-a259-e3dc5476c621. This API is available in the following national cloud deployments. * @param InstantiatePostRequestBody $body The request body * @param InstantiateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -62,11 +58,11 @@ public function toPostRequestInformation(InstantiatePostRequestBody $body, ?Inst $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/ApplicationsRequestBuilder.php b/src/Generated/Applications/ApplicationsRequestBuilder.php index 738bbc0337a..8b1dcdf8e46 100644 --- a/src/Generated/Applications/ApplicationsRequestBuilder.php +++ b/src/Generated/Applications/ApplicationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Applications\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Applications\GetAvailableExtensionProperties\GetAvailableExtensionPropertiesRequestBuilder; @@ -87,40 +86,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of applications in this organization. This API is available in the following national cloud deployments. * @param ApplicationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-list?view=graph-rest-1.0 Find more info here */ public function get(?ApplicationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new application object. This API is available in the following national cloud deployments. * @param Application $body The request body * @param ApplicationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-post-applications?view=graph-rest-1.0 Find more info here */ public function post(Application $body, ?ApplicationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,7 +126,6 @@ public function toGetRequestInformation(?ApplicationsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -141,6 +133,7 @@ public function toGetRequestInformation(?ApplicationsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -155,11 +148,11 @@ public function toPostRequestInformation(Application $body, ?ApplicationsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Count/CountRequestBuilder.php b/src/Generated/Applications/Count/CountRequestBuilder.php index 9d82259a639..dd089a4d3d5 100644 --- a/src/Generated/Applications/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Delta/DeltaRequestBuilder.php b/src/Generated/Applications/Delta/DeltaRequestBuilder.php index dc5d724fa56..13bc72f9072 100644 --- a/src/Generated/Applications/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Applications/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/Applications/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index 02d2d095d8b..ef97a32cfc9 100644 --- a/src/Generated/Applications/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/Applications/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/Applications/GetByIds/GetByIdsRequestBuilder.php index 73bb8ed66fb..e7db47e8454 100644 --- a/src/Generated/Applications/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/Applications/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/AddKey/AddKeyRequestBuilder.php b/src/Generated/Applications/Item/AddKey/AddKeyRequestBuilder.php index dcdafc2d8f4..a6fcf282ab4 100644 --- a/src/Generated/Applications/Item/AddKey/AddKeyRequestBuilder.php +++ b/src/Generated/Applications/Item/AddKey/AddKeyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\KeyCredential; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add a key credential to an application. This method, along with removeKey can be used by an application to automate rolling its expiring keys. As part of the request validation for this method, a proof of possession of an existing key is verified before the action can be performed. Applications that don’t have any existing valid certificates (no certificates have been added yet, or all certificates have expired), won’t be able to use this service action. You can use the Update application operation to perform an update instead. This API is available in the following national cloud deployments. * @param AddKeyPostRequestBody $body The request body * @param AddKeyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-addkey?view=graph-rest-1.0 Find more info here */ public function post(AddKeyPostRequestBody $body, ?AddKeyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [KeyCredential::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [KeyCredential::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddKeyPostRequestBody $body, ?AddKeyReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/AddPassword/AddPasswordRequestBuilder.php b/src/Generated/Applications/Item/AddPassword/AddPasswordRequestBuilder.php index f26a351dc44..99211399089 100644 --- a/src/Generated/Applications/Item/AddPassword/AddPasswordRequestBuilder.php +++ b/src/Generated/Applications/Item/AddPassword/AddPasswordRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PasswordCredential; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Adds a strong password or secret to an application. This API is available in the following national cloud deployments. * @param AddPasswordPostRequestBody $body The request body * @param AddPasswordRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-addpassword?view=graph-rest-1.0 Find more info here */ public function post(AddPasswordPostRequestBody $body, ?AddPasswordRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PasswordCredential::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PasswordCredential::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddPasswordPostRequestBody $body, ?AddP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/AppManagementPolicies/AppManagementPoliciesRequestBuilder.php b/src/Generated/Applications/Item/AppManagementPolicies/AppManagementPoliciesRequestBuilder.php index 327f2b60931..bb4a3bb2df1 100644 --- a/src/Generated/Applications/Item/AppManagementPolicies/AppManagementPoliciesRequestBuilder.php +++ b/src/Generated/Applications/Item/AppManagementPolicies/AppManagementPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\AppManagementPolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\AppManagementPolicies\Item\AppManagementPolicyItemRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\AppManagementPolicies\Ref\RefRequestBuilder; @@ -62,19 +61,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The appManagementPolicy applied to this application. * @param AppManagementPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppManagementPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -87,7 +83,6 @@ public function toGetRequestInformation(?AppManagementPoliciesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -95,6 +90,7 @@ public function toGetRequestInformation(?AppManagementPoliciesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/AppManagementPolicies/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/AppManagementPolicies/Count/CountRequestBuilder.php index 464995dba9d..d9c327ccc98 100644 --- a/src/Generated/Applications/Item/AppManagementPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/AppManagementPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/AppManagementPolicies/Item/Ref/RefRequestBuilder.php b/src/Generated/Applications/Item/AppManagementPolicies/Item/Ref/RefRequestBuilder.php index d0dd31d7aef..60d25216153 100644 --- a/src/Generated/Applications/Item/AppManagementPolicies/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Applications/Item/AppManagementPolicies/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an appManagementPolicy policy object from an application or service principal object. When you remove the appManagementPolicy, the application or service principal adopts the tenant-wide tenantAppManagementPolicy setting. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/appmanagementpolicy-delete-appliesto?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/AppManagementPolicies/Ref/RefRequestBuilder.php b/src/Generated/Applications/Item/AppManagementPolicies/Ref/RefRequestBuilder.php index 56e70c11dcc..b24292b2708 100644 --- a/src/Generated/Applications/Item/AppManagementPolicies/Ref/RefRequestBuilder.php +++ b/src/Generated/Applications/Item/AppManagementPolicies/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,39 +34,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The appManagementPolicy applied to this application. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Assign an appManagementPolicy policy object to an application or service principal object. The application or service principal adopts this policy over the tenant-wide tenantAppManagementPolicy setting. Only one policy object can be assigned to an application or service principal. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/appmanagementpolicy-post-appliesto?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -80,7 +73,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +80,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -106,6 +99,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/ApplicationItemRequestBuilder.php b/src/Generated/Applications/Item/ApplicationItemRequestBuilder.php index 671c27de19f..5f462427e9d 100644 --- a/src/Generated/Applications/Item/ApplicationItemRequestBuilder.php +++ b/src/Generated/Applications/Item/ApplicationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\AddKey\AddKeyRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\AddPassword\AddPasswordRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\AppManagementPolicies\AppManagementPoliciesRequestBuilder; @@ -202,59 +201,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an application object. When deleted, apps are moved to a temporary container and can be restored within 30 days. After that time, they are permanently deleted. This API is available in the following national cloud deployments. * @param ApplicationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ApplicationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of an application object. This API is available in the following national cloud deployments. * @param ApplicationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-get?view=graph-rest-1.0 Find more info here */ public function get(?ApplicationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an application object. This API is available in the following national cloud deployments. * @param Application $body The request body * @param ApplicationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-update?view=graph-rest-1.0 Find more info here */ public function patch(Application $body, ?ApplicationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -271,6 +261,7 @@ public function toDeleteRequestInformation(?ApplicationItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -284,7 +275,6 @@ public function toGetRequestInformation(?ApplicationItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -292,6 +282,7 @@ public function toGetRequestInformation(?ApplicationItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -306,11 +297,11 @@ public function toPatchRequestInformation(Application $body, ?ApplicationItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/Applications/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index dfcf804ebeb..b54e26992ca 100644 --- a/src/Generated/Applications/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/Applications/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/Applications/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index 970e773e628..42160e4f4bf 100644 --- a/src/Generated/Applications/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/Applications/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/CreatedOnBehalfOf/CreatedOnBehalfOfRequestBuilder.php b/src/Generated/Applications/Item/CreatedOnBehalfOf/CreatedOnBehalfOfRequestBuilder.php index 134ea770f92..8a38ba63252 100644 --- a/src/Generated/Applications/Item/CreatedOnBehalfOf/CreatedOnBehalfOfRequestBuilder.php +++ b/src/Generated/Applications/Item/CreatedOnBehalfOf/CreatedOnBehalfOfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Supports $filter (/$count eq 0, /$count ne 0). Read-only. * @param CreatedOnBehalfOfRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedOnBehalfOfRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CreatedOnBehalfOfRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CreatedOnBehalfOfRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/ExtensionProperties/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/ExtensionProperties/Count/CountRequestBuilder.php index 61d1c1f7bba..19f59f49997 100644 --- a/src/Generated/Applications/Item/ExtensionProperties/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/ExtensionProperties/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/ExtensionProperties/ExtensionPropertiesRequestBuilder.php b/src/Generated/Applications/Item/ExtensionProperties/ExtensionPropertiesRequestBuilder.php index 02233a4f82d..5de7fc1dc26 100644 --- a/src/Generated/Applications/Item/ExtensionProperties/ExtensionPropertiesRequestBuilder.php +++ b/src/Generated/Applications/Item/ExtensionProperties/ExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\ExtensionProperties\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\ExtensionProperties\Item\ExtensionPropertyItemRequestBuilder; use Microsoft\Graph\Generated\Models\ExtensionProperty; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of directory extension definitions, represented by extensionProperty objects on an application. This API is available in the following national cloud deployments. * @param ExtensionPropertiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-list-extensionproperty?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionPropertiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionPropertyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionPropertyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new directory extension definition, represented by an extensionProperty object. This API is available in the following national cloud deployments. * @param ExtensionProperty $body The request body * @param ExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-post-extensionproperty?view=graph-rest-1.0 Find more info here */ public function post(ExtensionProperty $body, ?ExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionProperty::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionProperty::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ExtensionPropertiesRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ExtensionPropertiesRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ExtensionProperty $body, ?ExtensionProp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/ExtensionProperties/Item/ExtensionPropertyItemRequestBuilder.php b/src/Generated/Applications/Item/ExtensionProperties/Item/ExtensionPropertyItemRequestBuilder.php index dfaf7b896dc..8a31ce1ecaf 100644 --- a/src/Generated/Applications/Item/ExtensionProperties/Item/ExtensionPropertyItemRequestBuilder.php +++ b/src/Generated/Applications/Item/ExtensionProperties/Item/ExtensionPropertyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ExtensionProperty; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a directory extension definition represented by an extensionProperty object. You can delete only directory extensions that aren't synced from on-premises active directory (AD). This API is available in the following national cloud deployments. * @param ExtensionPropertyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/extensionproperty-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ExtensionPropertyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read a directory extension definition represented by an extensionProperty object. This API is available in the following national cloud deployments. * @param ExtensionPropertyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/extensionproperty-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionPropertyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionProperty::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionProperty::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensionProperties in applications * @param ExtensionProperty $body The request body * @param ExtensionPropertyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ExtensionProperty $body, ?ExtensionPropertyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionProperty::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionProperty::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ExtensionPropertyItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ExtensionPropertyItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ExtensionPropertyItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(ExtensionProperty $body, ?ExtensionPro $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/FederatedIdentityCredentials/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/FederatedIdentityCredentials/Count/CountRequestBuilder.php index 2bddfb87753..ac7985f6bb8 100644 --- a/src/Generated/Applications/Item/FederatedIdentityCredentials/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/FederatedIdentityCredentials/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/FederatedIdentityCredentials/FederatedIdentityCredentialsRequestBuilder.php b/src/Generated/Applications/Item/FederatedIdentityCredentials/FederatedIdentityCredentialsRequestBuilder.php index 090c0c9a246..195c6cbf6d2 100644 --- a/src/Generated/Applications/Item/FederatedIdentityCredentials/FederatedIdentityCredentialsRequestBuilder.php +++ b/src/Generated/Applications/Item/FederatedIdentityCredentials/FederatedIdentityCredentialsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\FederatedIdentityCredentials\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\FederatedIdentityCredentials\Item\FederatedIdentityCredentialItemRequestBuilder; use Microsoft\Graph\Generated\Models\FederatedIdentityCredential; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the federatedIdentityCredential objects and their properties. This API is available in the following national cloud deployments. * @param FederatedIdentityCredentialsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-list-federatedidentitycredentials?view=graph-rest-1.0 Find more info here */ public function get(?FederatedIdentityCredentialsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredentialCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredentialCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create a new federatedIdentityCredential object for an application. By configuring a trust relationship between your Azure AD application registration and the identity provider for your compute platform, you can use tokens issued by that platform to authenticate with Microsoft identity platform and call APIs in the Microsoft ecosystem. Maximum of 20 objects can be added to an application. This API is available in the following national cloud deployments. + * Create a new federatedIdentityCredential object for an application. By configuring a trust relationship between your Microsoft Entra application registration and the identity provider for your compute platform, you can use tokens issued by that platform to authenticate with Microsoft identity platform and call APIs in the Microsoft ecosystem. Maximum of 20 objects can be added to an application. This API is available in the following national cloud deployments. * @param FederatedIdentityCredential $body The request body * @param FederatedIdentityCredentialsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-post-federatedidentitycredentials?view=graph-rest-1.0 Find more info here */ public function post(FederatedIdentityCredential $body, ?FederatedIdentityCredentialsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredential::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredential::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?FederatedIdentityCredentialsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,11 +101,12 @@ public function toGetRequestInformation(?FederatedIdentityCredentialsRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create a new federatedIdentityCredential object for an application. By configuring a trust relationship between your Azure AD application registration and the identity provider for your compute platform, you can use tokens issued by that platform to authenticate with Microsoft identity platform and call APIs in the Microsoft ecosystem. Maximum of 20 objects can be added to an application. This API is available in the following national cloud deployments. + * Create a new federatedIdentityCredential object for an application. By configuring a trust relationship between your Microsoft Entra application registration and the identity provider for your compute platform, you can use tokens issued by that platform to authenticate with Microsoft identity platform and call APIs in the Microsoft ecosystem. Maximum of 20 objects can be added to an application. This API is available in the following national cloud deployments. * @param FederatedIdentityCredential $body The request body * @param FederatedIdentityCredentialsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -123,11 +116,11 @@ public function toPostRequestInformation(FederatedIdentityCredential $body, ?Fed $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/FederatedIdentityCredentials/Item/FederatedIdentityCredentialItemRequestBuilder.php b/src/Generated/Applications/Item/FederatedIdentityCredentials/Item/FederatedIdentityCredentialItemRequestBuilder.php index 759dfbca138..55d7ea06e78 100644 --- a/src/Generated/Applications/Item/FederatedIdentityCredentials/Item/FederatedIdentityCredentialItemRequestBuilder.php +++ b/src/Generated/Applications/Item/FederatedIdentityCredentials/Item/FederatedIdentityCredentialItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FederatedIdentityCredential; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a federatedIdentityCredential object from an application. This API is available in the following national cloud deployments. * @param FederatedIdentityCredentialItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/federatedidentitycredential-delete?view=graph-rest-1.0 Find more info here */ public function delete(?FederatedIdentityCredentialItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a federatedIdentityCredential object. This API is available in the following national cloud deployments. * @param FederatedIdentityCredentialItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/federatedidentitycredential-get?view=graph-rest-1.0 Find more info here */ public function get(?FederatedIdentityCredentialItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredential::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredential::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a federatedIdentityCredential object. This API is available in the following national cloud deployments. * @param FederatedIdentityCredential $body The request body * @param FederatedIdentityCredentialItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/federatedidentitycredential-update?view=graph-rest-1.0 Find more info here */ public function patch(FederatedIdentityCredential $body, ?FederatedIdentityCredentialItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredential::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredential::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?FederatedIdentityCredentialItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?FederatedIdentityCredentialItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?FederatedIdentityCredentialItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(FederatedIdentityCredential $body, ?Fe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/Applications/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index 1e81df013ca..f4e0c546dbb 100644 --- a/src/Generated/Applications/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/Applications/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/Applications/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index f9e680684a1..bf4be8f8182 100644 --- a/src/Generated/Applications/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/Applications/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/HomeRealmDiscoveryPolicies/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/HomeRealmDiscoveryPolicies/Count/CountRequestBuilder.php index 0ae65e0d4d1..54e684a1f2c 100644 --- a/src/Generated/Applications/Item/HomeRealmDiscoveryPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/HomeRealmDiscoveryPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/HomeRealmDiscoveryPolicies/HomeRealmDiscoveryPoliciesRequestBuilder.php b/src/Generated/Applications/Item/HomeRealmDiscoveryPolicies/HomeRealmDiscoveryPoliciesRequestBuilder.php index 743627f8e44..cef3b7ba2bc 100644 --- a/src/Generated/Applications/Item/HomeRealmDiscoveryPolicies/HomeRealmDiscoveryPoliciesRequestBuilder.php +++ b/src/Generated/Applications/Item/HomeRealmDiscoveryPolicies/HomeRealmDiscoveryPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\HomeRealmDiscoveryPolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\HomeRealmDiscoveryPolicies\Item\HomeRealmDiscoveryPolicyItemRequestBuilder; use Microsoft\Graph\Generated\Models\HomeRealmDiscoveryPolicyCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get homeRealmDiscoveryPolicies from applications * @param HomeRealmDiscoveryPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HomeRealmDiscoveryPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?HomeRealmDiscoveryPoliciesRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?HomeRealmDiscoveryPoliciesRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/HomeRealmDiscoveryPolicies/Item/HomeRealmDiscoveryPolicyItemRequestBuilder.php b/src/Generated/Applications/Item/HomeRealmDiscoveryPolicies/Item/HomeRealmDiscoveryPolicyItemRequestBuilder.php index acdd0941414..7f8c161e2bc 100644 --- a/src/Generated/Applications/Item/HomeRealmDiscoveryPolicies/Item/HomeRealmDiscoveryPolicyItemRequestBuilder.php +++ b/src/Generated/Applications/Item/HomeRealmDiscoveryPolicies/Item/HomeRealmDiscoveryPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\HomeRealmDiscoveryPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get homeRealmDiscoveryPolicies from applications * @param HomeRealmDiscoveryPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HomeRealmDiscoveryPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HomeRealmDiscoveryPolicyItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HomeRealmDiscoveryPolicyItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Logo/LogoRequestBuilder.php b/src/Generated/Applications/Item/Logo/LogoRequestBuilder.php index 866b9c2d605..9874ce1a609 100644 --- a/src/Generated/Applications/Item/Logo/LogoRequestBuilder.php +++ b/src/Generated/Applications/Item/Logo/LogoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,38 +33,36 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The main logo for the application. Not nullable. * @param LogoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LogoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The main logo for the application. Not nullable. * @param StreamInterface $body Binary request body * @param LogoRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?LogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -82,6 +79,7 @@ public function toGetRequestInformation(?LogoRequestBuilderGetRequestConfigurati $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -100,7 +98,8 @@ public function toPutRequestInformation(StreamInterface $body, ?LogoRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/Owners/Count/CountRequestBuilder.php index 2c96b4f21f2..6c524417495 100644 --- a/src/Generated/Applications/Item/Owners/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/GraphAppRoleAssignment/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/Owners/GraphAppRoleAssignment/Count/CountRequestBuilder.php index 774080a0ab5..b7ff90ea008 100644 --- a/src/Generated/Applications/Item/Owners/GraphAppRoleAssignment/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/GraphAppRoleAssignment/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/Applications/Item/Owners/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index f7e1f73cf28..19521328735 100644 --- a/src/Generated/Applications/Item/Owners/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Owners\GraphAppRoleAssignment\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\AppRoleAssignmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.appRoleAssignment in the microsoft.graph.directoryObject collection * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/GraphEndpoint/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/Owners/GraphEndpoint/Count/CountRequestBuilder.php index 6fa5e5617d3..48a8407aba3 100644 --- a/src/Generated/Applications/Item/Owners/GraphEndpoint/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/GraphEndpoint/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/Applications/Item/Owners/GraphEndpoint/GraphEndpointRequestBuilder.php index e7c88069bf0..9ad981fe529 100644 --- a/src/Generated/Applications/Item/Owners/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Owners\GraphEndpoint\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\EndpointCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.endpoint in the microsoft.graph.directoryObject collection * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/Owners/GraphServicePrincipal/Count/CountRequestBuilder.php index fb0ed363869..a6eb52f739b 100644 --- a/src/Generated/Applications/Item/Owners/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Applications/Item/Owners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 50e9603fda9..3041dc1ecf9 100644 --- a/src/Generated/Applications/Item/Owners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Owners\GraphServicePrincipal\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/GraphUser/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/Owners/GraphUser/Count/CountRequestBuilder.php index 3d99793c73b..85ffa7924a0 100644 --- a/src/Generated/Applications/Item/Owners/GraphUser/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/GraphUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Applications/Item/Owners/GraphUser/GraphUserRequestBuilder.php index 4e96e0d1aed..449e7f8de1b 100644 --- a/src/Generated/Applications/Item/Owners/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Owners\GraphUser\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.user in the microsoft.graph.directoryObject collection * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/Applications/Item/Owners/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index bd779f1cadf..31254f78e20 100644 --- a/src/Generated/Applications/Item/Owners/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.appRoleAssignment * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/Item/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/Applications/Item/Owners/Item/GraphEndpoint/GraphEndpointRequestBuilder.php index b93acae3b3f..0b25de9137f 100644 --- a/src/Generated/Applications/Item/Owners/Item/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/Item/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Endpoint; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.endpoint * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Applications/Item/Owners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 0dd4ce3b8d7..206ba70e5d7 100644 --- a/src/Generated/Applications/Item/Owners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/Item/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Applications/Item/Owners/Item/GraphUser/GraphUserRequestBuilder.php index 7675d9b3d1d..cd3cba73d2d 100644 --- a/src/Generated/Applications/Item/Owners/Item/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/Item/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.user * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/Item/Ref/RefRequestBuilder.php b/src/Generated/Applications/Item/Owners/Item/Ref/RefRequestBuilder.php index 5f306a80d02..379ae281211 100644 --- a/src/Generated/Applications/Item/Owners/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an owner from an application. As a recommended best practice, apps should have at least two owners. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-delete-owners?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/OwnersRequestBuilder.php b/src/Generated/Applications/Item/Owners/OwnersRequestBuilder.php index 6d3294feae2..47f531823b2 100644 --- a/src/Generated/Applications/Item/Owners/OwnersRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/OwnersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Owners\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Owners\GraphAppRoleAssignment\GraphAppRoleAssignmentRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Owners\GraphEndpoint\GraphEndpointRequestBuilder; @@ -94,20 +93,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Directory objects that are owners of the application. Read-only. Nullable. Supports $expand, $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1), and $select nested in $expand. * @param OwnersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-list-owners?view=graph-rest-1.0 Find more info here */ public function get(?OwnersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -120,7 +116,6 @@ public function toGetRequestInformation(?OwnersRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -128,6 +123,7 @@ public function toGetRequestInformation(?OwnersRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Owners/Ref/RefRequestBuilder.php b/src/Generated/Applications/Item/Owners/Ref/RefRequestBuilder.php index 9b899e3195c..13d2bd3f366 100644 --- a/src/Generated/Applications/Item/Owners/Ref/RefRequestBuilder.php +++ b/src/Generated/Applications/Item/Owners/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Directory objects that are owners of the application. Read-only. Nullable. Supports $expand, $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1), and $select nested in $expand. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-list-owners?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add an owner to an application by posting to the owners collection. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-post-owners?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/RemoveKey/RemoveKeyRequestBuilder.php b/src/Generated/Applications/Item/RemoveKey/RemoveKeyRequestBuilder.php index 1a81621d94e..32be12480a3 100644 --- a/src/Generated/Applications/Item/RemoveKey/RemoveKeyRequestBuilder.php +++ b/src/Generated/Applications/Item/RemoveKey/RemoveKeyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Remove a key credential from an application. This method along with addKey can be used by an application to automate rolling its expiring keys. As part of the request validation for this method, a proof of possession of an existing key is verified before the action can be performed. This API is available in the following national cloud deployments. * @param RemoveKeyPostRequestBody $body The request body * @param RemoveKeyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-removekey?view=graph-rest-1.0 Find more info here */ public function post(RemoveKeyPostRequestBody $body, ?RemoveKeyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(RemoveKeyPostRequestBody $body, ?Remove $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/RemovePassword/RemovePasswordRequestBuilder.php b/src/Generated/Applications/Item/RemovePassword/RemovePasswordRequestBuilder.php index f2cb2f577ca..4879abb62be 100644 --- a/src/Generated/Applications/Item/RemovePassword/RemovePasswordRequestBuilder.php +++ b/src/Generated/Applications/Item/RemovePassword/RemovePasswordRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Remove a password from an application. This API is available in the following national cloud deployments. * @param RemovePasswordPostRequestBody $body The request body * @param RemovePasswordRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-removepassword?view=graph-rest-1.0 Find more info here */ public function post(RemovePasswordPostRequestBody $body, ?RemovePasswordRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(RemovePasswordPostRequestBody $body, ?R $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Restore/RestoreRequestBuilder.php b/src/Generated/Applications/Item/Restore/RestoreRequestBuilder.php index 04c1f5f61b9..c7aa1c2bbdb 100644 --- a/src/Generated/Applications/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/Applications/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/SetVerifiedPublisher/SetVerifiedPublisherRequestBuilder.php b/src/Generated/Applications/Item/SetVerifiedPublisher/SetVerifiedPublisherRequestBuilder.php index 5f894703d87..afd9019e0c3 100644 --- a/src/Generated/Applications/Item/SetVerifiedPublisher/SetVerifiedPublisherRequestBuilder.php +++ b/src/Generated/Applications/Item/SetVerifiedPublisher/SetVerifiedPublisherRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Set the verifiedPublisher on an application. For more information, including prerequisites to setting a verified publisher, see Publisher verification. This API is available in the following national cloud deployments. * @param SetVerifiedPublisherPostRequestBody $body The request body * @param SetVerifiedPublisherRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-setverifiedpublisher?view=graph-rest-1.0 Find more info here */ public function post(SetVerifiedPublisherPostRequestBody $body, ?SetVerifiedPublisherRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetVerifiedPublisherPostRequestBody $bo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/AcquireAccessToken/AcquireAccessTokenRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/AcquireAccessToken/AcquireAccessTokenRequestBuilder.php index d1c47820514..ea579971a73 100644 --- a/src/Generated/Applications/Item/Synchronization/AcquireAccessToken/AcquireAccessTokenRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/AcquireAccessToken/AcquireAccessTokenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Acquire an OAuth access token to authorize the Azure AD provisioning service to provision users into an application. This API is available in the following national cloud deployments. + * Acquire an OAuth access token to authorize the Microsoft Entra provisioning service to provision users into an application. This API is available in the following national cloud deployments. * @param AcquireAccessTokenPostRequestBody $body The request body * @param AcquireAccessTokenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronization-acquireaccesstoken?view=graph-rest-1.0 Find more info here */ public function post(AcquireAccessTokenPostRequestBody $body, ?AcquireAccessTokenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Acquire an OAuth access token to authorize the Azure AD provisioning service to provision users into an application. This API is available in the following national cloud deployments. + * Acquire an OAuth access token to authorize the Microsoft Entra provisioning service to provision users into an application. This API is available in the following national cloud deployments. * @param AcquireAccessTokenPostRequestBody $body The request body * @param AcquireAccessTokenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcquireAccessTokenPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Count/CountRequestBuilder.php index bde0836502b..f5ac44c1ca4 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Pause/PauseRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Pause/PauseRequestBuilder.php index afb171fb795..e49113344b7 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Pause/PauseRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Pause/PauseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Temporarily stop a running synchronization job. All the progress, including job state, is persisted, and the job will continue from where it left off when a start call is made. This API is available in the following national cloud deployments. * @param PauseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-pause?view=graph-rest-1.0 Find more info here */ public function post(?PauseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?PauseRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/ProvisionOnDemand/ProvisionOnDemandRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/ProvisionOnDemand/ProvisionOnDemandRequestBuilder.php index 39a2a8becf1..e6b8e3e0d70 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/ProvisionOnDemand/ProvisionOnDemandRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/ProvisionOnDemand/ProvisionOnDemandRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\StringKeyStringValuePair; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Select a user and provision the account on-demand. The rate limit for this API is 5 requests per 10 seconds. This API is available in the following national cloud deployments. * @param ProvisionOnDemandPostRequestBody $body The request body * @param ProvisionOnDemandRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-provisionondemand?view=graph-rest-1.0 Find more info here */ public function post(ProvisionOnDemandPostRequestBody $body, ?ProvisionOnDemandRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringKeyStringValuePair::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringKeyStringValuePair::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(ProvisionOnDemandPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Restart/RestartRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Restart/RestartRequestBuilder.php index e70ac5397bd..6839dc1cb10 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Restart/RestartRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Restart/RestartRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Restart a stopped synchronization job, forcing it to reprocess all the objects in the directory. Optionally clears existing the synchronization state and previous errors. This API is available in the following national cloud deployments. * @param RestartPostRequestBody $body The request body * @param RestartRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-restart?view=graph-rest-1.0 Find more info here */ public function post(RestartPostRequestBody $body, ?RestartRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(RestartPostRequestBody $body, ?RestartR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/Count/CountRequestBuilder.php index c7f1fd97a7e..6984a2dc6ce 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/DirectoriesRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/DirectoriesRequestBuilder.php index beca7249a92..67de42f75e5 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/DirectoriesRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/DirectoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Jobs\Item\Schema\Directories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Jobs\Item\Schema\Directories\Item\DirectoryDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\DirectoryDefinition; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the collection of directories and all of their objects. * @param DirectoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to directories for applications * @param DirectoryDefinition $body The request body * @param DirectoriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DirectoryDefinition $body, ?DirectoriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DirectoriesRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DirectoriesRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DirectoryDefinition $body, ?Directories $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php index befb3435f2a..1e986f81a69 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Jobs\Item\Schema\Directories\Item\Discover\DiscoverRequestBuilder; use Microsoft\Graph\Generated\Models\DirectoryDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property directories for applications * @param DirectoryDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DirectoryDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Contains the collection of directories and all of their objects. * @param DirectoryDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property directories in applications * @param DirectoryDefinition $body The request body * @param DirectoryDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DirectoryDefinition $body, ?DirectoryDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?DirectoryDefinitionItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?DirectoryDefinitionItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?DirectoryDefinitionItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(DirectoryDefinition $body, ?DirectoryD $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php index d041280d7f7..f110724354a 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Discover the latest schema definition for provisioning to an application. This API is available in the following national cloud deployments. * @param DiscoverRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-directorydefinition-discover?view=graph-rest-1.0 Find more info here */ public function post(?DiscoverRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?DiscoverRequestBuilderPostRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php index a5726c03fc0..b419e1c9a07 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterOperators * @param FilterOperatorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterOperatorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?FilterOperatorsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?FilterOperatorsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Functions/FunctionsRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Functions/FunctionsRequestBuilder.php index dbe083cb7e1..dd725c6b152 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Functions/FunctionsRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/Functions/FunctionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function functions * @param FunctionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FunctionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FunctionsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FunctionsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?FunctionsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?FunctionsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php index 4a423f5a7b8..80a4bc572a1 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ParseExpressionResponse; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,27 +31,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Azure Active Directory. This API is available in the following national cloud deployments. + * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Microsoft Entra ID. This API is available in the following national cloud deployments. * @param ParseExpressionPostRequestBody $body The request body * @param ParseExpressionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationschema-parseexpression?view=graph-rest-1.0 Find more info here */ public function post(ParseExpressionPostRequestBody $body, ?ParseExpressionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ParseExpressionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ParseExpressionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Azure Active Directory. This API is available in the following national cloud deployments. + * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Microsoft Entra ID. This API is available in the following national cloud deployments. * @param ParseExpressionPostRequestBody $body The request body * @param ParseExpressionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -62,11 +58,11 @@ public function toPostRequestInformation(ParseExpressionPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/SchemaRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/SchemaRequestBuilder.php index b56cb2e1641..efc2d0d9725 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/SchemaRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Schema/SchemaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Jobs\Item\Schema\Directories\DirectoriesRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Jobs\Item\Schema\FilterOperators\FilterOperatorsRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Jobs\Item\Schema\Functions\FunctionsRequestBuilder; @@ -66,58 +65,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property schema for applications * @param SchemaRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SchemaRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the schema for a given synchronization job or template. This API is available in the following national cloud deployments. * @param SchemaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationschema-get?view=graph-rest-1.0 Find more info here */ public function get(?SchemaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the synchronization schema for a given job or template. This method fully replaces the current schema with the one provided in the request. To update the schema of a template, make the call on the application object. You must be the owner of the application. * @param SynchronizationSchema $body The request body * @param SchemaRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationschema-update?view=graph-rest-1.0 Find more info here */ public function patch(SynchronizationSchema $body, ?SchemaRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -134,6 +124,7 @@ public function toDeleteRequestInformation(?SchemaRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -147,7 +138,6 @@ public function toGetRequestInformation(?SchemaRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -155,6 +145,7 @@ public function toGetRequestInformation(?SchemaRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -169,11 +160,11 @@ public function toPatchRequestInformation(SynchronizationSchema $body, ?SchemaRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Start/StartRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Start/StartRequestBuilder.php index a9af3b5dcf8..c45168dfec2 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/Start/StartRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/Start/StartRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Start an existing synchronization job. If the job is in a paused state, it continues processing changes from the point where it was paused. If the job is in quarantine, the quarantine status is cleared. Don't create scripts to call the start job continuously while it's running because that can cause the service to stop running. Use the start job only when the job is currently paused or in quarantine. This API is available in the following national cloud deployments. * @param StartRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-start?view=graph-rest-1.0 Find more info here */ public function post(?StartRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?StartRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/SynchronizationJobItemRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/SynchronizationJobItemRequestBuilder.php index 288cace41c3..48d90506035 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/SynchronizationJobItemRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/SynchronizationJobItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Jobs\Item\Pause\PauseRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Jobs\Item\ProvisionOnDemand\ProvisionOnDemandRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Jobs\Item\Restart\RestartRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Stop the synchronization job, and permanently delete all the state associated with it. Synchronized accounts are left as-is. This API is available in the following national cloud deployments. * @param SynchronizationJobItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SynchronizationJobItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the existing synchronization job and its properties. This API is available in the following national cloud deployments. * @param SynchronizationJobItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-get?view=graph-rest-1.0 Find more info here */ public function get(?SynchronizationJobItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property jobs in applications * @param SynchronizationJob $body The request body * @param SynchronizationJobItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SynchronizationJob $body, ?SynchronizationJobItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?SynchronizationJobItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?SynchronizationJobItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?SynchronizationJobItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(SynchronizationJob $body, ?Synchroniza $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/Item/ValidateCredentials/ValidateCredentialsRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/Item/ValidateCredentials/ValidateCredentialsRequestBuilder.php index 84a84e44ae5..6451299d8d8 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/Item/ValidateCredentials/ValidateCredentialsRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/Item/ValidateCredentials/ValidateCredentialsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that the credentials are valid in the tenant. This API is available in the following national cloud deployments. * @param ValidateCredentialsPostRequestBody $body The request body * @param ValidateCredentialsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-validatecredentials?view=graph-rest-1.0 Find more info here */ public function post(ValidateCredentialsPostRequestBody $body, ?ValidateCredentialsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidateCredentialsPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/JobsRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/JobsRequestBuilder.php index 8345814a3b9..c3e072723e7 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/JobsRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/JobsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Jobs\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Jobs\Item\SynchronizationJobItemRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Jobs\ValidateCredentials\ValidateCredentialsRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List existing jobs for a given application instance (service principal). This API is available in the following national cloud deployments. * @param JobsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronization-list-jobs?view=graph-rest-1.0 Find more info here */ public function get(?JobsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJobCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJobCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new synchronization job with a default synchronization schema. The job is created in a disabled state. Call Start job to start synchronization. This API is available in the following national cloud deployments. * @param SynchronizationJob $body The request body * @param JobsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronization-post-jobs?view=graph-rest-1.0 Find more info here */ public function post(SynchronizationJob $body, ?JobsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?JobsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?JobsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(SynchronizationJob $body, ?JobsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Jobs/ValidateCredentials/ValidateCredentialsRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Jobs/ValidateCredentials/ValidateCredentialsRequestBuilder.php index 5d0e728f9df..dcb681a9033 100644 --- a/src/Generated/Applications/Item/Synchronization/Jobs/ValidateCredentials/ValidateCredentialsRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Jobs/ValidateCredentials/ValidateCredentialsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action validateCredentials * @param ValidateCredentialsPostRequestBody $body The request body * @param ValidateCredentialsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ValidateCredentialsPostRequestBody $body, ?ValidateCredentialsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ValidateCredentialsPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Secrets/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Secrets/Count/CountRequestBuilder.php index fc52244c5b0..372605b4132 100644 --- a/src/Generated/Applications/Item/Synchronization/Secrets/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Secrets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Secrets/SecretsRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Secrets/SecretsRequestBuilder.php index 8b62c01d032..b42d2591b0a 100644 --- a/src/Generated/Applications/Item/Synchronization/Secrets/SecretsRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Secrets/SecretsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Secrets\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SynchronizationSecretKeyStringValuePair; @@ -43,19 +42,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Update property secrets value. * @param array $body The request body * @param SecretsRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise|null> + * @throws Exception */ public function put(array $body, ?SecretsRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendCollectionAsync($requestInfo, [SynchronizationSecretKeyStringValuePair::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendCollectionAsync($requestInfo, [SynchronizationSecretKeyStringValuePair::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -69,11 +65,11 @@ public function toPutRequestInformation(array $body, ?SecretsRequestBuilderPutRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsableCollection($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/SynchronizationRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/SynchronizationRequestBuilder.php index efc5e51a548..836f4f0ccad 100644 --- a/src/Generated/Applications/Item/Synchronization/SynchronizationRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/SynchronizationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Synchronization\AcquireAccessToken\AcquireAccessTokenRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Jobs\JobsRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Secrets\SecretsRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property synchronization for applications * @param SynchronizationRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SynchronizationRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Represents the capability for Azure Active Directory (Azure AD) identity synchronization through the Microsoft Graph API. + * Represents the capability for Microsoft Entra identity synchronization through the Microsoft Graph API. * @param SynchronizationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SynchronizationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Synchronization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Synchronization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property synchronization in applications * @param Synchronization $body The request body * @param SynchronizationRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(Synchronization $body, ?SynchronizationRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Synchronization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Synchronization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,11 +122,12 @@ public function toDeleteRequestInformation(?SynchronizationRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Represents the capability for Azure Active Directory (Azure AD) identity synchronization through the Microsoft Graph API. + * Represents the capability for Microsoft Entra identity synchronization through the Microsoft Graph API. * @param SynchronizationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -145,7 +136,6 @@ public function toGetRequestInformation(?SynchronizationRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?SynchronizationRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPutRequestInformation(Synchronization $body, ?SynchronizationR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/SynchronizationRequestBuilderGetQueryParameters.php b/src/Generated/Applications/Item/Synchronization/SynchronizationRequestBuilderGetQueryParameters.php index 2fa995e0ee1..f27552bd21d 100644 --- a/src/Generated/Applications/Item/Synchronization/SynchronizationRequestBuilderGetQueryParameters.php +++ b/src/Generated/Applications/Item/Synchronization/SynchronizationRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Represents the capability for Azure Active Directory (Azure AD) identity synchronization through the Microsoft Graph API. + * Represents the capability for Microsoft Entra identity synchronization through the Microsoft Graph API. */ class SynchronizationRequestBuilderGetQueryParameters { diff --git a/src/Generated/Applications/Item/Synchronization/Templates/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Templates/Count/CountRequestBuilder.php index 01075a8e5e4..f60bcf00068 100644 --- a/src/Generated/Applications/Item/Synchronization/Templates/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Templates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/Count/CountRequestBuilder.php index 4e8c196a2f0..b288a6f37b4 100644 --- a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/DirectoriesRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/DirectoriesRequestBuilder.php index 0cb997d49f9..18069e09c63 100644 --- a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/DirectoriesRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/DirectoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Templates\Item\Schema\Directories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Templates\Item\Schema\Directories\Item\DirectoryDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\DirectoryDefinition; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the collection of directories and all of their objects. * @param DirectoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to directories for applications * @param DirectoryDefinition $body The request body * @param DirectoriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DirectoryDefinition $body, ?DirectoriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DirectoriesRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DirectoriesRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DirectoryDefinition $body, ?Directories $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php index 0673e1450d9..311585864b8 100644 --- a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Templates\Item\Schema\Directories\Item\Discover\DiscoverRequestBuilder; use Microsoft\Graph\Generated\Models\DirectoryDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property directories for applications * @param DirectoryDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DirectoryDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Contains the collection of directories and all of their objects. * @param DirectoryDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property directories in applications * @param DirectoryDefinition $body The request body * @param DirectoryDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DirectoryDefinition $body, ?DirectoryDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?DirectoryDefinitionItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?DirectoryDefinitionItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?DirectoryDefinitionItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(DirectoryDefinition $body, ?DirectoryD $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php index a763ec08750..0b637622322 100644 --- a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Discover the latest schema definition for provisioning to an application. This API is available in the following national cloud deployments. * @param DiscoverRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-directorydefinition-discover?view=graph-rest-1.0 Find more info here */ public function post(?DiscoverRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?DiscoverRequestBuilderPostRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php index e1f1888586d..2948b6af509 100644 --- a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterOperators * @param FilterOperatorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterOperatorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?FilterOperatorsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?FilterOperatorsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Functions/FunctionsRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Functions/FunctionsRequestBuilder.php index c9002934a7a..b947679329c 100644 --- a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Functions/FunctionsRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/Functions/FunctionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function functions * @param FunctionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FunctionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FunctionsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FunctionsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?FunctionsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?FunctionsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php index 08d290b6c8d..af08b3088b5 100644 --- a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ParseExpressionResponse; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,27 +31,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Azure Active Directory. This API is available in the following national cloud deployments. + * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Microsoft Entra ID. This API is available in the following national cloud deployments. * @param ParseExpressionPostRequestBody $body The request body * @param ParseExpressionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationschema-parseexpression?view=graph-rest-1.0 Find more info here */ public function post(ParseExpressionPostRequestBody $body, ?ParseExpressionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ParseExpressionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ParseExpressionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Azure Active Directory. This API is available in the following national cloud deployments. + * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Microsoft Entra ID. This API is available in the following national cloud deployments. * @param ParseExpressionPostRequestBody $body The request body * @param ParseExpressionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -62,11 +58,11 @@ public function toPostRequestInformation(ParseExpressionPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/SchemaRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/SchemaRequestBuilder.php index cb61f9e669a..32fdad8f93b 100644 --- a/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/SchemaRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Templates/Item/Schema/SchemaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Templates\Item\Schema\Directories\DirectoriesRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Templates\Item\Schema\FilterOperators\FilterOperatorsRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Templates\Item\Schema\Functions\FunctionsRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property schema for applications * @param SchemaRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SchemaRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Default synchronization schema for the jobs based on this template. * @param SchemaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SchemaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property schema in applications * @param SynchronizationSchema $body The request body * @param SchemaRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SynchronizationSchema $body, ?SchemaRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?SchemaRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?SchemaRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?SchemaRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(SynchronizationSchema $body, ?SchemaRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Templates/Item/SynchronizationTemplateItemRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Templates/Item/SynchronizationTemplateItemRequestBuilder.php index 2bc4288b6f4..69aebc6596b 100644 --- a/src/Generated/Applications/Item/Synchronization/Templates/Item/SynchronizationTemplateItemRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Templates/Item/SynchronizationTemplateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Templates\Item\Schema\SchemaRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SynchronizationTemplate; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property templates for applications * @param SynchronizationTemplateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SynchronizationTemplateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Preconfigured synchronization settings for a particular application. * @param SynchronizationTemplateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SynchronizationTemplateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update (override) the synchronization template associated with a given application. This API is available in the following national cloud deployments. * @param SynchronizationTemplate $body The request body * @param SynchronizationTemplateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationtemplate-update?view=graph-rest-1.0 Find more info here */ public function patch(SynchronizationTemplate $body, ?SynchronizationTemplateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?SynchronizationTemplateItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?SynchronizationTemplateItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?SynchronizationTemplateItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(SynchronizationTemplate $body, ?Synchr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/Synchronization/Templates/TemplatesRequestBuilder.php b/src/Generated/Applications/Item/Synchronization/Templates/TemplatesRequestBuilder.php index e39dfbba062..e014635e2c5 100644 --- a/src/Generated/Applications/Item/Synchronization/Templates/TemplatesRequestBuilder.php +++ b/src/Generated/Applications/Item/Synchronization/Templates/TemplatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Templates\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\Synchronization\Templates\Item\SynchronizationTemplateItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the synchronization templates associated with a given application or service principal. This API is available in the following national cloud deployments. * @param TemplatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronization-list-templates?view=graph-rest-1.0 Find more info here */ public function get(?TemplatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to templates for applications * @param SynchronizationTemplate $body The request body * @param TemplatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SynchronizationTemplate $body, ?TemplatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TemplatesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TemplatesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SynchronizationTemplate $body, ?Templat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/TokenIssuancePolicies/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/TokenIssuancePolicies/Count/CountRequestBuilder.php index 1df443073ed..0be9958157f 100644 --- a/src/Generated/Applications/Item/TokenIssuancePolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/TokenIssuancePolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/TokenIssuancePolicies/Item/Ref/RefRequestBuilder.php b/src/Generated/Applications/Item/TokenIssuancePolicies/Item/Ref/RefRequestBuilder.php index c18c2a29836..ce6d9ba8bb8 100644 --- a/src/Generated/Applications/Item/TokenIssuancePolicies/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Applications/Item/TokenIssuancePolicies/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a tokenIssuancePolicy from an application. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-delete-tokenissuancepolicies?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/TokenIssuancePolicies/Ref/RefRequestBuilder.php b/src/Generated/Applications/Item/TokenIssuancePolicies/Ref/RefRequestBuilder.php index 2d17aadb565..a2ab93f3a93 100644 --- a/src/Generated/Applications/Item/TokenIssuancePolicies/Ref/RefRequestBuilder.php +++ b/src/Generated/Applications/Item/TokenIssuancePolicies/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the tokenIssuancePolicy objects that are assigned to an application. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-list-tokenissuancepolicies?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Assign a tokenIssuancePolicy to an application. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-post-tokenissuancepolicies?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/TokenIssuancePolicies/TokenIssuancePoliciesRequestBuilder.php b/src/Generated/Applications/Item/TokenIssuancePolicies/TokenIssuancePoliciesRequestBuilder.php index 90bf03c5253..125fd95aca9 100644 --- a/src/Generated/Applications/Item/TokenIssuancePolicies/TokenIssuancePoliciesRequestBuilder.php +++ b/src/Generated/Applications/Item/TokenIssuancePolicies/TokenIssuancePoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\TokenIssuancePolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\TokenIssuancePolicies\Item\TokenIssuancePolicyItemRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\TokenIssuancePolicies\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the tokenIssuancePolicy objects that are assigned to an application. This API is available in the following national cloud deployments. * @param TokenIssuancePoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-list-tokenissuancepolicies?view=graph-rest-1.0 Find more info here */ public function get(?TokenIssuancePoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?TokenIssuancePoliciesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?TokenIssuancePoliciesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/TokenLifetimePolicies/Count/CountRequestBuilder.php b/src/Generated/Applications/Item/TokenLifetimePolicies/Count/CountRequestBuilder.php index e225b70ee1d..2c9552c7da5 100644 --- a/src/Generated/Applications/Item/TokenLifetimePolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Applications/Item/TokenLifetimePolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/TokenLifetimePolicies/Item/Ref/RefRequestBuilder.php b/src/Generated/Applications/Item/TokenLifetimePolicies/Item/Ref/RefRequestBuilder.php index cfb9abf3fc7..899f28dd4c4 100644 --- a/src/Generated/Applications/Item/TokenLifetimePolicies/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Applications/Item/TokenLifetimePolicies/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a tokenLifetimePolicy from an application. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-delete-tokenlifetimepolicies?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/TokenLifetimePolicies/Ref/RefRequestBuilder.php b/src/Generated/Applications/Item/TokenLifetimePolicies/Ref/RefRequestBuilder.php index c21b5cad919..1e260909328 100644 --- a/src/Generated/Applications/Item/TokenLifetimePolicies/Ref/RefRequestBuilder.php +++ b/src/Generated/Applications/Item/TokenLifetimePolicies/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the tokenLifetimePolicy objects that are assigned to an application. Only one object is returned in the collection because only one tokenLifetimePolicy can be assigned to an application. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-list-tokenlifetimepolicies?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Assign a tokenLifetimePolicy to an application. You can have multiple tokenLifetimePolicy policies in a tenant but can assign only one tokenLifetimePolicy per application. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-post-tokenlifetimepolicies?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Applications/Item/TokenLifetimePolicies/TokenLifetimePoliciesRequestBuilder.php b/src/Generated/Applications/Item/TokenLifetimePolicies/TokenLifetimePoliciesRequestBuilder.php index 326b59cb475..4086260c097 100644 --- a/src/Generated/Applications/Item/TokenLifetimePolicies/TokenLifetimePoliciesRequestBuilder.php +++ b/src/Generated/Applications/Item/TokenLifetimePolicies/TokenLifetimePoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Applications\Item\TokenLifetimePolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\TokenLifetimePolicies\Item\TokenLifetimePolicyItemRequestBuilder; use Microsoft\Graph\Generated\Applications\Item\TokenLifetimePolicies\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the tokenLifetimePolicy objects that are assigned to an application. Only one object is returned in the collection because only one tokenLifetimePolicy can be assigned to an application. This API is available in the following national cloud deployments. * @param TokenLifetimePoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-list-tokenlifetimepolicies?view=graph-rest-1.0 Find more info here */ public function get(?TokenLifetimePoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?TokenLifetimePoliciesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?TokenLifetimePoliciesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Applications/Item/UnsetVerifiedPublisher/UnsetVerifiedPublisherRequestBuilder.php b/src/Generated/Applications/Item/UnsetVerifiedPublisher/UnsetVerifiedPublisherRequestBuilder.php index f40991032a7..dc5bf35a0a8 100644 --- a/src/Generated/Applications/Item/UnsetVerifiedPublisher/UnsetVerifiedPublisherRequestBuilder.php +++ b/src/Generated/Applications/Item/UnsetVerifiedPublisher/UnsetVerifiedPublisherRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unset the verifiedPublisher previously set on an application, removing all verified publisher properties. For more information, see Publisher verification. This API is available in the following national cloud deployments. * @param UnsetVerifiedPublisherRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-unsetverifiedpublisher?view=graph-rest-1.0 Find more info here */ public function post(?UnsetVerifiedPublisherRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnsetVerifiedPublisherRequestBuilderPo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Applications/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/Applications/ValidateProperties/ValidatePropertiesRequestBuilder.php index 20d4e6252b8..724a0d84188 100644 --- a/src/Generated/Applications/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/Applications/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ApplicationsWithAppId/ApplicationsWithAppIdRequestBuilder.php b/src/Generated/ApplicationsWithAppId/ApplicationsWithAppIdRequestBuilder.php index 5cd0919fab2..463b53001ef 100644 --- a/src/Generated/ApplicationsWithAppId/ApplicationsWithAppIdRequestBuilder.php +++ b/src/Generated/ApplicationsWithAppId/ApplicationsWithAppIdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Application; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,59 +36,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an application object. When deleted, apps are moved to a temporary container and can be restored within 30 days. After that time, they are permanently deleted. This API is available in the following national cloud deployments. * @param ApplicationsWithAppIdRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ApplicationsWithAppIdRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of an application object. This API is available in the following national cloud deployments. * @param ApplicationsWithAppIdRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-get?view=graph-rest-1.0 Find more info here */ public function get(?ApplicationsWithAppIdRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an application object. This API is available in the following national cloud deployments. * @param Application $body The request body * @param ApplicationsWithAppIdRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-update?view=graph-rest-1.0 Find more info here */ public function patch(Application $body, ?ApplicationsWithAppIdRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -106,6 +96,7 @@ public function toDeleteRequestInformation(?ApplicationsWithAppIdRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -119,7 +110,6 @@ public function toGetRequestInformation(?ApplicationsWithAppIdRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -127,6 +117,7 @@ public function toGetRequestInformation(?ApplicationsWithAppIdRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -141,11 +132,11 @@ public function toPatchRequestInformation(Application $body, ?ApplicationsWithAp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AuditLogs/AuditLogsRequestBuilder.php b/src/Generated/AuditLogs/AuditLogsRequestBuilder.php index a09ba179242..68b0d82043f 100644 --- a/src/Generated/AuditLogs/AuditLogsRequestBuilder.php +++ b/src/Generated/AuditLogs/AuditLogsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\AuditLogs\DirectoryAudits\DirectoryAuditsRequestBuilder; use Microsoft\Graph\Generated\AuditLogs\Provisioning\ProvisioningRequestBuilder; use Microsoft\Graph\Generated\AuditLogs\SignIns\SignInsRequestBuilder; @@ -58,38 +57,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get auditLogs * @param AuditLogsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuditLogsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuditLogRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuditLogRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update auditLogs * @param AuditLogRoot $body The request body * @param AuditLogsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AuditLogRoot $body, ?AuditLogsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuditLogRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuditLogRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,7 +95,6 @@ public function toGetRequestInformation(?AuditLogsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -110,6 +102,7 @@ public function toGetRequestInformation(?AuditLogsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -124,11 +117,11 @@ public function toPatchRequestInformation(AuditLogRoot $body, ?AuditLogsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AuditLogs/DirectoryAudits/Count/CountRequestBuilder.php b/src/Generated/AuditLogs/DirectoryAudits/Count/CountRequestBuilder.php index edf80518738..35fae0bb229 100644 --- a/src/Generated/AuditLogs/DirectoryAudits/Count/CountRequestBuilder.php +++ b/src/Generated/AuditLogs/DirectoryAudits/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/AuditLogs/DirectoryAudits/DirectoryAuditsRequestBuilder.php b/src/Generated/AuditLogs/DirectoryAudits/DirectoryAuditsRequestBuilder.php index 7a2dce7a65c..a7a1319b37c 100644 --- a/src/Generated/AuditLogs/DirectoryAudits/DirectoryAuditsRequestBuilder.php +++ b/src/Generated/AuditLogs/DirectoryAudits/DirectoryAuditsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\AuditLogs\DirectoryAudits\Count\CountRequestBuilder; use Microsoft\Graph\Generated\AuditLogs\DirectoryAudits\Item\DirectoryAuditItemRequestBuilder; use Microsoft\Graph\Generated\Models\DirectoryAudit; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get the list of audit logs generated by Azure Active Directory (Azure AD). This includes audit logs generated by various services within Azure AD, including user, app, device and group Management, privileged identity management (PIM), access reviews, terms of use, identity protection, password management (self-service and admin password resets), and self- service group management, and so on. This API is available in the following national cloud deployments. + * Get the list of audit logs generated by Microsoft Entra ID. This includes audit logs generated by various services within Microsoft Entra ID, including user, app, device and group Management, privileged identity management (PIM), access reviews, terms of use, identity protection, password management (self-service and admin password resets), and self- service group management, and so on. This API is available in the following national cloud deployments. * @param DirectoryAuditsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryaudit-list?view=graph-rest-1.0 Find more info here */ public function get(?DirectoryAuditsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryAuditCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryAuditCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to directoryAudits for auditLogs * @param DirectoryAudit $body The request body * @param DirectoryAuditsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DirectoryAudit $body, ?DirectoryAuditsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryAudit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryAudit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get the list of audit logs generated by Azure Active Directory (Azure AD). This includes audit logs generated by various services within Azure AD, including user, app, device and group Management, privileged identity management (PIM), access reviews, terms of use, identity protection, password management (self-service and admin password resets), and self- service group management, and so on. This API is available in the following national cloud deployments. + * Get the list of audit logs generated by Microsoft Entra ID. This includes audit logs generated by various services within Microsoft Entra ID, including user, app, device and group Management, privileged identity management (PIM), access reviews, terms of use, identity protection, password management (self-service and admin password resets), and self- service group management, and so on. This API is available in the following national cloud deployments. * @param DirectoryAuditsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?DirectoryAuditsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?DirectoryAuditsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(DirectoryAudit $body, ?DirectoryAuditsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AuditLogs/DirectoryAudits/DirectoryAuditsRequestBuilderGetQueryParameters.php b/src/Generated/AuditLogs/DirectoryAudits/DirectoryAuditsRequestBuilderGetQueryParameters.php index 3ef0077cb10..aa227078e9c 100644 --- a/src/Generated/AuditLogs/DirectoryAudits/DirectoryAuditsRequestBuilderGetQueryParameters.php +++ b/src/Generated/AuditLogs/DirectoryAudits/DirectoryAuditsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get the list of audit logs generated by Azure Active Directory (Azure AD). This includes audit logs generated by various services within Azure AD, including user, app, device and group Management, privileged identity management (PIM), access reviews, terms of use, identity protection, password management (self-service and admin password resets), and self- service group management, and so on. This API is available in the following national cloud deployments. + * Get the list of audit logs generated by Microsoft Entra ID. This includes audit logs generated by various services within Microsoft Entra ID, including user, app, device and group Management, privileged identity management (PIM), access reviews, terms of use, identity protection, password management (self-service and admin password resets), and self- service group management, and so on. This API is available in the following national cloud deployments. */ class DirectoryAuditsRequestBuilderGetQueryParameters { diff --git a/src/Generated/AuditLogs/DirectoryAudits/Item/DirectoryAuditItemRequestBuilder.php b/src/Generated/AuditLogs/DirectoryAudits/Item/DirectoryAuditItemRequestBuilder.php index 1867de5ac93..4bafe13e826 100644 --- a/src/Generated/AuditLogs/DirectoryAudits/Item/DirectoryAuditItemRequestBuilder.php +++ b/src/Generated/AuditLogs/DirectoryAudits/Item/DirectoryAuditItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryAudit; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property directoryAudits for auditLogs * @param DirectoryAuditItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DirectoryAuditItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Get a specific Azure Active Directory audit log item. This includes an audit log item generated by various services within Azure Active Directory like user, application, device and group management, privileged identity management (PIM), access reviews, terms of use, identity protection, password management (self-service and admin password resets), self-service group management, and so on. This API is available in the following national cloud deployments. + * Get a specific Microsoft Entra audit log item. This includes an audit log item generated by various services within Microsoft Entra ID like user, application, device and group management, privileged identity management (PIM), access reviews, terms of use, identity protection, password management (self-service and admin password resets), self-service group management, and so on. This API is available in the following national cloud deployments. * @param DirectoryAuditItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryaudit-get?view=graph-rest-1.0 Find more info here */ public function get(?DirectoryAuditItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryAudit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryAudit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property directoryAudits in auditLogs * @param DirectoryAudit $body The request body * @param DirectoryAuditItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DirectoryAudit $body, ?DirectoryAuditItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryAudit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryAudit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,11 +91,12 @@ public function toDeleteRequestInformation(?DirectoryAuditItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Get a specific Azure Active Directory audit log item. This includes an audit log item generated by various services within Azure Active Directory like user, application, device and group management, privileged identity management (PIM), access reviews, terms of use, identity protection, password management (self-service and admin password resets), self-service group management, and so on. This API is available in the following national cloud deployments. + * Get a specific Microsoft Entra audit log item. This includes an audit log item generated by various services within Microsoft Entra ID like user, application, device and group management, privileged identity management (PIM), access reviews, terms of use, identity protection, password management (self-service and admin password resets), self-service group management, and so on. This API is available in the following national cloud deployments. * @param DirectoryAuditItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -114,7 +105,6 @@ public function toGetRequestInformation(?DirectoryAuditItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?DirectoryAuditItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(DirectoryAudit $body, ?DirectoryAuditI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AuditLogs/DirectoryAudits/Item/DirectoryAuditItemRequestBuilderGetQueryParameters.php b/src/Generated/AuditLogs/DirectoryAudits/Item/DirectoryAuditItemRequestBuilderGetQueryParameters.php index b38ba591a99..49f3e91c267 100644 --- a/src/Generated/AuditLogs/DirectoryAudits/Item/DirectoryAuditItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/AuditLogs/DirectoryAudits/Item/DirectoryAuditItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get a specific Azure Active Directory audit log item. This includes an audit log item generated by various services within Azure Active Directory like user, application, device and group management, privileged identity management (PIM), access reviews, terms of use, identity protection, password management (self-service and admin password resets), self-service group management, and so on. This API is available in the following national cloud deployments. + * Get a specific Microsoft Entra audit log item. This includes an audit log item generated by various services within Microsoft Entra ID like user, application, device and group management, privileged identity management (PIM), access reviews, terms of use, identity protection, password management (self-service and admin password resets), self-service group management, and so on. This API is available in the following national cloud deployments. */ class DirectoryAuditItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/AuditLogs/Provisioning/Count/CountRequestBuilder.php b/src/Generated/AuditLogs/Provisioning/Count/CountRequestBuilder.php index 82aea89fdab..4f39247af0f 100644 --- a/src/Generated/AuditLogs/Provisioning/Count/CountRequestBuilder.php +++ b/src/Generated/AuditLogs/Provisioning/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/AuditLogs/Provisioning/Item/ProvisioningObjectSummaryItemRequestBuilder.php b/src/Generated/AuditLogs/Provisioning/Item/ProvisioningObjectSummaryItemRequestBuilder.php index f3ee8a93983..0fd41ef8aea 100644 --- a/src/Generated/AuditLogs/Provisioning/Item/ProvisioningObjectSummaryItemRequestBuilder.php +++ b/src/Generated/AuditLogs/Provisioning/Item/ProvisioningObjectSummaryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProvisioningObjectSummary; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property provisioning for auditLogs * @param ProvisioningObjectSummaryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ProvisioningObjectSummaryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get provisioning from auditLogs * @param ProvisioningObjectSummaryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ProvisioningObjectSummaryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProvisioningObjectSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProvisioningObjectSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property provisioning in auditLogs * @param ProvisioningObjectSummary $body The request body * @param ProvisioningObjectSummaryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ProvisioningObjectSummary $body, ?ProvisioningObjectSummaryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProvisioningObjectSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProvisioningObjectSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ProvisioningObjectSummaryItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ProvisioningObjectSummaryItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ProvisioningObjectSummaryItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ProvisioningObjectSummary $body, ?Prov $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AuditLogs/Provisioning/ProvisioningRequestBuilder.php b/src/Generated/AuditLogs/Provisioning/ProvisioningRequestBuilder.php index a05dfad3a63..6a12582aacb 100644 --- a/src/Generated/AuditLogs/Provisioning/ProvisioningRequestBuilder.php +++ b/src/Generated/AuditLogs/Provisioning/ProvisioningRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\AuditLogs\Provisioning\Count\CountRequestBuilder; use Microsoft\Graph\Generated\AuditLogs\Provisioning\Item\ProvisioningObjectSummaryItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get all provisioning events that occurred in your tenant, such as the deletion of a group in a target application or the creation of a user when provisioning user accounts from your HR system. This API is available in the following national cloud deployments. * @param ProvisioningRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/provisioningobjectsummary-list?view=graph-rest-1.0 Find more info here */ public function get(?ProvisioningRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProvisioningObjectSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProvisioningObjectSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to provisioning for auditLogs * @param ProvisioningObjectSummary $body The request body * @param ProvisioningRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ProvisioningObjectSummary $body, ?ProvisioningRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProvisioningObjectSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProvisioningObjectSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ProvisioningRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ProvisioningRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ProvisioningObjectSummary $body, ?Provi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AuditLogs/SignIns/Count/CountRequestBuilder.php b/src/Generated/AuditLogs/SignIns/Count/CountRequestBuilder.php index a94797d505c..c8e233e7ca0 100644 --- a/src/Generated/AuditLogs/SignIns/Count/CountRequestBuilder.php +++ b/src/Generated/AuditLogs/SignIns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/AuditLogs/SignIns/Item/SignInItemRequestBuilder.php b/src/Generated/AuditLogs/SignIns/Item/SignInItemRequestBuilder.php index b9ada164b35..ba6c3f20c2e 100644 --- a/src/Generated/AuditLogs/SignIns/Item/SignInItemRequestBuilder.php +++ b/src/Generated/AuditLogs/SignIns/Item/SignInItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SignIn; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property signIns for auditLogs * @param SignInItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SignInItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Retrieve a specific Azure AD user sign-in event for your tenant. Sign-ins that are interactive in nature (where a username/password is passed as part of auth token) and successful federated sign-ins are currently included in the sign-in logs. This API is available in the following national cloud deployments. + * Retrieve a specific Microsoft Entra user sign-in event for your tenant. Sign-ins that are interactive in nature (where a username/password is passed as part of auth token) and successful federated sign-ins are currently included in the sign-in logs. This API is available in the following national cloud deployments. * @param SignInItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/signin-get?view=graph-rest-1.0 Find more info here */ public function get(?SignInItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SignIn::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SignIn::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property signIns in auditLogs * @param SignIn $body The request body * @param SignInItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SignIn $body, ?SignInItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SignIn::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SignIn::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,11 +91,12 @@ public function toDeleteRequestInformation(?SignInItemRequestBuilderDeleteReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Retrieve a specific Azure AD user sign-in event for your tenant. Sign-ins that are interactive in nature (where a username/password is passed as part of auth token) and successful federated sign-ins are currently included in the sign-in logs. This API is available in the following national cloud deployments. + * Retrieve a specific Microsoft Entra user sign-in event for your tenant. Sign-ins that are interactive in nature (where a username/password is passed as part of auth token) and successful federated sign-ins are currently included in the sign-in logs. This API is available in the following national cloud deployments. * @param SignInItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -114,7 +105,6 @@ public function toGetRequestInformation(?SignInItemRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?SignInItemRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(SignIn $body, ?SignInItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AuditLogs/SignIns/Item/SignInItemRequestBuilderGetQueryParameters.php b/src/Generated/AuditLogs/SignIns/Item/SignInItemRequestBuilderGetQueryParameters.php index 6aec0fedfc7..686b29e1b83 100644 --- a/src/Generated/AuditLogs/SignIns/Item/SignInItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/AuditLogs/SignIns/Item/SignInItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve a specific Azure AD user sign-in event for your tenant. Sign-ins that are interactive in nature (where a username/password is passed as part of auth token) and successful federated sign-ins are currently included in the sign-in logs. This API is available in the following national cloud deployments. + * Retrieve a specific Microsoft Entra user sign-in event for your tenant. Sign-ins that are interactive in nature (where a username/password is passed as part of auth token) and successful federated sign-ins are currently included in the sign-in logs. This API is available in the following national cloud deployments. */ class SignInItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/AuditLogs/SignIns/SignInsRequestBuilder.php b/src/Generated/AuditLogs/SignIns/SignInsRequestBuilder.php index 50035b9a030..7847557dcf6 100644 --- a/src/Generated/AuditLogs/SignIns/SignInsRequestBuilder.php +++ b/src/Generated/AuditLogs/SignIns/SignInsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\AuditLogs\SignIns\Count\CountRequestBuilder; use Microsoft\Graph\Generated\AuditLogs\SignIns\Item\SignInItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the Azure AD user sign-ins for your tenant. Sign-ins that are interactive in nature (where a username/password is passed as part of auth token) and successful federated sign-ins are currently included in the sign-in logs. The maximum and default page size is 1,000 objects and by default, the most recent sign-ins are returned first. Only sign-in events that occurred within the Azure Active Directory (Azure AD) default retention period are available. This API is available in the following national cloud deployments. + * Retrieve the Microsoft Entra user sign-ins for your tenant. Sign-ins that are interactive in nature (where a username/password is passed as part of auth token) and successful federated sign-ins are currently included in the sign-in logs. The maximum and default page size is 1,000 objects and by default, the most recent sign-ins are returned first. Only sign-in events that occurred within the Microsoft Entra ID default retention period are available. This API is available in the following national cloud deployments. * @param SignInsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/signin-list?view=graph-rest-1.0 Find more info here */ public function get(?SignInsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SignInCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SignInCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to signIns for auditLogs * @param SignIn $body The request body * @param SignInsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SignIn $body, ?SignInsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SignIn::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SignIn::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the Azure AD user sign-ins for your tenant. Sign-ins that are interactive in nature (where a username/password is passed as part of auth token) and successful federated sign-ins are currently included in the sign-in logs. The maximum and default page size is 1,000 objects and by default, the most recent sign-ins are returned first. Only sign-in events that occurred within the Azure Active Directory (Azure AD) default retention period are available. This API is available in the following national cloud deployments. + * Retrieve the Microsoft Entra user sign-ins for your tenant. Sign-ins that are interactive in nature (where a username/password is passed as part of auth token) and successful federated sign-ins are currently included in the sign-in logs. The maximum and default page size is 1,000 objects and by default, the most recent sign-ins are returned first. Only sign-in events that occurred within the Microsoft Entra ID default retention period are available. This API is available in the following national cloud deployments. * @param SignInsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SignInsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SignInsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SignIn $body, ?SignInsRequestBuilderPos $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AuditLogs/SignIns/SignInsRequestBuilderGetQueryParameters.php b/src/Generated/AuditLogs/SignIns/SignInsRequestBuilderGetQueryParameters.php index ffcced9c961..61b1fe6f960 100644 --- a/src/Generated/AuditLogs/SignIns/SignInsRequestBuilderGetQueryParameters.php +++ b/src/Generated/AuditLogs/SignIns/SignInsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the Azure AD user sign-ins for your tenant. Sign-ins that are interactive in nature (where a username/password is passed as part of auth token) and successful federated sign-ins are currently included in the sign-in logs. The maximum and default page size is 1,000 objects and by default, the most recent sign-ins are returned first. Only sign-in events that occurred within the Azure Active Directory (Azure AD) default retention period are available. This API is available in the following national cloud deployments. + * Retrieve the Microsoft Entra user sign-ins for your tenant. Sign-ins that are interactive in nature (where a username/password is passed as part of auth token) and successful federated sign-ins are currently included in the sign-in logs. The maximum and default page size is 1,000 objects and by default, the most recent sign-ins are returned first. Only sign-in events that occurred within the Microsoft Entra ID default retention period are available. This API is available in the following national cloud deployments. */ class SignInsRequestBuilderGetQueryParameters { diff --git a/src/Generated/AuthenticationMethodConfigurations/AuthenticationMethodConfigurationsRequestBuilder.php b/src/Generated/AuthenticationMethodConfigurations/AuthenticationMethodConfigurationsRequestBuilder.php index 5721134029b..612499e8162 100644 --- a/src/Generated/AuthenticationMethodConfigurations/AuthenticationMethodConfigurationsRequestBuilder.php +++ b/src/Generated/AuthenticationMethodConfigurations/AuthenticationMethodConfigurationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\AuthenticationMethodConfigurations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\AuthenticationMethodConfigurations\Item\AuthenticationMethodConfigurationItemRequestBuilder; use Microsoft\Graph\Generated\Models\AuthenticationMethodConfiguration; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from authenticationMethodConfigurations * @param AuthenticationMethodConfigurationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthenticationMethodConfigurationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to authenticationMethodConfigurations * @param AuthenticationMethodConfiguration $body The request body * @param AuthenticationMethodConfigurationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AuthenticationMethodConfiguration $body, ?AuthenticationMethodConfigurationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AuthenticationMethodConfigurationsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AuthenticationMethodConfigurationsReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AuthenticationMethodConfiguration $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AuthenticationMethodConfigurations/Count/CountRequestBuilder.php b/src/Generated/AuthenticationMethodConfigurations/Count/CountRequestBuilder.php index 6aadf5d195b..589cb66e17c 100644 --- a/src/Generated/AuthenticationMethodConfigurations/Count/CountRequestBuilder.php +++ b/src/Generated/AuthenticationMethodConfigurations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/AuthenticationMethodConfigurations/Item/AuthenticationMethodConfigurationItemRequestBuilder.php b/src/Generated/AuthenticationMethodConfigurations/Item/AuthenticationMethodConfigurationItemRequestBuilder.php index 45ef720aee4..ab5abe2df67 100644 --- a/src/Generated/AuthenticationMethodConfigurations/Item/AuthenticationMethodConfigurationItemRequestBuilder.php +++ b/src/Generated/AuthenticationMethodConfigurations/Item/AuthenticationMethodConfigurationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationMethodConfiguration; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from authenticationMethodConfigurations * @param AuthenticationMethodConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AuthenticationMethodConfigurationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entity from authenticationMethodConfigurations by key * @param AuthenticationMethodConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthenticationMethodConfigurationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in authenticationMethodConfigurations * @param AuthenticationMethodConfiguration $body The request body * @param AuthenticationMethodConfigurationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AuthenticationMethodConfiguration $body, ?AuthenticationMethodConfigurationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AuthenticationMethodConfigurationIte $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AuthenticationMethodConfigurationItemRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AuthenticationMethodConfigurationItemRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AuthenticationMethodConfiguration $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/AuthenticationMethodConfigurationsRequestBuilder.php b/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/AuthenticationMethodConfigurationsRequestBuilder.php index 01e40c941f4..a0f9d966745 100644 --- a/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/AuthenticationMethodConfigurationsRequestBuilder.php +++ b/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/AuthenticationMethodConfigurationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\AuthenticationMethodsPolicy\AuthenticationMethodConfigurations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\AuthenticationMethodsPolicy\AuthenticationMethodConfigurations\Item\AuthenticationMethodConfigurationItemRequestBuilder; use Microsoft\Graph\Generated\Models\AuthenticationMethodConfiguration; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents the settings for each authentication method. Automatically expanded on GET /policies/authenticationMethodsPolicy. * @param AuthenticationMethodConfigurationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthenticationMethodConfigurationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to authenticationMethodConfigurations for authenticationMethodsPolicy * @param AuthenticationMethodConfiguration $body The request body * @param AuthenticationMethodConfigurationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AuthenticationMethodConfiguration $body, ?AuthenticationMethodConfigurationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AuthenticationMethodConfigurationsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AuthenticationMethodConfigurationsReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AuthenticationMethodConfiguration $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Count/CountRequestBuilder.php b/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Count/CountRequestBuilder.php index 325563478ce..0a3a9397c25 100644 --- a/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Count/CountRequestBuilder.php +++ b/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Item/AuthenticationMethodConfigurationItemRequestBuilder.php b/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Item/AuthenticationMethodConfigurationItemRequestBuilder.php index 3cc404302ad..613572ed93e 100644 --- a/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Item/AuthenticationMethodConfigurationItemRequestBuilder.php +++ b/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Item/AuthenticationMethodConfigurationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationMethodConfiguration; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property authenticationMethodConfigurations for authenticationMethodsPolicy * @param AuthenticationMethodConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AuthenticationMethodConfigurationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the settings for each authentication method. Automatically expanded on GET /policies/authenticationMethodsPolicy. * @param AuthenticationMethodConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthenticationMethodConfigurationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property authenticationMethodConfigurations in authenticationMethodsPolicy * @param AuthenticationMethodConfiguration $body The request body * @param AuthenticationMethodConfigurationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AuthenticationMethodConfiguration $body, ?AuthenticationMethodConfigurationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AuthenticationMethodConfigurationIte $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AuthenticationMethodConfigurationItemRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AuthenticationMethodConfigurationItemRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AuthenticationMethodConfiguration $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodsPolicyRequestBuilder.php b/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodsPolicyRequestBuilder.php index 43dd001a3f8..c2f93c131e5 100644 --- a/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodsPolicyRequestBuilder.php +++ b/src/Generated/AuthenticationMethodsPolicy/AuthenticationMethodsPolicyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\AuthenticationMethodsPolicy\AuthenticationMethodConfigurations\AuthenticationMethodConfigurationsRequestBuilder; use Microsoft\Graph\Generated\Models\AuthenticationMethodsPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,38 +41,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get authenticationMethodsPolicy * @param AuthenticationMethodsPolicyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthenticationMethodsPolicyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodsPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodsPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update authenticationMethodsPolicy * @param AuthenticationMethodsPolicy $body The request body * @param AuthenticationMethodsPolicyRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AuthenticationMethodsPolicy $body, ?AuthenticationMethodsPolicyRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodsPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodsPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -86,7 +79,6 @@ public function toGetRequestInformation(?AuthenticationMethodsPolicyRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -94,6 +86,7 @@ public function toGetRequestInformation(?AuthenticationMethodsPolicyRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -108,11 +101,11 @@ public function toPatchRequestInformation(AuthenticationMethodsPolicy $body, ?Au $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/CertificateBasedAuthConfiguration/CertificateBasedAuthConfigurationRequestBuilder.php b/src/Generated/CertificateBasedAuthConfiguration/CertificateBasedAuthConfigurationRequestBuilder.php index e5a10465bd9..dfdf4099e14 100644 --- a/src/Generated/CertificateBasedAuthConfiguration/CertificateBasedAuthConfigurationRequestBuilder.php +++ b/src/Generated/CertificateBasedAuthConfiguration/CertificateBasedAuthConfigurationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\CertificateBasedAuthConfiguration\Count\CountRequestBuilder; use Microsoft\Graph\Generated\CertificateBasedAuthConfiguration\Item\CertificateBasedAuthConfigurationItemRequestBuilder; use Microsoft\Graph\Generated\Models\CertificateBasedAuthConfiguration; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from certificateBasedAuthConfiguration * @param CertificateBasedAuthConfigurationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CertificateBasedAuthConfigurationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to certificateBasedAuthConfiguration * @param CertificateBasedAuthConfiguration $body The request body * @param CertificateBasedAuthConfigurationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CertificateBasedAuthConfiguration $body, ?CertificateBasedAuthConfigurationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?CertificateBasedAuthConfigurationReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?CertificateBasedAuthConfigurationReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(CertificateBasedAuthConfiguration $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/CertificateBasedAuthConfiguration/Count/CountRequestBuilder.php b/src/Generated/CertificateBasedAuthConfiguration/Count/CountRequestBuilder.php index 27847a3289c..caa344627d3 100644 --- a/src/Generated/CertificateBasedAuthConfiguration/Count/CountRequestBuilder.php +++ b/src/Generated/CertificateBasedAuthConfiguration/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/CertificateBasedAuthConfiguration/Item/CertificateBasedAuthConfigurationItemRequestBuilder.php b/src/Generated/CertificateBasedAuthConfiguration/Item/CertificateBasedAuthConfigurationItemRequestBuilder.php index 798e9fd867e..c414369438f 100644 --- a/src/Generated/CertificateBasedAuthConfiguration/Item/CertificateBasedAuthConfigurationItemRequestBuilder.php +++ b/src/Generated/CertificateBasedAuthConfiguration/Item/CertificateBasedAuthConfigurationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CertificateBasedAuthConfiguration; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from certificateBasedAuthConfiguration * @param CertificateBasedAuthConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CertificateBasedAuthConfigurationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entity from certificateBasedAuthConfiguration by key * @param CertificateBasedAuthConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CertificateBasedAuthConfigurationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in certificateBasedAuthConfiguration * @param CertificateBasedAuthConfiguration $body The request body * @param CertificateBasedAuthConfigurationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(CertificateBasedAuthConfiguration $body, ?CertificateBasedAuthConfigurationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?CertificateBasedAuthConfigurationIte $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?CertificateBasedAuthConfigurationItemRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?CertificateBasedAuthConfigurationItemRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(CertificateBasedAuthConfiguration $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/ChatsRequestBuilder.php b/src/Generated/Chats/ChatsRequestBuilder.php index 1c7b7d43978..bd0b921597a 100644 --- a/src/Generated/Chats/ChatsRequestBuilder.php +++ b/src/Generated/Chats/ChatsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Chats\GetAllMessages\GetAllMessagesRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\ChatItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of chats that the user is part of. This method supports federation. When a user ID is provided, the calling application must belong to the same tenant that the user belongs to. This API is available in the following national cloud deployments. * @param ChatsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-list?view=graph-rest-1.0 Find more info here */ public function get(?ChatsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new chat object. This API is available in the following national cloud deployments. * @param Chat $body The request body * @param ChatsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-post?view=graph-rest-1.0 Find more info here */ public function post(Chat $body, ?ChatsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ChatsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ChatsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Chat $body, ?ChatsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Count/CountRequestBuilder.php b/src/Generated/Chats/Count/CountRequestBuilder.php index d6a25a6c7b5..a1aff83fac3 100644 --- a/src/Generated/Chats/Count/CountRequestBuilder.php +++ b/src/Generated/Chats/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Chats/GetAllMessages/GetAllMessagesRequestBuilder.php b/src/Generated/Chats/GetAllMessages/GetAllMessagesRequestBuilder.php index 642d29e184d..7bae71ccce4 100644 --- a/src/Generated/Chats/GetAllMessages/GetAllMessagesRequestBuilder.php +++ b/src/Generated/Chats/GetAllMessages/GetAllMessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAllMessages * @param GetAllMessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAllMessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/ChatItemRequestBuilder.php b/src/Generated/Chats/Item/ChatItemRequestBuilder.php index 9c37d8bb2cc..4a79853c235 100644 --- a/src/Generated/Chats/Item/ChatItemRequestBuilder.php +++ b/src/Generated/Chats/Item/ChatItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\HideForUser\HideForUserRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\InstalledApps\InstalledAppsRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\LastMessagePreview\LastMessagePreviewRequestBuilder; @@ -130,58 +129,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from chats * @param ChatItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single chat (without its messages). This method supports federation. To access a chat, at least one chat member must belong to the tenant the request initiated from. This API is available in the following national cloud deployments. * @param ChatItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a chat object. This API is available in the following national cloud deployments. * @param Chat $body The request body * @param ChatItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-patch?view=graph-rest-1.0 Find more info here */ public function patch(Chat $body, ?ChatItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -198,6 +188,7 @@ public function toDeleteRequestInformation(?ChatItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -211,7 +202,6 @@ public function toGetRequestInformation(?ChatItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -219,6 +209,7 @@ public function toGetRequestInformation(?ChatItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -233,11 +224,11 @@ public function toPatchRequestInformation(Chat $body, ?ChatItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/HideForUser/HideForUserRequestBuilder.php b/src/Generated/Chats/Item/HideForUser/HideForUserRequestBuilder.php index d52fdbc106a..69618e18b61 100644 --- a/src/Generated/Chats/Item/HideForUser/HideForUserRequestBuilder.php +++ b/src/Generated/Chats/Item/HideForUser/HideForUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Hide a chat for a user. This API is available in the following national cloud deployments. * @param HideForUserPostRequestBody $body The request body * @param HideForUserRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-hideforuser?view=graph-rest-1.0 Find more info here */ public function post(HideForUserPostRequestBody $body, ?HideForUserRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(HideForUserPostRequestBody $body, ?Hide $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/InstalledApps/Count/CountRequestBuilder.php b/src/Generated/Chats/Item/InstalledApps/Count/CountRequestBuilder.php index 360b7919bac..7b02a29e413 100644 --- a/src/Generated/Chats/Item/InstalledApps/Count/CountRequestBuilder.php +++ b/src/Generated/Chats/Item/InstalledApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/InstalledApps/InstalledAppsRequestBuilder.php b/src/Generated/Chats/Item/InstalledApps/InstalledAppsRequestBuilder.php index dceb94319bb..d38bccbe2f8 100644 --- a/src/Generated/Chats/Item/InstalledApps/InstalledAppsRequestBuilder.php +++ b/src/Generated/Chats/Item/InstalledApps/InstalledAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\InstalledApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\InstalledApps\Item\TeamsAppInstallationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all app installations within a chat. This API is available in the following national cloud deployments. * @param InstalledAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-list-installedapps?view=graph-rest-1.0 Find more info here */ public function get(?InstalledAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Install a teamsApp to the specified chat. This API is available in the following national cloud deployments. * @param TeamsAppInstallation $body The request body * @param InstalledAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-post-installedapps?view=graph-rest-1.0 Find more info here */ public function post(TeamsAppInstallation $body, ?InstalledAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?InstalledAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?InstalledAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsAppInstallation $body, ?InstalledA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Chats/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php index 7fb59b5131d..1643a02d82d 100644 --- a/src/Generated/Chats/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Chats/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The app that is installed. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php b/src/Generated/Chats/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php index c55ac945e40..9fb166869e5 100644 --- a/src/Generated/Chats/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php +++ b/src/Generated/Chats/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The details of this version of the app. * @param TeamsAppDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppDefinitionRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppDefinitionRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php b/src/Generated/Chats/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php index 60ad65c6508..b92991ae164 100644 --- a/src/Generated/Chats/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php +++ b/src/Generated/Chats/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\InstalledApps\Item\TeamsApp\TeamsAppRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\InstalledApps\Item\TeamsAppDefinition\TeamsAppDefinitionRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\InstalledApps\Item\Upgrade\UpgradeRequestBuilder; @@ -58,58 +57,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Uninstall an app installed within a chat. This API is available in the following national cloud deployments. * @param TeamsAppInstallationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-delete-installedapps?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsAppInstallationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an app installed in a chat. This API is available in the following national cloud deployments. * @param TeamsAppInstallationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-get-installedapps?view=graph-rest-1.0 Find more info here */ public function get(?TeamsAppInstallationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property installedApps in chats * @param TeamsAppInstallation $body The request body * @param TeamsAppInstallationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamsAppInstallation $body, ?TeamsAppInstallationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -126,6 +116,7 @@ public function toDeleteRequestInformation(?TeamsAppInstallationItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -139,7 +130,6 @@ public function toGetRequestInformation(?TeamsAppInstallationItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +137,7 @@ public function toGetRequestInformation(?TeamsAppInstallationItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -161,11 +152,11 @@ public function toPatchRequestInformation(TeamsAppInstallation $body, ?TeamsAppI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php b/src/Generated/Chats/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php index 2ff341bc2be..cd1845d5b69 100644 --- a/src/Generated/Chats/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php +++ b/src/Generated/Chats/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Upgrade an app installation within a chat. This API is available in the following national cloud deployments. * @param UpgradePostRequestBody $body The request body * @param UpgradeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-teamsappinstallation-upgrade?view=graph-rest-1.0 Find more info here */ public function post(UpgradePostRequestBody $body, ?UpgradeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(UpgradePostRequestBody $body, ?UpgradeR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/LastMessagePreview/LastMessagePreviewRequestBuilder.php b/src/Generated/Chats/Item/LastMessagePreview/LastMessagePreviewRequestBuilder.php index 79d98e223d6..35f693b7e41 100644 --- a/src/Generated/Chats/Item/LastMessagePreview/LastMessagePreviewRequestBuilder.php +++ b/src/Generated/Chats/Item/LastMessagePreview/LastMessagePreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageInfo; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property lastMessagePreview for chats * @param LastMessagePreviewRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LastMessagePreviewRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Preview of the last message sent in the chat. Null if no messages have been sent in the chat. Currently, only the list chats operation supports this property. * @param LastMessagePreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastMessagePreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property lastMessagePreview in chats * @param ChatMessageInfo $body The request body * @param LastMessagePreviewRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageInfo $body, ?LastMessagePreviewRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?LastMessagePreviewRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?LastMessagePreviewRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?LastMessagePreviewRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ChatMessageInfo $body, ?LastMessagePre $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/MarkChatReadForUser/MarkChatReadForUserRequestBuilder.php b/src/Generated/Chats/Item/MarkChatReadForUser/MarkChatReadForUserRequestBuilder.php index f1c1c144b6e..938fbce4e3a 100644 --- a/src/Generated/Chats/Item/MarkChatReadForUser/MarkChatReadForUserRequestBuilder.php +++ b/src/Generated/Chats/Item/MarkChatReadForUser/MarkChatReadForUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Mark a chat as read for a user. This API is available in the following national cloud deployments. * @param MarkChatReadForUserPostRequestBody $body The request body * @param MarkChatReadForUserRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-markchatreadforuser?view=graph-rest-1.0 Find more info here */ public function post(MarkChatReadForUserPostRequestBody $body, ?MarkChatReadForUserRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(MarkChatReadForUserPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/MarkChatUnreadForUser/MarkChatUnreadForUserRequestBuilder.php b/src/Generated/Chats/Item/MarkChatUnreadForUser/MarkChatUnreadForUserRequestBuilder.php index 38312fab8bc..20203ef23b9 100644 --- a/src/Generated/Chats/Item/MarkChatUnreadForUser/MarkChatUnreadForUserRequestBuilder.php +++ b/src/Generated/Chats/Item/MarkChatUnreadForUser/MarkChatUnreadForUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Mark a chat as unread for a user. This API is available in the following national cloud deployments. * @param MarkChatUnreadForUserPostRequestBody $body The request body * @param MarkChatUnreadForUserRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-markchatunreadforuser?view=graph-rest-1.0 Find more info here */ public function post(MarkChatUnreadForUserPostRequestBody $body, ?MarkChatUnreadForUserRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(MarkChatUnreadForUserPostRequestBody $b $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Members/Add/AddRequestBuilder.php b/src/Generated/Chats/Item/Members/Add/AddRequestBuilder.php index 78b1c503f70..f977a1e2ef1 100644 --- a/src/Generated/Chats/Item/Members/Add/AddRequestBuilder.php +++ b/src/Generated/Chats/Item/Members/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add multiple members in a single request to a team. The response provides details about which memberships could and couldn't be created. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmembers-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Chats/Item/Members/Count/CountRequestBuilder.php index 42e924e63dd..17a61107950 100644 --- a/src/Generated/Chats/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Chats/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Members/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Chats/Item/Members/Item/ConversationMemberItemRequestBuilder.php index ca6d50e0bdf..ae2cffa5d19 100644 --- a/src/Generated/Chats/Item/Members/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Chats/Item/Members/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a conversationMember from a chat. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-delete-members?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a conversationMember from a chat. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-get-members?view=graph-rest-1.0 Find more info here */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property members in chats * @param ConversationMember $body The request body * @param ConversationMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ConversationMember $body, ?ConversationMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ConversationMemberItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(ConversationMember $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Members/MembersRequestBuilder.php b/src/Generated/Chats/Item/Members/MembersRequestBuilder.php index af7265e50ce..e6ac85f60f9 100644 --- a/src/Generated/Chats/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Chats/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\Members\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\Members\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\Members\Item\ConversationMemberItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all conversation members in a chat or channel. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmember-list?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a conversationMember to a chat. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-post-members?view=graph-rest-1.0 Find more info here */ public function post(ConversationMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ConversationMember $body, ?MembersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Count/CountRequestBuilder.php b/src/Generated/Chats/Item/Messages/Count/CountRequestBuilder.php index ba79cf6b3c7..1b5ae74a562 100644 --- a/src/Generated/Chats/Item/Messages/Count/CountRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Delta/DeltaRequestBuilder.php b/src/Generated/Chats/Item/Messages/Delta/DeltaRequestBuilder.php index e1bcdac76fd..d2d64bb14ff 100644 --- a/src/Generated/Chats/Item/Messages/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/ChatMessageItemRequestBuilder.php index 7117ce19806..7424e4f0045 100644 --- a/src/Generated/Chats/Item/Messages/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\HostedContents\HostedContentsRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\Replies\RepliesRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\SetReaction\SetReactionRequestBuilder; @@ -82,57 +81,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property messages for chats * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property messages in chats * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -149,6 +139,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -162,7 +153,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -170,6 +160,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -184,11 +175,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php index cb6140e327c..42f2904242e 100644 --- a/src/Generated/Chats/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php index 4941e4c333a..96d1d968e61 100644 --- a/src/Generated/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\HostedContents\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\HostedContents\Item\ChatMessageHostedContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for chats * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 9bc7bfc1494..787bac1fe12 100644 --- a/src/Generated/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Chats/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index 6a8c37d5606..945e95696dd 100644 --- a/src/Generated/Chats/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\HostedContents\Item\Value\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for chats * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in chats * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php index 1a65c68fc82..7b5112532e1 100644 --- a/src/Generated/Chats/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from chats * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in chats * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/Replies/Count/CountRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/Replies/Count/CountRequestBuilder.php index 6add55e9a76..67fceefa109 100644 --- a/src/Generated/Chats/Item/Messages/Item/Replies/Count/CountRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/Replies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php index ef671850c9c..d0fa3928079 100644 --- a/src/Generated/Chats/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php index 52e3de06421..54a189bf719 100644 --- a/src/Generated/Chats/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\Replies\Item\HostedContents\HostedContentsRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\Replies\Item\SetReaction\SetReactionRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\Replies\Item\SoftDelete\SoftDeleteRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property replies for chats * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property replies in chats * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php index b01bebcafa2..4486f27eae7 100644 --- a/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php index 0632f8b76b5..084f717555f 100644 --- a/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\Replies\Item\HostedContents\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\Replies\Item\HostedContents\Item\ChatMessageHostedContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for chats * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index cd1787c7cd2..4aed78be3c4 100644 --- a/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index f0e41033638..96643dfbdbc 100644 --- a/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\Replies\Item\HostedContents\Item\Value\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for chats * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in chats * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php index 1cbf274764a..8011465cbbb 100644 --- a/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from chats * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in chats * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php index 494f4ba83d0..301565cf132 100644 --- a/src/Generated/Chats/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php index ca0b6026938..2eec5f62c29 100644 --- a/src/Generated/Chats/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index 3ee2d7e2733..0345c790a03 100644 --- a/src/Generated/Chats/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php index 1a0fb07b1d9..d9d7fc81bf4 100644 --- a/src/Generated/Chats/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/Replies/RepliesRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/Replies/RepliesRequestBuilder.php index ca5365e7a1c..b3cf644bc7f 100644 --- a/src/Generated/Chats/Item/Messages/Item/Replies/RepliesRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/Replies/RepliesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\Replies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\Replies\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\Replies\Item\ChatMessageItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the replies to a message in a channel of a team. This method lists only the replies of the specified message, if any. To get the message itself, simply call get channel message. This API is available in the following national cloud deployments. * @param RepliesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-replies?view=graph-rest-1.0 Find more info here */ public function get(?RepliesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new reply to a chatMessage in a specified channel. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param RepliesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-messagereply?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?RepliesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?RepliesRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php index 65594099a9f..af1c794aa0e 100644 --- a/src/Generated/Chats/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php index 32122dd6b7c..d820c55f0ba 100644 --- a/src/Generated/Chats/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index 1e6c86e0994..1ef83aacaee 100644 --- a/src/Generated/Chats/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Chats/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php index 2a2f494224f..e78b6ba1ba8 100644 --- a/src/Generated/Chats/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Messages/MessagesRequestBuilder.php b/src/Generated/Chats/Item/Messages/MessagesRequestBuilder.php index d813985b4da..b9a796e1cfe 100644 --- a/src/Generated/Chats/Item/Messages/MessagesRequestBuilder.php +++ b/src/Generated/Chats/Item/Messages/MessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\Messages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\Messages\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\Messages\Item\ChatMessageItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of messages in a chat. This method supports federation. To list chat messages in application context, the request must be made from the tenant that the channel owner belongs to (represented by the tenantId property on the channel). This API is available in the following national cloud deployments. * @param MessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?MessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Send a new chatMessage in the specified chat. This API can't create a new chat; you must use the list chats method to retrieve the ID of an existing chat before you can create a chat message. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/chat-post-messages?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/chatmessage-post?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?MessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,11 +109,12 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Send a new chatMessage in the specified chat. This API can't create a new chat; you must use the list chats method to retrieve the ID of an existing chat before you can create a chat message. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?MessagesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/PermissionGrants/Count/CountRequestBuilder.php b/src/Generated/Chats/Item/PermissionGrants/Count/CountRequestBuilder.php index 5b7279e151b..68c8f0ccc59 100644 --- a/src/Generated/Chats/Item/PermissionGrants/Count/CountRequestBuilder.php +++ b/src/Generated/Chats/Item/PermissionGrants/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php b/src/Generated/Chats/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php index de556b4ff5a..25ec52d0857 100644 --- a/src/Generated/Chats/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php +++ b/src/Generated/Chats/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrant; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property permissionGrants for chats * @param ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of permissions granted to apps for the chat. * @param ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property permissionGrants in chats * @param ResourceSpecificPermissionGrant $body The request body * @param ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ResourceSpecificPermissionGrant $body, ?ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ResourceSpecificPermissionGrantItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilder.php b/src/Generated/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilder.php index f40e32a1e37..2b923ac8667 100644 --- a/src/Generated/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilder.php +++ b/src/Generated/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\PermissionGrants\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\PermissionGrants\Item\ResourceSpecificPermissionGrantItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List all resource-specific permission grants on the chat. This list specifies the Azure AD apps that have access to the chat, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the chat. This list specifies the Microsoft Entra apps that have access to the chat, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. * @param PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-list-permissiongrants?view=graph-rest-1.0 Find more info here */ public function get(?PermissionGrantsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to permissionGrants for chats * @param ResourceSpecificPermissionGrant $body The request body * @param PermissionGrantsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ResourceSpecificPermissionGrant $body, ?PermissionGrantsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List all resource-specific permission grants on the chat. This list specifies the Azure AD apps that have access to the chat, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the chat. This list specifies the Microsoft Entra apps that have access to the chat, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. * @param PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php b/src/Generated/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php index 7125845378c..e436781bec6 100644 --- a/src/Generated/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List all resource-specific permission grants on the chat. This list specifies the Azure AD apps that have access to the chat, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the chat. This list specifies the Microsoft Entra apps that have access to the chat, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. */ class PermissionGrantsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Chats/Item/PinnedMessages/Count/CountRequestBuilder.php b/src/Generated/Chats/Item/PinnedMessages/Count/CountRequestBuilder.php index cf03667db36..2157cca6740 100644 --- a/src/Generated/Chats/Item/PinnedMessages/Count/CountRequestBuilder.php +++ b/src/Generated/Chats/Item/PinnedMessages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/PinnedMessages/Item/Message/MessageRequestBuilder.php b/src/Generated/Chats/Item/PinnedMessages/Item/Message/MessageRequestBuilder.php index 85829dffa48..dc57a0059ed 100644 --- a/src/Generated/Chats/Item/PinnedMessages/Item/Message/MessageRequestBuilder.php +++ b/src/Generated/Chats/Item/PinnedMessages/Item/Message/MessageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents details about the chat message that is pinned. * @param MessageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MessageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MessageRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MessageRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/PinnedMessages/Item/PinnedChatMessageInfoItemRequestBuilder.php b/src/Generated/Chats/Item/PinnedMessages/Item/PinnedChatMessageInfoItemRequestBuilder.php index 93aec878ef5..1993014fc43 100644 --- a/src/Generated/Chats/Item/PinnedMessages/Item/PinnedChatMessageInfoItemRequestBuilder.php +++ b/src/Generated/Chats/Item/PinnedMessages/Item/PinnedChatMessageInfoItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\PinnedMessages\Item\Message\MessageRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PinnedChatMessageInfo; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unpin a message from a chat. This API is available in the following national cloud deployments. * @param PinnedChatMessageInfoItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-delete-pinnedmessages?view=graph-rest-1.0 Find more info here */ public function delete(?PinnedChatMessageInfoItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of all the pinned messages in the chat. Nullable. * @param PinnedChatMessageInfoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PinnedChatMessageInfoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pinnedMessages in chats * @param PinnedChatMessageInfo $body The request body * @param PinnedChatMessageInfoItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PinnedChatMessageInfo $body, ?PinnedChatMessageInfoItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?PinnedChatMessageInfoItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?PinnedChatMessageInfoItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?PinnedChatMessageInfoItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(PinnedChatMessageInfo $body, ?PinnedCh $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/PinnedMessages/PinnedMessagesRequestBuilder.php b/src/Generated/Chats/Item/PinnedMessages/PinnedMessagesRequestBuilder.php index 886b7d37704..f6515659831 100644 --- a/src/Generated/Chats/Item/PinnedMessages/PinnedMessagesRequestBuilder.php +++ b/src/Generated/Chats/Item/PinnedMessages/PinnedMessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\PinnedMessages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\PinnedMessages\Item\PinnedChatMessageInfoItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of pinnedChatMessages in a chat. This API is available in the following national cloud deployments. * @param PinnedMessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-list-pinnedmessages?view=graph-rest-1.0 Find more info here */ public function get(?PinnedMessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Pin a chat message in the specified chat. This API cannot create a new chat; you must use the list chats method to retrieve the ID of an existing chat before you can pin a chat message. This API is available in the following national cloud deployments. * @param PinnedChatMessageInfo $body The request body * @param PinnedMessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-post-pinnedmessages?view=graph-rest-1.0 Find more info here */ public function post(PinnedChatMessageInfo $body, ?PinnedMessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PinnedMessagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PinnedMessagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(PinnedChatMessageInfo $body, ?PinnedMes $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php b/src/Generated/Chats/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php index 0282192f05a..b8dbee58be5 100644 --- a/src/Generated/Chats/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php +++ b/src/Generated/Chats/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Send an activity feed notification in scope of a chat. For more details about sending notifications and the requirements for doing so, see sending Teams activity notifications. This API is available in the following national cloud deployments. * @param SendActivityNotificationPostRequestBody $body The request body * @param SendActivityNotificationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-sendactivitynotification?view=graph-rest-1.0 Find more info here */ public function post(SendActivityNotificationPostRequestBody $body, ?SendActivityNotificationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SendActivityNotificationPostRequestBody $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Tabs/Count/CountRequestBuilder.php b/src/Generated/Chats/Item/Tabs/Count/CountRequestBuilder.php index 15d801a2e3a..c8cf104e7a5 100644 --- a/src/Generated/Chats/Item/Tabs/Count/CountRequestBuilder.php +++ b/src/Generated/Chats/Item/Tabs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Chats/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php index 9c0b0dcad47..fae7fbc2e0e 100644 --- a/src/Generated/Chats/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Chats/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The application that is linked to the tab. This can't be changed after tab creation. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Tabs/Item/TeamsTabItemRequestBuilder.php b/src/Generated/Chats/Item/Tabs/Item/TeamsTabItemRequestBuilder.php index 294a5fc306f..1b13f3adda4 100644 --- a/src/Generated/Chats/Item/Tabs/Item/TeamsTabItemRequestBuilder.php +++ b/src/Generated/Chats/Item/Tabs/Item/TeamsTabItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\Tabs\Item\TeamsApp\TeamsAppRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove (unpin) a tab from the specified chat. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-delete-tabs?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsTabItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of the specified tab in a chat. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-get-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TeamsTabItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified tab in a chat. This can be used to configure the content of the tab. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TeamsTabItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-patch-tabs?view=graph-rest-1.0 Find more info here */ public function patch(TeamsTab $body, ?TeamsTabItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TeamsTabItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TeamsTab $body, ?TeamsTabItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/Tabs/TabsRequestBuilder.php b/src/Generated/Chats/Item/Tabs/TabsRequestBuilder.php index 74672384f95..fbd62491ae3 100644 --- a/src/Generated/Chats/Item/Tabs/TabsRequestBuilder.php +++ b/src/Generated/Chats/Item/Tabs/TabsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Chats\Item\Tabs\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Chats\Item\Tabs\Item\TeamsTabItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of tabs in the specified chat. This API is available in the following national cloud deployments. * @param TabsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-list-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TabsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add (pin) a tab to the specified chat. The corresponding app must already be installed in the chat. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TabsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-post-tabs?view=graph-rest-1.0 Find more info here */ public function post(TeamsTab $body, ?TabsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsTab $body, ?TabsRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Chats/Item/UnhideForUser/UnhideForUserRequestBuilder.php b/src/Generated/Chats/Item/UnhideForUser/UnhideForUserRequestBuilder.php index 8d19485720f..be78491df12 100644 --- a/src/Generated/Chats/Item/UnhideForUser/UnhideForUserRequestBuilder.php +++ b/src/Generated/Chats/Item/UnhideForUser/UnhideForUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Unhide a chat for a user. This API is available in the following national cloud deployments. * @param UnhideForUserPostRequestBody $body The request body * @param UnhideForUserRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-unhideforuser?view=graph-rest-1.0 Find more info here */ public function post(UnhideForUserPostRequestBody $body, ?UnhideForUserRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(UnhideForUserPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/CallRecords/CallRecordsRequestBuilder.php b/src/Generated/Communications/CallRecords/CallRecordsRequestBuilder.php index 9a6815943a0..b5579ce132c 100644 --- a/src/Generated/Communications/CallRecords/CallRecordsRequestBuilder.php +++ b/src/Generated/Communications/CallRecords/CallRecordsRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\CallRecords\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Communications\CallRecords\Item\CallRecordItemRequestBuilder; use Microsoft\Graph\Generated\Communications\CallRecords\MicrosoftGraphCallRecordsGetDirectRoutingCallsWithFromDateTimeWithToDateTime\MicrosoftGraphCallRecordsGetDirectRoutingCallsWithFromDateTimeWithToDateTimeRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of a callRecord object. There are two ways to get the id of a callRecord: You can use the $expand query parameter to optionally include session and segment details, as shown in the Get full details example. When you expand session details, the maximum page size is 60 sessions. This API is available in the following national cloud deployments. * @param CallRecordsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CallRecordsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -97,19 +93,16 @@ public function microsoftGraphCallRecordsGetPstnCallsWithFromDateTimeWithToDateT * Create new navigation property to callRecords for communications * @param CallRecord $body The request body * @param CallRecordsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CallRecord $body, ?CallRecordsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -122,7 +115,6 @@ public function toGetRequestInformation(?CallRecordsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +122,7 @@ public function toGetRequestInformation(?CallRecordsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +137,11 @@ public function toPostRequestInformation(CallRecord $body, ?CallRecordsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/CallRecords/Count/CountRequestBuilder.php b/src/Generated/Communications/CallRecords/Count/CountRequestBuilder.php index 0d475a0d6b6..2443cde202c 100644 --- a/src/Generated/Communications/CallRecords/Count/CountRequestBuilder.php +++ b/src/Generated/Communications/CallRecords/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Communications/CallRecords/Item/CallRecordItemRequestBuilder.php b/src/Generated/Communications/CallRecords/Item/CallRecordItemRequestBuilder.php index 4bbcb98593e..712d1c6a83f 100644 --- a/src/Generated/Communications/CallRecords/Item/CallRecordItemRequestBuilder.php +++ b/src/Generated/Communications/CallRecords/Item/CallRecordItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\CallRecords\Item\Sessions\SessionsRequestBuilder; use Microsoft\Graph\Generated\Models\CallRecords\CallRecord; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property callRecords for communications * @param CallRecordItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CallRecordItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a callRecord object. There are two ways to get the id of a callRecord: You can use the $expand query parameter to optionally include session and segment details, as shown in the Get full details example. When you expand session details, the maximum page size is 60 sessions. This API is available in the following national cloud deployments. * @param CallRecordItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/callrecords-callrecord-get?view=graph-rest-1.0 Find more info here */ public function get(?CallRecordItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property callRecords in communications * @param CallRecord $body The request body * @param CallRecordItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(CallRecord $body, ?CallRecordItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?CallRecordItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?CallRecordItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?CallRecordItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(CallRecord $body, ?CallRecordItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/CallRecords/Item/Sessions/Count/CountRequestBuilder.php b/src/Generated/Communications/CallRecords/Item/Sessions/Count/CountRequestBuilder.php index d2bb81543d7..87ebe1e05a7 100644 --- a/src/Generated/Communications/CallRecords/Item/Sessions/Count/CountRequestBuilder.php +++ b/src/Generated/Communications/CallRecords/Item/Sessions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Communications/CallRecords/Item/Sessions/Item/Segments/Count/CountRequestBuilder.php b/src/Generated/Communications/CallRecords/Item/Sessions/Item/Segments/Count/CountRequestBuilder.php index b4697d3a8d5..71e311ece79 100644 --- a/src/Generated/Communications/CallRecords/Item/Sessions/Item/Segments/Count/CountRequestBuilder.php +++ b/src/Generated/Communications/CallRecords/Item/Sessions/Item/Segments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Communications/CallRecords/Item/Sessions/Item/Segments/Item/SegmentItemRequestBuilder.php b/src/Generated/Communications/CallRecords/Item/Sessions/Item/Segments/Item/SegmentItemRequestBuilder.php index 55b78cc732f..ef39e230f8f 100644 --- a/src/Generated/Communications/CallRecords/Item/Sessions/Item/Segments/Item/SegmentItemRequestBuilder.php +++ b/src/Generated/Communications/CallRecords/Item/Sessions/Item/Segments/Item/SegmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CallRecords\Segment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property segments for communications * @param SegmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SegmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of segments involved in the session. Read-only. Nullable. * @param SegmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SegmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Segment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Segment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property segments in communications * @param Segment $body The request body * @param SegmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Segment $body, ?SegmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Segment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Segment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?SegmentItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?SegmentItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?SegmentItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Segment $body, ?SegmentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/CallRecords/Item/Sessions/Item/Segments/SegmentsRequestBuilder.php b/src/Generated/Communications/CallRecords/Item/Sessions/Item/Segments/SegmentsRequestBuilder.php index b4decbe0df4..761349f3617 100644 --- a/src/Generated/Communications/CallRecords/Item/Sessions/Item/Segments/SegmentsRequestBuilder.php +++ b/src/Generated/Communications/CallRecords/Item/Sessions/Item/Segments/SegmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\CallRecords\Item\Sessions\Item\Segments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Communications\CallRecords\Item\Sessions\Item\Segments\Item\SegmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\CallRecords\Segment; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of segments involved in the session. Read-only. Nullable. * @param SegmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SegmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SegmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SegmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to segments for communications * @param Segment $body The request body * @param SegmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Segment $body, ?SegmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Segment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Segment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?SegmentsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?SegmentsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Segment $body, ?SegmentsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/CallRecords/Item/Sessions/Item/SessionItemRequestBuilder.php b/src/Generated/Communications/CallRecords/Item/Sessions/Item/SessionItemRequestBuilder.php index 7d6b7bc1f30..9d860705686 100644 --- a/src/Generated/Communications/CallRecords/Item/Sessions/Item/SessionItemRequestBuilder.php +++ b/src/Generated/Communications/CallRecords/Item/Sessions/Item/SessionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\CallRecords\Item\Sessions\Item\Segments\SegmentsRequestBuilder; use Microsoft\Graph\Generated\Models\CallRecords\Session; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sessions for communications * @param SessionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SessionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * List of sessions involved in the call. Peer-to-peer calls typically only have one session, whereas group calls typically have at least one session per participant. Read-only. Nullable. * @param SessionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SessionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Session::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Session::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sessions in communications * @param Session $body The request body * @param SessionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Session $body, ?SessionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Session::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Session::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?SessionItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?SessionItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?SessionItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Session $body, ?SessionItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/CallRecords/Item/Sessions/SessionsRequestBuilder.php b/src/Generated/Communications/CallRecords/Item/Sessions/SessionsRequestBuilder.php index 8d791992f54..f6fb3c2829e 100644 --- a/src/Generated/Communications/CallRecords/Item/Sessions/SessionsRequestBuilder.php +++ b/src/Generated/Communications/CallRecords/Item/Sessions/SessionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\CallRecords\Item\Sessions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Communications\CallRecords\Item\Sessions\Item\SessionItemRequestBuilder; use Microsoft\Graph\Generated\Models\CallRecords\Session; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of sessions associated with a callRecord object. If the sessions list is truncated, a sessions@odata.nextLink value will be provided to retrieve the next page of sessions. The maximum page size for sessions is 60 entries. This API is available in the following national cloud deployments. * @param SessionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/callrecords-session-list?view=graph-rest-1.0 Find more info here */ public function get(?SessionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SessionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SessionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sessions for communications * @param Session $body The request body * @param SessionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Session $body, ?SessionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Session::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Session::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SessionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SessionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Session $body, ?SessionsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/CallRecords/MicrosoftGraphCallRecordsGetDirectRoutingCallsWithFromDateTimeWithToDateTime/MicrosoftGraphCallRecordsGetDirectRoutingCallsWithFromDateTimeWithToDateTimeRequestBuilder.php b/src/Generated/Communications/CallRecords/MicrosoftGraphCallRecordsGetDirectRoutingCallsWithFromDateTimeWithToDateTime/MicrosoftGraphCallRecordsGetDirectRoutingCallsWithFromDateTimeWithToDateTimeRequestBuilder.php index 906da6615c7..e75409abdc9 100644 --- a/src/Generated/Communications/CallRecords/MicrosoftGraphCallRecordsGetDirectRoutingCallsWithFromDateTimeWithToDateTime/MicrosoftGraphCallRecordsGetDirectRoutingCallsWithFromDateTimeWithToDateTimeRequestBuilder.php +++ b/src/Generated/Communications/CallRecords/MicrosoftGraphCallRecordsGetDirectRoutingCallsWithFromDateTimeWithToDateTime/MicrosoftGraphCallRecordsGetDirectRoutingCallsWithFromDateTimeWithToDateTimeRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -39,19 +38,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getDirectRoutingCalls * @param MicrosoftGraphCallRecordsGetDirectRoutingCallsWithFromDateTimeWithToDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MicrosoftGraphCallRecordsGetDirectRoutingCallsWithFromDateTimeWithToDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetDirectRoutingCallsWithFromDateTimeWithToDateTimeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetDirectRoutingCallsWithFromDateTimeWithToDateTimeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -64,7 +60,6 @@ public function toGetRequestInformation(?MicrosoftGraphCallRecordsGetDirectRouti $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -72,6 +67,7 @@ public function toGetRequestInformation(?MicrosoftGraphCallRecordsGetDirectRouti } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Communications/CallRecords/MicrosoftGraphCallRecordsGetPstnCallsWithFromDateTimeWithToDateTime/MicrosoftGraphCallRecordsGetPstnCallsWithFromDateTimeWithToDateTimeRequestBuilder.php b/src/Generated/Communications/CallRecords/MicrosoftGraphCallRecordsGetPstnCallsWithFromDateTimeWithToDateTime/MicrosoftGraphCallRecordsGetPstnCallsWithFromDateTimeWithToDateTimeRequestBuilder.php index 7724002cf00..f97ef09f2a3 100644 --- a/src/Generated/Communications/CallRecords/MicrosoftGraphCallRecordsGetPstnCallsWithFromDateTimeWithToDateTime/MicrosoftGraphCallRecordsGetPstnCallsWithFromDateTimeWithToDateTimeRequestBuilder.php +++ b/src/Generated/Communications/CallRecords/MicrosoftGraphCallRecordsGetPstnCallsWithFromDateTimeWithToDateTime/MicrosoftGraphCallRecordsGetPstnCallsWithFromDateTimeWithToDateTimeRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -39,19 +38,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getPstnCalls * @param MicrosoftGraphCallRecordsGetPstnCallsWithFromDateTimeWithToDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MicrosoftGraphCallRecordsGetPstnCallsWithFromDateTimeWithToDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetPstnCallsWithFromDateTimeWithToDateTimeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetPstnCallsWithFromDateTimeWithToDateTimeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -64,7 +60,6 @@ public function toGetRequestInformation(?MicrosoftGraphCallRecordsGetPstnCallsWi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -72,6 +67,7 @@ public function toGetRequestInformation(?MicrosoftGraphCallRecordsGetPstnCallsWi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/CallsRequestBuilder.php b/src/Generated/Communications/Calls/CallsRequestBuilder.php index b88b5f3b637..b367d441688 100644 --- a/src/Generated/Communications/Calls/CallsRequestBuilder.php +++ b/src/Generated/Communications/Calls/CallsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\Calls\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Communications\Calls\Item\CallItemRequestBuilder; use Microsoft\Graph\Generated\Communications\Calls\LogTeleconferenceDeviceQuality\LogTeleconferenceDeviceQualityRequestBuilder; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of a call object. This API is available in the following national cloud deployments. * @param CallsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CallsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create call enables your bot to create a new outgoing peer-to-peer or group call, or join an existing meeting. You will need to register the calling bot and go through the list of permissions needed as mentioned below. This API is available in the following national cloud deployments. * @param Call $body The request body * @param CallsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-post-calls?view=graph-rest-1.0 Find more info here */ public function post(Call $body, ?CallsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Call::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Call::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?CallsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?CallsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(Call $body, ?CallsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Count/CountRequestBuilder.php b/src/Generated/Communications/Calls/Count/CountRequestBuilder.php index fbdeaec37ef..26098da5892 100644 --- a/src/Generated/Communications/Calls/Count/CountRequestBuilder.php +++ b/src/Generated/Communications/Calls/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/AddLargeGalleryView/AddLargeGalleryViewRequestBuilder.php b/src/Generated/Communications/Calls/Item/AddLargeGalleryView/AddLargeGalleryViewRequestBuilder.php index 64721aff710..22c9d63bf05 100644 --- a/src/Generated/Communications/Calls/Item/AddLargeGalleryView/AddLargeGalleryViewRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/AddLargeGalleryView/AddLargeGalleryViewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AddLargeGalleryViewOperation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add the large gallery view to a call. For details about how to identify a large gallery view participant in a roster so that you can retrieve the relevant data to subscribe to the video feed, see Identify large gallery view participants in a roster. This API is available in the following national cloud deployments. * @param AddLargeGalleryViewPostRequestBody $body The request body * @param AddLargeGalleryViewRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-addlargegalleryview?view=graph-rest-1.0 Find more info here */ public function post(AddLargeGalleryViewPostRequestBody $body, ?AddLargeGalleryViewRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddLargeGalleryViewOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddLargeGalleryViewOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddLargeGalleryViewPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Answer/AnswerRequestBuilder.php b/src/Generated/Communications/Calls/Item/Answer/AnswerRequestBuilder.php index 761164ed619..2ef0d950fdd 100644 --- a/src/Generated/Communications/Calls/Item/Answer/AnswerRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Answer/AnswerRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Enable a bot to answer an incoming call. The incoming call request can be an invite from a participant in a group call or a peer-to-peer call. If an invite to a group call is received, the notification will contain the chatInfo and meetingInfo parameters. The bot is expected to answer, reject, or redirect the call before the call times out. The current timeout value is 15 seconds for regular scenarios, and 5 seconds for policy-based recording scenarios. This API is available in the following national cloud deployments. * @param AnswerPostRequestBody $body The request body * @param AnswerRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-answer?view=graph-rest-1.0 Find more info here */ public function post(AnswerPostRequestBody $body, ?AnswerRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AnswerPostRequestBody $body, ?AnswerReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/AudioRoutingGroups/AudioRoutingGroupsRequestBuilder.php b/src/Generated/Communications/Calls/Item/AudioRoutingGroups/AudioRoutingGroupsRequestBuilder.php index 4d667e1e7bb..b4a1ae72ead 100644 --- a/src/Generated/Communications/Calls/Item/AudioRoutingGroups/AudioRoutingGroupsRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/AudioRoutingGroups/AudioRoutingGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\Calls\Item\AudioRoutingGroups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Communications\Calls\Item\AudioRoutingGroups\Item\AudioRoutingGroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\AudioRoutingGroup; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of audioRoutingGroup objects. This API is available in the following national cloud deployments. * @param AudioRoutingGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-list-audioroutinggroups?view=graph-rest-1.0 Find more info here */ public function get(?AudioRoutingGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AudioRoutingGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AudioRoutingGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new audioRoutingGroup. This API is available in the following national cloud deployments. * @param AudioRoutingGroup $body The request body * @param AudioRoutingGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-post-audioroutinggroups?view=graph-rest-1.0 Find more info here */ public function post(AudioRoutingGroup $body, ?AudioRoutingGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AudioRoutingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AudioRoutingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AudioRoutingGroupsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AudioRoutingGroupsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AudioRoutingGroup $body, ?AudioRoutingG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/AudioRoutingGroups/Count/CountRequestBuilder.php b/src/Generated/Communications/Calls/Item/AudioRoutingGroups/Count/CountRequestBuilder.php index e3474295d29..86beed54706 100644 --- a/src/Generated/Communications/Calls/Item/AudioRoutingGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/AudioRoutingGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/AudioRoutingGroups/Item/AudioRoutingGroupItemRequestBuilder.php b/src/Generated/Communications/Calls/Item/AudioRoutingGroups/Item/AudioRoutingGroupItemRequestBuilder.php index 9a6ca265ae8..2b405071e73 100644 --- a/src/Generated/Communications/Calls/Item/AudioRoutingGroups/Item/AudioRoutingGroupItemRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/AudioRoutingGroups/Item/AudioRoutingGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AudioRoutingGroup; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the specified audioRoutingGroup. This API is available in the following national cloud deployments. * @param AudioRoutingGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/audioroutinggroup-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AudioRoutingGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an audioRoutingGroup object. This API is available in the following national cloud deployments. * @param AudioRoutingGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/audioroutinggroup-get?view=graph-rest-1.0 Find more info here */ public function get(?AudioRoutingGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AudioRoutingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AudioRoutingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Modify sources and receivers of an audioRoutingGroup. This API is available in the following national cloud deployments. * @param AudioRoutingGroup $body The request body * @param AudioRoutingGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/audioroutinggroup-update?view=graph-rest-1.0 Find more info here */ public function patch(AudioRoutingGroup $body, ?AudioRoutingGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AudioRoutingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AudioRoutingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?AudioRoutingGroupItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?AudioRoutingGroupItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?AudioRoutingGroupItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(AudioRoutingGroup $body, ?AudioRouting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/CallItemRequestBuilder.php b/src/Generated/Communications/Calls/Item/CallItemRequestBuilder.php index 5cd3efb3436..2687622fff1 100644 --- a/src/Generated/Communications/Calls/Item/CallItemRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/CallItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\Calls\Item\AddLargeGalleryView\AddLargeGalleryViewRequestBuilder; use Microsoft\Graph\Generated\Communications\Calls\Item\Answer\AnswerRequestBuilder; use Microsoft\Graph\Generated\Communications\Calls\Item\AudioRoutingGroups\AudioRoutingGroupsRequestBuilder; @@ -178,58 +177,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete or hang up an active call. For group calls, this will only delete your call leg and the underlying group call will still continue. This API is available in the following national cloud deployments. * @param CallItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-delete?view=graph-rest-1.0 Find more info here */ public function delete(?CallItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a call object. This API is available in the following national cloud deployments. * @param CallItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-get?view=graph-rest-1.0 Find more info here */ public function get(?CallItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Call::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Call::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property calls in communications * @param Call $body The request body * @param CallItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Call $body, ?CallItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Call::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Call::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -246,6 +236,7 @@ public function toDeleteRequestInformation(?CallItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -259,7 +250,6 @@ public function toGetRequestInformation(?CallItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -267,6 +257,7 @@ public function toGetRequestInformation(?CallItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -281,11 +272,11 @@ public function toPatchRequestInformation(Call $body, ?CallItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/CancelMediaProcessing/CancelMediaProcessingRequestBuilder.php b/src/Generated/Communications/Calls/Item/CancelMediaProcessing/CancelMediaProcessingRequestBuilder.php index 46cb1b77ac5..9c600d54328 100644 --- a/src/Generated/Communications/Calls/Item/CancelMediaProcessing/CancelMediaProcessingRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/CancelMediaProcessing/CancelMediaProcessingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CancelMediaProcessingOperation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Cancels processing for any in-progress media operations. Media operations refer to the IVR operations playPrompt and recordResponse, which are by default queued to process in order. The cancelMediaProcessing method cancels any operation that is in-process as well as operations that are queued. For example, this method can be used to clean up the IVR operation queue for a new media operation. However, it will not cancel a subscribeToTone operation because it operates independent of any operation queue. This API is available in the following national cloud deployments. * @param CancelMediaProcessingPostRequestBody $body The request body * @param CancelMediaProcessingRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-cancelmediaprocessing?view=graph-rest-1.0 Find more info here */ public function post(CancelMediaProcessingPostRequestBody $body, ?CancelMediaProcessingRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CancelMediaProcessingOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CancelMediaProcessingOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CancelMediaProcessingPostRequestBody $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/ChangeScreenSharingRole/ChangeScreenSharingRoleRequestBuilder.php b/src/Generated/Communications/Calls/Item/ChangeScreenSharingRole/ChangeScreenSharingRoleRequestBuilder.php index 026ea662fcc..4140ec8a1e0 100644 --- a/src/Generated/Communications/Calls/Item/ChangeScreenSharingRole/ChangeScreenSharingRoleRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/ChangeScreenSharingRole/ChangeScreenSharingRoleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Allow applications to share screen content with the participants of a group call. This API is available in the following national cloud deployments. * @param ChangeScreenSharingRolePostRequestBody $body The request body * @param ChangeScreenSharingRoleRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-changescreensharingrole?view=graph-rest-1.0 Find more info here */ public function post(ChangeScreenSharingRolePostRequestBody $body, ?ChangeScreenSharingRoleRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ChangeScreenSharingRolePostRequestBody $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/ContentSharingSessions/ContentSharingSessionsRequestBuilder.php b/src/Generated/Communications/Calls/Item/ContentSharingSessions/ContentSharingSessionsRequestBuilder.php index 9324c27ef31..0e0d46f67ae 100644 --- a/src/Generated/Communications/Calls/Item/ContentSharingSessions/ContentSharingSessionsRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/ContentSharingSessions/ContentSharingSessionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\Calls\Item\ContentSharingSessions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Communications\Calls\Item\ContentSharingSessions\Item\ContentSharingSessionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ContentSharingSession; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of contentSharingSession objects in a call. This API is available in the following national cloud deployments. * @param ContentSharingSessionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-list-contentsharingsessions?view=graph-rest-1.0 Find more info here */ public function get(?ContentSharingSessionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentSharingSessionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentSharingSessionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentSharingSessions for communications * @param ContentSharingSession $body The request body * @param ContentSharingSessionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ContentSharingSession $body, ?ContentSharingSessionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentSharingSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentSharingSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ContentSharingSessionsRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ContentSharingSessionsRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ContentSharingSession $body, ?ContentSh $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/ContentSharingSessions/Count/CountRequestBuilder.php b/src/Generated/Communications/Calls/Item/ContentSharingSessions/Count/CountRequestBuilder.php index 91848ac87ba..bacb98120cd 100644 --- a/src/Generated/Communications/Calls/Item/ContentSharingSessions/Count/CountRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/ContentSharingSessions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/ContentSharingSessions/Item/ContentSharingSessionItemRequestBuilder.php b/src/Generated/Communications/Calls/Item/ContentSharingSessions/Item/ContentSharingSessionItemRequestBuilder.php index 75fbe88c9c7..83623480a18 100644 --- a/src/Generated/Communications/Calls/Item/ContentSharingSessions/Item/ContentSharingSessionItemRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/ContentSharingSessions/Item/ContentSharingSessionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentSharingSession; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentSharingSessions for communications * @param ContentSharingSessionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ContentSharingSessionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of a contentSharingSession object in a call. This API is available in the following national cloud deployments. * @param ContentSharingSessionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contentsharingsession-get?view=graph-rest-1.0 Find more info here */ public function get(?ContentSharingSessionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentSharingSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentSharingSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentSharingSessions in communications * @param ContentSharingSession $body The request body * @param ContentSharingSessionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ContentSharingSession $body, ?ContentSharingSessionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentSharingSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentSharingSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ContentSharingSessionItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ContentSharingSessionItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ContentSharingSessionItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(ContentSharingSession $body, ?ContentS $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/KeepAlive/KeepAliveRequestBuilder.php b/src/Generated/Communications/Calls/Item/KeepAlive/KeepAliveRequestBuilder.php index 0e50997f318..60b4da4cd2e 100644 --- a/src/Generated/Communications/Calls/Item/KeepAlive/KeepAliveRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/KeepAlive/KeepAliveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Make a request to this API every 15 to 45 minutes to ensure that an ongoing call remains active. A call that does not receive this request within 45 minutes is considered inactive and will subsequently end. At least one successful request must be made within 45 minutes of the previous request, or the start of the call. We recommend that you send a request in shorter time intervals (every 15 minutes). Make sure that these requests are successful to prevent the call from timing out and ending. Attempting to send a request to a call that has already ended will result in a 404 Not-Found error. The resources related to the call should be cleaned up on the application side. This API is available in the following national cloud deployments. * @param KeepAliveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-keepalive?view=graph-rest-1.0 Find more info here */ public function post(?KeepAliveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?KeepAliveRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Mute/MuteRequestBuilder.php b/src/Generated/Communications/Calls/Item/Mute/MuteRequestBuilder.php index 6d8bc618a2d..8c1b435674b 100644 --- a/src/Generated/Communications/Calls/Item/Mute/MuteRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Mute/MuteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MuteParticipantOperation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Allows the application to mute itself. This is a server mute, meaning that the server will drop all audio packets for this participant, even if the participant continues to stream audio. For more details about how to handle mute operations, see muteParticipantOperation This API is available in the following national cloud deployments. * @param MutePostRequestBody $body The request body * @param MuteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-mute?view=graph-rest-1.0 Find more info here */ public function post(MutePostRequestBody $body, ?MuteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MuteParticipantOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MuteParticipantOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(MutePostRequestBody $body, ?MuteRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Operations/Count/CountRequestBuilder.php b/src/Generated/Communications/Calls/Item/Operations/Count/CountRequestBuilder.php index f194d76d348..83e0bc25c62 100644 --- a/src/Generated/Communications/Calls/Item/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Operations/Item/CommsOperationItemRequestBuilder.php b/src/Generated/Communications/Calls/Item/Operations/Item/CommsOperationItemRequestBuilder.php index 77fceca9f4e..d0362695f92 100644 --- a/src/Generated/Communications/Calls/Item/Operations/Item/CommsOperationItemRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Operations/Item/CommsOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CommsOperation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for communications * @param CommsOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CommsOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the status of an operation that adds the large gallery view to a call. This API is available in the following national cloud deployments. * @param CommsOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/addlargegalleryviewoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?CommsOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CommsOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CommsOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in communications * @param CommsOperation $body The request body * @param CommsOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(CommsOperation $body, ?CommsOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CommsOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CommsOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?CommsOperationItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?CommsOperationItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?CommsOperationItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(CommsOperation $body, ?CommsOperationI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Operations/OperationsRequestBuilder.php b/src/Generated/Communications/Calls/Item/Operations/OperationsRequestBuilder.php index 6e45f91c6e0..d15be1923c1 100644 --- a/src/Generated/Communications/Calls/Item/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\Calls\Item\Operations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Communications\Calls\Item\Operations\Item\CommsOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\CommsOperation; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the status of an operation that adds the large gallery view to a call. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CommsOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CommsOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for communications * @param CommsOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CommsOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CommsOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CommsOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(CommsOperation $body, ?OperationsReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Participants/Count/CountRequestBuilder.php b/src/Generated/Communications/Calls/Item/Participants/Count/CountRequestBuilder.php index 6ff909bf58a..ccf40660e98 100644 --- a/src/Generated/Communications/Calls/Item/Participants/Count/CountRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Participants/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Participants/Invite/InviteRequestBuilder.php b/src/Generated/Communications/Calls/Item/Participants/Invite/InviteRequestBuilder.php index d6115044a3f..e8ca82c1d9b 100644 --- a/src/Generated/Communications/Calls/Item/Participants/Invite/InviteRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Participants/Invite/InviteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\InviteParticipantsOperation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invite participants to the active call. For more information about how to handle operations, see commsOperation. This API is available in the following national cloud deployments. * @param InvitePostRequestBody $body The request body * @param InviteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/participant-invite?view=graph-rest-1.0 Find more info here */ public function post(InvitePostRequestBody $body, ?InviteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InviteParticipantsOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InviteParticipantsOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(InvitePostRequestBody $body, ?InviteReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Participants/Item/Mute/MuteRequestBuilder.php b/src/Generated/Communications/Calls/Item/Participants/Item/Mute/MuteRequestBuilder.php index 566b4cbde18..acfc89e246a 100644 --- a/src/Generated/Communications/Calls/Item/Participants/Item/Mute/MuteRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Participants/Item/Mute/MuteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MuteParticipantOperation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Mute a specific participant in the call. This is a server mute, meaning that the server will drop all audio packets for this participant, even if the participant continues to stream audio. For more information about how to handle mute operations, see muteParticipantOperation. This API is available in the following national cloud deployments. * @param MutePostRequestBody $body The request body * @param MuteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/participant-mute?view=graph-rest-1.0 Find more info here */ public function post(MutePostRequestBody $body, ?MuteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MuteParticipantOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MuteParticipantOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(MutePostRequestBody $body, ?MuteRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Participants/Item/ParticipantItemRequestBuilder.php b/src/Generated/Communications/Calls/Item/Participants/Item/ParticipantItemRequestBuilder.php index 751b18407f8..40a21f518d0 100644 --- a/src/Generated/Communications/Calls/Item/Participants/Item/ParticipantItemRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Participants/Item/ParticipantItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\Calls\Item\Participants\Item\Mute\MuteRequestBuilder; use Microsoft\Graph\Generated\Communications\Calls\Item\Participants\Item\StartHoldMusic\StartHoldMusicRequestBuilder; use Microsoft\Graph\Generated\Communications\Calls\Item\Participants\Item\StopHoldMusic\StopHoldMusicRequestBuilder; @@ -58,58 +57,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a specific participant in a call. In some situations, it is appropriate for an application to remove a participant from an active call. This action can be done before or after the participant answers the call. When an active caller is removed, they are immediately dropped from the call with no pre- or post-removal notification. When an invited participant is removed, any outstanding add participant request is canceled. This API is available in the following national cloud deployments. * @param ParticipantItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/participant-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ParticipantItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a participant object. This API is available in the following national cloud deployments. * @param ParticipantItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/participant-get?view=graph-rest-1.0 Find more info here */ public function get(?ParticipantItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Participant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Participant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property participants in communications * @param Participant $body The request body * @param ParticipantItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Participant $body, ?ParticipantItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Participant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Participant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -126,6 +116,7 @@ public function toDeleteRequestInformation(?ParticipantItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -139,7 +130,6 @@ public function toGetRequestInformation(?ParticipantItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +137,7 @@ public function toGetRequestInformation(?ParticipantItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -161,11 +152,11 @@ public function toPatchRequestInformation(Participant $body, ?ParticipantItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Participants/Item/StartHoldMusic/StartHoldMusicRequestBuilder.php b/src/Generated/Communications/Calls/Item/Participants/Item/StartHoldMusic/StartHoldMusicRequestBuilder.php index 217049af3eb..28b81592197 100644 --- a/src/Generated/Communications/Calls/Item/Participants/Item/StartHoldMusic/StartHoldMusicRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Participants/Item/StartHoldMusic/StartHoldMusicRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\StartHoldMusicOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Put a participant on hold and play music in the background. This API is available in the following national cloud deployments. * @param StartHoldMusicPostRequestBody $body The request body * @param StartHoldMusicRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/participant-startholdmusic?view=graph-rest-1.0 Find more info here */ public function post(StartHoldMusicPostRequestBody $body, ?StartHoldMusicRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StartHoldMusicOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StartHoldMusicOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(StartHoldMusicPostRequestBody $body, ?S $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Participants/Item/StopHoldMusic/StopHoldMusicRequestBuilder.php b/src/Generated/Communications/Calls/Item/Participants/Item/StopHoldMusic/StopHoldMusicRequestBuilder.php index eb51ab00158..a764e0a0a69 100644 --- a/src/Generated/Communications/Calls/Item/Participants/Item/StopHoldMusic/StopHoldMusicRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Participants/Item/StopHoldMusic/StopHoldMusicRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\StopHoldMusicOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Reincorporate a participant previously put on hold to the call. This API is available in the following national cloud deployments. * @param StopHoldMusicPostRequestBody $body The request body * @param StopHoldMusicRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/participant-stopholdmusic?view=graph-rest-1.0 Find more info here */ public function post(StopHoldMusicPostRequestBody $body, ?StopHoldMusicRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StopHoldMusicOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StopHoldMusicOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(StopHoldMusicPostRequestBody $body, ?St $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Participants/ParticipantsRequestBuilder.php b/src/Generated/Communications/Calls/Item/Participants/ParticipantsRequestBuilder.php index fc6cc7f8f1b..fa61a8dcdb5 100644 --- a/src/Generated/Communications/Calls/Item/Participants/ParticipantsRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Participants/ParticipantsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\Calls\Item\Participants\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Communications\Calls\Item\Participants\Invite\InviteRequestBuilder; use Microsoft\Graph\Generated\Communications\Calls\Item\Participants\Item\ParticipantItemRequestBuilder; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of participant objects in the call. This API is available in the following national cloud deployments. * @param ParticipantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-list-participants?view=graph-rest-1.0 Find more info here */ public function get(?ParticipantsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ParticipantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ParticipantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to participants for communications * @param Participant $body The request body * @param ParticipantsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Participant $body, ?ParticipantsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Participant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Participant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?ParticipantsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?ParticipantsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(Participant $body, ?ParticipantsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/PlayPrompt/PlayPromptRequestBuilder.php b/src/Generated/Communications/Calls/Item/PlayPrompt/PlayPromptRequestBuilder.php index 57b8018f080..03b6d37cd30 100644 --- a/src/Generated/Communications/Calls/Item/PlayPrompt/PlayPromptRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/PlayPrompt/PlayPromptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlayPromptOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Play a prompt in the call. For more information about how to handle operations, see commsOperation This API is available in the following national cloud deployments. * @param PlayPromptPostRequestBody $body The request body * @param PlayPromptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-playprompt?view=graph-rest-1.0 Find more info here */ public function post(PlayPromptPostRequestBody $body, ?PlayPromptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlayPromptOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlayPromptOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(PlayPromptPostRequestBody $body, ?PlayP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/RecordResponse/RecordResponseRequestBuilder.php b/src/Generated/Communications/Calls/Item/RecordResponse/RecordResponseRequestBuilder.php index 2ffb716ee48..0742353ab3a 100644 --- a/src/Generated/Communications/Calls/Item/RecordResponse/RecordResponseRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/RecordResponse/RecordResponseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RecordOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Records a short audio response from the caller.A bot can utilize this to capture a voice response from a caller after they are prompted for a response. For further information on how to handle operations, please review commsOperation This action is not intended to record the entire call. The maximum length of recording is 2 minutes. The recording is not saved permanently by the Cloud Communications Platform and is discarded shortly after the call ends. The bot must download the recording promptly after the recording operation finishes by using the recordingLocation value that's given in the completed notification. This API is available in the following national cloud deployments. * @param RecordResponsePostRequestBody $body The request body * @param RecordResponseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-record?view=graph-rest-1.0 Find more info here */ public function post(RecordResponsePostRequestBody $body, ?RecordResponseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RecordOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RecordOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(RecordResponsePostRequestBody $body, ?R $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Redirect/RedirectRequestBuilder.php b/src/Generated/Communications/Calls/Item/Redirect/RedirectRequestBuilder.php index cf8f2061bda..bbb1a0af91a 100644 --- a/src/Generated/Communications/Calls/Item/Redirect/RedirectRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Redirect/RedirectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Redirect an incoming call that hasn't been answered or rejected yet. The terms 'redirecting' and 'forwarding' a call are used interchangeably. The bot is expected to redirect the call before the call times out. The current timeout value is 15 seconds. This API is available in the following national cloud deployments. * @param RedirectPostRequestBody $body The request body * @param RedirectRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-redirect?view=graph-rest-1.0 Find more info here */ public function post(RedirectPostRequestBody $body, ?RedirectRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(RedirectPostRequestBody $body, ?Redirec $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Reject/RejectRequestBuilder.php b/src/Generated/Communications/Calls/Item/Reject/RejectRequestBuilder.php index 5bd37acb1e5..6f472f7ab3e 100644 --- a/src/Generated/Communications/Calls/Item/Reject/RejectRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Reject/RejectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Enable a bot to reject an incoming call. The incoming call request can be an invite from a participant in a group call or a peer-to-peer call. If an invite to a group call is received, the notification will contain the chatInfo and meetingInfo parameters. The bot is expected to answer or reject the call before the call times out. The current timeout value is 15 seconds. This API does not end existing calls that have already been answered. Use delete call to end a call. This API is available in the following national cloud deployments. * @param RejectPostRequestBody $body The request body * @param RejectRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-reject?view=graph-rest-1.0 Find more info here */ public function post(RejectPostRequestBody $body, ?RejectRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(RejectPostRequestBody $body, ?RejectReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/SubscribeToTone/SubscribeToToneRequestBuilder.php b/src/Generated/Communications/Calls/Item/SubscribeToTone/SubscribeToToneRequestBuilder.php index 74ab44872cd..8a57b948a84 100644 --- a/src/Generated/Communications/Calls/Item/SubscribeToTone/SubscribeToToneRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/SubscribeToTone/SubscribeToToneRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SubscribeToToneOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Subscribe to DTMF (dual-tone multi-frequency signaling) which allows you to be notified when the user presses keys on a 'dialpad'. This API is available in the following national cloud deployments. * @param SubscribeToTonePostRequestBody $body The request body * @param SubscribeToToneRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-subscribetotone?view=graph-rest-1.0 Find more info here */ public function post(SubscribeToTonePostRequestBody $body, ?SubscribeToToneRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubscribeToToneOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubscribeToToneOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(SubscribeToTonePostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Transfer/TransferRequestBuilder.php b/src/Generated/Communications/Calls/Item/Transfer/TransferRequestBuilder.php index 829d54b2782..5a4276f4091 100644 --- a/src/Generated/Communications/Calls/Item/Transfer/TransferRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Transfer/TransferRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Transfer an active peer-to-peer call or group call. A consultative transfer means that the transferor can inform the person they want to transfer the call to (the transferee), before the transfer is made. This is opposed to transfering the call directly. This API is available in the following national cloud deployments. * @param TransferPostRequestBody $body The request body * @param TransferRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-transfer?view=graph-rest-1.0 Find more info here */ public function post(TransferPostRequestBody $body, ?TransferRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TransferPostRequestBody $body, ?Transfe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/Unmute/UnmuteRequestBuilder.php b/src/Generated/Communications/Calls/Item/Unmute/UnmuteRequestBuilder.php index f2288ac82b6..9ebe5952f60 100644 --- a/src/Generated/Communications/Calls/Item/Unmute/UnmuteRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/Unmute/UnmuteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnmuteParticipantOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Allow the application to unmute itself. This is a server unmute, meaning that the server will start sending audio packets for this participant to other participants again. For more information about how to handle unmute operations, see unmuteParticipantOperation. This API is available in the following national cloud deployments. * @param UnmutePostRequestBody $body The request body * @param UnmuteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-unmute?view=graph-rest-1.0 Find more info here */ public function post(UnmutePostRequestBody $body, ?UnmuteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnmuteParticipantOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnmuteParticipantOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(UnmutePostRequestBody $body, ?UnmuteReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/Item/UpdateRecordingStatus/UpdateRecordingStatusRequestBuilder.php b/src/Generated/Communications/Calls/Item/UpdateRecordingStatus/UpdateRecordingStatusRequestBuilder.php index b5e60c5a2f1..e07169d7688 100644 --- a/src/Generated/Communications/Calls/Item/UpdateRecordingStatus/UpdateRecordingStatusRequestBuilder.php +++ b/src/Generated/Communications/Calls/Item/UpdateRecordingStatus/UpdateRecordingStatusRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UpdateRecordingStatusOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Update the application's recording status associated with a call. This requires the use of the Teams policy-based recording solution. This API is available in the following national cloud deployments. * @param UpdateRecordingStatusPostRequestBody $body The request body * @param UpdateRecordingStatusRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-updaterecordingstatus?view=graph-rest-1.0 Find more info here */ public function post(UpdateRecordingStatusPostRequestBody $body, ?UpdateRecordingStatusRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UpdateRecordingStatusOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UpdateRecordingStatusOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(UpdateRecordingStatusPostRequestBody $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Calls/LogTeleconferenceDeviceQuality/LogTeleconferenceDeviceQualityRequestBuilder.php b/src/Generated/Communications/Calls/LogTeleconferenceDeviceQuality/LogTeleconferenceDeviceQualityRequestBuilder.php index fcb2ecaf7c2..fff9269cbfa 100644 --- a/src/Generated/Communications/Calls/LogTeleconferenceDeviceQuality/LogTeleconferenceDeviceQualityRequestBuilder.php +++ b/src/Generated/Communications/Calls/LogTeleconferenceDeviceQuality/LogTeleconferenceDeviceQualityRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Log video teleconferencing device quality data. The Cloud Video Interop (CVI) bot represents video teleconferencing (VTC) devices and acts as a back-to-back agent for a VTC device in a conference call. Because a CVI bot is in the middle of the VTC and Microsoft Teams infrastructure as a VTC proxy, it has two media legs. One media leg is between the CVI bot and Teams infrastructure, such as Teams conference server or a Teams client. The other media leg is between the CVI bot and the VTC device. The third-party partners own the VTC media leg and the Teams infrastructure cannot access the quality data of the third-party call leg. This method is only for the CVI partners to provide their media quality data. This API is available in the following national cloud deployments. * @param LogTeleconferenceDeviceQualityPostRequestBody $body The request body * @param LogTeleconferenceDeviceQualityRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/call-logteleconferencedevicequality?view=graph-rest-1.0 Find more info here */ public function post(LogTeleconferenceDeviceQualityPostRequestBody $body, ?LogTeleconferenceDeviceQualityRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(LogTeleconferenceDeviceQualityPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/CommunicationsRequestBuilder.php b/src/Generated/Communications/CommunicationsRequestBuilder.php index e24bd029ba9..59b5c60f23d 100644 --- a/src/Generated/Communications/CommunicationsRequestBuilder.php +++ b/src/Generated/Communications/CommunicationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\CallRecords\CallRecordsRequestBuilder; use Microsoft\Graph\Generated\Communications\Calls\CallsRequestBuilder; use Microsoft\Graph\Generated\Communications\GetPresencesByUserId\GetPresencesByUserIdRequestBuilder; @@ -74,38 +73,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get communications * @param CommunicationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CommunicationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CloudCommunications::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CloudCommunications::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update communications * @param CloudCommunications $body The request body * @param CommunicationsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(CloudCommunications $body, ?CommunicationsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CloudCommunications::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CloudCommunications::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,7 +111,6 @@ public function toGetRequestInformation(?CommunicationsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -126,6 +118,7 @@ public function toGetRequestInformation(?CommunicationsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -140,11 +133,11 @@ public function toPatchRequestInformation(CloudCommunications $body, ?Communicat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/GetPresencesByUserId/GetPresencesByUserIdRequestBuilder.php b/src/Generated/Communications/GetPresencesByUserId/GetPresencesByUserIdRequestBuilder.php index ae6046c4977..1e077e9393f 100644 --- a/src/Generated/Communications/GetPresencesByUserId/GetPresencesByUserIdRequestBuilder.php +++ b/src/Generated/Communications/GetPresencesByUserId/GetPresencesByUserIdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Get the presence information for multiple users. This API is available in the following national cloud deployments. * @param GetPresencesByUserIdPostRequestBody $body The request body * @param GetPresencesByUserIdRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/cloudcommunications-getpresencesbyuserid?view=graph-rest-1.0 Find more info here */ public function post(GetPresencesByUserIdPostRequestBody $body, ?GetPresencesByUserIdRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetPresencesByUserIdPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetPresencesByUserIdPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetPresencesByUserIdPostRequestBody $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Count/CountRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Count/CountRequestBuilder.php index 5203d84d510..b5e05c8b04b 100644 --- a/src/Generated/Communications/OnlineMeetings/Count/CountRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/CreateOrGet/CreateOrGetRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/CreateOrGet/CreateOrGetRequestBuilder.php index ca1eb43cffd..26ca9915bf0 100644 --- a/src/Generated/Communications/OnlineMeetings/CreateOrGet/CreateOrGetRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/CreateOrGet/CreateOrGetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnlineMeeting; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an onlineMeeting object with a custom specified external ID. If the external ID already exists, this API will return the onlineMeeting object with that external ID. This API is available in the following national cloud deployments. * @param CreateOrGetPostRequestBody $body The request body * @param CreateOrGetRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-createorget?view=graph-rest-1.0 Find more info here */ public function post(CreateOrGetPostRequestBody $body, ?CreateOrGetRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateOrGetPostRequestBody $body, ?Crea $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/AttendanceReportsRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/AttendanceReportsRequestBuilder.php index 2211db3a1f4..0378339a925 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/AttendanceReportsRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/AttendanceReportsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Item\AttendanceReports\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Item\AttendanceReports\Item\MeetingAttendanceReportItemRequestBuilder; use Microsoft\Graph\Generated\Models\MeetingAttendanceReport; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of meetingAttendanceReport objects for an onlineMeeting. Each time an online meeting ends, an attendance report is generated for that session. This API is available in the following national cloud deployments. * @param AttendanceReportsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/meetingattendancereport-list?view=graph-rest-1.0 Find more info here */ public function get(?AttendanceReportsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReportCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReportCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to attendanceReports for communications * @param MeetingAttendanceReport $body The request body * @param AttendanceReportsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MeetingAttendanceReport $body, ?AttendanceReportsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReport::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReport::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?AttendanceReportsRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?AttendanceReportsRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(MeetingAttendanceReport $body, ?Attenda $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Count/CountRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Count/CountRequestBuilder.php index 43c162de70a..0d06b71ee31 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Count/CountRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/AttendanceRecordsRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/AttendanceRecordsRequestBuilder.php index fe8b382bf22..0f7913cd6be 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/AttendanceRecordsRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/AttendanceRecordsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Item\AttendanceReports\Item\AttendanceRecords\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Item\AttendanceReports\Item\AttendanceRecords\Item\AttendanceRecordItemRequestBuilder; use Microsoft\Graph\Generated\Models\AttendanceRecord; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of attendanceRecord objects and their properties. This API is available in the following national cloud deployments. * @param AttendanceRecordsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attendancerecord-list?view=graph-rest-1.0 Find more info here */ public function get(?AttendanceRecordsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to attendanceRecords for communications * @param AttendanceRecord $body The request body * @param AttendanceRecordsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AttendanceRecord $body, ?AttendanceRecordsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?AttendanceRecordsRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?AttendanceRecordsRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AttendanceRecord $body, ?AttendanceReco $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Count/CountRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Count/CountRequestBuilder.php index 1bc0fa88e4b..a4cd414ee41 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Count/CountRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Item/AttendanceRecordItemRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Item/AttendanceRecordItemRequestBuilder.php index b26fb931399..1210ea1dc59 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Item/AttendanceRecordItemRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Item/AttendanceRecordItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AttendanceRecord; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attendanceRecords for communications * @param AttendanceRecordItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttendanceRecordItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * List of attendance records of an attendance report. Read-only. * @param AttendanceRecordItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttendanceRecordItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property attendanceRecords in communications * @param AttendanceRecord $body The request body * @param AttendanceRecordItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AttendanceRecord $body, ?AttendanceRecordItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AttendanceRecordItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AttendanceRecordItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AttendanceRecordItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AttendanceRecord $body, ?AttendanceRec $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/MeetingAttendanceReportItemRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/MeetingAttendanceReportItemRequestBuilder.php index 17852e8dd78..d34a2580b04 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/MeetingAttendanceReportItemRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/AttendanceReports/Item/MeetingAttendanceReportItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Item\AttendanceReports\Item\AttendanceRecords\AttendanceRecordsRequestBuilder; use Microsoft\Graph\Generated\Models\MeetingAttendanceReport; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attendanceReports for communications * @param MeetingAttendanceReportItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MeetingAttendanceReportItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the meetingAttendanceReport for an onlineMeeting. Each time an online meeting ends, an attendance report will be generated for that session. This API is available in the following national cloud deployments. * @param MeetingAttendanceReportItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/meetingattendancereport-get?view=graph-rest-1.0 Find more info here */ public function get(?MeetingAttendanceReportItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReport::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReport::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property attendanceReports in communications * @param MeetingAttendanceReport $body The request body * @param MeetingAttendanceReportItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MeetingAttendanceReport $body, ?MeetingAttendanceReportItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReport::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReport::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?MeetingAttendanceReportItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?MeetingAttendanceReportItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?MeetingAttendanceReportItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(MeetingAttendanceReport $body, ?Meetin $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/AttendeeReport/AttendeeReportRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/AttendeeReport/AttendeeReportRequestBuilder.php index 8df69de8b38..5696e91e9b9 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/AttendeeReport/AttendeeReportRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/AttendeeReport/AttendeeReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get attendeeReport for the navigation property onlineMeetings from communications * @param AttendeeReportRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-get?view=graph-rest-1.0 Find more info here */ public function get(?AttendeeReportRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update attendeeReport for the navigation property onlineMeetings in communications * @param StreamInterface $body Binary request body * @param AttendeeReportRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?AttendeeReportRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?AttendeeReportRequestBuilderGetRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?AttendeeReportRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/GetVirtualAppointmentJoinWebUrl/GetVirtualAppointmentJoinWebUrlRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/GetVirtualAppointmentJoinWebUrl/GetVirtualAppointmentJoinWebUrlRequestBuilder.php index a4748461ee5..f93680d5904 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/GetVirtualAppointmentJoinWebUrl/GetVirtualAppointmentJoinWebUrlRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/GetVirtualAppointmentJoinWebUrl/GetVirtualAppointmentJoinWebUrlRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getVirtualAppointmentJoinWebUrl * @param GetVirtualAppointmentJoinWebUrlRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetVirtualAppointmentJoinWebUrlRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetVirtualAppointmentJoinWebUrlGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetVirtualAppointmentJoinWebUrlGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?GetVirtualAppointmentJoinWebUrlRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/OnlineMeetingItemRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/OnlineMeetingItemRequestBuilder.php index aa50bcd752b..45a48c02c2b 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/OnlineMeetingItemRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/OnlineMeetingItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Item\AttendanceReports\AttendanceReportsRequestBuilder; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Item\AttendeeReport\AttendeeReportRequestBuilder; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Item\GetVirtualAppointmentJoinWebUrl\GetVirtualAppointmentJoinWebUrlRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property onlineMeetings for communications * @param OnlineMeetingItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnlineMeetingItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get onlineMeetings from communications * @param OnlineMeetingItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnlineMeetingItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property onlineMeetings in communications * @param OnlineMeeting $body The request body * @param OnlineMeetingItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnlineMeeting $body, ?OnlineMeetingItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?OnlineMeetingItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?OnlineMeetingItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?OnlineMeetingItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(OnlineMeeting $body, ?OnlineMeetingIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Count/CountRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Count/CountRequestBuilder.php index 5588573bde0..fba3e3d7f40 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Count/CountRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Item/CallTranscriptItemRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Item/CallTranscriptItemRequestBuilder.php index 06cdab83dde..4f598907bfe 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Item/CallTranscriptItemRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Item/CallTranscriptItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Item\Transcripts\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Item\Transcripts\Item\MetadataContent\MetadataContentRequestBuilder; use Microsoft\Graph\Generated\Models\CallTranscript; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property transcripts for communications * @param CallTranscriptItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CallTranscriptItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a callTranscript object associated with a scheduled onlineMeeting. This API doesn't support getting call transcripts from channel meetings. Retrieving the transcript returns the metadata of the single transcript associated with the online meeting. Retrieving the content of the transcript returns the stream of text associated with the transcript. This API is available in the following national cloud deployments. * @param CallTranscriptItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calltranscript-get?view=graph-rest-1.0 Find more info here */ public function get(?CallTranscriptItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property transcripts in communications * @param CallTranscript $body The request body * @param CallTranscriptItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(CallTranscript $body, ?CallTranscriptItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?CallTranscriptItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?CallTranscriptItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?CallTranscriptItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(CallTranscript $body, ?CallTranscriptI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Item/Content/ContentRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Item/Content/ContentRequestBuilder.php index 25bd962663e..8d966f5e49e 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CallTranscript; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content of the transcript. Read-only. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-list-transcripts?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content of the transcript. Read-only. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Item/MetadataContent/MetadataContentRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Item/MetadataContent/MetadataContentRequestBuilder.php index df868729ae0..248464203fe 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Item/MetadataContent/MetadataContentRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/Transcripts/Item/MetadataContent/MetadataContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The time-aligned metadata of the utterances in the transcript. Read-only. * @param MetadataContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-list-transcripts?view=graph-rest-1.0 Find more info here */ public function get(?MetadataContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The time-aligned metadata of the utterances in the transcript. Read-only. * @param StreamInterface $body Binary request body * @param MetadataContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?MetadataContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?MetadataContentRequestBuilderGetRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?MetadataContentR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/Item/Transcripts/TranscriptsRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/Item/Transcripts/TranscriptsRequestBuilder.php index 70fcdbdd8c1..38ec7f01694 100644 --- a/src/Generated/Communications/OnlineMeetings/Item/Transcripts/TranscriptsRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/Item/Transcripts/TranscriptsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Item\Transcripts\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Item\Transcripts\Item\CallTranscriptItemRequestBuilder; use Microsoft\Graph\Generated\Models\CallTranscript; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of callTranscript objects associated with a scheduled onlineMeeting. This API doesn't support getting call transcripts from channel meetings. This API is available in the following national cloud deployments. * @param TranscriptsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-list-transcripts?view=graph-rest-1.0 Find more info here */ public function get(?TranscriptsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallTranscriptCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallTranscriptCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to transcripts for communications * @param CallTranscript $body The request body * @param TranscriptsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CallTranscript $body, ?TranscriptsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TranscriptsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TranscriptsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(CallTranscript $body, ?TranscriptsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/OnlineMeetings/OnlineMeetingsRequestBuilder.php b/src/Generated/Communications/OnlineMeetings/OnlineMeetingsRequestBuilder.php index 8d5a2e2eab4..91f4b9ad787 100644 --- a/src/Generated/Communications/OnlineMeetings/OnlineMeetingsRequestBuilder.php +++ b/src/Generated/Communications/OnlineMeetings/OnlineMeetingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Communications\OnlineMeetings\CreateOrGet\CreateOrGetRequestBuilder; use Microsoft\Graph\Generated\Communications\OnlineMeetings\Item\OnlineMeetingItemRequestBuilder; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of an onlineMeeting object. For example, you can: Teams live event attendee report (deprecated) is an online meeting artifact. For details, see Online meeting artifacts and permissions. This API is available in the following national cloud deployments. * @param OnlineMeetingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-get?view=graph-rest-1.0 Find more info here */ public function get(?OnlineMeetingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeetingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeetingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to onlineMeetings for communications * @param OnlineMeeting $body The request body * @param OnlineMeetingsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnlineMeeting $body, ?OnlineMeetingsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?OnlineMeetingsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?OnlineMeetingsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(OnlineMeeting $body, ?OnlineMeetingsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Presences/Count/CountRequestBuilder.php b/src/Generated/Communications/Presences/Count/CountRequestBuilder.php index 83d69a2452a..7fe6dfa308a 100644 --- a/src/Generated/Communications/Presences/Count/CountRequestBuilder.php +++ b/src/Generated/Communications/Presences/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Communications/Presences/Item/ClearPresence/ClearPresenceRequestBuilder.php b/src/Generated/Communications/Presences/Item/ClearPresence/ClearPresenceRequestBuilder.php index 3fab476ab24..73df72793d6 100644 --- a/src/Generated/Communications/Presences/Item/ClearPresence/ClearPresenceRequestBuilder.php +++ b/src/Generated/Communications/Presences/Item/ClearPresence/ClearPresenceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Clear the application's presence session for a user. If it is the user's only presence session, the user's presence will change to Offline/Offline. For details about presences sessions, see presence: setPresence. This API is available in the following national cloud deployments. * @param ClearPresencePostRequestBody $body The request body * @param ClearPresenceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/presence-clearpresence?view=graph-rest-1.0 Find more info here */ public function post(ClearPresencePostRequestBody $body, ?ClearPresenceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ClearPresencePostRequestBody $body, ?Cl $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Presences/Item/ClearUserPreferredPresence/ClearUserPreferredPresenceRequestBuilder.php b/src/Generated/Communications/Presences/Item/ClearUserPreferredPresence/ClearUserPreferredPresenceRequestBuilder.php index 1e72fbd9605..600d0d4a6a9 100644 --- a/src/Generated/Communications/Presences/Item/ClearUserPreferredPresence/ClearUserPreferredPresenceRequestBuilder.php +++ b/src/Generated/Communications/Presences/Item/ClearUserPreferredPresence/ClearUserPreferredPresenceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the preferred availability and activity status for a user. This API is available in the following national cloud deployments. * @param ClearUserPreferredPresenceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/presence-clearuserpreferredpresence?view=graph-rest-1.0 Find more info here */ public function post(?ClearUserPreferredPresenceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearUserPreferredPresenceRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Communications/Presences/Item/PresenceItemRequestBuilder.php b/src/Generated/Communications/Presences/Item/PresenceItemRequestBuilder.php index a8e7e0ff988..005dea8b53a 100644 --- a/src/Generated/Communications/Presences/Item/PresenceItemRequestBuilder.php +++ b/src/Generated/Communications/Presences/Item/PresenceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\Presences\Item\ClearPresence\ClearPresenceRequestBuilder; use Microsoft\Graph\Generated\Communications\Presences\Item\ClearUserPreferredPresence\ClearUserPreferredPresenceRequestBuilder; use Microsoft\Graph\Generated\Communications\Presences\Item\SetPresence\SetPresenceRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property presences for communications * @param PresenceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PresenceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a user's presence information. This API is available in the following national cloud deployments. * @param PresenceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/presence-get?view=graph-rest-1.0 Find more info here */ public function get(?PresenceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Presence::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Presence::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property presences in communications * @param Presence $body The request body * @param PresenceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Presence $body, ?PresenceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Presence::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Presence::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?PresenceItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?PresenceItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?PresenceItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(Presence $body, ?PresenceItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Presences/Item/SetPresence/SetPresenceRequestBuilder.php b/src/Generated/Communications/Presences/Item/SetPresence/SetPresenceRequestBuilder.php index 4739707fef6..39cb8e1f0ab 100644 --- a/src/Generated/Communications/Presences/Item/SetPresence/SetPresenceRequestBuilder.php +++ b/src/Generated/Communications/Presences/Item/SetPresence/SetPresenceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Set the state of a user's presence session as an application. This API is available in the following national cloud deployments. * @param SetPresencePostRequestBody $body The request body * @param SetPresenceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/presence-setpresence?view=graph-rest-1.0 Find more info here */ public function post(SetPresencePostRequestBody $body, ?SetPresenceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetPresencePostRequestBody $body, ?SetP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Presences/Item/SetStatusMessage/SetStatusMessageRequestBuilder.php b/src/Generated/Communications/Presences/Item/SetStatusMessage/SetStatusMessageRequestBuilder.php index 0d9cee33a53..3737771e3b4 100644 --- a/src/Generated/Communications/Presences/Item/SetStatusMessage/SetStatusMessageRequestBuilder.php +++ b/src/Generated/Communications/Presences/Item/SetStatusMessage/SetStatusMessageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Set a presence status message for a user. An optional expiration date and time can be supplied. This API is available in the following national cloud deployments. * @param SetStatusMessagePostRequestBody $body The request body * @param SetStatusMessageRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/presence-setstatusmessage?view=graph-rest-1.0 Find more info here */ public function post(SetStatusMessagePostRequestBody $body, ?SetStatusMessageRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetStatusMessagePostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Presences/Item/SetUserPreferredPresence/SetUserPreferredPresenceRequestBuilder.php b/src/Generated/Communications/Presences/Item/SetUserPreferredPresence/SetUserPreferredPresenceRequestBuilder.php index f292e707a08..82c8684c17c 100644 --- a/src/Generated/Communications/Presences/Item/SetUserPreferredPresence/SetUserPreferredPresenceRequestBuilder.php +++ b/src/Generated/Communications/Presences/Item/SetUserPreferredPresence/SetUserPreferredPresenceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Set the preferred availability and activity status for a user. If the preferred presence of a user is set, the user's presence shows as the preferred status. Preferred presence takes effect only when at least one presence session exists for the user. Otherwise, the user's presence shows as Offline. A presence session is created as a result of a successful setPresence operation, or if the user is signed in on a Microsoft Teams client. For more details, see presence sessions and time-out and expiration. This API is available in the following national cloud deployments. * @param SetUserPreferredPresencePostRequestBody $body The request body * @param SetUserPreferredPresenceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/presence-setuserpreferredpresence?view=graph-rest-1.0 Find more info here */ public function post(SetUserPreferredPresencePostRequestBody $body, ?SetUserPreferredPresenceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetUserPreferredPresencePostRequestBody $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Communications/Presences/PresencesRequestBuilder.php b/src/Generated/Communications/Presences/PresencesRequestBuilder.php index 76ec87f1c24..83e365b7b06 100644 --- a/src/Generated/Communications/Presences/PresencesRequestBuilder.php +++ b/src/Generated/Communications/Presences/PresencesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Communications\Presences\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Communications\Presences\Item\PresenceItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a user's presence information. This API is available in the following national cloud deployments. * @param PresencesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PresencesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PresenceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PresenceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to presences for communications * @param Presence $body The request body * @param PresencesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Presence $body, ?PresencesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Presence::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Presence::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?PresencesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?PresencesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Presence $body, ?PresencesRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Compliance/ComplianceRequestBuilder.php b/src/Generated/Compliance/ComplianceRequestBuilder.php index 6bbe457f1b7..22089e3db90 100644 --- a/src/Generated/Compliance/ComplianceRequestBuilder.php +++ b/src/Generated/Compliance/ComplianceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Compliance; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get compliance * @param ComplianceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ComplianceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Compliance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Compliance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update compliance * @param Compliance $body The request body * @param ComplianceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Compliance $body, ?ComplianceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Compliance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Compliance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?ComplianceRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?ComplianceRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(Compliance $body, ?ComplianceRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/ConnectionsRequestBuilder.php b/src/Generated/Connections/ConnectionsRequestBuilder.php index 73a9b1bc7e1..fc75c3e9e25 100644 --- a/src/Generated/Connections/ConnectionsRequestBuilder.php +++ b/src/Generated/Connections/ConnectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Connections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Connections\Item\ExternalConnectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalConnection; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from connections * @param ConnectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ConnectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to connections * @param ExternalConnection $body The request body * @param ConnectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ExternalConnection $body, ?ConnectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ConnectionsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ConnectionsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ExternalConnection $body, ?ConnectionsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/Count/CountRequestBuilder.php b/src/Generated/Connections/Count/CountRequestBuilder.php index 017d633b363..45f734a4e66 100644 --- a/src/Generated/Connections/Count/CountRequestBuilder.php +++ b/src/Generated/Connections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Connections/Item/ExternalConnectionItemRequestBuilder.php b/src/Generated/Connections/Item/ExternalConnectionItemRequestBuilder.php index a65801d9298..b513c2c2f7b 100644 --- a/src/Generated/Connections/Item/ExternalConnectionItemRequestBuilder.php +++ b/src/Generated/Connections/Item/ExternalConnectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Connections\Item\Groups\GroupsRequestBuilder; use Microsoft\Graph\Generated\Connections\Item\Items\ItemsRequestBuilder; use Microsoft\Graph\Generated\Connections\Item\Operations\OperationsRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from connections * @param ExternalConnectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExternalConnectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entity from connections by key * @param ExternalConnectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExternalConnectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in connections * @param ExternalConnection $body The request body * @param ExternalConnectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ExternalConnection $body, ?ExternalConnectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?ExternalConnectionItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?ExternalConnectionItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?ExternalConnectionItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(ExternalConnection $body, ?ExternalCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Groups/Count/CountRequestBuilder.php b/src/Generated/Connections/Item/Groups/Count/CountRequestBuilder.php index 6ba1ec922bb..e5c89173cdb 100644 --- a/src/Generated/Connections/Item/Groups/Count/CountRequestBuilder.php +++ b/src/Generated/Connections/Item/Groups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Groups/GroupsRequestBuilder.php b/src/Generated/Connections/Item/Groups/GroupsRequestBuilder.php index 35801950c41..5a92a52f71a 100644 --- a/src/Generated/Connections/Item/Groups/GroupsRequestBuilder.php +++ b/src/Generated/Connections/Item/Groups/GroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Connections\Item\Groups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Connections\Item\Groups\Item\ExternalGroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalGroup; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an externalGroup object. This API is available in the following national cloud deployments. * @param GroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new externalGroup object. This API is available in the following national cloud deployments. * @param ExternalGroup $body The request body * @param GroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalconnection-post-groups?view=graph-rest-1.0 Find more info here */ public function post(ExternalGroup $body, ?GroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ExternalGroup $body, ?GroupsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Groups/Item/ExternalGroupItemRequestBuilder.php b/src/Generated/Connections/Item/Groups/Item/ExternalGroupItemRequestBuilder.php index e8ccb82b4b3..b4b10864a0c 100644 --- a/src/Generated/Connections/Item/Groups/Item/ExternalGroupItemRequestBuilder.php +++ b/src/Generated/Connections/Item/Groups/Item/ExternalGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Connections\Item\Groups\Item\Members\MembersRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalGroup; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an externalGroup object. This API is available in the following national cloud deployments. * @param ExternalGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalgroup-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ExternalGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an externalGroup object. This API is available in the following national cloud deployments. * @param ExternalGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalgroup-get?view=graph-rest-1.0 Find more info here */ public function get(?ExternalGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an externalGroup object. This API is available in the following national cloud deployments. * @param ExternalGroup $body The request body * @param ExternalGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalgroup-update?view=graph-rest-1.0 Find more info here */ public function patch(ExternalGroup $body, ?ExternalGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?ExternalGroupItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?ExternalGroupItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?ExternalGroupItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(ExternalGroup $body, ?ExternalGroupIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Groups/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Connections/Item/Groups/Item/Members/Count/CountRequestBuilder.php index e55793e936c..fca9edcb0b9 100644 --- a/src/Generated/Connections/Item/Groups/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Connections/Item/Groups/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilder.php b/src/Generated/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilder.php index 75f4349e433..4e8e7d06046 100644 --- a/src/Generated/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilder.php +++ b/src/Generated/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ExternalConnectors\Identity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an identity resource to remove the corresponding member from an externalGroup. This API is available in the following national cloud deployments. * @param IdentityItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalgroupmember-delete?view=graph-rest-1.0 Find more info here */ public function delete(?IdentityItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. * @param IdentityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IdentityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property members in connections * @param Identity $body The request body * @param IdentityItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Identity $body, ?IdentityItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,11 +91,12 @@ public function toDeleteRequestInformation(?IdentityItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. * @param IdentityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -114,7 +105,6 @@ public function toGetRequestInformation(?IdentityItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?IdentityItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Identity $body, ?IdentityItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilderGetQueryParameters.php b/src/Generated/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilderGetQueryParameters.php index e25645740fb..4d4e7b9e514 100644 --- a/src/Generated/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. */ class IdentityItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Connections/Item/Groups/Item/Members/MembersRequestBuilder.php b/src/Generated/Connections/Item/Groups/Item/Members/MembersRequestBuilder.php index b73b255409f..22b33280a21 100644 --- a/src/Generated/Connections/Item/Groups/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Connections/Item/Groups/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Connections\Item\Groups\Item\Members\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Connections\Item\Groups\Item\Members\Item\IdentityItemRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\Identity; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an identity resource for a new member in an externalGroup. This API is available in the following national cloud deployments. * @param Identity $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalgroup-post-members?view=graph-rest-1.0 Find more info here */ public function post(Identity $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Identity $body, ?MembersRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Groups/Item/Members/MembersRequestBuilderGetQueryParameters.php b/src/Generated/Connections/Item/Groups/Item/Members/MembersRequestBuilderGetQueryParameters.php index ee7333bb61b..8460cd6a0a5 100644 --- a/src/Generated/Connections/Item/Groups/Item/Members/MembersRequestBuilderGetQueryParameters.php +++ b/src/Generated/Connections/Item/Groups/Item/Members/MembersRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. */ class MembersRequestBuilderGetQueryParameters { diff --git a/src/Generated/Connections/Item/Items/Count/CountRequestBuilder.php b/src/Generated/Connections/Item/Items/Count/CountRequestBuilder.php index 1c087372db3..cf5c0d0d760 100644 --- a/src/Generated/Connections/Item/Items/Count/CountRequestBuilder.php +++ b/src/Generated/Connections/Item/Items/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Items/Item/Activities/ActivitiesRequestBuilder.php b/src/Generated/Connections/Item/Items/Item/Activities/ActivitiesRequestBuilder.php index 54941c892d9..9a790f6b1d1 100644 --- a/src/Generated/Connections/Item/Items/Item/Activities/ActivitiesRequestBuilder.php +++ b/src/Generated/Connections/Item/Items/Item/Activities/ActivitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Connections\Item\Items\Item\Activities\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Connections\Item\Items\Item\Activities\Item\ExternalActivityItemRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalActivity; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Returns a list of activities performed on the item. Write-only. * @param ActivitiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivitiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to activities for connections * @param ExternalActivity $body The request body * @param ActivitiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ExternalActivity $body, ?ActivitiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ActivitiesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ActivitiesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ExternalActivity $body, ?ActivitiesRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Items/Item/Activities/Count/CountRequestBuilder.php b/src/Generated/Connections/Item/Items/Item/Activities/Count/CountRequestBuilder.php index 86125a60dfb..d1e7640432a 100644 --- a/src/Generated/Connections/Item/Items/Item/Activities/Count/CountRequestBuilder.php +++ b/src/Generated/Connections/Item/Items/Item/Activities/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Items/Item/Activities/Item/ExternalActivityItemRequestBuilder.php b/src/Generated/Connections/Item/Items/Item/Activities/Item/ExternalActivityItemRequestBuilder.php index 1d660cf2407..e997bbe5503 100644 --- a/src/Generated/Connections/Item/Items/Item/Activities/Item/ExternalActivityItemRequestBuilder.php +++ b/src/Generated/Connections/Item/Items/Item/Activities/Item/ExternalActivityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Connections\Item\Items\Item\Activities\Item\PerformedBy\PerformedByRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalActivity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property activities for connections * @param ExternalActivityItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExternalActivityItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns a list of activities performed on the item. Write-only. * @param ExternalActivityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExternalActivityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property activities in connections * @param ExternalActivity $body The request body * @param ExternalActivityItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ExternalActivity $body, ?ExternalActivityItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ExternalActivityItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ExternalActivityItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ExternalActivityItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ExternalActivity $body, ?ExternalActiv $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Items/Item/Activities/Item/PerformedBy/PerformedByRequestBuilder.php b/src/Generated/Connections/Item/Items/Item/Activities/Item/PerformedBy/PerformedByRequestBuilder.php index 7397dd57778..4c79881bfc2 100644 --- a/src/Generated/Connections/Item/Items/Item/Activities/Item/PerformedBy/PerformedByRequestBuilder.php +++ b/src/Generated/Connections/Item/Items/Item/Activities/Item/PerformedBy/PerformedByRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ExternalConnectors\Identity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents an identity used to identify who is responsible for the activity. * @param PerformedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PerformedByRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PerformedByRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PerformedByRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Items/Item/ExternalItemItemRequestBuilder.php b/src/Generated/Connections/Item/Items/Item/ExternalItemItemRequestBuilder.php index 4c2a1ec96bb..aab4c27ec77 100644 --- a/src/Generated/Connections/Item/Items/Item/ExternalItemItemRequestBuilder.php +++ b/src/Generated/Connections/Item/Items/Item/ExternalItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Connections\Item\Items\Item\Activities\ActivitiesRequestBuilder; use Microsoft\Graph\Generated\Connections\Item\Items\Item\MicrosoftGraphExternalConnectorsAddActivities\MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalItem; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an externalItem object. This API is available in the following national cloud deployments. * @param ExternalItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalitem-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ExternalItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an externalItem object. This API is available in the following national cloud deployments. * @param ExternalItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalitem-get?view=graph-rest-1.0 Find more info here */ public function get(?ExternalItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property items in connections * @param ExternalItem $body The request body * @param ExternalItemItemRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(ExternalItem $body, ?ExternalItemItemRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?ExternalItemItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?ExternalItemItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?ExternalItemItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPutRequestInformation(ExternalItem $body, ?ExternalItemItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Items/Item/MicrosoftGraphExternalConnectorsAddActivities/MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilder.php b/src/Generated/Connections/Item/Items/Item/MicrosoftGraphExternalConnectorsAddActivities/MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilder.php index 884b5f2e991..937db7862f9 100644 --- a/src/Generated/Connections/Item/Items/Item/MicrosoftGraphExternalConnectorsAddActivities/MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilder.php +++ b/src/Generated/Connections/Item/Items/Item/MicrosoftGraphExternalConnectorsAddActivities/MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action addActivities * @param AddActivitiesPostRequestBody $body The request body * @param MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AddActivitiesPostRequestBody $body, ?MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddActivitiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddActivitiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(AddActivitiesPostRequestBody $body, ?Mi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Items/ItemsRequestBuilder.php b/src/Generated/Connections/Item/Items/ItemsRequestBuilder.php index cef5f6d6b61..78ed63bba48 100644 --- a/src/Generated/Connections/Item/Items/ItemsRequestBuilder.php +++ b/src/Generated/Connections/Item/Items/ItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Connections\Item\Items\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Connections\Item\Items\Item\ExternalItemItemRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalItem; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of an externalItem object. This API is available in the following national cloud deployments. * @param ItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to items for connections * @param ExternalItem $body The request body * @param ItemsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ExternalItem $body, ?ItemsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ExternalItem $body, ?ItemsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Operations/Count/CountRequestBuilder.php b/src/Generated/Connections/Item/Operations/Count/CountRequestBuilder.php index 9fd0c387f21..d73c476fc65 100644 --- a/src/Generated/Connections/Item/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Connections/Item/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Operations/Item/ConnectionOperationItemRequestBuilder.php b/src/Generated/Connections/Item/Operations/Item/ConnectionOperationItemRequestBuilder.php index 87f40a534db..fb82a50cf27 100644 --- a/src/Generated/Connections/Item/Operations/Item/ConnectionOperationItemRequestBuilder.php +++ b/src/Generated/Connections/Item/Operations/Item/ConnectionOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ExternalConnectors\ConnectionOperation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for connections * @param ConnectionOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ConnectionOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a connectionOperation object. This API is available in the following national cloud deployments. * @param ConnectionOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-connectionoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?ConnectionOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in connections * @param ConnectionOperation $body The request body * @param ConnectionOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ConnectionOperation $body, ?ConnectionOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ConnectionOperationItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ConnectionOperationItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ConnectionOperationItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(ConnectionOperation $body, ?Connection $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Operations/OperationsRequestBuilder.php b/src/Generated/Connections/Item/Operations/OperationsRequestBuilder.php index 7056a0a40f0..561ebc02881 100644 --- a/src/Generated/Connections/Item/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Connections/Item/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Connections\Item\Operations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Connections\Item\Operations\Item\ConnectionOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ConnectionOperation; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a connectionOperation object. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for connections * @param ConnectionOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ConnectionOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ConnectionOperation $body, ?OperationsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Connections/Item/Schema/SchemaRequestBuilder.php b/src/Generated/Connections/Item/Schema/SchemaRequestBuilder.php index a2d36eda0fd..4b3c87562ec 100644 --- a/src/Generated/Connections/Item/Schema/SchemaRequestBuilder.php +++ b/src/Generated/Connections/Item/Schema/SchemaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ExternalConnectors\Schema; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,40 +33,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a schema object. This API is available in the following national cloud deployments. * @param SchemaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-schema-get?view=graph-rest-1.0 Find more info here */ public function get(?SchemaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Schema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Schema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create a new schema object. + * Create a new schema object. This API is available in the following national cloud deployments. * @param Schema $body The request body * @param SchemaRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalconnection-patch-schema?view=graph-rest-1.0 Find more info here */ public function patch(Schema $body, ?SchemaRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Schema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Schema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +73,6 @@ public function toGetRequestInformation(?SchemaRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,11 +80,12 @@ public function toGetRequestInformation(?SchemaRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create a new schema object. + * Create a new schema object. This API is available in the following national cloud deployments. * @param Schema $body The request body * @param SchemaRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -102,11 +95,11 @@ public function toPatchRequestInformation(Schema $body, ?SchemaRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contacts/ContactsRequestBuilder.php b/src/Generated/Contacts/ContactsRequestBuilder.php index 7d3c7ac67a0..5cb6b309c56 100644 --- a/src/Generated/Contacts/ContactsRequestBuilder.php +++ b/src/Generated/Contacts/ContactsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Contacts\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Contacts\GetAvailableExtensionProperties\GetAvailableExtensionPropertiesRequestBuilder; @@ -87,39 +86,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of organizational contacts for this organization. This API is available in the following national cloud deployments. * @param ContactsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/orgcontact-list?view=graph-rest-1.0 Find more info here */ public function get(?ContactsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to contacts * @param OrgContact $body The request body * @param ContactsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OrgContact $body, ?ContactsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,7 +125,6 @@ public function toGetRequestInformation(?ContactsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +132,7 @@ public function toGetRequestInformation(?ContactsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +147,11 @@ public function toPostRequestInformation(OrgContact $body, ?ContactsRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contacts/Count/CountRequestBuilder.php b/src/Generated/Contacts/Count/CountRequestBuilder.php index a0fbc8039a5..d4ece61d60a 100644 --- a/src/Generated/Contacts/Count/CountRequestBuilder.php +++ b/src/Generated/Contacts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Contacts/Delta/DeltaRequestBuilder.php b/src/Generated/Contacts/Delta/DeltaRequestBuilder.php index 5f4ec10e995..628bac49175 100644 --- a/src/Generated/Contacts/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Contacts/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/Contacts/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index 44a2d8d0244..f2de3e2c9f5 100644 --- a/src/Generated/Contacts/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/Contacts/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contacts/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/Contacts/GetByIds/GetByIdsRequestBuilder.php index 913ad567188..98b40c9712c 100644 --- a/src/Generated/Contacts/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/Contacts/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/Contacts/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index 20e0b65d5de..2f4d7ee2cb2 100644 --- a/src/Generated/Contacts/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/Contacts/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/Contacts/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index 53fc2892b59..d6be557b150 100644 --- a/src/Generated/Contacts/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/Contacts/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/DirectReports/Count/CountRequestBuilder.php b/src/Generated/Contacts/Item/DirectReports/Count/CountRequestBuilder.php index 2f43cac7685..be99b23cd81 100644 --- a/src/Generated/Contacts/Item/DirectReports/Count/CountRequestBuilder.php +++ b/src/Generated/Contacts/Item/DirectReports/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/DirectReports/DirectReportsRequestBuilder.php b/src/Generated/Contacts/Item/DirectReports/DirectReportsRequestBuilder.php index 0fb179ed786..b50882cb8c9 100644 --- a/src/Generated/Contacts/Item/DirectReports/DirectReportsRequestBuilder.php +++ b/src/Generated/Contacts/Item/DirectReports/DirectReportsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\DirectReports\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Contacts\Item\DirectReports\GraphOrgContact\GraphOrgContactRequestBuilder; use Microsoft\Graph\Generated\Contacts\Item\DirectReports\GraphUser\GraphUserRequestBuilder; @@ -70,20 +69,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The contact's direct reports. (The users and contacts that have their manager property set to this contact.) Read-only. Nullable. Supports $expand. * @param DirectReportsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/orgcontact-list-directreports?view=graph-rest-1.0 Find more info here */ public function get(?DirectReportsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -96,7 +92,6 @@ public function toGetRequestInformation(?DirectReportsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -104,6 +99,7 @@ public function toGetRequestInformation(?DirectReportsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/DirectReports/GraphOrgContact/Count/CountRequestBuilder.php b/src/Generated/Contacts/Item/DirectReports/GraphOrgContact/Count/CountRequestBuilder.php index 79f9b118f9e..5f550ca20b6 100644 --- a/src/Generated/Contacts/Item/DirectReports/GraphOrgContact/Count/CountRequestBuilder.php +++ b/src/Generated/Contacts/Item/DirectReports/GraphOrgContact/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/DirectReports/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Contacts/Item/DirectReports/GraphOrgContact/GraphOrgContactRequestBuilder.php index 055724b8ce9..da41fe60aa0 100644 --- a/src/Generated/Contacts/Item/DirectReports/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Contacts/Item/DirectReports/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\DirectReports\GraphOrgContact\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContactCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.orgContact in the microsoft.graph.directoryObject collection * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/DirectReports/GraphUser/Count/CountRequestBuilder.php b/src/Generated/Contacts/Item/DirectReports/GraphUser/Count/CountRequestBuilder.php index c963e83d961..4146ccdf7aa 100644 --- a/src/Generated/Contacts/Item/DirectReports/GraphUser/Count/CountRequestBuilder.php +++ b/src/Generated/Contacts/Item/DirectReports/GraphUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/DirectReports/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Contacts/Item/DirectReports/GraphUser/GraphUserRequestBuilder.php index 72d1942a07f..235c122faee 100644 --- a/src/Generated/Contacts/Item/DirectReports/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Contacts/Item/DirectReports/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\DirectReports\GraphUser\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.user in the microsoft.graph.directoryObject collection * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/DirectReports/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Contacts/Item/DirectReports/Item/DirectoryObjectItemRequestBuilder.php index 57512b00bd7..ac6e61c060d 100644 --- a/src/Generated/Contacts/Item/DirectReports/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Contacts/Item/DirectReports/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\DirectReports\Item\GraphOrgContact\GraphOrgContactRequestBuilder; use Microsoft\Graph\Generated\Contacts\Item\DirectReports\Item\GraphUser\GraphUserRequestBuilder; use Microsoft\Graph\Generated\Models\DirectoryObject; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The contact's direct reports. (The users and contacts that have their manager property set to this contact.) Read-only. Nullable. Supports $expand. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/DirectReports/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Contacts/Item/DirectReports/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php index 33cf9f72134..af494839d65 100644 --- a/src/Generated/Contacts/Item/DirectReports/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Contacts/Item/DirectReports/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContact; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.orgContact * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/DirectReports/Item/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Contacts/Item/DirectReports/Item/GraphUser/GraphUserRequestBuilder.php index 41135ccac99..ff945a52c38 100644 --- a/src/Generated/Contacts/Item/DirectReports/Item/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Contacts/Item/DirectReports/Item/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.user * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/Contacts/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index d5b01f40b16..849426ee519 100644 --- a/src/Generated/Contacts/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/Contacts/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/Contacts/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index 08607eeb75e..03fe65c596c 100644 --- a/src/Generated/Contacts/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/Contacts/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/Manager/ManagerRequestBuilder.php b/src/Generated/Contacts/Item/Manager/ManagerRequestBuilder.php index cf008c0e6e8..083088ac2ac 100644 --- a/src/Generated/Contacts/Item/Manager/ManagerRequestBuilder.php +++ b/src/Generated/Contacts/Item/Manager/ManagerRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get this organizational contact's manager. This API is available in the following national cloud deployments. * @param ManagerRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/orgcontact-get-manager?view=graph-rest-1.0 Find more info here */ public function get(?ManagerRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?ManagerRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?ManagerRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/MemberOf/Count/CountRequestBuilder.php b/src/Generated/Contacts/Item/MemberOf/Count/CountRequestBuilder.php index 4d7b267c3ec..55d5b15821e 100644 --- a/src/Generated/Contacts/Item/MemberOf/Count/CountRequestBuilder.php +++ b/src/Generated/Contacts/Item/MemberOf/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php b/src/Generated/Contacts/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php index 5cd9112e62e..50308eed93d 100644 --- a/src/Generated/Contacts/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php +++ b/src/Generated/Contacts/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Contacts/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index bf32080bc20..14232e7f9a4 100644 --- a/src/Generated/Contacts/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Contacts/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\MemberOf\GraphAdministrativeUnit\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\AdministrativeUnitCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.administrativeUnit in the microsoft.graph.directoryObject collection * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Contacts/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php index 1fa15fcc468..32da0411a2b 100644 --- a/src/Generated/Contacts/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Contacts/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Contacts/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php index 728710b9c21..9f5b77a8b80 100644 --- a/src/Generated/Contacts/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Contacts/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\MemberOf\GraphGroup\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Contacts/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php index 8a65d33934b..30db0124138 100644 --- a/src/Generated/Contacts/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Contacts/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\MemberOf\Item\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; use Microsoft\Graph\Generated\Contacts\Item\MemberOf\Item\GraphGroup\GraphGroupRequestBuilder; use Microsoft\Graph\Generated\Models\DirectoryObject; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Groups that this contact is a member of. Read-only. Nullable. Supports $expand. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Contacts/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index 6421f414bdf..8c6ffaa7312 100644 --- a/src/Generated/Contacts/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Contacts/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnit; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.administrativeUnit * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Contacts/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php index 99d5f88ea7c..0144fd5a25c 100644 --- a/src/Generated/Contacts/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Contacts/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/MemberOf/MemberOfRequestBuilder.php b/src/Generated/Contacts/Item/MemberOf/MemberOfRequestBuilder.php index eab19ca20ac..3a288fa9a2d 100644 --- a/src/Generated/Contacts/Item/MemberOf/MemberOfRequestBuilder.php +++ b/src/Generated/Contacts/Item/MemberOf/MemberOfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\MemberOf\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Contacts\Item\MemberOf\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; use Microsoft\Graph\Generated\Contacts\Item\MemberOf\GraphGroup\GraphGroupRequestBuilder; @@ -70,20 +69,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Groups that this contact is a member of. Read-only. Nullable. Supports $expand. * @param MemberOfRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/orgcontact-list-memberof?view=graph-rest-1.0 Find more info here */ public function get(?MemberOfRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -96,7 +92,6 @@ public function toGetRequestInformation(?MemberOfRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -104,6 +99,7 @@ public function toGetRequestInformation(?MemberOfRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/OrgContactItemRequestBuilder.php b/src/Generated/Contacts/Item/OrgContactItemRequestBuilder.php index 521250dcf4c..0d9c8d88ef0 100644 --- a/src/Generated/Contacts/Item/OrgContactItemRequestBuilder.php +++ b/src/Generated/Contacts/Item/OrgContactItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\CheckMemberGroups\CheckMemberGroupsRequestBuilder; use Microsoft\Graph\Generated\Contacts\Item\CheckMemberObjects\CheckMemberObjectsRequestBuilder; use Microsoft\Graph\Generated\Contacts\Item\DirectReports\DirectReportsRequestBuilder; @@ -122,57 +121,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from contacts * @param OrgContactItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OrgContactItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of an organizational contact. This API is available in the following national cloud deployments. * @param OrgContactItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/orgcontact-get?view=graph-rest-1.0 Find more info here */ public function get(?OrgContactItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in contacts * @param OrgContact $body The request body * @param OrgContactItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OrgContact $body, ?OrgContactItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -189,6 +179,7 @@ public function toDeleteRequestInformation(?OrgContactItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -202,7 +193,6 @@ public function toGetRequestInformation(?OrgContactItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -210,6 +200,7 @@ public function toGetRequestInformation(?OrgContactItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -224,11 +215,11 @@ public function toPatchRequestInformation(OrgContact $body, ?OrgContactItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/Restore/RestoreRequestBuilder.php b/src/Generated/Contacts/Item/Restore/RestoreRequestBuilder.php index eaae9792ae6..72b9a1962d6 100644 --- a/src/Generated/Contacts/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/Contacts/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/RetryServiceProvisioning/RetryServiceProvisioningRequestBuilder.php b/src/Generated/Contacts/Item/RetryServiceProvisioning/RetryServiceProvisioningRequestBuilder.php index a4010183853..6b19a805de7 100644 --- a/src/Generated/Contacts/Item/RetryServiceProvisioning/RetryServiceProvisioningRequestBuilder.php +++ b/src/Generated/Contacts/Item/RetryServiceProvisioning/RetryServiceProvisioningRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action retryServiceProvisioning * @param RetryServiceProvisioningRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RetryServiceProvisioningRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RetryServiceProvisioningRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Contacts/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php index df71b4ffa6e..f03e651f3ba 100644 --- a/src/Generated/Contacts/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Contacts/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Contacts/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index d3de22f1b7f..8d8ab362d5d 100644 --- a/src/Generated/Contacts/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Contacts/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/TransitiveMemberOf/Count/CountRequestBuilder.php b/src/Generated/Contacts/Item/TransitiveMemberOf/Count/CountRequestBuilder.php index ec591c11786..9e5890fe2c2 100644 --- a/src/Generated/Contacts/Item/TransitiveMemberOf/Count/CountRequestBuilder.php +++ b/src/Generated/Contacts/Item/TransitiveMemberOf/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php b/src/Generated/Contacts/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php index 42199476e3f..98a2f846829 100644 --- a/src/Generated/Contacts/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php +++ b/src/Generated/Contacts/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Contacts/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index 1a00c089576..c34b0f3e537 100644 --- a/src/Generated/Contacts/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Contacts/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\TransitiveMemberOf\GraphAdministrativeUnit\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\AdministrativeUnitCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.administrativeUnit in the microsoft.graph.directoryObject collection * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Contacts/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php index b54cbe4ff1d..a6cd20e7406 100644 --- a/src/Generated/Contacts/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Contacts/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Contacts/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php index 0382ae9484c..09b7a78084f 100644 --- a/src/Generated/Contacts/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Contacts/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\TransitiveMemberOf\GraphGroup\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Contacts/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php index 121b98e5a89..9f7cf626376 100644 --- a/src/Generated/Contacts/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Contacts/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\TransitiveMemberOf\Item\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; use Microsoft\Graph\Generated\Contacts\Item\TransitiveMemberOf\Item\GraphGroup\GraphGroupRequestBuilder; use Microsoft\Graph\Generated\Models\DirectoryObject; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Groups that this contact is a member of, including groups that the contact is nested under. Read-only. Nullable. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Contacts/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index 3037f87e0a1..4e7a7671e5f 100644 --- a/src/Generated/Contacts/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Contacts/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnit; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.administrativeUnit * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Contacts/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php index 0d83ac7f665..546546c5813 100644 --- a/src/Generated/Contacts/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Contacts/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php b/src/Generated/Contacts/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php index 1a522f48cd6..6a14b05dd41 100644 --- a/src/Generated/Contacts/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php +++ b/src/Generated/Contacts/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contacts\Item\TransitiveMemberOf\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Contacts\Item\TransitiveMemberOf\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; use Microsoft\Graph\Generated\Contacts\Item\TransitiveMemberOf\GraphGroup\GraphGroupRequestBuilder; @@ -70,20 +69,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Groups that this contact is a member of, including groups that the contact is nested under. Read-only. Nullable. * @param TransitiveMemberOfRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/orgcontact-list-transitivememberof?view=graph-rest-1.0 Find more info here */ public function get(?TransitiveMemberOfRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -96,7 +92,6 @@ public function toGetRequestInformation(?TransitiveMemberOfRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -104,6 +99,7 @@ public function toGetRequestInformation(?TransitiveMemberOfRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contacts/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/Contacts/ValidateProperties/ValidatePropertiesRequestBuilder.php index dea7bf7c845..f11cdb6e8a0 100644 --- a/src/Generated/Contacts/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/Contacts/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contracts/ContractsRequestBuilder.php b/src/Generated/Contracts/ContractsRequestBuilder.php index 1041f674289..c00881efb1f 100644 --- a/src/Generated/Contracts/ContractsRequestBuilder.php +++ b/src/Generated/Contracts/ContractsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contracts\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Contracts\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Contracts\GetAvailableExtensionProperties\GetAvailableExtensionPropertiesRequestBuilder; @@ -87,39 +86,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of contract objects associated to a partner tenant. This API is available in the following national cloud deployments. * @param ContractsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contract-list?view=graph-rest-1.0 Find more info here */ public function get(?ContractsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContractCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContractCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to contracts * @param Contract $body The request body * @param ContractsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Contract $body, ?ContractsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Contract::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Contract::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,7 +125,6 @@ public function toGetRequestInformation(?ContractsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +132,7 @@ public function toGetRequestInformation(?ContractsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +147,11 @@ public function toPostRequestInformation(Contract $body, ?ContractsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contracts/Count/CountRequestBuilder.php b/src/Generated/Contracts/Count/CountRequestBuilder.php index 6af345b531b..78637ccd4a5 100644 --- a/src/Generated/Contracts/Count/CountRequestBuilder.php +++ b/src/Generated/Contracts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Contracts/Delta/DeltaRequestBuilder.php b/src/Generated/Contracts/Delta/DeltaRequestBuilder.php index 387ccae821b..6884a7446ff 100644 --- a/src/Generated/Contracts/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Contracts/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contracts/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/Contracts/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index 65e9a1be7eb..ff431b0e8f3 100644 --- a/src/Generated/Contracts/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/Contracts/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contracts/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/Contracts/GetByIds/GetByIdsRequestBuilder.php index b294c8b2b2a..5d08ca9ced6 100644 --- a/src/Generated/Contracts/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/Contracts/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contracts/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/Contracts/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index a24f70ea1a6..fda7bd4f058 100644 --- a/src/Generated/Contracts/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/Contracts/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contracts/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/Contracts/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index 2f72b087a53..1361ba162cb 100644 --- a/src/Generated/Contracts/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/Contracts/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contracts/Item/ContractItemRequestBuilder.php b/src/Generated/Contracts/Item/ContractItemRequestBuilder.php index 7c655dcaa72..742f9fb8a38 100644 --- a/src/Generated/Contracts/Item/ContractItemRequestBuilder.php +++ b/src/Generated/Contracts/Item/ContractItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Contracts\Item\CheckMemberGroups\CheckMemberGroupsRequestBuilder; use Microsoft\Graph\Generated\Contracts\Item\CheckMemberObjects\CheckMemberObjectsRequestBuilder; use Microsoft\Graph\Generated\Contracts\Item\GetMemberGroups\GetMemberGroupsRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from contracts * @param ContractItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ContractItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of contract object. This API is available in the following national cloud deployments. * @param ContractItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contract-get?view=graph-rest-1.0 Find more info here */ public function get(?ContractItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Contract::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Contract::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in contracts * @param Contract $body The request body * @param ContractItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Contract $body, ?ContractItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Contract::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Contract::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?ContractItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?ContractItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?ContractItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(Contract $body, ?ContractItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contracts/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/Contracts/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index 01a8e63321b..fb9f6a540a8 100644 --- a/src/Generated/Contracts/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/Contracts/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contracts/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/Contracts/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index ddb305da9c7..585c24fb758 100644 --- a/src/Generated/Contracts/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/Contracts/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Contracts/Item/Restore/RestoreRequestBuilder.php b/src/Generated/Contracts/Item/Restore/RestoreRequestBuilder.php index 96de5d4ac6a..f5c071da4e1 100644 --- a/src/Generated/Contracts/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/Contracts/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Contracts/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/Contracts/ValidateProperties/ValidatePropertiesRequestBuilder.php index a4e8270b431..e536afb4431 100644 --- a/src/Generated/Contracts/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/Contracts/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DataPolicyOperations/Count/CountRequestBuilder.php b/src/Generated/DataPolicyOperations/Count/CountRequestBuilder.php index 42799e2a137..d9c22344e05 100644 --- a/src/Generated/DataPolicyOperations/Count/CountRequestBuilder.php +++ b/src/Generated/DataPolicyOperations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DataPolicyOperations/DataPolicyOperationsRequestBuilder.php b/src/Generated/DataPolicyOperations/DataPolicyOperationsRequestBuilder.php index 1c0f76e06c3..a557083a645 100644 --- a/src/Generated/DataPolicyOperations/DataPolicyOperationsRequestBuilder.php +++ b/src/Generated/DataPolicyOperations/DataPolicyOperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DataPolicyOperations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DataPolicyOperations\Item\DataPolicyOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\DataPolicyOperation; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties of a dataPolicyOperation object. This API is available in the following national cloud deployments. * @param DataPolicyOperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DataPolicyOperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DataPolicyOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DataPolicyOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to dataPolicyOperations * @param DataPolicyOperation $body The request body * @param DataPolicyOperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DataPolicyOperation $body, ?DataPolicyOperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DataPolicyOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DataPolicyOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DataPolicyOperationsRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DataPolicyOperationsRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DataPolicyOperation $body, ?DataPolicyO $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DataPolicyOperations/Item/DataPolicyOperationItemRequestBuilder.php b/src/Generated/DataPolicyOperations/Item/DataPolicyOperationItemRequestBuilder.php index 8141b7fbe12..3adda6c549d 100644 --- a/src/Generated/DataPolicyOperations/Item/DataPolicyOperationItemRequestBuilder.php +++ b/src/Generated/DataPolicyOperations/Item/DataPolicyOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DataPolicyOperation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from dataPolicyOperations * @param DataPolicyOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DataPolicyOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of a dataPolicyOperation object. This API is available in the following national cloud deployments. * @param DataPolicyOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/datapolicyoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?DataPolicyOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DataPolicyOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DataPolicyOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in dataPolicyOperations * @param DataPolicyOperation $body The request body * @param DataPolicyOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DataPolicyOperation $body, ?DataPolicyOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DataPolicyOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DataPolicyOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?DataPolicyOperationItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?DataPolicyOperationItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?DataPolicyOperationItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(DataPolicyOperation $body, ?DataPolicy $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/AndroidManagedAppProtectionsRequestBuilder.php b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/AndroidManagedAppProtectionsRequestBuilder.php index fae139f2cf7..7281a2dbda4 100644 --- a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/AndroidManagedAppProtectionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/AndroidManagedAppProtectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\AndroidManagedAppProtections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\AndroidManagedAppProtections\Item\AndroidManagedAppProtectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\AndroidManagedAppProtection; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the androidManagedAppProtection objects. * @param AndroidManagedAppProtectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-androidmanagedappprotection-list?view=graph-rest-1.0 Find more info here */ public function get(?AndroidManagedAppProtectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AndroidManagedAppProtectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AndroidManagedAppProtectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new androidManagedAppProtection object. * @param AndroidManagedAppProtection $body The request body * @param AndroidManagedAppProtectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-androidmanagedappprotection-create?view=graph-rest-1.0 Find more info here */ public function post(AndroidManagedAppProtection $body, ?AndroidManagedAppProtectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AndroidManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AndroidManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AndroidManagedAppProtectionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AndroidManagedAppProtectionsRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AndroidManagedAppProtection $body, ?And $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Count/CountRequestBuilder.php index 9f1908e4714..19a699703d0 100644 --- a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/AndroidManagedAppProtectionItemRequestBuilder.php b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/AndroidManagedAppProtectionItemRequestBuilder.php index 1ba50f05afa..e0b7f799d6f 100644 --- a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/AndroidManagedAppProtectionItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/AndroidManagedAppProtectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\AndroidManagedAppProtections\Item\Apps\AppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\AndroidManagedAppProtections\Item\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\AndroidManagedAppProtections\Item\DeploymentSummary\DeploymentSummaryRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a androidManagedAppProtection. * @param AndroidManagedAppProtectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-androidmanagedappprotection-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AndroidManagedAppProtectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the androidManagedAppProtection object. * @param AndroidManagedAppProtectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-androidmanagedappprotection-get?view=graph-rest-1.0 Find more info here */ public function get(?AndroidManagedAppProtectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AndroidManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AndroidManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a androidManagedAppProtection object. * @param AndroidManagedAppProtection $body The request body * @param AndroidManagedAppProtectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-androidmanagedappprotection-update?view=graph-rest-1.0 Find more info here */ public function patch(AndroidManagedAppProtection $body, ?AndroidManagedAppProtectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AndroidManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AndroidManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?AndroidManagedAppProtectionItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?AndroidManagedAppProtectionItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?AndroidManagedAppProtectionItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(AndroidManagedAppProtection $body, ?An $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Apps/AppsRequestBuilder.php b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Apps/AppsRequestBuilder.php index 7ae40291362..992f65bfb4a 100644 --- a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Apps/AppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Apps/AppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\AndroidManagedAppProtections\Item\Apps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\AndroidManagedAppProtections\Item\Apps\Item\ManagedMobileAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedMobileApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List of apps to which the policy is deployed. * @param AppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to apps for deviceAppManagement * @param ManagedMobileApp $body The request body * @param AppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ManagedMobileApp $body, ?AppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AppsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AppsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ManagedMobileApp $body, ?AppsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Apps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Apps/Count/CountRequestBuilder.php index 71d93a7794a..0e7533742a6 100644 --- a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Apps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Apps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php index c6560db7d8f..87943c4819a 100644 --- a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedMobileApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property apps for deviceAppManagement * @param ManagedMobileAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ManagedMobileAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * List of apps to which the policy is deployed. * @param ManagedMobileAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedMobileAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property apps in deviceAppManagement * @param ManagedMobileApp $body The request body * @param ManagedMobileAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ManagedMobileApp $body, ?ManagedMobileAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ManagedMobileAppItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ManagedMobileAppItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ManagedMobileAppItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ManagedMobileApp $body, ?ManagedMobile $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Assignments/AssignmentsRequestBuilder.php index 30b916d8d7f..42fc279c407 100644 --- a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\AndroidManagedAppProtections\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\AndroidManagedAppProtections\Item\Assignments\Item\TargetedManagedAppPolicyAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Navigation property to list of inclusion and exclusion groups to which the policy is deployed. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to assignments for deviceAppManagement * @param TargetedManagedAppPolicyAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TargetedManagedAppPolicyAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(TargetedManagedAppPolicyAssignment $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Assignments/Count/CountRequestBuilder.php index 5ff64f9d3e7..65d3a505e2c 100644 --- a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php index 2a756398b77..3e90f440a2e 100644 --- a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TargetedManagedAppPolicyAssignment; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignments for deviceAppManagement * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TargetedManagedAppPolicyAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Navigation property to list of inclusion and exclusion groups to which the policy is deployed. * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TargetedManagedAppPolicyAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignments in deviceAppManagement * @param TargetedManagedAppPolicyAssignment $body The request body * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TargetedManagedAppPolicyAssignment $body, ?TargetedManagedAppPolicyAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?TargetedManagedAppPolicyAssignmentIt $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?TargetedManagedAppPolicyAssignmentItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?TargetedManagedAppPolicyAssignmentItemR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(TargetedManagedAppPolicyAssignment $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php index aa5ce9a71fe..cc300eb3c99 100644 --- a/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/AndroidManagedAppProtections/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedAppPolicyDeploymentSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deploymentSummary for deviceAppManagement * @param DeploymentSummaryRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeploymentSummaryRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Navigation property to deployment summary of the configuration. * @param DeploymentSummaryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeploymentSummaryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property deploymentSummary in deviceAppManagement * @param ManagedAppPolicyDeploymentSummary $body The request body * @param DeploymentSummaryRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ManagedAppPolicyDeploymentSummary $body, ?DeploymentSummaryRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DeploymentSummaryRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DeploymentSummaryRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DeploymentSummaryRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ManagedAppPolicyDeploymentSummary $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Count/CountRequestBuilder.php index bf274d6e0aa..e60baebff38 100644 --- a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/DefaultManagedAppProtectionsRequestBuilder.php b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/DefaultManagedAppProtectionsRequestBuilder.php index eb41c72974d..af2cc17ee3e 100644 --- a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/DefaultManagedAppProtectionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/DefaultManagedAppProtectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\DefaultManagedAppProtections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\DefaultManagedAppProtections\Item\DefaultManagedAppProtectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\DefaultManagedAppProtection; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the defaultManagedAppProtection objects. * @param DefaultManagedAppProtectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-defaultmanagedappprotection-list?view=graph-rest-1.0 Find more info here */ public function get(?DefaultManagedAppProtectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DefaultManagedAppProtectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DefaultManagedAppProtectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new defaultManagedAppProtection object. * @param DefaultManagedAppProtection $body The request body * @param DefaultManagedAppProtectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-defaultmanagedappprotection-create?view=graph-rest-1.0 Find more info here */ public function post(DefaultManagedAppProtection $body, ?DefaultManagedAppProtectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DefaultManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DefaultManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DefaultManagedAppProtectionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DefaultManagedAppProtectionsRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DefaultManagedAppProtection $body, ?Def $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/Apps/AppsRequestBuilder.php b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/Apps/AppsRequestBuilder.php index af800038fc8..ed70d082ef3 100644 --- a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/Apps/AppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/Apps/AppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\DefaultManagedAppProtections\Item\Apps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\DefaultManagedAppProtections\Item\Apps\Item\ManagedMobileAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedMobileApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List of apps to which the policy is deployed. * @param AppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to apps for deviceAppManagement * @param ManagedMobileApp $body The request body * @param AppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ManagedMobileApp $body, ?AppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AppsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AppsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ManagedMobileApp $body, ?AppsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/Apps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/Apps/Count/CountRequestBuilder.php index 7a663107e33..b3726a1d764 100644 --- a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/Apps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/Apps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php index 41f990804b9..fbaa3a7896c 100644 --- a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedMobileApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property apps for deviceAppManagement * @param ManagedMobileAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ManagedMobileAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * List of apps to which the policy is deployed. * @param ManagedMobileAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedMobileAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property apps in deviceAppManagement * @param ManagedMobileApp $body The request body * @param ManagedMobileAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ManagedMobileApp $body, ?ManagedMobileAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ManagedMobileAppItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ManagedMobileAppItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ManagedMobileAppItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ManagedMobileApp $body, ?ManagedMobile $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/DefaultManagedAppProtectionItemRequestBuilder.php b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/DefaultManagedAppProtectionItemRequestBuilder.php index 876280a3716..268ddd2fe22 100644 --- a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/DefaultManagedAppProtectionItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/DefaultManagedAppProtectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\DefaultManagedAppProtections\Item\Apps\AppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\DefaultManagedAppProtections\Item\DeploymentSummary\DeploymentSummaryRequestBuilder; use Microsoft\Graph\Generated\Models\DefaultManagedAppProtection; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a defaultManagedAppProtection. * @param DefaultManagedAppProtectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-defaultmanagedappprotection-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DefaultManagedAppProtectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the defaultManagedAppProtection object. * @param DefaultManagedAppProtectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-defaultmanagedappprotection-get?view=graph-rest-1.0 Find more info here */ public function get(?DefaultManagedAppProtectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DefaultManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DefaultManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a defaultManagedAppProtection object. * @param DefaultManagedAppProtection $body The request body * @param DefaultManagedAppProtectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-defaultmanagedappprotection-update?view=graph-rest-1.0 Find more info here */ public function patch(DefaultManagedAppProtection $body, ?DefaultManagedAppProtectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DefaultManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DefaultManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?DefaultManagedAppProtectionItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?DefaultManagedAppProtectionItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?DefaultManagedAppProtectionItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(DefaultManagedAppProtection $body, ?De $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php index ae725ea42d2..3bb43b358fb 100644 --- a/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/DefaultManagedAppProtections/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedAppPolicyDeploymentSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deploymentSummary for deviceAppManagement * @param DeploymentSummaryRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeploymentSummaryRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Navigation property to deployment summary of the configuration. * @param DeploymentSummaryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeploymentSummaryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property deploymentSummary in deviceAppManagement * @param ManagedAppPolicyDeploymentSummary $body The request body * @param DeploymentSummaryRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ManagedAppPolicyDeploymentSummary $body, ?DeploymentSummaryRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DeploymentSummaryRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DeploymentSummaryRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DeploymentSummaryRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ManagedAppPolicyDeploymentSummary $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/DeviceAppManagementRequestBuilder.php b/src/Generated/DeviceAppManagement/DeviceAppManagementRequestBuilder.php index 60b77aed40f..5a40b127e5a 100644 --- a/src/Generated/DeviceAppManagement/DeviceAppManagementRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/DeviceAppManagementRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\AndroidManagedAppProtections\AndroidManagedAppProtectionsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\DefaultManagedAppProtections\DefaultManagedAppProtectionsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\IosManagedAppProtections\IosManagedAppProtectionsRequestBuilder; @@ -154,40 +153,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read properties and relationships of the deviceAppManagement object. * @param DeviceAppManagementRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-unlock-deviceappmanagement-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-partnerintegration-deviceappmanagement-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceAppManagementRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceAppManagement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceAppManagement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceAppManagement object. * @param DeviceAppManagement $body The request body * @param DeviceAppManagementRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-policyset-deviceappmanagement-update?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-partnerintegration-deviceappmanagement-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceAppManagement $body, ?DeviceAppManagementRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceAppManagement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceAppManagement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -200,7 +193,6 @@ public function toGetRequestInformation(?DeviceAppManagementRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -208,6 +200,7 @@ public function toGetRequestInformation(?DeviceAppManagementRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -222,11 +215,11 @@ public function toPatchRequestInformation(DeviceAppManagement $body, ?DeviceAppM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Count/CountRequestBuilder.php index 273db571bb1..c239a898e05 100644 --- a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/IosManagedAppProtections/IosManagedAppProtectionsRequestBuilder.php b/src/Generated/DeviceAppManagement/IosManagedAppProtections/IosManagedAppProtectionsRequestBuilder.php index 50510b3e623..eb080aa5c93 100644 --- a/src/Generated/DeviceAppManagement/IosManagedAppProtections/IosManagedAppProtectionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/IosManagedAppProtections/IosManagedAppProtectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\IosManagedAppProtections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\IosManagedAppProtections\Item\IosManagedAppProtectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\IosManagedAppProtection; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the iosManagedAppProtection objects. * @param IosManagedAppProtectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-iosmanagedappprotection-list?view=graph-rest-1.0 Find more info here */ public function get(?IosManagedAppProtectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosManagedAppProtectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosManagedAppProtectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new iosManagedAppProtection object. * @param IosManagedAppProtection $body The request body * @param IosManagedAppProtectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-iosmanagedappprotection-create?view=graph-rest-1.0 Find more info here */ public function post(IosManagedAppProtection $body, ?IosManagedAppProtectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?IosManagedAppProtectionsRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?IosManagedAppProtectionsRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(IosManagedAppProtection $body, ?IosMana $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Apps/AppsRequestBuilder.php b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Apps/AppsRequestBuilder.php index 4de7b64710a..a373336fdee 100644 --- a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Apps/AppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Apps/AppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\IosManagedAppProtections\Item\Apps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\IosManagedAppProtections\Item\Apps\Item\ManagedMobileAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedMobileApp; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the managedMobileApp objects. * @param AppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-managedmobileapp-list?view=graph-rest-1.0 Find more info here */ public function get(?AppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new managedMobileApp object. * @param ManagedMobileApp $body The request body * @param AppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-managedmobileapp-create?view=graph-rest-1.0 Find more info here */ public function post(ManagedMobileApp $body, ?AppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AppsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AppsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ManagedMobileApp $body, ?AppsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Apps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Apps/Count/CountRequestBuilder.php index 2bfdfb537f8..36ccce0e2dd 100644 --- a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Apps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Apps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php index 84bb5fc4f3d..1d047956314 100644 --- a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedMobileApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a managedMobileApp. * @param ManagedMobileAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-managedmobileapp-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ManagedMobileAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the managedMobileApp object. * @param ManagedMobileAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-managedmobileapp-get?view=graph-rest-1.0 Find more info here */ public function get(?ManagedMobileAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a managedMobileApp object. * @param ManagedMobileApp $body The request body * @param ManagedMobileAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-managedmobileapp-update?view=graph-rest-1.0 Find more info here */ public function patch(ManagedMobileApp $body, ?ManagedMobileAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ManagedMobileAppItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ManagedMobileAppItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ManagedMobileAppItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ManagedMobileApp $body, ?ManagedMobile $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Assignments/AssignmentsRequestBuilder.php index 49ea3417cf7..afd531d8e91 100644 --- a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\IosManagedAppProtections\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\IosManagedAppProtections\Item\Assignments\Item\TargetedManagedAppPolicyAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Navigation property to list of inclusion and exclusion groups to which the policy is deployed. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to assignments for deviceAppManagement * @param TargetedManagedAppPolicyAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TargetedManagedAppPolicyAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(TargetedManagedAppPolicyAssignment $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Assignments/Count/CountRequestBuilder.php index d859ada3356..005204645d7 100644 --- a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php index d3ef68a44ab..1732de2b391 100644 --- a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TargetedManagedAppPolicyAssignment; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignments for deviceAppManagement * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TargetedManagedAppPolicyAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Navigation property to list of inclusion and exclusion groups to which the policy is deployed. * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TargetedManagedAppPolicyAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignments in deviceAppManagement * @param TargetedManagedAppPolicyAssignment $body The request body * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TargetedManagedAppPolicyAssignment $body, ?TargetedManagedAppPolicyAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?TargetedManagedAppPolicyAssignmentIt $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?TargetedManagedAppPolicyAssignmentItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?TargetedManagedAppPolicyAssignmentItemR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(TargetedManagedAppPolicyAssignment $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php index dfbd3d938be..5488d1bdd61 100644 --- a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedAppPolicyDeploymentSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deploymentSummary for deviceAppManagement * @param DeploymentSummaryRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeploymentSummaryRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the managedAppPolicyDeploymentSummary object. * @param DeploymentSummaryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-managedapppolicydeploymentsummary-get?view=graph-rest-1.0 Find more info here */ public function get(?DeploymentSummaryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a managedAppPolicyDeploymentSummary object. * @param ManagedAppPolicyDeploymentSummary $body The request body * @param DeploymentSummaryRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-managedapppolicydeploymentsummary-update?view=graph-rest-1.0 Find more info here */ public function patch(ManagedAppPolicyDeploymentSummary $body, ?DeploymentSummaryRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DeploymentSummaryRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DeploymentSummaryRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DeploymentSummaryRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(ManagedAppPolicyDeploymentSummary $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/IosManagedAppProtectionItemRequestBuilder.php b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/IosManagedAppProtectionItemRequestBuilder.php index e86fc408904..7d2209ba1e3 100644 --- a/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/IosManagedAppProtectionItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/IosManagedAppProtections/Item/IosManagedAppProtectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\IosManagedAppProtections\Item\Apps\AppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\IosManagedAppProtections\Item\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\IosManagedAppProtections\Item\DeploymentSummary\DeploymentSummaryRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a iosManagedAppProtection. * @param IosManagedAppProtectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-iosmanagedappprotection-delete?view=graph-rest-1.0 Find more info here */ public function delete(?IosManagedAppProtectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the iosManagedAppProtection object. * @param IosManagedAppProtectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-iosmanagedappprotection-get?view=graph-rest-1.0 Find more info here */ public function get(?IosManagedAppProtectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a iosManagedAppProtection object. * @param IosManagedAppProtection $body The request body * @param IosManagedAppProtectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-iosmanagedappprotection-update?view=graph-rest-1.0 Find more info here */ public function patch(IosManagedAppProtection $body, ?IosManagedAppProtectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosManagedAppProtection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?IosManagedAppProtectionItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?IosManagedAppProtectionItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?IosManagedAppProtectionItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(IosManagedAppProtection $body, ?IosMan $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppPolicies/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppPolicies/Count/CountRequestBuilder.php index 7a9d4eaac8c..04fe992336b 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppPolicies/Item/ManagedAppPolicyItemRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppPolicies/Item/ManagedAppPolicyItemRequestBuilder.php index 7a1e2a61bc9..0cf08a3e097 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppPolicies/Item/ManagedAppPolicyItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppPolicies/Item/ManagedAppPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppPolicies\Item\TargetApps\TargetAppsRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedAppPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property managedAppPolicies for deviceAppManagement * @param ManagedAppPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ManagedAppPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read properties and relationships of the windowsInformationProtection object. + * Read properties and relationships of the targetedManagedAppProtection object. * @param ManagedAppPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-mam-windowsinformationprotection-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-mam-targetedmanagedappprotection-get?view=graph-rest-1.0 Find more info here */ public function get(?ManagedAppPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property managedAppPolicies in deviceAppManagement * @param ManagedAppPolicy $body The request body * @param ManagedAppPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ManagedAppPolicy $body, ?ManagedAppPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,11 +99,12 @@ public function toDeleteRequestInformation(?ManagedAppPolicyItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read properties and relationships of the windowsInformationProtection object. + * Read properties and relationships of the targetedManagedAppProtection object. * @param ManagedAppPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ManagedAppPolicyItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ManagedAppPolicyItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ManagedAppPolicy $body, ?ManagedAppPol $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppPolicies/Item/ManagedAppPolicyItemRequestBuilderGetQueryParameters.php b/src/Generated/DeviceAppManagement/ManagedAppPolicies/Item/ManagedAppPolicyItemRequestBuilderGetQueryParameters.php index 01409153916..612793385c9 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppPolicies/Item/ManagedAppPolicyItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/DeviceAppManagement/ManagedAppPolicies/Item/ManagedAppPolicyItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read properties and relationships of the windowsInformationProtection object. + * Read properties and relationships of the targetedManagedAppProtection object. */ class ManagedAppPolicyItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/DeviceAppManagement/ManagedAppPolicies/Item/TargetApps/TargetAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppPolicies/Item/TargetApps/TargetAppsRequestBuilder.php index 97d8339b456..e09c0c07d04 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppPolicies/Item/TargetApps/TargetAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppPolicies/Item/TargetApps/TargetAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param TargetAppsPostRequestBody $body The request body * @param TargetAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-mam-targetedmanagedappprotection-targetapps?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-mam-managedappprotection-targetapps?view=graph-rest-1.0 Find more info here */ public function post(TargetAppsPostRequestBody $body, ?TargetAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TargetAppsPostRequestBody $body, ?Targe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppPolicies/ManagedAppPoliciesRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppPolicies/ManagedAppPoliciesRequestBuilder.php index c8072c317c1..ef6d5978231 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppPolicies/ManagedAppPoliciesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppPolicies/ManagedAppPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppPolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppPolicies\Item\ManagedAppPolicyItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedAppPolicy; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List properties and relationships of the windowsInformationProtection objects. + * List properties and relationships of the targetedManagedAppProtection objects. * @param ManagedAppPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-mam-windowsinformationprotection-list?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-mam-targetedmanagedappprotection-list?view=graph-rest-1.0 Find more info here */ public function get(?ManagedAppPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to managedAppPolicies for deviceAppManagement * @param ManagedAppPolicy $body The request body * @param ManagedAppPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ManagedAppPolicy $body, ?ManagedAppPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List properties and relationships of the windowsInformationProtection objects. + * List properties and relationships of the targetedManagedAppProtection objects. * @param ManagedAppPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ManagedAppPoliciesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ManagedAppPoliciesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ManagedAppPolicy $body, ?ManagedAppPoli $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppPolicies/ManagedAppPoliciesRequestBuilderGetQueryParameters.php b/src/Generated/DeviceAppManagement/ManagedAppPolicies/ManagedAppPoliciesRequestBuilderGetQueryParameters.php index 417359735f2..5501668ceb1 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppPolicies/ManagedAppPoliciesRequestBuilderGetQueryParameters.php +++ b/src/Generated/DeviceAppManagement/ManagedAppPolicies/ManagedAppPoliciesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List properties and relationships of the windowsInformationProtection objects. + * List properties and relationships of the targetedManagedAppProtection objects. */ class ManagedAppPoliciesRequestBuilderGetQueryParameters { diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Count/CountRequestBuilder.php index f2834b5839c..ed59382a16b 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/GetUserIdsWithFlaggedAppRegistration/GetUserIdsWithFlaggedAppRegistrationRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/GetUserIdsWithFlaggedAppRegistration/GetUserIdsWithFlaggedAppRegistrationRequestBuilder.php index 2cc57e66ca0..2338f8a977a 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/GetUserIdsWithFlaggedAppRegistration/GetUserIdsWithFlaggedAppRegistrationRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/GetUserIdsWithFlaggedAppRegistration/GetUserIdsWithFlaggedAppRegistrationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getUserIdsWithFlaggedAppRegistration * @param GetUserIdsWithFlaggedAppRegistrationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetUserIdsWithFlaggedAppRegistrationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetUserIdsWithFlaggedAppRegistrationGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetUserIdsWithFlaggedAppRegistrationGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetUserIdsWithFlaggedAppRegistrationReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetUserIdsWithFlaggedAppRegistrationReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/AppliedPoliciesRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/AppliedPoliciesRequestBuilder.php index 6d38c607772..80834d4a981 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/AppliedPoliciesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/AppliedPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\Item\AppliedPolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\Item\AppliedPolicies\Item\ManagedAppPolicyItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedAppPolicy; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Zero or more policys already applied on the registered app when it last synchronized with managment service. * @param AppliedPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppliedPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to appliedPolicies for deviceAppManagement * @param ManagedAppPolicy $body The request body * @param AppliedPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ManagedAppPolicy $body, ?AppliedPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AppliedPoliciesRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AppliedPoliciesRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ManagedAppPolicy $body, ?AppliedPolicie $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/Count/CountRequestBuilder.php index a12733f733d..971a5b78b12 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/Item/ManagedAppPolicyItemRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/Item/ManagedAppPolicyItemRequestBuilder.php index ba477855bd2..a6c50a484e7 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/Item/ManagedAppPolicyItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/Item/ManagedAppPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\Item\AppliedPolicies\Item\TargetApps\TargetAppsRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedAppPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property appliedPolicies for deviceAppManagement * @param ManagedAppPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ManagedAppPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Zero or more policys already applied on the registered app when it last synchronized with managment service. * @param ManagedAppPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedAppPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property appliedPolicies in deviceAppManagement * @param ManagedAppPolicy $body The request body * @param ManagedAppPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ManagedAppPolicy $body, ?ManagedAppPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ManagedAppPolicyItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ManagedAppPolicyItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ManagedAppPolicyItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ManagedAppPolicy $body, ?ManagedAppPol $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/Item/TargetApps/TargetAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/Item/TargetApps/TargetAppsRequestBuilder.php index 81f9141b707..d552c9e3ac3 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/Item/TargetApps/TargetAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/AppliedPolicies/Item/TargetApps/TargetAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param TargetAppsPostRequestBody $body The request body * @param TargetAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-mam-targetedmanagedappprotection-targetapps?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-mam-managedappprotection-targetapps?view=graph-rest-1.0 Find more info here */ public function post(TargetAppsPostRequestBody $body, ?TargetAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TargetAppsPostRequestBody $body, ?Targe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/Count/CountRequestBuilder.php index a8be7d6af51..964fe24679d 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/IntendedPoliciesRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/IntendedPoliciesRequestBuilder.php index 7139a8fe40d..269bfbbbde5 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/IntendedPoliciesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/IntendedPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\Item\IntendedPolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\Item\IntendedPolicies\Item\ManagedAppPolicyItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedAppPolicy; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Zero or more policies admin intended for the app as of now. * @param IntendedPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IntendedPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to intendedPolicies for deviceAppManagement * @param ManagedAppPolicy $body The request body * @param IntendedPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ManagedAppPolicy $body, ?IntendedPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?IntendedPoliciesRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?IntendedPoliciesRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ManagedAppPolicy $body, ?IntendedPolici $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/Item/ManagedAppPolicyItemRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/Item/ManagedAppPolicyItemRequestBuilder.php index 268e4bad43e..3ec82784928 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/Item/ManagedAppPolicyItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/Item/ManagedAppPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\Item\IntendedPolicies\Item\TargetApps\TargetAppsRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedAppPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property intendedPolicies for deviceAppManagement * @param ManagedAppPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ManagedAppPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Zero or more policies admin intended for the app as of now. * @param ManagedAppPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedAppPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property intendedPolicies in deviceAppManagement * @param ManagedAppPolicy $body The request body * @param ManagedAppPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ManagedAppPolicy $body, ?ManagedAppPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ManagedAppPolicyItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ManagedAppPolicyItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ManagedAppPolicyItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ManagedAppPolicy $body, ?ManagedAppPol $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/Item/TargetApps/TargetAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/Item/TargetApps/TargetAppsRequestBuilder.php index 874824a9d8f..5da3f476bc5 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/Item/TargetApps/TargetAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/IntendedPolicies/Item/TargetApps/TargetAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param TargetAppsPostRequestBody $body The request body * @param TargetAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-mam-targetedmanagedappprotection-targetapps?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-mam-managedappprotection-targetapps?view=graph-rest-1.0 Find more info here */ public function post(TargetAppsPostRequestBody $body, ?TargetAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TargetAppsPostRequestBody $body, ?Targe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/ManagedAppRegistrationItemRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/ManagedAppRegistrationItemRequestBuilder.php index 2ad06aa1c0f..f43a6e74f97 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/ManagedAppRegistrationItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/ManagedAppRegistrationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\Item\AppliedPolicies\AppliedPoliciesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\Item\IntendedPolicies\IntendedPoliciesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\Item\Operations\OperationsRequestBuilder; @@ -58,57 +57,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property managedAppRegistrations for deviceAppManagement * @param ManagedAppRegistrationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ManagedAppRegistrationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read properties and relationships of the iosManagedAppRegistration object. + * Read properties and relationships of the androidManagedAppRegistration object. * @param ManagedAppRegistrationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-mam-iosmanagedappregistration-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-mam-androidmanagedappregistration-get?view=graph-rest-1.0 Find more info here */ public function get(?ManagedAppRegistrationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppRegistration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppRegistration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property managedAppRegistrations in deviceAppManagement * @param ManagedAppRegistration $body The request body * @param ManagedAppRegistrationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ManagedAppRegistration $body, ?ManagedAppRegistrationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppRegistration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppRegistration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -125,11 +115,12 @@ public function toDeleteRequestInformation(?ManagedAppRegistrationItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read properties and relationships of the iosManagedAppRegistration object. + * Read properties and relationships of the androidManagedAppRegistration object. * @param ManagedAppRegistrationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -138,7 +129,6 @@ public function toGetRequestInformation(?ManagedAppRegistrationItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -146,6 +136,7 @@ public function toGetRequestInformation(?ManagedAppRegistrationItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -160,11 +151,11 @@ public function toPatchRequestInformation(ManagedAppRegistration $body, ?Managed $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/ManagedAppRegistrationItemRequestBuilderGetQueryParameters.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/ManagedAppRegistrationItemRequestBuilderGetQueryParameters.php index 92858399e1b..bae004f29fe 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/ManagedAppRegistrationItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/ManagedAppRegistrationItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read properties and relationships of the iosManagedAppRegistration object. + * Read properties and relationships of the androidManagedAppRegistration object. */ class ManagedAppRegistrationItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/Operations/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/Operations/Count/CountRequestBuilder.php index c40ec43825e..c453eb6d520 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/Operations/Item/ManagedAppOperationItemRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/Operations/Item/ManagedAppOperationItemRequestBuilder.php index 7aade8de7f1..e375d33925c 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/Operations/Item/ManagedAppOperationItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/Operations/Item/ManagedAppOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedAppOperation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a managedAppOperation. * @param ManagedAppOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-managedappoperation-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ManagedAppOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the managedAppOperation object. * @param ManagedAppOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-managedappoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?ManagedAppOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a managedAppOperation object. * @param ManagedAppOperation $body The request body * @param ManagedAppOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-managedappoperation-update?view=graph-rest-1.0 Find more info here */ public function patch(ManagedAppOperation $body, ?ManagedAppOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ManagedAppOperationItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ManagedAppOperationItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ManagedAppOperationItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ManagedAppOperation $body, ?ManagedApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/Operations/OperationsRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/Operations/OperationsRequestBuilder.php index a375de0216e..2a46a1b6c2b 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/Operations/OperationsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/Item/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\Item\Operations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\Item\Operations\Item\ManagedAppOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedAppOperation; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the managedAppOperation objects. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-managedappoperation-list?view=graph-rest-1.0 Find more info here */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new managedAppOperation object. * @param ManagedAppOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-managedappoperation-create?view=graph-rest-1.0 Find more info here */ public function post(ManagedAppOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ManagedAppOperation $body, ?OperationsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/ManagedAppRegistrationsRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/ManagedAppRegistrationsRequestBuilder.php index e5d479ccfbe..68ef82cf49c 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/ManagedAppRegistrationsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/ManagedAppRegistrationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\GetUserIdsWithFlaggedAppRegistration\GetUserIdsWithFlaggedAppRegistrationRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppRegistrations\Item\ManagedAppRegistrationItemRequestBuilder; @@ -61,46 +60,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List properties and relationships of the managedAppRegistration objects. + * List properties and relationships of the androidManagedAppRegistration objects. * @param ManagedAppRegistrationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-mam-managedappregistration-list?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-mam-androidmanagedappregistration-list?view=graph-rest-1.0 Find more info here */ public function get(?ManagedAppRegistrationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppRegistrationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppRegistrationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new androidManagedAppRegistration object. * @param ManagedAppRegistration $body The request body * @param ManagedAppRegistrationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-androidmanagedappregistration-create?view=graph-rest-1.0 Find more info here */ public function post(ManagedAppRegistration $body, ?ManagedAppRegistrationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppRegistration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppRegistration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List properties and relationships of the managedAppRegistration objects. + * List properties and relationships of the androidManagedAppRegistration objects. * @param ManagedAppRegistrationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ManagedAppRegistrationsRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ManagedAppRegistrationsRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ManagedAppRegistration $body, ?ManagedA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/ManagedAppRegistrationsRequestBuilderGetQueryParameters.php b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/ManagedAppRegistrationsRequestBuilderGetQueryParameters.php index 6712257a390..327ac218e6b 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppRegistrations/ManagedAppRegistrationsRequestBuilderGetQueryParameters.php +++ b/src/Generated/DeviceAppManagement/ManagedAppRegistrations/ManagedAppRegistrationsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List properties and relationships of the managedAppRegistration objects. + * List properties and relationships of the androidManagedAppRegistration objects. */ class ManagedAppRegistrationsRequestBuilderGetQueryParameters { diff --git a/src/Generated/DeviceAppManagement/ManagedAppStatuses/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppStatuses/Count/CountRequestBuilder.php index cd3403721d0..a340921b63c 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppStatuses/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppStatuses/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppStatuses/Item/ManagedAppStatusItemRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppStatuses/Item/ManagedAppStatusItemRequestBuilder.php index 874f3fc346b..ea65a996cf4 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppStatuses/Item/ManagedAppStatusItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppStatuses/Item/ManagedAppStatusItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedAppStatus; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property managedAppStatuses for deviceAppManagement * @param ManagedAppStatusItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ManagedAppStatusItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read properties and relationships of the managedAppStatusRaw object. + * Read properties and relationships of the managedAppStatus object. * @param ManagedAppStatusItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-mam-managedappstatusraw-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-mam-managedappstatus-get?view=graph-rest-1.0 Find more info here */ public function get(?ManagedAppStatusItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property managedAppStatuses in deviceAppManagement * @param ManagedAppStatus $body The request body * @param ManagedAppStatusItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ManagedAppStatus $body, ?ManagedAppStatusItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,11 +91,12 @@ public function toDeleteRequestInformation(?ManagedAppStatusItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read properties and relationships of the managedAppStatusRaw object. + * Read properties and relationships of the managedAppStatus object. * @param ManagedAppStatusItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ManagedAppStatusItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ManagedAppStatusItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(ManagedAppStatus $body, ?ManagedAppSta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedAppStatuses/Item/ManagedAppStatusItemRequestBuilderGetQueryParameters.php b/src/Generated/DeviceAppManagement/ManagedAppStatuses/Item/ManagedAppStatusItemRequestBuilderGetQueryParameters.php index e257e0cbe70..1a778e35b25 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppStatuses/Item/ManagedAppStatusItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/DeviceAppManagement/ManagedAppStatuses/Item/ManagedAppStatusItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read properties and relationships of the managedAppStatusRaw object. + * Read properties and relationships of the managedAppStatus object. */ class ManagedAppStatusItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/DeviceAppManagement/ManagedAppStatuses/ManagedAppStatusesRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedAppStatuses/ManagedAppStatusesRequestBuilder.php index a49c796c778..15737b232d3 100644 --- a/src/Generated/DeviceAppManagement/ManagedAppStatuses/ManagedAppStatusesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedAppStatuses/ManagedAppStatusesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppStatuses\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedAppStatuses\Item\ManagedAppStatusItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedAppStatus; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the managedAppStatus objects. * @param ManagedAppStatusesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-managedappstatus-list?view=graph-rest-1.0 Find more info here */ public function get(?ManagedAppStatusesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to managedAppStatuses for deviceAppManagement * @param ManagedAppStatus $body The request body * @param ManagedAppStatusesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ManagedAppStatus $body, ?ManagedAppStatusesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ManagedAppStatusesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ManagedAppStatusesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ManagedAppStatus $body, ?ManagedAppStat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Count/CountRequestBuilder.php index 0846a64e542..13559a2dc62 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assign/AssignRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assign/AssignRequestBuilder.php index 7d0b4b249a4..73132cafd60 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assign/AssignRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assign/AssignRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param AssignPostRequestBody $body The request body * @param AssignRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-managedebook-assign?view=graph-rest-1.0 Find more info here */ public function post(AssignPostRequestBody $body, ?AssignRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AssignPostRequestBody $body, ?AssignReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/AssignmentsRequestBuilder.php index f33f77bfca0..16c77f9c373 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\Assignments\Item\ManagedEBookAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedEBookAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the managedEBookAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-managedebookassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBookAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBookAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new managedEBookAssignment object. * @param ManagedEBookAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-managedebookassignment-create?view=graph-rest-1.0 Find more info here */ public function post(ManagedEBookAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBookAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBookAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ManagedEBookAssignment $body, ?Assignme $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/Count/CountRequestBuilder.php index 42b99558303..8b617b81026 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/Item/ManagedEBookAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/Item/ManagedEBookAssignmentItemRequestBuilder.php index 0e2b77782a8..92a1a2d5c24 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/Item/ManagedEBookAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/Item/ManagedEBookAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedEBookAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a iosVppEBookAssignment. * @param ManagedEBookAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-iosvppebookassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ManagedEBookAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read properties and relationships of the managedEBookAssignment object. + * Read properties and relationships of the iosVppEBookAssignment object. * @param ManagedEBookAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-books-managedebookassignment-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-books-iosvppebookassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?ManagedEBookAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBookAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBookAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a managedEBookAssignment object. * @param ManagedEBookAssignment $body The request body * @param ManagedEBookAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-managedebookassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(ManagedEBookAssignment $body, ?ManagedEBookAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBookAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBookAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,11 +93,12 @@ public function toDeleteRequestInformation(?ManagedEBookAssignmentItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read properties and relationships of the managedEBookAssignment object. + * Read properties and relationships of the iosVppEBookAssignment object. * @param ManagedEBookAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ManagedEBookAssignmentItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ManagedEBookAssignmentItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ManagedEBookAssignment $body, ?Managed $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/Item/ManagedEBookAssignmentItemRequestBuilderGetQueryParameters.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/Item/ManagedEBookAssignmentItemRequestBuilderGetQueryParameters.php index 854e051c551..fa920db8c52 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/Item/ManagedEBookAssignmentItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/Assignments/Item/ManagedEBookAssignmentItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read properties and relationships of the managedEBookAssignment object. + * Read properties and relationships of the iosVppEBookAssignment object. */ class ManagedEBookAssignmentItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/DeviceStates/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/DeviceStates/Count/CountRequestBuilder.php index 24cb31b0b13..69591e2b4e9 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/DeviceStates/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/DeviceStates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/DeviceStates/DeviceStatesRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/DeviceStates/DeviceStatesRequestBuilder.php index 0a63c58dbf1..4dc5865d9f6 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/DeviceStates/DeviceStatesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/DeviceStates/DeviceStatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\DeviceStates\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\DeviceStates\Item\DeviceInstallStateItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceInstallState; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceInstallState objects. * @param DeviceStatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-deviceinstallstate-list?view=graph-rest-1.0 Find more info here */ public function get(?DeviceStatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceInstallState object. * @param DeviceInstallState $body The request body * @param DeviceStatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-deviceinstallstate-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceInstallState $body, ?DeviceStatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DeviceStatesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DeviceStatesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceInstallState $body, ?DeviceStates $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/DeviceStates/Item/DeviceInstallStateItemRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/DeviceStates/Item/DeviceInstallStateItemRequestBuilder.php index ed216658ccf..0122a5383e7 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/DeviceStates/Item/DeviceInstallStateItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/DeviceStates/Item/DeviceInstallStateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceInstallState; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceInstallState. * @param DeviceInstallStateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-deviceinstallstate-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceInstallStateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceInstallState object. * @param DeviceInstallStateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-deviceinstallstate-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceInstallStateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceInstallState object. * @param DeviceInstallState $body The request body * @param DeviceInstallStateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-deviceinstallstate-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceInstallState $body, ?DeviceInstallStateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?DeviceInstallStateItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?DeviceInstallStateItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?DeviceInstallStateItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(DeviceInstallState $body, ?DeviceInsta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/InstallSummary/InstallSummaryRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/InstallSummary/InstallSummaryRequestBuilder.php index c2a3a0e8113..bdeea3287f9 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/InstallSummary/InstallSummaryRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/InstallSummary/InstallSummaryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EBookInstallSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property installSummary for deviceAppManagement * @param InstallSummaryRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?InstallSummaryRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the eBookInstallSummary object. * @param InstallSummaryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-ebookinstallsummary-get?view=graph-rest-1.0 Find more info here */ public function get(?InstallSummaryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EBookInstallSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EBookInstallSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a eBookInstallSummary object. * @param EBookInstallSummary $body The request body * @param InstallSummaryRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-ebookinstallsummary-update?view=graph-rest-1.0 Find more info here */ public function patch(EBookInstallSummary $body, ?InstallSummaryRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EBookInstallSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EBookInstallSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?InstallSummaryRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?InstallSummaryRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?InstallSummaryRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(EBookInstallSummary $body, ?InstallSum $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/ManagedEBookItemRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/ManagedEBookItemRequestBuilder.php index b2ebb6629c7..01fe1bcaab3 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/ManagedEBookItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/ManagedEBookItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\Assign\AssignRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\DeviceStates\DeviceStatesRequestBuilder; @@ -74,59 +73,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a iosVppEBook. * @param ManagedEBookItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-iosvppebook-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ManagedEBookItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the iosVppEBook object. * @param ManagedEBookItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-iosvppebook-get?view=graph-rest-1.0 Find more info here */ public function get(?ManagedEBookItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a iosVppEBook object. * @param ManagedEBook $body The request body * @param ManagedEBookItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-iosvppebook-update?view=graph-rest-1.0 Find more info here */ public function patch(ManagedEBook $body, ?ManagedEBookItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -143,6 +133,7 @@ public function toDeleteRequestInformation(?ManagedEBookItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -156,7 +147,6 @@ public function toGetRequestInformation(?ManagedEBookItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -164,6 +154,7 @@ public function toGetRequestInformation(?ManagedEBookItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -178,11 +169,11 @@ public function toPatchRequestInformation(ManagedEBook $body, ?ManagedEBookItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Count/CountRequestBuilder.php index 633878888f9..18e04bb579d 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/DeviceStates/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/DeviceStates/Count/CountRequestBuilder.php index 4b1af5ac294..b1d92e64219 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/DeviceStates/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/DeviceStates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/DeviceStates/DeviceStatesRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/DeviceStates/DeviceStatesRequestBuilder.php index 4840bde54a4..f814938c5e1 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/DeviceStates/DeviceStatesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/DeviceStates/DeviceStatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\UserStateSummary\Item\DeviceStates\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\UserStateSummary\Item\DeviceStates\Item\DeviceInstallStateItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceInstallState; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The install state of the eBook. * @param DeviceStatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceStatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to deviceStates for deviceAppManagement * @param DeviceInstallState $body The request body * @param DeviceStatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DeviceInstallState $body, ?DeviceStatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DeviceStatesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DeviceStatesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DeviceInstallState $body, ?DeviceStates $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/DeviceStates/Item/DeviceInstallStateItemRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/DeviceStates/Item/DeviceInstallStateItemRequestBuilder.php index b1f3b8f0b91..9db909cc07b 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/DeviceStates/Item/DeviceInstallStateItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/DeviceStates/Item/DeviceInstallStateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceInstallState; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceStates for deviceAppManagement * @param DeviceInstallStateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceInstallStateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The install state of the eBook. * @param DeviceInstallStateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceInstallStateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property deviceStates in deviceAppManagement * @param DeviceInstallState $body The request body * @param DeviceInstallStateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DeviceInstallState $body, ?DeviceInstallStateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceInstallState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DeviceInstallStateItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DeviceInstallStateItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DeviceInstallStateItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(DeviceInstallState $body, ?DeviceInsta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/UserInstallStateSummaryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/UserInstallStateSummaryItemRequestBuilder.php index b0fab26e8e0..33b08e549ac 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/UserInstallStateSummaryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/Item/UserInstallStateSummaryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\UserStateSummary\Item\DeviceStates\DeviceStatesRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserInstallStateSummary; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a userInstallStateSummary. * @param UserInstallStateSummaryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-userinstallstatesummary-delete?view=graph-rest-1.0 Find more info here */ public function delete(?UserInstallStateSummaryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the userInstallStateSummary object. * @param UserInstallStateSummaryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-userinstallstatesummary-get?view=graph-rest-1.0 Find more info here */ public function get(?UserInstallStateSummaryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserInstallStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserInstallStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a userInstallStateSummary object. * @param UserInstallStateSummary $body The request body * @param UserInstallStateSummaryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-userinstallstatesummary-update?view=graph-rest-1.0 Find more info here */ public function patch(UserInstallStateSummary $body, ?UserInstallStateSummaryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserInstallStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserInstallStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?UserInstallStateSummaryItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?UserInstallStateSummaryItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?UserInstallStateSummaryItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(UserInstallStateSummary $body, ?UserIn $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/UserStateSummaryRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/UserStateSummaryRequestBuilder.php index 77ebdd3237e..7b7fcb43e6b 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/UserStateSummaryRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/Item/UserStateSummary/UserStateSummaryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\UserStateSummary\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\UserStateSummary\Item\UserInstallStateSummaryItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the userInstallStateSummary objects. * @param UserStateSummaryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-userinstallstatesummary-list?view=graph-rest-1.0 Find more info here */ public function get(?UserStateSummaryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserInstallStateSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserInstallStateSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new userInstallStateSummary object. * @param UserInstallStateSummary $body The request body * @param UserStateSummaryRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-userinstallstatesummary-create?view=graph-rest-1.0 Find more info here */ public function post(UserInstallStateSummary $body, ?UserStateSummaryRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserInstallStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserInstallStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?UserStateSummaryRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?UserStateSummaryRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(UserInstallStateSummary $body, ?UserSta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/ManagedEBooks/ManagedEBooksRequestBuilder.php b/src/Generated/DeviceAppManagement/ManagedEBooks/ManagedEBooksRequestBuilder.php index 15f9f96891d..64f7b9ca980 100644 --- a/src/Generated/DeviceAppManagement/ManagedEBooks/ManagedEBooksRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/ManagedEBooks/ManagedEBooksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\ManagedEBookItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedEBook; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the iosVppEBook objects. * @param ManagedEBooksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-iosvppebook-list?view=graph-rest-1.0 Find more info here */ public function get(?ManagedEBooksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBookCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBookCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new iosVppEBook object. * @param ManagedEBook $body The request body * @param ManagedEBooksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-books-iosvppebook-create?view=graph-rest-1.0 Find more info here */ public function post(ManagedEBook $body, ?ManagedEBooksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedEBook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ManagedEBooksRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ManagedEBooksRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ManagedEBook $body, ?ManagedEBooksReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Count/CountRequestBuilder.php index ba115bccca9..1048d72db00 100644 --- a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/Assignments/AssignmentsRequestBuilder.php index 829a058b7df..826ea606a38 100644 --- a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MdmWindowsInformationProtectionPolicies\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MdmWindowsInformationProtectionPolicies\Item\Assignments\Item\TargetedManagedAppPolicyAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Navigation property to list of security groups targeted for policy. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to assignments for deviceAppManagement * @param TargetedManagedAppPolicyAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TargetedManagedAppPolicyAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(TargetedManagedAppPolicyAssignment $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/Assignments/Count/CountRequestBuilder.php index 1cac208cc83..6d70b017676 100644 --- a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php index 06e70f163e7..1c038e6ff5c 100644 --- a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TargetedManagedAppPolicyAssignment; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignments for deviceAppManagement * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TargetedManagedAppPolicyAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Navigation property to list of security groups targeted for policy. * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TargetedManagedAppPolicyAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignments in deviceAppManagement * @param TargetedManagedAppPolicyAssignment $body The request body * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TargetedManagedAppPolicyAssignment $body, ?TargetedManagedAppPolicyAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?TargetedManagedAppPolicyAssignmentIt $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?TargetedManagedAppPolicyAssignmentItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?TargetedManagedAppPolicyAssignmentItemR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(TargetedManagedAppPolicyAssignment $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Count/CountRequestBuilder.php index 1219bfe0eee..251d824a2b2 100644 --- a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/ExemptAppLockerFilesRequestBuilder.php b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/ExemptAppLockerFilesRequestBuilder.php index cccfd696974..ff8bd44cf84 100644 --- a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/ExemptAppLockerFilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/ExemptAppLockerFilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MdmWindowsInformationProtectionPolicies\Item\ExemptAppLockerFiles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MdmWindowsInformationProtectionPolicies\Item\ExemptAppLockerFiles\Item\WindowsInformationProtectionAppLockerFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Another way to input exempt apps through xml files * @param ExemptAppLockerFilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExemptAppLockerFilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to exemptAppLockerFiles for deviceAppManagement * @param WindowsInformationProtectionAppLockerFile $body The request body * @param ExemptAppLockerFilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WindowsInformationProtectionAppLockerFile $body, ?ExemptAppLockerFilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExemptAppLockerFilesRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExemptAppLockerFilesRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(WindowsInformationProtectionAppLockerFi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php index d5d39d7f362..4cec4a3229a 100644 --- a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsInformationProtectionAppLockerFile; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property exemptAppLockerFiles for deviceAppManagement * @param WindowsInformationProtectionAppLockerFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WindowsInformationProtectionAppLockerFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Another way to input exempt apps through xml files * @param WindowsInformationProtectionAppLockerFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WindowsInformationProtectionAppLockerFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property exemptAppLockerFiles in deviceAppManagement * @param WindowsInformationProtectionAppLockerFile $body The request body * @param WindowsInformationProtectionAppLockerFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WindowsInformationProtectionAppLockerFile $body, ?WindowsInformationProtectionAppLockerFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?WindowsInformationProtectionAppLocke $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?WindowsInformationProtectionAppLockerFi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?WindowsInformationProtectionAppLockerFi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(WindowsInformationProtectionAppLockerF $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/MdmWindowsInformationProtectionPolicyItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/MdmWindowsInformationProtectionPolicyItemRequestBuilder.php index 049fd45ad74..baabf9b75b7 100644 --- a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/MdmWindowsInformationProtectionPolicyItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/MdmWindowsInformationProtectionPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MdmWindowsInformationProtectionPolicies\Item\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MdmWindowsInformationProtectionPolicies\Item\ExemptAppLockerFiles\ExemptAppLockerFilesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MdmWindowsInformationProtectionPolicies\Item\ProtectedAppLockerFiles\ProtectedAppLockerFilesRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mdmWindowsInformationProtectionPolicy. * @param MdmWindowsInformationProtectionPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-mdmwindowsinformationprotectionpolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MdmWindowsInformationProtectionPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mdmWindowsInformationProtectionPolicy object. * @param MdmWindowsInformationProtectionPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-mdmwindowsinformationprotectionpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?MdmWindowsInformationProtectionPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MdmWindowsInformationProtectionPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MdmWindowsInformationProtectionPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mdmWindowsInformationProtectionPolicy object. * @param MdmWindowsInformationProtectionPolicy $body The request body * @param MdmWindowsInformationProtectionPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-mdmwindowsinformationprotectionpolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(MdmWindowsInformationProtectionPolicy $body, ?MdmWindowsInformationProtectionPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MdmWindowsInformationProtectionPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MdmWindowsInformationProtectionPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?MdmWindowsInformationProtectionPolic $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?MdmWindowsInformationProtectionPolicyIt $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?MdmWindowsInformationProtectionPolicyIt } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(MdmWindowsInformationProtectionPolicy $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Count/CountRequestBuilder.php index e662fad0ec6..8e6ca1d6b18 100644 --- a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php index b37f709f43f..953646317e0 100644 --- a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsInformationProtectionAppLockerFile; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property protectedAppLockerFiles for deviceAppManagement * @param WindowsInformationProtectionAppLockerFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WindowsInformationProtectionAppLockerFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Another way to input protected apps through xml files * @param WindowsInformationProtectionAppLockerFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WindowsInformationProtectionAppLockerFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property protectedAppLockerFiles in deviceAppManagement * @param WindowsInformationProtectionAppLockerFile $body The request body * @param WindowsInformationProtectionAppLockerFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WindowsInformationProtectionAppLockerFile $body, ?WindowsInformationProtectionAppLockerFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?WindowsInformationProtectionAppLocke $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?WindowsInformationProtectionAppLockerFi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?WindowsInformationProtectionAppLockerFi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(WindowsInformationProtectionAppLockerF $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/ProtectedAppLockerFilesRequestBuilder.php b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/ProtectedAppLockerFilesRequestBuilder.php index 60339a5d087..d432a8c4494 100644 --- a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/ProtectedAppLockerFilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/ProtectedAppLockerFilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MdmWindowsInformationProtectionPolicies\Item\ProtectedAppLockerFiles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MdmWindowsInformationProtectionPolicies\Item\ProtectedAppLockerFiles\Item\WindowsInformationProtectionAppLockerFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Another way to input protected apps through xml files * @param ProtectedAppLockerFilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ProtectedAppLockerFilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to protectedAppLockerFiles for deviceAppManagement * @param WindowsInformationProtectionAppLockerFile $body The request body * @param ProtectedAppLockerFilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WindowsInformationProtectionAppLockerFile $body, ?ProtectedAppLockerFilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ProtectedAppLockerFilesRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ProtectedAppLockerFilesRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(WindowsInformationProtectionAppLockerFi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/MdmWindowsInformationProtectionPoliciesRequestBuilder.php b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/MdmWindowsInformationProtectionPoliciesRequestBuilder.php index 72889841517..4fe6e683db8 100644 --- a/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/MdmWindowsInformationProtectionPoliciesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MdmWindowsInformationProtectionPolicies/MdmWindowsInformationProtectionPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MdmWindowsInformationProtectionPolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MdmWindowsInformationProtectionPolicies\Item\MdmWindowsInformationProtectionPolicyItemRequestBuilder; use Microsoft\Graph\Generated\Models\MdmWindowsInformationProtectionPolicy; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mdmWindowsInformationProtectionPolicy objects. * @param MdmWindowsInformationProtectionPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-mdmwindowsinformationprotectionpolicy-list?view=graph-rest-1.0 Find more info here */ public function get(?MdmWindowsInformationProtectionPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MdmWindowsInformationProtectionPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MdmWindowsInformationProtectionPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mdmWindowsInformationProtectionPolicy object. * @param MdmWindowsInformationProtectionPolicy $body The request body * @param MdmWindowsInformationProtectionPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-mdmwindowsinformationprotectionpolicy-create?view=graph-rest-1.0 Find more info here */ public function post(MdmWindowsInformationProtectionPolicy $body, ?MdmWindowsInformationProtectionPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MdmWindowsInformationProtectionPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MdmWindowsInformationProtectionPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?MdmWindowsInformationProtectionPolicies $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?MdmWindowsInformationProtectionPolicies } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MdmWindowsInformationProtectionPolicy $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppCategories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppCategories/Count/CountRequestBuilder.php index cf221d769de..3e77abd9f28 100644 --- a/src/Generated/DeviceAppManagement/MobileAppCategories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppCategories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppCategories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppCategories/Item/MobileAppCategoryItemRequestBuilder.php index 2145bec02a7..ee91f3fe4eb 100644 --- a/src/Generated/DeviceAppManagement/MobileAppCategories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppCategories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppCategory. * @param MobileAppCategoryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappcategory-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppCategoryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppCategory object. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappcategory-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppCategory object. * @param MobileAppCategory $body The request body * @param MobileAppCategoryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappcategory-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppCategory $body, ?MobileAppCategoryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppCategoryItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppCategory $body, ?MobileAppCat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppCategories/MobileAppCategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppCategories/MobileAppCategoriesRequestBuilder.php index 72f2c329073..947c40cd8ad 100644 --- a/src/Generated/DeviceAppManagement/MobileAppCategories/MobileAppCategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppCategories/MobileAppCategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileAppCategories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileAppCategories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategory; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppCategory objects. * @param MobileAppCategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappcategory-list?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppCategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppCategory object. * @param MobileAppCategory $body The request body * @param MobileAppCategoriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappcategory-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppCategory $body, ?MobileAppCategoriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?MobileAppCategoriesRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?MobileAppCategoriesRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppCategory $body, ?MobileAppCate $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Count/CountRequestBuilder.php index e203d2127ca..23f19be8a47 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assign/AssignRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assign/AssignRequestBuilder.php index 8b68c32cc5c..0cf646493d7 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assign/AssignRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assign/AssignRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param AssignPostRequestBody $body The request body * @param AssignRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfiguration-assign?view=graph-rest-1.0 Find more info here */ public function post(AssignPostRequestBody $body, ?AssignRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AssignPostRequestBody $body, ?AssignReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assignments/AssignmentsRequestBuilder.php index 88d40c9aee2..392cc8613fb 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileAppConfigurations\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileAppConfigurations\Item\Assignments\Item\ManagedDeviceMobileAppConfigurationAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedDeviceMobileAppConfigurationAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the managedDeviceMobileAppConfigurationAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new managedDeviceMobileAppConfigurationAssignment object. * @param ManagedDeviceMobileAppConfigurationAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationassignment-create?view=graph-rest-1.0 Find more info here */ public function post(ManagedDeviceMobileAppConfigurationAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ManagedDeviceMobileAppConfigurationAssi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assignments/Count/CountRequestBuilder.php index f5f38c1e10f..a96dc1d7e13 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assignments/Item/ManagedDeviceMobileAppConfigurationAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assignments/Item/ManagedDeviceMobileAppConfigurationAssignmentItemRequestBuilder.php index 138f5cf05df..c52d6ed03f4 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assignments/Item/ManagedDeviceMobileAppConfigurationAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/Assignments/Item/ManagedDeviceMobileAppConfigurationAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedDeviceMobileAppConfigurationAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a managedDeviceMobileAppConfigurationAssignment. * @param ManagedDeviceMobileAppConfigurationAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ManagedDeviceMobileAppConfigurationAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the managedDeviceMobileAppConfigurationAssignment object. * @param ManagedDeviceMobileAppConfigurationAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?ManagedDeviceMobileAppConfigurationAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a managedDeviceMobileAppConfigurationAssignment object. * @param ManagedDeviceMobileAppConfigurationAssignment $body The request body * @param ManagedDeviceMobileAppConfigurationAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(ManagedDeviceMobileAppConfigurationAssignment $body, ?ManagedDeviceMobileAppConfigurationAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ManagedDeviceMobileAppConfigurationA $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ManagedDeviceMobileAppConfigurationAssi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ManagedDeviceMobileAppConfigurationAssi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ManagedDeviceMobileAppConfigurationAss $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatusSummary/DeviceStatusSummaryRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatusSummary/DeviceStatusSummaryRequestBuilder.php index d1212489ace..7ca7b22830b 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatusSummary/DeviceStatusSummaryRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatusSummary/DeviceStatusSummaryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedDeviceMobileAppConfigurationDeviceSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceStatusSummary for deviceAppManagement * @param DeviceStatusSummaryRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceStatusSummaryRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the managedDeviceMobileAppConfigurationDeviceSummary object. * @param DeviceStatusSummaryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationdevicesummary-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceStatusSummaryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a managedDeviceMobileAppConfigurationDeviceSummary object. * @param ManagedDeviceMobileAppConfigurationDeviceSummary $body The request body * @param DeviceStatusSummaryRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationdevicesummary-update?view=graph-rest-1.0 Find more info here */ public function patch(ManagedDeviceMobileAppConfigurationDeviceSummary $body, ?DeviceStatusSummaryRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DeviceStatusSummaryRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DeviceStatusSummaryRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DeviceStatusSummaryRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(ManagedDeviceMobileAppConfigurationDev $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatuses/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatuses/Count/CountRequestBuilder.php index 39cb33e79f7..c01a4fe9927 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatuses/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatuses/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatuses/DeviceStatusesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatuses/DeviceStatusesRequestBuilder.php index 24e9e9536db..7f39d7c8e05 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatuses/DeviceStatusesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatuses/DeviceStatusesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileAppConfigurations\Item\DeviceStatuses\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileAppConfigurations\Item\DeviceStatuses\Item\ManagedDeviceMobileAppConfigurationDeviceStatusItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedDeviceMobileAppConfigurationDeviceStatus; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the managedDeviceMobileAppConfigurationDeviceStatus objects. * @param DeviceStatusesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationdevicestatus-list?view=graph-rest-1.0 Find more info here */ public function get(?DeviceStatusesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationDeviceStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationDeviceStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new managedDeviceMobileAppConfigurationDeviceStatus object. * @param ManagedDeviceMobileAppConfigurationDeviceStatus $body The request body * @param DeviceStatusesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationdevicestatus-create?view=graph-rest-1.0 Find more info here */ public function post(ManagedDeviceMobileAppConfigurationDeviceStatus $body, ?DeviceStatusesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DeviceStatusesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DeviceStatusesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ManagedDeviceMobileAppConfigurationDevi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatuses/Item/ManagedDeviceMobileAppConfigurationDeviceStatusItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatuses/Item/ManagedDeviceMobileAppConfigurationDeviceStatusItemRequestBuilder.php index d820850ad4a..8c8f7eac15d 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatuses/Item/ManagedDeviceMobileAppConfigurationDeviceStatusItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/DeviceStatuses/Item/ManagedDeviceMobileAppConfigurationDeviceStatusItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedDeviceMobileAppConfigurationDeviceStatus; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a managedDeviceMobileAppConfigurationDeviceStatus. * @param ManagedDeviceMobileAppConfigurationDeviceStatusItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationdevicestatus-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ManagedDeviceMobileAppConfigurationDeviceStatusItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the managedDeviceMobileAppConfigurationDeviceStatus object. * @param ManagedDeviceMobileAppConfigurationDeviceStatusItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationdevicestatus-get?view=graph-rest-1.0 Find more info here */ public function get(?ManagedDeviceMobileAppConfigurationDeviceStatusItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a managedDeviceMobileAppConfigurationDeviceStatus object. * @param ManagedDeviceMobileAppConfigurationDeviceStatus $body The request body * @param ManagedDeviceMobileAppConfigurationDeviceStatusItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationdevicestatus-update?view=graph-rest-1.0 Find more info here */ public function patch(ManagedDeviceMobileAppConfigurationDeviceStatus $body, ?ManagedDeviceMobileAppConfigurationDeviceStatusItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ManagedDeviceMobileAppConfigurationD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ManagedDeviceMobileAppConfigurationDevi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ManagedDeviceMobileAppConfigurationDevi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ManagedDeviceMobileAppConfigurationDev $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/ManagedDeviceMobileAppConfigurationItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/ManagedDeviceMobileAppConfigurationItemRequestBuilder.php index b7acfa85075..9d94dbe1ec8 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/ManagedDeviceMobileAppConfigurationItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/ManagedDeviceMobileAppConfigurationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileAppConfigurations\Item\Assign\AssignRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileAppConfigurations\Item\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileAppConfigurations\Item\DeviceStatuses\DeviceStatusesRequestBuilder; @@ -82,59 +81,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a iosMobileAppConfiguration. * @param ManagedDeviceMobileAppConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-iosmobileappconfiguration-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ManagedDeviceMobileAppConfigurationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read properties and relationships of the iosMobileAppConfiguration object. + * Read properties and relationships of the managedDeviceMobileAppConfiguration object. * @param ManagedDeviceMobileAppConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-apps-iosmobileappconfiguration-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfiguration-get?view=graph-rest-1.0 Find more info here */ public function get(?ManagedDeviceMobileAppConfigurationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a iosMobileAppConfiguration object. * @param ManagedDeviceMobileAppConfiguration $body The request body * @param ManagedDeviceMobileAppConfigurationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-iosmobileappconfiguration-update?view=graph-rest-1.0 Find more info here */ public function patch(ManagedDeviceMobileAppConfiguration $body, ?ManagedDeviceMobileAppConfigurationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -151,11 +141,12 @@ public function toDeleteRequestInformation(?ManagedDeviceMobileAppConfigurationI $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read properties and relationships of the iosMobileAppConfiguration object. + * Read properties and relationships of the managedDeviceMobileAppConfiguration object. * @param ManagedDeviceMobileAppConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -164,7 +155,6 @@ public function toGetRequestInformation(?ManagedDeviceMobileAppConfigurationItem $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -172,6 +162,7 @@ public function toGetRequestInformation(?ManagedDeviceMobileAppConfigurationItem } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -186,11 +177,11 @@ public function toPatchRequestInformation(ManagedDeviceMobileAppConfiguration $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/ManagedDeviceMobileAppConfigurationItemRequestBuilderGetQueryParameters.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/ManagedDeviceMobileAppConfigurationItemRequestBuilderGetQueryParameters.php index 4b0240dadba..22dd29d03d8 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/ManagedDeviceMobileAppConfigurationItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/ManagedDeviceMobileAppConfigurationItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read properties and relationships of the iosMobileAppConfiguration object. + * Read properties and relationships of the managedDeviceMobileAppConfiguration object. */ class ManagedDeviceMobileAppConfigurationItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatusSummary/UserStatusSummaryRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatusSummary/UserStatusSummaryRequestBuilder.php index ed6ff583649..abedf6ad954 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatusSummary/UserStatusSummaryRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatusSummary/UserStatusSummaryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedDeviceMobileAppConfigurationUserSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userStatusSummary for deviceAppManagement * @param UserStatusSummaryRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserStatusSummaryRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the managedDeviceMobileAppConfigurationUserSummary object. * @param UserStatusSummaryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationusersummary-get?view=graph-rest-1.0 Find more info here */ public function get(?UserStatusSummaryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationUserSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationUserSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a managedDeviceMobileAppConfigurationUserSummary object. * @param ManagedDeviceMobileAppConfigurationUserSummary $body The request body * @param UserStatusSummaryRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationusersummary-update?view=graph-rest-1.0 Find more info here */ public function patch(ManagedDeviceMobileAppConfigurationUserSummary $body, ?UserStatusSummaryRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationUserSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationUserSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?UserStatusSummaryRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?UserStatusSummaryRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?UserStatusSummaryRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(ManagedDeviceMobileAppConfigurationUse $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatuses/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatuses/Count/CountRequestBuilder.php index 97c63841db4..a169208439b 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatuses/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatuses/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatuses/Item/ManagedDeviceMobileAppConfigurationUserStatusItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatuses/Item/ManagedDeviceMobileAppConfigurationUserStatusItemRequestBuilder.php index f74837981c6..95bb2e5d538 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatuses/Item/ManagedDeviceMobileAppConfigurationUserStatusItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatuses/Item/ManagedDeviceMobileAppConfigurationUserStatusItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedDeviceMobileAppConfigurationUserStatus; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a managedDeviceMobileAppConfigurationUserStatus. * @param ManagedDeviceMobileAppConfigurationUserStatusItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationuserstatus-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ManagedDeviceMobileAppConfigurationUserStatusItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the managedDeviceMobileAppConfigurationUserStatus object. * @param ManagedDeviceMobileAppConfigurationUserStatusItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationuserstatus-get?view=graph-rest-1.0 Find more info here */ public function get(?ManagedDeviceMobileAppConfigurationUserStatusItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a managedDeviceMobileAppConfigurationUserStatus object. * @param ManagedDeviceMobileAppConfigurationUserStatus $body The request body * @param ManagedDeviceMobileAppConfigurationUserStatusItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationuserstatus-update?view=graph-rest-1.0 Find more info here */ public function patch(ManagedDeviceMobileAppConfigurationUserStatus $body, ?ManagedDeviceMobileAppConfigurationUserStatusItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ManagedDeviceMobileAppConfigurationU $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ManagedDeviceMobileAppConfigurationUser $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ManagedDeviceMobileAppConfigurationUser } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ManagedDeviceMobileAppConfigurationUse $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatuses/UserStatusesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatuses/UserStatusesRequestBuilder.php index 3112d7cecbb..c913b5d4370 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatuses/UserStatusesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/Item/UserStatuses/UserStatusesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileAppConfigurations\Item\UserStatuses\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileAppConfigurations\Item\UserStatuses\Item\ManagedDeviceMobileAppConfigurationUserStatusItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedDeviceMobileAppConfigurationUserStatus; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the managedDeviceMobileAppConfigurationUserStatus objects. * @param UserStatusesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationuserstatus-list?view=graph-rest-1.0 Find more info here */ public function get(?UserStatusesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationUserStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationUserStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new managedDeviceMobileAppConfigurationUserStatus object. * @param ManagedDeviceMobileAppConfigurationUserStatus $body The request body * @param UserStatusesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfigurationuserstatus-create?view=graph-rest-1.0 Find more info here */ public function post(ManagedDeviceMobileAppConfigurationUserStatus $body, ?UserStatusesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?UserStatusesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?UserStatusesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ManagedDeviceMobileAppConfigurationUser $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileAppConfigurations/MobileAppConfigurationsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileAppConfigurations/MobileAppConfigurationsRequestBuilder.php index 793aafd86c0..e2eccf0ec85 100644 --- a/src/Generated/DeviceAppManagement/MobileAppConfigurations/MobileAppConfigurationsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileAppConfigurations/MobileAppConfigurationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileAppConfigurations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileAppConfigurations\Item\ManagedDeviceMobileAppConfigurationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedDeviceMobileAppConfiguration; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the managedDeviceMobileAppConfiguration objects. * @param MobileAppConfigurationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-manageddevicemobileappconfiguration-list?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppConfigurationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new iosMobileAppConfiguration object. * @param ManagedDeviceMobileAppConfiguration $body The request body * @param MobileAppConfigurationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-iosmobileappconfiguration-create?view=graph-rest-1.0 Find more info here */ public function post(ManagedDeviceMobileAppConfiguration $body, ?MobileAppConfigurationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceMobileAppConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?MobileAppConfigurationsRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?MobileAppConfigurationsRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ManagedDeviceMobileAppConfiguration $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Count/CountRequestBuilder.php index 9924b034e9f..ae29c0ecae9 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidLobApp/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidLobApp/Count/CountRequestBuilder.php index 91bd525e50a..0d60bb96ad9 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidLobApp/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidLobApp/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidLobApp/GraphAndroidLobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidLobApp/GraphAndroidLobAppRequestBuilder.php index f9cb9714ae7..8c8804db219 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidLobApp/GraphAndroidLobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidLobApp/GraphAndroidLobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphAndroidLobApp\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\AndroidLobAppCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.androidLobApp in the microsoft.graph.mobileApp collection * @param GraphAndroidLobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAndroidLobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AndroidLobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AndroidLobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAndroidLobAppRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAndroidLobAppRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidStoreApp/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidStoreApp/Count/CountRequestBuilder.php index db38ff217f9..3bf7ffd16c1 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidStoreApp/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidStoreApp/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidStoreApp/GraphAndroidStoreAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidStoreApp/GraphAndroidStoreAppRequestBuilder.php index 30d3724620c..45132fb4961 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidStoreApp/GraphAndroidStoreAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphAndroidStoreApp/GraphAndroidStoreAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphAndroidStoreApp\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\AndroidStoreAppCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.androidStoreApp in the microsoft.graph.mobileApp collection * @param GraphAndroidStoreAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAndroidStoreAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AndroidStoreAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AndroidStoreAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAndroidStoreAppRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAndroidStoreAppRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphIosLobApp/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphIosLobApp/Count/CountRequestBuilder.php index 7559d939170..91cea842994 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphIosLobApp/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphIosLobApp/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphIosLobApp/GraphIosLobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphIosLobApp/GraphIosLobAppRequestBuilder.php index 37b85245961..da773c982b6 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphIosLobApp/GraphIosLobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphIosLobApp/GraphIosLobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphIosLobApp\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\IosLobAppCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.iosLobApp in the microsoft.graph.mobileApp collection * @param GraphIosLobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphIosLobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosLobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosLobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphIosLobAppRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphIosLobAppRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphIosStoreApp/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphIosStoreApp/Count/CountRequestBuilder.php index 2d5b5c5919a..494b131b3ff 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphIosStoreApp/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphIosStoreApp/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphIosStoreApp/GraphIosStoreAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphIosStoreApp/GraphIosStoreAppRequestBuilder.php index 3dae7bcf59b..838e504e61f 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphIosStoreApp/GraphIosStoreAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphIosStoreApp/GraphIosStoreAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphIosStoreApp\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\IosStoreAppCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.iosStoreApp in the microsoft.graph.mobileApp collection * @param GraphIosStoreAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphIosStoreAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosStoreAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosStoreAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphIosStoreAppRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphIosStoreAppRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphIosVppApp/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphIosVppApp/Count/CountRequestBuilder.php index 76eaa0ae06b..44cd4cec66b 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphIosVppApp/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphIosVppApp/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphIosVppApp/GraphIosVppAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphIosVppApp/GraphIosVppAppRequestBuilder.php index c1bba9fa588..75a719e76e7 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphIosVppApp/GraphIosVppAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphIosVppApp/GraphIosVppAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphIosVppApp\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\IosVppAppCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.iosVppApp in the microsoft.graph.mobileApp collection * @param GraphIosVppAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphIosVppAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosVppAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosVppAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphIosVppAppRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphIosVppAppRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSDmgApp/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSDmgApp/Count/CountRequestBuilder.php index ffbe572cb27..fe35fdf7c4d 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSDmgApp/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSDmgApp/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSDmgApp/GraphMacOSDmgAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSDmgApp/GraphMacOSDmgAppRequestBuilder.php index c567d3aecc2..f9ef339b428 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSDmgApp/GraphMacOSDmgAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSDmgApp/GraphMacOSDmgAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphMacOSDmgApp\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\MacOSDmgAppCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.macOSDmgApp in the microsoft.graph.mobileApp collection * @param GraphMacOSDmgAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphMacOSDmgAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MacOSDmgAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MacOSDmgAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphMacOSDmgAppRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphMacOSDmgAppRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSLobApp/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSLobApp/Count/CountRequestBuilder.php index 5daf3885d21..3aaf4a81292 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSLobApp/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSLobApp/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSLobApp/GraphMacOSLobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSLobApp/GraphMacOSLobAppRequestBuilder.php index ce8467ad276..2d062189e1c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSLobApp/GraphMacOSLobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphMacOSLobApp/GraphMacOSLobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphMacOSLobApp\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\MacOSLobAppCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.macOSLobApp in the microsoft.graph.mobileApp collection * @param GraphMacOSLobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphMacOSLobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MacOSLobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MacOSLobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphMacOSLobAppRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphMacOSLobAppRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphManagedAndroidLobApp/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphManagedAndroidLobApp/Count/CountRequestBuilder.php index 1258b2ac084..3a9a228b494 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphManagedAndroidLobApp/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphManagedAndroidLobApp/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphManagedAndroidLobApp/GraphManagedAndroidLobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphManagedAndroidLobApp/GraphManagedAndroidLobAppRequestBuilder.php index 5d8d4fbaf57..6c260219cff 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphManagedAndroidLobApp/GraphManagedAndroidLobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphManagedAndroidLobApp/GraphManagedAndroidLobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphManagedAndroidLobApp\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedAndroidLobAppCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.managedAndroidLobApp in the microsoft.graph.mobileApp collection * @param GraphManagedAndroidLobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphManagedAndroidLobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAndroidLobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAndroidLobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphManagedAndroidLobAppRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphManagedAndroidLobAppRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphManagedIOSLobApp/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphManagedIOSLobApp/Count/CountRequestBuilder.php index 4001213cdbf..730d2fba904 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphManagedIOSLobApp/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphManagedIOSLobApp/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphManagedIOSLobApp/GraphManagedIOSLobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphManagedIOSLobApp/GraphManagedIOSLobAppRequestBuilder.php index 4830a39506c..b11a108ce9a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphManagedIOSLobApp/GraphManagedIOSLobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphManagedIOSLobApp/GraphManagedIOSLobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphManagedIOSLobApp\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedIOSLobAppCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.managedIOSLobApp in the microsoft.graph.mobileApp collection * @param GraphManagedIOSLobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphManagedIOSLobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedIOSLobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedIOSLobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphManagedIOSLobAppRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphManagedIOSLobAppRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphManagedMobileLobApp/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphManagedMobileLobApp/Count/CountRequestBuilder.php index 9a1f8525d5a..6d92e91be76 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphManagedMobileLobApp/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphManagedMobileLobApp/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphManagedMobileLobApp/GraphManagedMobileLobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphManagedMobileLobApp/GraphManagedMobileLobAppRequestBuilder.php index 2e0c1fcca11..9ffde8a759a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphManagedMobileLobApp/GraphManagedMobileLobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphManagedMobileLobApp/GraphManagedMobileLobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphManagedMobileLobApp\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedMobileLobAppCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.managedMobileLobApp in the microsoft.graph.mobileApp collection * @param GraphManagedMobileLobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphManagedMobileLobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileLobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileLobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphManagedMobileLobAppRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphManagedMobileLobAppRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphMicrosoftStoreForBusinessApp/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphMicrosoftStoreForBusinessApp/Count/CountRequestBuilder.php index d27f275fc8d..e5f31b9a629 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphMicrosoftStoreForBusinessApp/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphMicrosoftStoreForBusinessApp/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphMicrosoftStoreForBusinessApp/GraphMicrosoftStoreForBusinessAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphMicrosoftStoreForBusinessApp/GraphMicrosoftStoreForBusinessAppRequestBuilder.php index 9d1dbc25327..8b60f13a713 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphMicrosoftStoreForBusinessApp/GraphMicrosoftStoreForBusinessAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphMicrosoftStoreForBusinessApp/GraphMicrosoftStoreForBusinessAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphMicrosoftStoreForBusinessApp\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\MicrosoftStoreForBusinessAppCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.microsoftStoreForBusinessApp in the microsoft.graph.mobileApp collection * @param GraphMicrosoftStoreForBusinessAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphMicrosoftStoreForBusinessAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MicrosoftStoreForBusinessAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MicrosoftStoreForBusinessAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphMicrosoftStoreForBusinessAppReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphMicrosoftStoreForBusinessAppReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphWin32LobApp/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphWin32LobApp/Count/CountRequestBuilder.php index 0ba09240023..fcd07cab632 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphWin32LobApp/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphWin32LobApp/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphWin32LobApp/GraphWin32LobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphWin32LobApp/GraphWin32LobAppRequestBuilder.php index a572e959dae..0ae42f28ed2 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphWin32LobApp/GraphWin32LobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphWin32LobApp/GraphWin32LobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphWin32LobApp\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Win32LobAppCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.win32LobApp in the microsoft.graph.mobileApp collection * @param GraphWin32LobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphWin32LobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Win32LobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Win32LobAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphWin32LobAppRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphWin32LobAppRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsAppX/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsAppX/Count/CountRequestBuilder.php index 154c41e9378..e61b0b0c239 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsAppX/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsAppX/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsAppX/GraphWindowsAppXRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsAppX/GraphWindowsAppXRequestBuilder.php index f40985e3c9d..b0ecaedd3bf 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsAppX/GraphWindowsAppXRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsAppX/GraphWindowsAppXRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphWindowsAppX\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsAppXCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.windowsAppX in the microsoft.graph.mobileApp collection * @param GraphWindowsAppXRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphWindowsAppXRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsAppXCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsAppXCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphWindowsAppXRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphWindowsAppXRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsMobileMSI/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsMobileMSI/Count/CountRequestBuilder.php index 7d108a1988a..a10d45130b8 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsMobileMSI/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsMobileMSI/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsMobileMSI/GraphWindowsMobileMSIRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsMobileMSI/GraphWindowsMobileMSIRequestBuilder.php index eea202c4beb..b0c4a435310 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsMobileMSI/GraphWindowsMobileMSIRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsMobileMSI/GraphWindowsMobileMSIRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphWindowsMobileMSI\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsMobileMSICollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.windowsMobileMSI in the microsoft.graph.mobileApp collection * @param GraphWindowsMobileMSIRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphWindowsMobileMSIRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsMobileMSICollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsMobileMSICollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphWindowsMobileMSIRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphWindowsMobileMSIRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsUniversalAppX/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsUniversalAppX/Count/CountRequestBuilder.php index f9328a922fe..86eb3cb2c74 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsUniversalAppX/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsUniversalAppX/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsUniversalAppX/GraphWindowsUniversalAppXRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsUniversalAppX/GraphWindowsUniversalAppXRequestBuilder.php index a6d5676e3f0..805dd7f01c5 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsUniversalAppX/GraphWindowsUniversalAppXRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsUniversalAppX/GraphWindowsUniversalAppXRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphWindowsUniversalAppX\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsUniversalAppXCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.windowsUniversalAppX in the microsoft.graph.mobileApp collection * @param GraphWindowsUniversalAppXRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphWindowsUniversalAppXRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsUniversalAppXCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsUniversalAppXCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphWindowsUniversalAppXRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphWindowsUniversalAppXRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsWebApp/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsWebApp/Count/CountRequestBuilder.php index e5940ad5341..f019a433405 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsWebApp/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsWebApp/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsWebApp/GraphWindowsWebAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsWebApp/GraphWindowsWebAppRequestBuilder.php index 408dc919d3a..c4eebbed4ed 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsWebApp/GraphWindowsWebAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/GraphWindowsWebApp/GraphWindowsWebAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphWindowsWebApp\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsWebAppCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.windowsWebApp in the microsoft.graph.mobileApp collection * @param GraphWindowsWebAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphWindowsWebAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsWebAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsWebAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphWindowsWebAppRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphWindowsWebAppRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/Assign/AssignRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/Assign/AssignRequestBuilder.php index 3e67ea0073d..9740ec80fd6 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/Assign/AssignRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/Assign/AssignRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param AssignPostRequestBody $body The request body * @param AssignRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileapp-assign?view=graph-rest-1.0 Find more info here */ public function post(AssignPostRequestBody $body, ?AssignRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AssignPostRequestBody $body, ?AssignReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/Assignments/AssignmentsRequestBuilder.php index 4f45d0cb236..57597e70c73 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/Assignments/Count/CountRequestBuilder.php index f99cd3ae668..41af35d5563 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index 0a28347e67f..15c91dbd78c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/Categories/CategoriesRequestBuilder.php index ab2ac0ef92e..647bcf92caf 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/Categories/Count/CountRequestBuilder.php index c818068f009..79463ec6aac 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/Categories/Item/MobileAppCategoryItemRequestBuilder.php index f03b8b3899c..875ea2998da 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Assignments/AssignmentsRequestBuilder.php index 687c82f253a..e5282995a26 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Assignments/Count/CountRequestBuilder.php index 125087ba3ce..3a52378e67c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index e3ea96bf0fc..230971a1ab1 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Categories/CategoriesRequestBuilder.php index 48d23379d3d..81c0bb782a0 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Categories/Count/CountRequestBuilder.php index e4959fcb45e..bb5699445ce 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php index bfd6a4ed4da..e56cf93818a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/ContentVersionsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/ContentVersionsRequestBuilder.php index 8cb44d1a4e8..d9db093e3bb 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/ContentVersionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/ContentVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\ContentVersions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\ContentVersions\Item\MobileAppContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of content versions for this app. * @param ContentVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentVersions for deviceAppManagement * @param MobileAppContent $body The request body * @param ContentVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContent $body, ?ContentVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContent $body, ?ContentVersion $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Count/CountRequestBuilder.php index b662666e814..13fe152846e 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php index 36d5aa1c7d0..0aeba7e152d 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\ContentVersions\Item\ContainedApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\ContentVersions\Item\ContainedApps\Item\MobileContainedAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileContainedApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of contained apps in a MobileLobApp acting as a package. * @param ContainedAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContainedAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to containedApps for deviceAppManagement * @param MobileContainedApp $body The request body * @param ContainedAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileContainedApp $body, ?ContainedAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileContainedApp $body, ?ContainedApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php index 37dcaba9b77..0f7e276f381 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php index d31a1516e2e..394d426ad2f 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileContainedApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property containedApps for deviceAppManagement * @param MobileContainedAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileContainedAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of contained apps in a MobileLobApp acting as a package. * @param MobileContainedAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileContainedAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property containedApps in deviceAppManagement * @param MobileContainedApp $body The request body * @param MobileContainedAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileContainedApp $body, ?MobileContainedAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?MobileContainedAppItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(MobileContainedApp $body, ?MobileConta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php index 71b891c67f3..901db20ca1a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php index a38866c4b62..77c0e77745b 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\ContentVersions\Item\Files\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\ContentVersions\Item\Files\Item\MobileAppContentFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of files for this app content version. * @param FilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to files for deviceAppManagement * @param MobileAppContentFile $body The request body * @param FilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContentFile $body, ?FilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContentFile $body, ?FilesReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php index c86d3493b20..3e1303be57b 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Commits a file of a given app. * @param CommitPostRequestBody $body The request body * @param CommitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CommitPostRequestBody $body, ?CommitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(CommitPostRequestBody $body, ?CommitReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php index e5378e66619..d6bb64e03e8 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\ContentVersions\Item\Files\Item\Commit\CommitRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\ContentVersions\Item\Files\Item\RenewUpload\RenewUploadRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property files for deviceAppManagement * @param MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of files for this app content version. * @param MobileAppContentFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property files in deviceAppManagement * @param MobileAppContentFile $body The request body * @param MobileAppContentFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContentFile $body, ?MobileAppContentFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentFileItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContentFile $body, ?MobileApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php index 45729acad84..27b92afbfcd 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Renews the SAS URI for an application file upload. * @param RenewUploadRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RenewUploadRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RenewUploadRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php index 445900360bb..c4ad2f1a3af 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\ContentVersions\Item\ContainedApps\ContainedAppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\ContentVersions\Item\Files\FilesRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentVersions for deviceAppManagement * @param MobileAppContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of content versions for this app. * @param MobileAppContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentVersions in deviceAppManagement * @param MobileAppContent $body The request body * @param MobileAppContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContent $body, ?MobileAppContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContent $body, ?MobileAppCont $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/GraphAndroidLobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/GraphAndroidLobAppRequestBuilder.php index 660df9c21d3..e452ce83634 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/GraphAndroidLobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidLobApp/GraphAndroidLobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidLobApp\ContentVersions\ContentVersionsRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.androidLobApp * @param GraphAndroidLobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAndroidLobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AndroidLobApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AndroidLobApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?GraphAndroidLobAppRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?GraphAndroidLobAppRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Assignments/AssignmentsRequestBuilder.php index f9c782bee41..dba4577cbde 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidStoreApp\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidStoreApp\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Assignments/Count/CountRequestBuilder.php index 3dd62560b00..91ed7df232a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index 37e9655f853..e44fbf6200b 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Categories/CategoriesRequestBuilder.php index cbcb905804a..9496d08d3a5 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidStoreApp\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidStoreApp\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Categories/Count/CountRequestBuilder.php index 17109a34ed5..05355d6e4c6 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php index 57250cb1d0f..7b38e0fe606 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/GraphAndroidStoreAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/GraphAndroidStoreAppRequestBuilder.php index 81f10ab670f..c3be0b61712 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/GraphAndroidStoreAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphAndroidStoreApp/GraphAndroidStoreAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidStoreApp\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphAndroidStoreApp\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\Models\AndroidStoreApp; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.androidStoreApp * @param GraphAndroidStoreAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAndroidStoreAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AndroidStoreApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AndroidStoreApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?GraphAndroidStoreAppRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?GraphAndroidStoreAppRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Assignments/AssignmentsRequestBuilder.php index 66dd6f8c51d..9885814642c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Assignments/Count/CountRequestBuilder.php index 2ef745b0ff4..78b36a81c10 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index 4132c747353..8e1daf52fff 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Categories/CategoriesRequestBuilder.php index cca52d6a473..13d219f2186 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Categories/Count/CountRequestBuilder.php index da059010ad7..b239896e916 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php index c07f0bcb26d..4bfd98e326f 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/ContentVersionsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/ContentVersionsRequestBuilder.php index 697bcf404ef..b5430091db1 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/ContentVersionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/ContentVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\ContentVersions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\ContentVersions\Item\MobileAppContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of content versions for this app. * @param ContentVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentVersions for deviceAppManagement * @param MobileAppContent $body The request body * @param ContentVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContent $body, ?ContentVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContent $body, ?ContentVersion $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Count/CountRequestBuilder.php index 9aefd231041..88f2b310852 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php index 115c466145b..d9c685c2ad3 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\ContentVersions\Item\ContainedApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\ContentVersions\Item\ContainedApps\Item\MobileContainedAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileContainedApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of contained apps in a MobileLobApp acting as a package. * @param ContainedAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContainedAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to containedApps for deviceAppManagement * @param MobileContainedApp $body The request body * @param ContainedAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileContainedApp $body, ?ContainedAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileContainedApp $body, ?ContainedApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php index 5364285a117..c592e0d6067 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php index cd02e84e1bf..be6e2dc4571 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileContainedApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property containedApps for deviceAppManagement * @param MobileContainedAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileContainedAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of contained apps in a MobileLobApp acting as a package. * @param MobileContainedAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileContainedAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property containedApps in deviceAppManagement * @param MobileContainedApp $body The request body * @param MobileContainedAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileContainedApp $body, ?MobileContainedAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?MobileContainedAppItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(MobileContainedApp $body, ?MobileConta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php index 74112417e5e..b0cc4ab0f2f 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php index a41c53df8b9..d6cc985309c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\ContentVersions\Item\Files\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\ContentVersions\Item\Files\Item\MobileAppContentFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of files for this app content version. * @param FilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to files for deviceAppManagement * @param MobileAppContentFile $body The request body * @param FilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContentFile $body, ?FilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContentFile $body, ?FilesReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php index 4b446cbe0c4..5ad2b413688 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Commits a file of a given app. * @param CommitPostRequestBody $body The request body * @param CommitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CommitPostRequestBody $body, ?CommitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(CommitPostRequestBody $body, ?CommitReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php index d8ec1e1896c..6380ccf5b17 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\ContentVersions\Item\Files\Item\Commit\CommitRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\ContentVersions\Item\Files\Item\RenewUpload\RenewUploadRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property files for deviceAppManagement * @param MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of files for this app content version. * @param MobileAppContentFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property files in deviceAppManagement * @param MobileAppContentFile $body The request body * @param MobileAppContentFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContentFile $body, ?MobileAppContentFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentFileItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContentFile $body, ?MobileApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php index 3511b2f7605..24fbcdc00b4 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Renews the SAS URI for an application file upload. * @param RenewUploadRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RenewUploadRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RenewUploadRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php index 2f3cfe704fb..fbe89ab030c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\ContentVersions\Item\ContainedApps\ContainedAppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\ContentVersions\Item\Files\FilesRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentVersions for deviceAppManagement * @param MobileAppContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of content versions for this app. * @param MobileAppContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentVersions in deviceAppManagement * @param MobileAppContent $body The request body * @param MobileAppContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContent $body, ?MobileAppContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContent $body, ?MobileAppCont $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/GraphIosLobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/GraphIosLobAppRequestBuilder.php index bcf33d38b24..930fc4ca65f 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/GraphIosLobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosLobApp/GraphIosLobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosLobApp\ContentVersions\ContentVersionsRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.iosLobApp * @param GraphIosLobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphIosLobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosLobApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosLobApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?GraphIosLobAppRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?GraphIosLobAppRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Assignments/AssignmentsRequestBuilder.php index 80474da30a6..86ca7a29196 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosStoreApp\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosStoreApp\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Assignments/Count/CountRequestBuilder.php index a4ef2da902c..f174fdcb347 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index 7f85d5179e9..343ef9b3283 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Categories/CategoriesRequestBuilder.php index f4312fa7652..0293ca82bf4 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosStoreApp\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosStoreApp\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Categories/Count/CountRequestBuilder.php index e44d3c12e0c..aca7bf43f2a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php index df542464fae..bd456a345e3 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/GraphIosStoreAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/GraphIosStoreAppRequestBuilder.php index 63d04ea7bc7..f0630a40750 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/GraphIosStoreAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosStoreApp/GraphIosStoreAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosStoreApp\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosStoreApp\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\Models\IosStoreApp; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.iosStoreApp * @param GraphIosStoreAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphIosStoreAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosStoreApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosStoreApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?GraphIosStoreAppRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?GraphIosStoreAppRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Assignments/AssignmentsRequestBuilder.php index fdcee943e19..236561f743b 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosVppApp\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosVppApp\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Assignments/Count/CountRequestBuilder.php index f3575fa09f0..515205c2ed0 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index 40cacd60bdb..b46ac75062a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Categories/CategoriesRequestBuilder.php index 84fa8276adc..fd3ba9004cb 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosVppApp\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosVppApp\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Categories/Count/CountRequestBuilder.php index 4c90e7bb1cf..4b81ddc6258 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php index 41776e4d98a..af84cc802eb 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/GraphIosVppAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/GraphIosVppAppRequestBuilder.php index e11d4d90f33..cf77c61edb6 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/GraphIosVppAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphIosVppApp/GraphIosVppAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosVppApp\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphIosVppApp\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\Models\IosVppApp; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.iosVppApp * @param GraphIosVppAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphIosVppAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosVppApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosVppApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?GraphIosVppAppRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?GraphIosVppAppRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Assignments/AssignmentsRequestBuilder.php index 8b3ce1afd0f..33318b40668 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Assignments/Count/CountRequestBuilder.php index a6323dbc78e..6769bef68f7 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index 0e350b457a0..eaff1c555bf 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Categories/CategoriesRequestBuilder.php index 4e3a30678e2..389f5a76f1e 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Categories/Count/CountRequestBuilder.php index 94733160e5c..d1227823114 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php index d347b45f93f..14b69b69af5 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/ContentVersionsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/ContentVersionsRequestBuilder.php index 750c0fc439e..3f519393a97 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/ContentVersionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/ContentVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\ContentVersions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\ContentVersions\Item\MobileAppContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of content versions for this app. * @param ContentVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentVersions for deviceAppManagement * @param MobileAppContent $body The request body * @param ContentVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContent $body, ?ContentVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContent $body, ?ContentVersion $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Count/CountRequestBuilder.php index 9f021c33fda..288855b4add 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php index 4c41d41dd8f..2483e3c4e0c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\ContentVersions\Item\ContainedApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\ContentVersions\Item\ContainedApps\Item\MobileContainedAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileContainedApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of contained apps in a MobileLobApp acting as a package. * @param ContainedAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContainedAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to containedApps for deviceAppManagement * @param MobileContainedApp $body The request body * @param ContainedAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileContainedApp $body, ?ContainedAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileContainedApp $body, ?ContainedApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php index 04d6715d7f4..96d2019714c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php index a943accb611..2f5ccb571af 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileContainedApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property containedApps for deviceAppManagement * @param MobileContainedAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileContainedAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of contained apps in a MobileLobApp acting as a package. * @param MobileContainedAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileContainedAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property containedApps in deviceAppManagement * @param MobileContainedApp $body The request body * @param MobileContainedAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileContainedApp $body, ?MobileContainedAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?MobileContainedAppItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(MobileContainedApp $body, ?MobileConta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php index 4f8beba1464..dcb1d173c1c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/FilesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/FilesRequestBuilder.php index 6c6cf94c0f5..b9b034602d2 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/FilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/FilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\ContentVersions\Item\Files\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\ContentVersions\Item\Files\Item\MobileAppContentFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of files for this app content version. * @param FilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to files for deviceAppManagement * @param MobileAppContentFile $body The request body * @param FilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContentFile $body, ?FilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContentFile $body, ?FilesReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php index fc4997e31fc..1d3bbb2fbe9 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Commits a file of a given app. * @param CommitPostRequestBody $body The request body * @param CommitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CommitPostRequestBody $body, ?CommitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(CommitPostRequestBody $body, ?CommitReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php index affc2a6cd83..b665f4eae0e 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\ContentVersions\Item\Files\Item\Commit\CommitRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\ContentVersions\Item\Files\Item\RenewUpload\RenewUploadRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property files for deviceAppManagement * @param MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of files for this app content version. * @param MobileAppContentFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property files in deviceAppManagement * @param MobileAppContentFile $body The request body * @param MobileAppContentFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContentFile $body, ?MobileAppContentFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentFileItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContentFile $body, ?MobileApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php index a0be1f4ecd5..64f5243ec65 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Renews the SAS URI for an application file upload. * @param RenewUploadRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RenewUploadRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RenewUploadRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php index 917fff3843d..7708bf463d7 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\ContentVersions\Item\ContainedApps\ContainedAppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\ContentVersions\Item\Files\FilesRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentVersions for deviceAppManagement * @param MobileAppContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of content versions for this app. * @param MobileAppContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentVersions in deviceAppManagement * @param MobileAppContent $body The request body * @param MobileAppContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContent $body, ?MobileAppContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContent $body, ?MobileAppCont $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/GraphMacOSDmgAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/GraphMacOSDmgAppRequestBuilder.php index 302cf53e41d..0ae59a53930 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/GraphMacOSDmgAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSDmgApp/GraphMacOSDmgAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSDmgApp\ContentVersions\ContentVersionsRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.macOSDmgApp * @param GraphMacOSDmgAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphMacOSDmgAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MacOSDmgApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MacOSDmgApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?GraphMacOSDmgAppRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?GraphMacOSDmgAppRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Assignments/AssignmentsRequestBuilder.php index a9b691228b6..410d717a6ea 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Assignments/Count/CountRequestBuilder.php index 832cf8f1862..9dc35d6c052 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index 989db17e47c..346165bd772 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Categories/CategoriesRequestBuilder.php index 43f814b2c0e..5d3c6a800eb 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Categories/Count/CountRequestBuilder.php index 1138aaf4b81..a2c15e61470 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php index 1d5d1834eb1..92f7f6240c9 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/ContentVersionsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/ContentVersionsRequestBuilder.php index 65538991960..7e979723406 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/ContentVersionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/ContentVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\ContentVersions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\ContentVersions\Item\MobileAppContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of content versions for this app. * @param ContentVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentVersions for deviceAppManagement * @param MobileAppContent $body The request body * @param ContentVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContent $body, ?ContentVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContent $body, ?ContentVersion $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Count/CountRequestBuilder.php index 20dd6696d77..ef4c0099d3e 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php index b406c71bfa9..769a0ac58a9 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\ContentVersions\Item\ContainedApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\ContentVersions\Item\ContainedApps\Item\MobileContainedAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileContainedApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of contained apps in a MobileLobApp acting as a package. * @param ContainedAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContainedAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to containedApps for deviceAppManagement * @param MobileContainedApp $body The request body * @param ContainedAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileContainedApp $body, ?ContainedAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileContainedApp $body, ?ContainedApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php index 501486ef871..6f11e1577ff 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php index c54189dcad1..993c2338129 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileContainedApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property containedApps for deviceAppManagement * @param MobileContainedAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileContainedAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of contained apps in a MobileLobApp acting as a package. * @param MobileContainedAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileContainedAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property containedApps in deviceAppManagement * @param MobileContainedApp $body The request body * @param MobileContainedAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileContainedApp $body, ?MobileContainedAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?MobileContainedAppItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(MobileContainedApp $body, ?MobileConta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php index 905df485e13..f00fb5fb362 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php index 2fc38afe13f..3b662e95e65 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\ContentVersions\Item\Files\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\ContentVersions\Item\Files\Item\MobileAppContentFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of files for this app content version. * @param FilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to files for deviceAppManagement * @param MobileAppContentFile $body The request body * @param FilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContentFile $body, ?FilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContentFile $body, ?FilesReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php index 049036f2218..3d45f0c242e 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Commits a file of a given app. * @param CommitPostRequestBody $body The request body * @param CommitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CommitPostRequestBody $body, ?CommitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(CommitPostRequestBody $body, ?CommitReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php index 89fc748322a..8e0296a4000 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\ContentVersions\Item\Files\Item\Commit\CommitRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\ContentVersions\Item\Files\Item\RenewUpload\RenewUploadRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property files for deviceAppManagement * @param MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of files for this app content version. * @param MobileAppContentFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property files in deviceAppManagement * @param MobileAppContentFile $body The request body * @param MobileAppContentFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContentFile $body, ?MobileAppContentFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentFileItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContentFile $body, ?MobileApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php index 4f6de6910d4..ba9118b6aed 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Renews the SAS URI for an application file upload. * @param RenewUploadRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RenewUploadRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RenewUploadRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php index b4f7d35a5a9..ce50c940a8e 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\ContentVersions\Item\ContainedApps\ContainedAppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\ContentVersions\Item\Files\FilesRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentVersions for deviceAppManagement * @param MobileAppContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of content versions for this app. * @param MobileAppContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentVersions in deviceAppManagement * @param MobileAppContent $body The request body * @param MobileAppContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContent $body, ?MobileAppContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContent $body, ?MobileAppCont $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/GraphMacOSLobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/GraphMacOSLobAppRequestBuilder.php index ddabdd47378..b6dda902854 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/GraphMacOSLobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMacOSLobApp/GraphMacOSLobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMacOSLobApp\ContentVersions\ContentVersionsRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.macOSLobApp * @param GraphMacOSLobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphMacOSLobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MacOSLobApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MacOSLobApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?GraphMacOSLobAppRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?GraphMacOSLobAppRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Assignments/AssignmentsRequestBuilder.php index 5b754df5a15..2d5712820c6 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Assignments/Count/CountRequestBuilder.php index 50f60e04aef..68ef774d2fc 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index c373b6b5561..a1e304d3c90 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Categories/CategoriesRequestBuilder.php index 3d8178d03a8..b0a7b191018 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Categories/Count/CountRequestBuilder.php index f957f3070c8..59d74c9e392 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php index 7403ccc6772..37eee1ef8aa 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/ContentVersionsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/ContentVersionsRequestBuilder.php index 99049233f2a..4dc3ad45b06 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/ContentVersionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/ContentVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\ContentVersions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\ContentVersions\Item\MobileAppContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of content versions for this app. * @param ContentVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentVersions for deviceAppManagement * @param MobileAppContent $body The request body * @param ContentVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContent $body, ?ContentVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContent $body, ?ContentVersion $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Count/CountRequestBuilder.php index e3e3242ee81..16c77253817 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php index e720b37d6a9..684fe98613f 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\ContentVersions\Item\ContainedApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\ContentVersions\Item\ContainedApps\Item\MobileContainedAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileContainedApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of contained apps in a MobileLobApp acting as a package. * @param ContainedAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContainedAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to containedApps for deviceAppManagement * @param MobileContainedApp $body The request body * @param ContainedAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileContainedApp $body, ?ContainedAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileContainedApp $body, ?ContainedApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php index 47ec1c79f41..bd0fe3b9c82 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php index 0d11ed4667e..1b492b67389 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileContainedApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property containedApps for deviceAppManagement * @param MobileContainedAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileContainedAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of contained apps in a MobileLobApp acting as a package. * @param MobileContainedAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileContainedAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property containedApps in deviceAppManagement * @param MobileContainedApp $body The request body * @param MobileContainedAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileContainedApp $body, ?MobileContainedAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?MobileContainedAppItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(MobileContainedApp $body, ?MobileConta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php index 5e5129674a0..6b79f7bf6a7 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php index 0eaf088cfa9..2000752a1c8 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\ContentVersions\Item\Files\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\ContentVersions\Item\Files\Item\MobileAppContentFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of files for this app content version. * @param FilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to files for deviceAppManagement * @param MobileAppContentFile $body The request body * @param FilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContentFile $body, ?FilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContentFile $body, ?FilesReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php index 2c489e03d65..155048e9296 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Commits a file of a given app. * @param CommitPostRequestBody $body The request body * @param CommitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CommitPostRequestBody $body, ?CommitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(CommitPostRequestBody $body, ?CommitReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php index 59da9578b67..92bcdab5643 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\ContentVersions\Item\Files\Item\Commit\CommitRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\ContentVersions\Item\Files\Item\RenewUpload\RenewUploadRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property files for deviceAppManagement * @param MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of files for this app content version. * @param MobileAppContentFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property files in deviceAppManagement * @param MobileAppContentFile $body The request body * @param MobileAppContentFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContentFile $body, ?MobileAppContentFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentFileItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContentFile $body, ?MobileApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php index a247f7b27b4..433da91437d 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Renews the SAS URI for an application file upload. * @param RenewUploadRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RenewUploadRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RenewUploadRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php index 0fe43f7be06..7763e28dade 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\ContentVersions\Item\ContainedApps\ContainedAppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\ContentVersions\Item\Files\FilesRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentVersions for deviceAppManagement * @param MobileAppContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of content versions for this app. * @param MobileAppContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentVersions in deviceAppManagement * @param MobileAppContent $body The request body * @param MobileAppContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContent $body, ?MobileAppContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContent $body, ?MobileAppCont $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/GraphManagedAndroidLobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/GraphManagedAndroidLobAppRequestBuilder.php index 9fbd5cb809a..518a404aa25 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/GraphManagedAndroidLobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedAndroidLobApp/GraphManagedAndroidLobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedAndroidLobApp\ContentVersions\ContentVersionsRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.managedAndroidLobApp * @param GraphManagedAndroidLobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphManagedAndroidLobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAndroidLobApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAndroidLobApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?GraphManagedAndroidLobAppRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?GraphManagedAndroidLobAppRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Assignments/AssignmentsRequestBuilder.php index 075cfa47ac7..e8331999eae 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Assignments/Count/CountRequestBuilder.php index 48fe899e0b7..ce9df79dc71 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index 38a8b6d61de..f63de32718a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Categories/CategoriesRequestBuilder.php index 0b11dc93c8e..a883dd46fcd 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Categories/Count/CountRequestBuilder.php index 3d06c383357..e56ea18ade8 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php index 96b15f3e9e8..a254907fc11 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/ContentVersionsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/ContentVersionsRequestBuilder.php index acffd579400..5901c7f80f9 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/ContentVersionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/ContentVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\ContentVersions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\ContentVersions\Item\MobileAppContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of content versions for this app. * @param ContentVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentVersions for deviceAppManagement * @param MobileAppContent $body The request body * @param ContentVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContent $body, ?ContentVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContent $body, ?ContentVersion $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Count/CountRequestBuilder.php index db4178658e2..158efe6d514 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php index 593b8b22c30..879fdff48c0 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\ContentVersions\Item\ContainedApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\ContentVersions\Item\ContainedApps\Item\MobileContainedAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileContainedApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of contained apps in a MobileLobApp acting as a package. * @param ContainedAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContainedAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to containedApps for deviceAppManagement * @param MobileContainedApp $body The request body * @param ContainedAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileContainedApp $body, ?ContainedAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileContainedApp $body, ?ContainedApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php index 42c88d60486..1e2dad0fe0d 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php index f0384da8890..faa6684a6fe 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileContainedApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property containedApps for deviceAppManagement * @param MobileContainedAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileContainedAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of contained apps in a MobileLobApp acting as a package. * @param MobileContainedAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileContainedAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property containedApps in deviceAppManagement * @param MobileContainedApp $body The request body * @param MobileContainedAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileContainedApp $body, ?MobileContainedAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?MobileContainedAppItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(MobileContainedApp $body, ?MobileConta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php index f0da85fcb91..f92ffacb20e 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php index 164adb55874..9503357a819 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\ContentVersions\Item\Files\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\ContentVersions\Item\Files\Item\MobileAppContentFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of files for this app content version. * @param FilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to files for deviceAppManagement * @param MobileAppContentFile $body The request body * @param FilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContentFile $body, ?FilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContentFile $body, ?FilesReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php index 99172eb02af..0338d234294 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Commits a file of a given app. * @param CommitPostRequestBody $body The request body * @param CommitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CommitPostRequestBody $body, ?CommitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(CommitPostRequestBody $body, ?CommitReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php index 8edafbdda1b..efe7f1a5bcf 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\ContentVersions\Item\Files\Item\Commit\CommitRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\ContentVersions\Item\Files\Item\RenewUpload\RenewUploadRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property files for deviceAppManagement * @param MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of files for this app content version. * @param MobileAppContentFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property files in deviceAppManagement * @param MobileAppContentFile $body The request body * @param MobileAppContentFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContentFile $body, ?MobileAppContentFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentFileItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContentFile $body, ?MobileApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php index 57bc23ec069..15b0c8dfbf3 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Renews the SAS URI for an application file upload. * @param RenewUploadRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RenewUploadRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RenewUploadRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php index 200b366a704..603f703135c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\ContentVersions\Item\ContainedApps\ContainedAppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\ContentVersions\Item\Files\FilesRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentVersions for deviceAppManagement * @param MobileAppContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of content versions for this app. * @param MobileAppContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentVersions in deviceAppManagement * @param MobileAppContent $body The request body * @param MobileAppContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContent $body, ?MobileAppContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContent $body, ?MobileAppCont $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/GraphManagedIOSLobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/GraphManagedIOSLobAppRequestBuilder.php index 444d49bf76e..06c2d2a9ae4 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/GraphManagedIOSLobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedIOSLobApp/GraphManagedIOSLobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedIOSLobApp\ContentVersions\ContentVersionsRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.managedIOSLobApp * @param GraphManagedIOSLobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphManagedIOSLobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedIOSLobApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedIOSLobApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?GraphManagedIOSLobAppRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?GraphManagedIOSLobAppRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Assignments/AssignmentsRequestBuilder.php index d073eada3e2..949055262e5 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Assignments/Count/CountRequestBuilder.php index e41be051272..db03c91369a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index 48fdc676b4d..c05bedbce18 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Categories/CategoriesRequestBuilder.php index 39f2acb16d2..ac3f491080f 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Categories/Count/CountRequestBuilder.php index f4d74b085a2..5af5d0dbc93 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php index 4afde7858b3..777c5255be4 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/ContentVersionsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/ContentVersionsRequestBuilder.php index d64bd549ffd..001ea51cce7 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/ContentVersionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/ContentVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\ContentVersions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\ContentVersions\Item\MobileAppContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of content versions for this app. * @param ContentVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentVersions for deviceAppManagement * @param MobileAppContent $body The request body * @param ContentVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContent $body, ?ContentVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContent $body, ?ContentVersion $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Count/CountRequestBuilder.php index 598c709a7c6..f8aa3c8941a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php index b27a2d2b41e..c01920799ef 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\ContentVersions\Item\ContainedApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\ContentVersions\Item\ContainedApps\Item\MobileContainedAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileContainedApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of contained apps in a MobileLobApp acting as a package. * @param ContainedAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContainedAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to containedApps for deviceAppManagement * @param MobileContainedApp $body The request body * @param ContainedAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileContainedApp $body, ?ContainedAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileContainedApp $body, ?ContainedApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php index 0f6f97e106f..51d85d94c05 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php index 337eeb8ae64..c2b4a5f717c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileContainedApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property containedApps for deviceAppManagement * @param MobileContainedAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileContainedAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of contained apps in a MobileLobApp acting as a package. * @param MobileContainedAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileContainedAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property containedApps in deviceAppManagement * @param MobileContainedApp $body The request body * @param MobileContainedAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileContainedApp $body, ?MobileContainedAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?MobileContainedAppItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(MobileContainedApp $body, ?MobileConta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php index c8654d8dfa9..f331340202c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php index 028d7a35df9..828ba4fdd24 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/FilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\ContentVersions\Item\Files\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\ContentVersions\Item\Files\Item\MobileAppContentFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of files for this app content version. * @param FilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to files for deviceAppManagement * @param MobileAppContentFile $body The request body * @param FilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContentFile $body, ?FilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContentFile $body, ?FilesReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php index 0f3e0244529..a68545cda62 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Commits a file of a given app. * @param CommitPostRequestBody $body The request body * @param CommitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CommitPostRequestBody $body, ?CommitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(CommitPostRequestBody $body, ?CommitReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php index 6b3ae921db3..fbea3a0d5d7 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\ContentVersions\Item\Files\Item\Commit\CommitRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\ContentVersions\Item\Files\Item\RenewUpload\RenewUploadRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property files for deviceAppManagement * @param MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of files for this app content version. * @param MobileAppContentFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property files in deviceAppManagement * @param MobileAppContentFile $body The request body * @param MobileAppContentFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContentFile $body, ?MobileAppContentFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentFileItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContentFile $body, ?MobileApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php index ad9c8aed5e9..4b7eae8a03f 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Renews the SAS URI for an application file upload. * @param RenewUploadRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RenewUploadRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RenewUploadRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php index ed88d8afe45..2988e30f172 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\ContentVersions\Item\ContainedApps\ContainedAppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\ContentVersions\Item\Files\FilesRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentVersions for deviceAppManagement * @param MobileAppContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of content versions for this app. * @param MobileAppContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentVersions in deviceAppManagement * @param MobileAppContent $body The request body * @param MobileAppContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContent $body, ?MobileAppContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContent $body, ?MobileAppCont $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/GraphManagedMobileLobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/GraphManagedMobileLobAppRequestBuilder.php index 3d6dd8c9f75..78d2e5e16cb 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/GraphManagedMobileLobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphManagedMobileLobApp/GraphManagedMobileLobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphManagedMobileLobApp\ContentVersions\ContentVersionsRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.managedMobileLobApp * @param GraphManagedMobileLobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphManagedMobileLobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileLobApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileLobApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?GraphManagedMobileLobAppRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?GraphManagedMobileLobAppRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Assignments/AssignmentsRequestBuilder.php index 133134777a6..ad69c7e3ac1 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMicrosoftStoreForBusinessApp\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMicrosoftStoreForBusinessApp\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Assignments/Count/CountRequestBuilder.php index aaaaf1de03b..fb25ddb4a96 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index fc5d177e913..b2a74e97c48 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Categories/CategoriesRequestBuilder.php index 00a79fd4811..248852f260d 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMicrosoftStoreForBusinessApp\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMicrosoftStoreForBusinessApp\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Categories/Count/CountRequestBuilder.php index 93177306607..4e57d8dc88d 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php index 0d361f3e7d4..4fca22de83d 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/GraphMicrosoftStoreForBusinessAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/GraphMicrosoftStoreForBusinessAppRequestBuilder.php index f68d70fbe23..b1429ca4d25 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/GraphMicrosoftStoreForBusinessAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphMicrosoftStoreForBusinessApp/GraphMicrosoftStoreForBusinessAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMicrosoftStoreForBusinessApp\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphMicrosoftStoreForBusinessApp\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\Models\MicrosoftStoreForBusinessApp; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.microsoftStoreForBusinessApp * @param GraphMicrosoftStoreForBusinessAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphMicrosoftStoreForBusinessAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MicrosoftStoreForBusinessApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MicrosoftStoreForBusinessApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?GraphMicrosoftStoreForBusinessAppReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?GraphMicrosoftStoreForBusinessAppReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Assignments/AssignmentsRequestBuilder.php index c713726b5bb..af011b00041 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Assignments/Count/CountRequestBuilder.php index 179f8654a24..1c7ebb35925 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index 8b587970eb4..7fa0f3220a8 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Categories/CategoriesRequestBuilder.php index 5fbd7735c5a..c18237a1896 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Categories/Count/CountRequestBuilder.php index e4a2d1becb4..6c76c7c4741 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php index d128ca93bad..a0747f00c9b 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/ContentVersionsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/ContentVersionsRequestBuilder.php index 67e8b1bf752..48746c7d05a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/ContentVersionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/ContentVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\ContentVersions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\ContentVersions\Item\MobileAppContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of content versions for this app. * @param ContentVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentVersions for deviceAppManagement * @param MobileAppContent $body The request body * @param ContentVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContent $body, ?ContentVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContent $body, ?ContentVersion $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Count/CountRequestBuilder.php index 72d49dfe6fc..fd1ea00b147 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php index f0c8e24b559..d3cb7e83d33 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\ContentVersions\Item\ContainedApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\ContentVersions\Item\ContainedApps\Item\MobileContainedAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileContainedApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of contained apps in a MobileLobApp acting as a package. * @param ContainedAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContainedAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to containedApps for deviceAppManagement * @param MobileContainedApp $body The request body * @param ContainedAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileContainedApp $body, ?ContainedAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileContainedApp $body, ?ContainedApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php index bc3cebe8de6..467a5b7caac 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php index afaa359c709..91641439d6d 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileContainedApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property containedApps for deviceAppManagement * @param MobileContainedAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileContainedAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of contained apps in a MobileLobApp acting as a package. * @param MobileContainedAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileContainedAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property containedApps in deviceAppManagement * @param MobileContainedApp $body The request body * @param MobileContainedAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileContainedApp $body, ?MobileContainedAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?MobileContainedAppItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(MobileContainedApp $body, ?MobileConta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php index b2ec5252132..6aafbcfa6de 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/FilesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/FilesRequestBuilder.php index d1b203e6c03..151596652fc 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/FilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/FilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\ContentVersions\Item\Files\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\ContentVersions\Item\Files\Item\MobileAppContentFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of files for this app content version. * @param FilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to files for deviceAppManagement * @param MobileAppContentFile $body The request body * @param FilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContentFile $body, ?FilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContentFile $body, ?FilesReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php index 4002971ddbc..ce4fa576e43 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Commits a file of a given app. * @param CommitPostRequestBody $body The request body * @param CommitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CommitPostRequestBody $body, ?CommitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(CommitPostRequestBody $body, ?CommitReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php index 3ccbd259a73..7e9db2b0cd0 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\ContentVersions\Item\Files\Item\Commit\CommitRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\ContentVersions\Item\Files\Item\RenewUpload\RenewUploadRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property files for deviceAppManagement * @param MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of files for this app content version. * @param MobileAppContentFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property files in deviceAppManagement * @param MobileAppContentFile $body The request body * @param MobileAppContentFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContentFile $body, ?MobileAppContentFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentFileItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContentFile $body, ?MobileApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php index 6cb83a9f817..90c7a12b5a4 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Renews the SAS URI for an application file upload. * @param RenewUploadRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RenewUploadRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RenewUploadRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php index 3c0a80fc08d..455383a0b7f 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/ContentVersions/Item/MobileAppContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\ContentVersions\Item\ContainedApps\ContainedAppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\ContentVersions\Item\Files\FilesRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentVersions for deviceAppManagement * @param MobileAppContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of content versions for this app. * @param MobileAppContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentVersions in deviceAppManagement * @param MobileAppContent $body The request body * @param MobileAppContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContent $body, ?MobileAppContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContent $body, ?MobileAppCont $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/GraphWin32LobAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/GraphWin32LobAppRequestBuilder.php index 90b4adbf8be..5b5b9caadf3 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/GraphWin32LobAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWin32LobApp/GraphWin32LobAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWin32LobApp\ContentVersions\ContentVersionsRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.win32LobApp * @param GraphWin32LobAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphWin32LobAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Win32LobApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Win32LobApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?GraphWin32LobAppRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?GraphWin32LobAppRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Assignments/AssignmentsRequestBuilder.php index a421e7975eb..422ebf7ae91 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Assignments/Count/CountRequestBuilder.php index d20e382713d..07efc037983 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index 1204a7d4b2e..766a3356d11 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Categories/CategoriesRequestBuilder.php index 2770fd55a1c..82d7f8649a2 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Categories/Count/CountRequestBuilder.php index 22668c27dea..c6943d109e9 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Categories/Item/MobileAppCategoryItemRequestBuilder.php index 8a5bc369655..334a3b1034c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/ContentVersionsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/ContentVersionsRequestBuilder.php index 8c343561173..8f7195a75f7 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/ContentVersionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/ContentVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\ContentVersions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\ContentVersions\Item\MobileAppContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of content versions for this app. * @param ContentVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentVersions for deviceAppManagement * @param MobileAppContent $body The request body * @param ContentVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContent $body, ?ContentVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContent $body, ?ContentVersion $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Count/CountRequestBuilder.php index 2e7d59febde..ae77c58042c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php index ca0899ee1d2..548143c59d1 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\ContentVersions\Item\ContainedApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\ContentVersions\Item\ContainedApps\Item\MobileContainedAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileContainedApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of contained apps in a MobileLobApp acting as a package. * @param ContainedAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContainedAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to containedApps for deviceAppManagement * @param MobileContainedApp $body The request body * @param ContainedAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileContainedApp $body, ?ContainedAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileContainedApp $body, ?ContainedApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php index dacf58ba4ae..48d4e78be55 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php index bdfadb5f631..43a57e463e6 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileContainedApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property containedApps for deviceAppManagement * @param MobileContainedAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileContainedAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of contained apps in a MobileLobApp acting as a package. * @param MobileContainedAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileContainedAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property containedApps in deviceAppManagement * @param MobileContainedApp $body The request body * @param MobileContainedAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileContainedApp $body, ?MobileContainedAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?MobileContainedAppItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(MobileContainedApp $body, ?MobileConta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Count/CountRequestBuilder.php index f71661d0433..0ea940a21fa 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/FilesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/FilesRequestBuilder.php index f3493f0aae9..d37ff4787e5 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/FilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/FilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\ContentVersions\Item\Files\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\ContentVersions\Item\Files\Item\MobileAppContentFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of files for this app content version. * @param FilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to files for deviceAppManagement * @param MobileAppContentFile $body The request body * @param FilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContentFile $body, ?FilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContentFile $body, ?FilesReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php index 72f5fbfbe35..8eb806cbe5e 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Commits a file of a given app. * @param CommitPostRequestBody $body The request body * @param CommitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CommitPostRequestBody $body, ?CommitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(CommitPostRequestBody $body, ?CommitReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php index 71626889039..4c16b66d682 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\ContentVersions\Item\Files\Item\Commit\CommitRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\ContentVersions\Item\Files\Item\RenewUpload\RenewUploadRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property files for deviceAppManagement * @param MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of files for this app content version. * @param MobileAppContentFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property files in deviceAppManagement * @param MobileAppContentFile $body The request body * @param MobileAppContentFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContentFile $body, ?MobileAppContentFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentFileItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContentFile $body, ?MobileApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php index 2700d4bd1c6..2a1ed8b8aa4 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Renews the SAS URI for an application file upload. * @param RenewUploadRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RenewUploadRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RenewUploadRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/MobileAppContentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/MobileAppContentItemRequestBuilder.php index f3aa09a2ad6..b8cb4a6afd5 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/MobileAppContentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/ContentVersions/Item/MobileAppContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\ContentVersions\Item\ContainedApps\ContainedAppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\ContentVersions\Item\Files\FilesRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentVersions for deviceAppManagement * @param MobileAppContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of content versions for this app. * @param MobileAppContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentVersions in deviceAppManagement * @param MobileAppContent $body The request body * @param MobileAppContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContent $body, ?MobileAppContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContent $body, ?MobileAppCont $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/GraphWindowsAppXRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/GraphWindowsAppXRequestBuilder.php index 944d85a8485..28a6195dbdf 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/GraphWindowsAppXRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsAppX/GraphWindowsAppXRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsAppX\ContentVersions\ContentVersionsRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.windowsAppX * @param GraphWindowsAppXRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphWindowsAppXRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsAppX::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsAppX::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?GraphWindowsAppXRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?GraphWindowsAppXRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Assignments/AssignmentsRequestBuilder.php index 6cacae7f5ee..a1d2fd1f25f 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Assignments/Count/CountRequestBuilder.php index 1640f7b2eb9..1080392b12b 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index 1b9ed8d123c..f8708daeeb8 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Categories/CategoriesRequestBuilder.php index 1f99aa8607b..6e6d37561ab 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Categories/Count/CountRequestBuilder.php index f0426911439..9ebe029f0c5 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Categories/Item/MobileAppCategoryItemRequestBuilder.php index 7256c038dc4..b7664571b50 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/ContentVersionsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/ContentVersionsRequestBuilder.php index 0a10bf2dec3..e2db316cc10 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/ContentVersionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/ContentVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\ContentVersions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\ContentVersions\Item\MobileAppContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of content versions for this app. * @param ContentVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentVersions for deviceAppManagement * @param MobileAppContent $body The request body * @param ContentVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContent $body, ?ContentVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContent $body, ?ContentVersion $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Count/CountRequestBuilder.php index cba6aa24d2e..6d68861025a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php index 4bef48f9458..bc0df17d79c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\ContentVersions\Item\ContainedApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\ContentVersions\Item\ContainedApps\Item\MobileContainedAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileContainedApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of contained apps in a MobileLobApp acting as a package. * @param ContainedAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContainedAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to containedApps for deviceAppManagement * @param MobileContainedApp $body The request body * @param ContainedAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileContainedApp $body, ?ContainedAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileContainedApp $body, ?ContainedApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php index 1ecc34a0b8c..45a3eb0501c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php index e3211a5e096..60c3a12e2c4 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileContainedApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property containedApps for deviceAppManagement * @param MobileContainedAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileContainedAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of contained apps in a MobileLobApp acting as a package. * @param MobileContainedAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileContainedAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property containedApps in deviceAppManagement * @param MobileContainedApp $body The request body * @param MobileContainedAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileContainedApp $body, ?MobileContainedAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?MobileContainedAppItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(MobileContainedApp $body, ?MobileConta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Count/CountRequestBuilder.php index 8c54ef413d6..ab9ade4b536 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/FilesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/FilesRequestBuilder.php index 8ef2690c64e..db05be2b3af 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/FilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/FilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\ContentVersions\Item\Files\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\ContentVersions\Item\Files\Item\MobileAppContentFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of files for this app content version. * @param FilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to files for deviceAppManagement * @param MobileAppContentFile $body The request body * @param FilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContentFile $body, ?FilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContentFile $body, ?FilesReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php index 65f1a7ae3ca..2b5de003cdb 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Commits a file of a given app. * @param CommitPostRequestBody $body The request body * @param CommitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CommitPostRequestBody $body, ?CommitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(CommitPostRequestBody $body, ?CommitReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php index c867ad77d6f..4857cc7fd9a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\ContentVersions\Item\Files\Item\Commit\CommitRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\ContentVersions\Item\Files\Item\RenewUpload\RenewUploadRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property files for deviceAppManagement * @param MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of files for this app content version. * @param MobileAppContentFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property files in deviceAppManagement * @param MobileAppContentFile $body The request body * @param MobileAppContentFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContentFile $body, ?MobileAppContentFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentFileItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContentFile $body, ?MobileApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php index 6ddb08205f0..f80dc45b8e6 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Renews the SAS URI for an application file upload. * @param RenewUploadRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RenewUploadRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RenewUploadRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/MobileAppContentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/MobileAppContentItemRequestBuilder.php index b07b767433e..e0eec7a21fd 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/MobileAppContentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/ContentVersions/Item/MobileAppContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\ContentVersions\Item\ContainedApps\ContainedAppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\ContentVersions\Item\Files\FilesRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentVersions for deviceAppManagement * @param MobileAppContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of content versions for this app. * @param MobileAppContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentVersions in deviceAppManagement * @param MobileAppContent $body The request body * @param MobileAppContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContent $body, ?MobileAppContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContent $body, ?MobileAppCont $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/GraphWindowsMobileMSIRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/GraphWindowsMobileMSIRequestBuilder.php index a828e4637b8..353fdf30343 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/GraphWindowsMobileMSIRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsMobileMSI/GraphWindowsMobileMSIRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsMobileMSI\ContentVersions\ContentVersionsRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.windowsMobileMSI * @param GraphWindowsMobileMSIRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphWindowsMobileMSIRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsMobileMSI::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsMobileMSI::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?GraphWindowsMobileMSIRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?GraphWindowsMobileMSIRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Assignments/AssignmentsRequestBuilder.php index 4806ee98043..807b3bae72b 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Assignments/Count/CountRequestBuilder.php index 963489a9750..ede723ba67e 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index 6afcfa58bf4..33377076d06 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Categories/CategoriesRequestBuilder.php index 9bc60cfb17c..27af2dc6408 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Categories/Count/CountRequestBuilder.php index cab11736d69..3a81fd43141 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Categories/Item/MobileAppCategoryItemRequestBuilder.php index 30cc53e47cd..3a23df1cabc 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/CommittedContainedApps/CommittedContainedAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/CommittedContainedApps/CommittedContainedAppsRequestBuilder.php index a5f04199c69..1dcb97eb398 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/CommittedContainedApps/CommittedContainedAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/CommittedContainedApps/CommittedContainedAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\CommittedContainedApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\CommittedContainedApps\Item\MobileContainedAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileContainedApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of contained apps in the committed mobileAppContent of a windowsUniversalAppX app. * @param CommittedContainedAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CommittedContainedAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to committedContainedApps for deviceAppManagement * @param MobileContainedApp $body The request body * @param CommittedContainedAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileContainedApp $body, ?CommittedContainedAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?CommittedContainedAppsRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?CommittedContainedAppsRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileContainedApp $body, ?CommittedCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/CommittedContainedApps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/CommittedContainedApps/Count/CountRequestBuilder.php index 30d39e0b1ba..c1d33e91ea0 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/CommittedContainedApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/CommittedContainedApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/CommittedContainedApps/Item/MobileContainedAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/CommittedContainedApps/Item/MobileContainedAppItemRequestBuilder.php index 90894c6371b..2dafeb53fb1 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/CommittedContainedApps/Item/MobileContainedAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/CommittedContainedApps/Item/MobileContainedAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileContainedApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property committedContainedApps for deviceAppManagement * @param MobileContainedAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileContainedAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of contained apps in the committed mobileAppContent of a windowsUniversalAppX app. * @param MobileContainedAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileContainedAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property committedContainedApps in deviceAppManagement * @param MobileContainedApp $body The request body * @param MobileContainedAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileContainedApp $body, ?MobileContainedAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?MobileContainedAppItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(MobileContainedApp $body, ?MobileConta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/ContentVersionsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/ContentVersionsRequestBuilder.php index 64bbee0e7b2..9b00fa21f03 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/ContentVersionsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/ContentVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\ContentVersions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\ContentVersions\Item\MobileAppContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of content versions for this app. * @param ContentVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentVersions for deviceAppManagement * @param MobileAppContent $body The request body * @param ContentVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContent $body, ?ContentVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContentVersionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContent $body, ?ContentVersion $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Count/CountRequestBuilder.php index d6d79522e78..5006b81b564 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php index 29f76ab1c44..d5d570643bd 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/ContainedApps/ContainedAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\ContentVersions\Item\ContainedApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\ContentVersions\Item\ContainedApps\Item\MobileContainedAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileContainedApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of contained apps in a MobileLobApp acting as a package. * @param ContainedAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContainedAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to containedApps for deviceAppManagement * @param MobileContainedApp $body The request body * @param ContainedAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileContainedApp $body, ?ContainedAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ContainedAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileContainedApp $body, ?ContainedApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php index f5effe3c004..39aabd2d3e4 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/ContainedApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php index 5be6b7cb2c0..46a29734aef 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/ContainedApps/Item/MobileContainedAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileContainedApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property containedApps for deviceAppManagement * @param MobileContainedAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileContainedAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of contained apps in a MobileLobApp acting as a package. * @param MobileContainedAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileContainedAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property containedApps in deviceAppManagement * @param MobileContainedApp $body The request body * @param MobileContainedAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileContainedApp $body, ?MobileContainedAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileContainedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?MobileContainedAppItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?MobileContainedAppItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(MobileContainedApp $body, ?MobileConta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Count/CountRequestBuilder.php index b44a013e3d9..015d37a677a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/FilesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/FilesRequestBuilder.php index 3e06bf02964..01e7c0ed9cb 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/FilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/FilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\ContentVersions\Item\Files\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\ContentVersions\Item\Files\Item\MobileAppContentFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of files for this app content version. * @param FilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to files for deviceAppManagement * @param MobileAppContentFile $body The request body * @param FilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MobileAppContentFile $body, ?FilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(MobileAppContentFile $body, ?FilesReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php index 5ea58c0b39a..15de7753c6d 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Item/Commit/CommitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Commits a file of a given app. * @param CommitPostRequestBody $body The request body * @param CommitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CommitPostRequestBody $body, ?CommitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(CommitPostRequestBody $body, ?CommitReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php index 2dbc865c5b3..3219c06f4ee 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Item/MobileAppContentFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\ContentVersions\Item\Files\Item\Commit\CommitRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\ContentVersions\Item\Files\Item\RenewUpload\RenewUploadRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContentFile; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property files for deviceAppManagement * @param MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of files for this app content version. * @param MobileAppContentFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property files in deviceAppManagement * @param MobileAppContentFile $body The request body * @param MobileAppContentFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContentFile $body, ?MobileAppContentFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContentFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentFileItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentFileItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContentFile $body, ?MobileApp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php index 4b264f9a56c..d93eb6598ec 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/Files/Item/RenewUpload/RenewUploadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Renews the SAS URI for an application file upload. * @param RenewUploadRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RenewUploadRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RenewUploadRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/MobileAppContentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/MobileAppContentItemRequestBuilder.php index 63bf91b5bbb..c08876542b4 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/MobileAppContentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/ContentVersions/Item/MobileAppContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\ContentVersions\Item\ContainedApps\ContainedAppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\ContentVersions\Item\Files\FilesRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppContent; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentVersions for deviceAppManagement * @param MobileAppContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MobileAppContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of content versions for this app. * @param MobileAppContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentVersions in deviceAppManagement * @param MobileAppContent $body The request body * @param MobileAppContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MobileAppContent $body, ?MobileAppContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?MobileAppContentItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?MobileAppContentItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(MobileAppContent $body, ?MobileAppCont $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/GraphWindowsUniversalAppXRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/GraphWindowsUniversalAppXRequestBuilder.php index d48c153a964..44605c839a9 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/GraphWindowsUniversalAppXRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsUniversalAppX/GraphWindowsUniversalAppXRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsUniversalAppX\CommittedContainedApps\CommittedContainedAppsRequestBuilder; @@ -66,19 +65,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.windowsUniversalAppX * @param GraphWindowsUniversalAppXRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphWindowsUniversalAppXRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsUniversalAppX::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsUniversalAppX::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -91,7 +87,6 @@ public function toGetRequestInformation(?GraphWindowsUniversalAppXRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -99,6 +94,7 @@ public function toGetRequestInformation(?GraphWindowsUniversalAppXRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Assignments/AssignmentsRequestBuilder.php index 833c9bbbcc2..9e876ed0ba8 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsWebApp\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsWebApp\Assignments\Item\MobileAppAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Assignments/Count/CountRequestBuilder.php index e51e4811d19..8bed0fc982c 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php index b9c13eb5aca..bd96612f03a 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Assignments/Item/MobileAppAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppAssignment. * @param MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppAssignment object. * @param MobileAppAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppAssignment object. * @param MobileAppAssignment $body The request body * @param MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-apps-mobileappassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppAssignment $body, ?MobileAppAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileAppAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileAppAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileAppAssignment $body, ?MobileAppA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Categories/CategoriesRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Categories/CategoriesRequestBuilder.php index 6b05adc199c..c906368cc8e 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsWebApp\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsWebApp\Categories\Item\MobileAppCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppCategoryCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Categories/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Categories/Count/CountRequestBuilder.php index e581bdc7466..7b17e4cae9b 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php index c9f30d7b329..f3c7c6224df 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/Categories/Item/MobileAppCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileAppCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of categories for this app. * @param MobileAppCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MobileAppCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MobileAppCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/GraphWindowsWebAppRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/GraphWindowsWebAppRequestBuilder.php index a4a7242023d..f18b035def7 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/GraphWindowsWebAppRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/GraphWindowsWebApp/GraphWindowsWebAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsWebApp\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\GraphWindowsWebApp\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.mobileApp as microsoft.graph.windowsWebApp * @param GraphWindowsWebAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphWindowsWebAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsWebApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsWebApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?GraphWindowsWebAppRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?GraphWindowsWebAppRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/MobileAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/Item/MobileAppItemRequestBuilder.php index bb64d5b5b3d..ed0b4c39c45 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/MobileAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/MobileAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\Assign\AssignRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Item\Categories\CategoriesRequestBuilder; @@ -184,65 +183,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Deletes a windowsMobileMSI. + * Deletes a windowsMicrosoftEdgeApp. * @param MobileAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-apps-windowsmobilemsi-delete?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-apps-windowsmicrosoftedgeapp-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read properties and relationships of the windowsAppX object. + * Read properties and relationships of the win32LobApp object. * @param MobileAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-apps-windowsappx-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-apps-win32lobapp-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update the properties of a win32LobApp object. + * Update the properties of a managedIOSStoreApp object. * @param MobileApp $body The request body * @param MobileAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-apps-win32lobapp-update?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-apps-managediosstoreapp-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileApp $body, ?MobileAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Deletes a windowsMobileMSI. + * Deletes a windowsMicrosoftEdgeApp. * @param MobileAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -255,11 +245,12 @@ public function toDeleteRequestInformation(?MobileAppItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read properties and relationships of the windowsAppX object. + * Read properties and relationships of the win32LobApp object. * @param MobileAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -268,7 +259,6 @@ public function toGetRequestInformation(?MobileAppItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -276,11 +266,12 @@ public function toGetRequestInformation(?MobileAppItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the properties of a win32LobApp object. + * Update the properties of a managedIOSStoreApp object. * @param MobileApp $body The request body * @param MobileAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -290,11 +281,11 @@ public function toPatchRequestInformation(MobileApp $body, ?MobileAppItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/Item/MobileAppItemRequestBuilderGetQueryParameters.php b/src/Generated/DeviceAppManagement/MobileApps/Item/MobileAppItemRequestBuilderGetQueryParameters.php index 4221055abc6..6755f5b832b 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/Item/MobileAppItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/DeviceAppManagement/MobileApps/Item/MobileAppItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read properties and relationships of the windowsAppX object. + * Read properties and relationships of the win32LobApp object. */ class MobileAppItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/DeviceAppManagement/MobileApps/MobileAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/MobileApps/MobileAppsRequestBuilder.php index 010f548d9d0..7a5ca6cf021 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/MobileAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/MobileApps/MobileAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphAndroidLobApp\GraphAndroidLobAppRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\MobileApps\GraphAndroidStoreApp\GraphAndroidStoreAppRequestBuilder; @@ -181,46 +180,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List properties and relationships of the windowsMicrosoftEdgeApp objects. + * List properties and relationships of the win32LobApp objects. * @param MobileAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-apps-windowsmicrosoftedgeapp-list?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-apps-win32lobapp-list?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create a new windowsUniversalAppX object. + * Create a new managedIOSLobApp object. * @param MobileApp $body The request body * @param MobileAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-apps-windowsuniversalappx-create?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-apps-managedioslobapp-create?view=graph-rest-1.0 Find more info here */ public function post(MobileApp $body, ?MobileAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List properties and relationships of the windowsMicrosoftEdgeApp objects. + * List properties and relationships of the win32LobApp objects. * @param MobileAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -229,7 +222,6 @@ public function toGetRequestInformation(?MobileAppsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -237,11 +229,12 @@ public function toGetRequestInformation(?MobileAppsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create a new windowsUniversalAppX object. + * Create a new managedIOSLobApp object. * @param MobileApp $body The request body * @param MobileAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -251,11 +244,11 @@ public function toPostRequestInformation(MobileApp $body, ?MobileAppsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/MobileApps/MobileAppsRequestBuilderGetQueryParameters.php b/src/Generated/DeviceAppManagement/MobileApps/MobileAppsRequestBuilderGetQueryParameters.php index 6a62fd492bf..ee26d51f179 100644 --- a/src/Generated/DeviceAppManagement/MobileApps/MobileAppsRequestBuilderGetQueryParameters.php +++ b/src/Generated/DeviceAppManagement/MobileApps/MobileAppsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List properties and relationships of the windowsMicrosoftEdgeApp objects. + * List properties and relationships of the win32LobApp objects. */ class MobileAppsRequestBuilderGetQueryParameters { diff --git a/src/Generated/DeviceAppManagement/SyncMicrosoftStoreForBusinessApps/SyncMicrosoftStoreForBusinessAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/SyncMicrosoftStoreForBusinessApps/SyncMicrosoftStoreForBusinessAppsRequestBuilder.php index e5dc0fdb35e..e565ffb1da9 100644 --- a/src/Generated/DeviceAppManagement/SyncMicrosoftStoreForBusinessApps/SyncMicrosoftStoreForBusinessAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/SyncMicrosoftStoreForBusinessApps/SyncMicrosoftStoreForBusinessAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Syncs Intune account with Microsoft Store For Business * @param SyncMicrosoftStoreForBusinessAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-deviceappmanagement-syncmicrosoftstoreforbusinessapps?view=graph-rest-1.0 Find more info here */ public function post(?SyncMicrosoftStoreForBusinessAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SyncMicrosoftStoreForBusinessAppsReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Count/CountRequestBuilder.php index 8c397d6384b..14272e44e09 100644 --- a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Apps/AppsRequestBuilder.php b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Apps/AppsRequestBuilder.php index 2d8ab9813b0..2b793bfb72d 100644 --- a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Apps/AppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Apps/AppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\TargetedManagedAppConfigurations\Item\Apps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\TargetedManagedAppConfigurations\Item\Apps\Item\ManagedMobileAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedMobileApp; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List of apps to which the policy is deployed. * @param AppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to apps for deviceAppManagement * @param ManagedMobileApp $body The request body * @param AppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ManagedMobileApp $body, ?AppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AppsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AppsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ManagedMobileApp $body, ?AppsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Apps/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Apps/Count/CountRequestBuilder.php index 24107fb64f2..6b1e537c2cd 100644 --- a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Apps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Apps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php index b0f8017206d..4268451471b 100644 --- a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Apps/Item/ManagedMobileAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedMobileApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property apps for deviceAppManagement * @param ManagedMobileAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ManagedMobileAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * List of apps to which the policy is deployed. * @param ManagedMobileAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedMobileAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property apps in deviceAppManagement * @param ManagedMobileApp $body The request body * @param ManagedMobileAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ManagedMobileApp $body, ?ManagedMobileAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedMobileApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ManagedMobileAppItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ManagedMobileAppItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ManagedMobileAppItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ManagedMobileApp $body, ?ManagedMobile $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assign/AssignRequestBuilder.php b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assign/AssignRequestBuilder.php index 02960b0d6b5..8344e3be711 100644 --- a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assign/AssignRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assign/AssignRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param AssignPostRequestBody $body The request body * @param AssignRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-targetedmanagedappconfiguration-assign?view=graph-rest-1.0 Find more info here */ public function post(AssignPostRequestBody $body, ?AssignRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AssignPostRequestBody $body, ?AssignReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assignments/AssignmentsRequestBuilder.php index 5536f173950..7a2e11365fe 100644 --- a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\TargetedManagedAppConfigurations\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\TargetedManagedAppConfigurations\Item\Assignments\Item\TargetedManagedAppPolicyAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Navigation property to list of inclusion and exclusion groups to which the policy is deployed. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to assignments for deviceAppManagement * @param TargetedManagedAppPolicyAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TargetedManagedAppPolicyAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(TargetedManagedAppPolicyAssignment $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assignments/Count/CountRequestBuilder.php index bea56318943..028662759dd 100644 --- a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php index bf2aebd785d..7e858e573fa 100644 --- a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TargetedManagedAppPolicyAssignment; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignments for deviceAppManagement * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TargetedManagedAppPolicyAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Navigation property to list of inclusion and exclusion groups to which the policy is deployed. * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TargetedManagedAppPolicyAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignments in deviceAppManagement * @param TargetedManagedAppPolicyAssignment $body The request body * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TargetedManagedAppPolicyAssignment $body, ?TargetedManagedAppPolicyAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?TargetedManagedAppPolicyAssignmentIt $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?TargetedManagedAppPolicyAssignmentItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?TargetedManagedAppPolicyAssignmentItemR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(TargetedManagedAppPolicyAssignment $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php index a5d76b1dc8c..29e8ba47916 100644 --- a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/DeploymentSummary/DeploymentSummaryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedAppPolicyDeploymentSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deploymentSummary for deviceAppManagement * @param DeploymentSummaryRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeploymentSummaryRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Navigation property to deployment summary of the configuration. * @param DeploymentSummaryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeploymentSummaryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property deploymentSummary in deviceAppManagement * @param ManagedAppPolicyDeploymentSummary $body The request body * @param DeploymentSummaryRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ManagedAppPolicyDeploymentSummary $body, ?DeploymentSummaryRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppPolicyDeploymentSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DeploymentSummaryRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DeploymentSummaryRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DeploymentSummaryRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ManagedAppPolicyDeploymentSummary $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/TargetApps/TargetAppsRequestBuilder.php b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/TargetApps/TargetAppsRequestBuilder.php index 6fad58cd365..b3dac55bcc7 100644 --- a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/TargetApps/TargetAppsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/TargetApps/TargetAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param TargetAppsPostRequestBody $body The request body * @param TargetAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-targetedmanagedappconfiguration-targetapps?view=graph-rest-1.0 Find more info here */ public function post(TargetAppsPostRequestBody $body, ?TargetAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TargetAppsPostRequestBody $body, ?Targe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/TargetedManagedAppConfigurationItemRequestBuilder.php b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/TargetedManagedAppConfigurationItemRequestBuilder.php index e9b7dcd8e2b..d239b3e92e6 100644 --- a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/TargetedManagedAppConfigurationItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/Item/TargetedManagedAppConfigurationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\TargetedManagedAppConfigurations\Item\Apps\AppsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\TargetedManagedAppConfigurations\Item\Assign\AssignRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\TargetedManagedAppConfigurations\Item\Assignments\AssignmentsRequestBuilder; @@ -74,59 +73,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a targetedManagedAppConfiguration. * @param TargetedManagedAppConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-targetedmanagedappconfiguration-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TargetedManagedAppConfigurationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the targetedManagedAppConfiguration object. * @param TargetedManagedAppConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-targetedmanagedappconfiguration-get?view=graph-rest-1.0 Find more info here */ public function get(?TargetedManagedAppConfigurationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a targetedManagedAppConfiguration object. * @param TargetedManagedAppConfiguration $body The request body * @param TargetedManagedAppConfigurationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-targetedmanagedappconfiguration-update?view=graph-rest-1.0 Find more info here */ public function patch(TargetedManagedAppConfiguration $body, ?TargetedManagedAppConfigurationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -143,6 +133,7 @@ public function toDeleteRequestInformation(?TargetedManagedAppConfigurationItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -156,7 +147,6 @@ public function toGetRequestInformation(?TargetedManagedAppConfigurationItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -164,6 +154,7 @@ public function toGetRequestInformation(?TargetedManagedAppConfigurationItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -178,11 +169,11 @@ public function toPatchRequestInformation(TargetedManagedAppConfiguration $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/TargetedManagedAppConfigurationsRequestBuilder.php b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/TargetedManagedAppConfigurationsRequestBuilder.php index cc73646f72a..2a2d4fccbb7 100644 --- a/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/TargetedManagedAppConfigurationsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/TargetedManagedAppConfigurations/TargetedManagedAppConfigurationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\TargetedManagedAppConfigurations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\TargetedManagedAppConfigurations\Item\TargetedManagedAppConfigurationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the targetedManagedAppConfiguration objects. * @param TargetedManagedAppConfigurationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-targetedmanagedappconfiguration-list?view=graph-rest-1.0 Find more info here */ public function get(?TargetedManagedAppConfigurationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new targetedManagedAppConfiguration object. * @param TargetedManagedAppConfiguration $body The request body * @param TargetedManagedAppConfigurationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-targetedmanagedappconfiguration-create?view=graph-rest-1.0 Find more info here */ public function post(TargetedManagedAppConfiguration $body, ?TargetedManagedAppConfigurationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TargetedManagedAppConfigurationsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TargetedManagedAppConfigurationsRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TargetedManagedAppConfiguration $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/VppTokens/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/VppTokens/Count/CountRequestBuilder.php index aec6087e791..556e64c5225 100644 --- a/src/Generated/DeviceAppManagement/VppTokens/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/VppTokens/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/VppTokens/Item/SyncLicenses/SyncLicensesRequestBuilder.php b/src/Generated/DeviceAppManagement/VppTokens/Item/SyncLicenses/SyncLicensesRequestBuilder.php index 6233f4adf85..b9fa90bf49b 100644 --- a/src/Generated/DeviceAppManagement/VppTokens/Item/SyncLicenses/SyncLicensesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/VppTokens/Item/SyncLicenses/SyncLicensesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\VppToken; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Syncs licenses associated with a specific appleVolumePurchaseProgramToken * @param SyncLicensesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-vpptoken-synclicenses?view=graph-rest-1.0 Find more info here */ public function post(?SyncLicensesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [VppToken::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [VppToken::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?SyncLicensesRequestBuilderPostRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/VppTokens/Item/VppTokenItemRequestBuilder.php b/src/Generated/DeviceAppManagement/VppTokens/Item/VppTokenItemRequestBuilder.php index 30cc42cb34a..dbe30508354 100644 --- a/src/Generated/DeviceAppManagement/VppTokens/Item/VppTokenItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/VppTokens/Item/VppTokenItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\VppTokens\Item\SyncLicenses\SyncLicensesRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\VppToken; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a vppToken. * @param VppTokenItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-vpptoken-delete?view=graph-rest-1.0 Find more info here */ public function delete(?VppTokenItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the vppToken object. * @param VppTokenItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-vpptoken-get?view=graph-rest-1.0 Find more info here */ public function get(?VppTokenItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [VppToken::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [VppToken::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a vppToken object. * @param VppToken $body The request body * @param VppTokenItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-vpptoken-update?view=graph-rest-1.0 Find more info here */ public function patch(VppToken $body, ?VppTokenItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [VppToken::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [VppToken::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?VppTokenItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?VppTokenItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?VppTokenItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(VppToken $body, ?VppTokenItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/VppTokens/VppTokensRequestBuilder.php b/src/Generated/DeviceAppManagement/VppTokens/VppTokensRequestBuilder.php index a5f7b363d3f..4cb70130cb9 100644 --- a/src/Generated/DeviceAppManagement/VppTokens/VppTokensRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/VppTokens/VppTokensRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\VppTokens\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\VppTokens\Item\VppTokenItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the vppToken objects. * @param VppTokensRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-vpptoken-list?view=graph-rest-1.0 Find more info here */ public function get(?VppTokensRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [VppTokenCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [VppTokenCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new vppToken object. * @param VppToken $body The request body * @param VppTokensRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-vpptoken-create?view=graph-rest-1.0 Find more info here */ public function post(VppToken $body, ?VppTokensRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [VppToken::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [VppToken::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?VppTokensRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?VppTokensRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(VppToken $body, ?VppTokensRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Count/CountRequestBuilder.php index 4920841630f..e6523b84a30 100644 --- a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/Assignments/AssignmentsRequestBuilder.php index 445e7b2ae96..feaf85f075f 100644 --- a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\WindowsInformationProtectionPolicies\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\WindowsInformationProtectionPolicies\Item\Assignments\Item\TargetedManagedAppPolicyAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Navigation property to list of security groups targeted for policy. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to assignments for deviceAppManagement * @param TargetedManagedAppPolicyAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TargetedManagedAppPolicyAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(TargetedManagedAppPolicyAssignment $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/Assignments/Count/CountRequestBuilder.php index 196f6bb47df..4f8195f8341 100644 --- a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php index e04429c4bcb..109053ac94d 100644 --- a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/Assignments/Item/TargetedManagedAppPolicyAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TargetedManagedAppPolicyAssignment; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignments for deviceAppManagement * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TargetedManagedAppPolicyAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Navigation property to list of security groups targeted for policy. * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TargetedManagedAppPolicyAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignments in deviceAppManagement * @param TargetedManagedAppPolicyAssignment $body The request body * @param TargetedManagedAppPolicyAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TargetedManagedAppPolicyAssignment $body, ?TargetedManagedAppPolicyAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetedManagedAppPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?TargetedManagedAppPolicyAssignmentIt $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?TargetedManagedAppPolicyAssignmentItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?TargetedManagedAppPolicyAssignmentItemR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(TargetedManagedAppPolicyAssignment $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Count/CountRequestBuilder.php index 08a902e1ceb..510f7bf89dd 100644 --- a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/ExemptAppLockerFilesRequestBuilder.php b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/ExemptAppLockerFilesRequestBuilder.php index 0c753d10500..9933c8c6f94 100644 --- a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/ExemptAppLockerFilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/ExemptAppLockerFilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\WindowsInformationProtectionPolicies\Item\ExemptAppLockerFiles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\WindowsInformationProtectionPolicies\Item\ExemptAppLockerFiles\Item\WindowsInformationProtectionAppLockerFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Another way to input exempt apps through xml files * @param ExemptAppLockerFilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExemptAppLockerFilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to exemptAppLockerFiles for deviceAppManagement * @param WindowsInformationProtectionAppLockerFile $body The request body * @param ExemptAppLockerFilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WindowsInformationProtectionAppLockerFile $body, ?ExemptAppLockerFilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExemptAppLockerFilesRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExemptAppLockerFilesRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(WindowsInformationProtectionAppLockerFi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php index 9e20ae8dcb5..a5e91ea205a 100644 --- a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ExemptAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsInformationProtectionAppLockerFile; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property exemptAppLockerFiles for deviceAppManagement * @param WindowsInformationProtectionAppLockerFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WindowsInformationProtectionAppLockerFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Another way to input exempt apps through xml files * @param WindowsInformationProtectionAppLockerFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WindowsInformationProtectionAppLockerFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property exemptAppLockerFiles in deviceAppManagement * @param WindowsInformationProtectionAppLockerFile $body The request body * @param WindowsInformationProtectionAppLockerFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WindowsInformationProtectionAppLockerFile $body, ?WindowsInformationProtectionAppLockerFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?WindowsInformationProtectionAppLocke $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?WindowsInformationProtectionAppLockerFi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?WindowsInformationProtectionAppLockerFi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(WindowsInformationProtectionAppLockerF $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Count/CountRequestBuilder.php b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Count/CountRequestBuilder.php index 22f59ab2aec..2283e6cc3b5 100644 --- a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php index dde72dfe5ed..fbd9389e4e4 100644 --- a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/Item/WindowsInformationProtectionAppLockerFileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsInformationProtectionAppLockerFile; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property protectedAppLockerFiles for deviceAppManagement * @param WindowsInformationProtectionAppLockerFileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WindowsInformationProtectionAppLockerFileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Another way to input protected apps through xml files * @param WindowsInformationProtectionAppLockerFileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WindowsInformationProtectionAppLockerFileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property protectedAppLockerFiles in deviceAppManagement * @param WindowsInformationProtectionAppLockerFile $body The request body * @param WindowsInformationProtectionAppLockerFileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WindowsInformationProtectionAppLockerFile $body, ?WindowsInformationProtectionAppLockerFileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?WindowsInformationProtectionAppLocke $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?WindowsInformationProtectionAppLockerFi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?WindowsInformationProtectionAppLockerFi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(WindowsInformationProtectionAppLockerF $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/ProtectedAppLockerFilesRequestBuilder.php b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/ProtectedAppLockerFilesRequestBuilder.php index e6cb219acbb..d856b6ab636 100644 --- a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/ProtectedAppLockerFilesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/ProtectedAppLockerFiles/ProtectedAppLockerFilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\WindowsInformationProtectionPolicies\Item\ProtectedAppLockerFiles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\WindowsInformationProtectionPolicies\Item\ProtectedAppLockerFiles\Item\WindowsInformationProtectionAppLockerFileItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Another way to input protected apps through xml files * @param ProtectedAppLockerFilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ProtectedAppLockerFilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to protectedAppLockerFiles for deviceAppManagement * @param WindowsInformationProtectionAppLockerFile $body The request body * @param ProtectedAppLockerFilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WindowsInformationProtectionAppLockerFile $body, ?ProtectedAppLockerFilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLockerFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ProtectedAppLockerFilesRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ProtectedAppLockerFilesRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(WindowsInformationProtectionAppLockerFi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/WindowsInformationProtectionPolicyItemRequestBuilder.php b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/WindowsInformationProtectionPolicyItemRequestBuilder.php index 89acf4a971d..3dd9cc96851 100644 --- a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/WindowsInformationProtectionPolicyItemRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/Item/WindowsInformationProtectionPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\WindowsInformationProtectionPolicies\Item\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\WindowsInformationProtectionPolicies\Item\ExemptAppLockerFiles\ExemptAppLockerFilesRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\WindowsInformationProtectionPolicies\Item\ProtectedAppLockerFiles\ProtectedAppLockerFilesRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a windowsInformationProtectionPolicy. * @param WindowsInformationProtectionPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-windowsinformationprotectionpolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WindowsInformationProtectionPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the windowsInformationProtectionPolicy object. * @param WindowsInformationProtectionPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-windowsinformationprotectionpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?WindowsInformationProtectionPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a windowsInformationProtectionPolicy object. * @param WindowsInformationProtectionPolicy $body The request body * @param WindowsInformationProtectionPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-windowsinformationprotectionpolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(WindowsInformationProtectionPolicy $body, ?WindowsInformationProtectionPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?WindowsInformationProtectionPolicyIt $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?WindowsInformationProtectionPolicyItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?WindowsInformationProtectionPolicyItemR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(WindowsInformationProtectionPolicy $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/WindowsInformationProtectionPoliciesRequestBuilder.php b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/WindowsInformationProtectionPoliciesRequestBuilder.php index bc4e4be3bfa..2d1cdff4cbd 100644 --- a/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/WindowsInformationProtectionPoliciesRequestBuilder.php +++ b/src/Generated/DeviceAppManagement/WindowsInformationProtectionPolicies/WindowsInformationProtectionPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceAppManagement\WindowsInformationProtectionPolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceAppManagement\WindowsInformationProtectionPolicies\Item\WindowsInformationProtectionPolicyItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the windowsInformationProtectionPolicy objects. * @param WindowsInformationProtectionPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-windowsinformationprotectionpolicy-list?view=graph-rest-1.0 Find more info here */ public function get(?WindowsInformationProtectionPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new windowsInformationProtectionPolicy object. * @param WindowsInformationProtectionPolicy $body The request body * @param WindowsInformationProtectionPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-windowsinformationprotectionpolicy-create?view=graph-rest-1.0 Find more info here */ public function post(WindowsInformationProtectionPolicy $body, ?WindowsInformationProtectionPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?WindowsInformationProtectionPoliciesReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?WindowsInformationProtectionPoliciesReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(WindowsInformationProtectionPolicy $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ApplePushNotificationCertificate/ApplePushNotificationCertificateRequestBuilder.php b/src/Generated/DeviceManagement/ApplePushNotificationCertificate/ApplePushNotificationCertificateRequestBuilder.php index faec6a6434d..ea5a684745b 100644 --- a/src/Generated/DeviceManagement/ApplePushNotificationCertificate/ApplePushNotificationCertificateRequestBuilder.php +++ b/src/Generated/DeviceManagement/ApplePushNotificationCertificate/ApplePushNotificationCertificateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ApplePushNotificationCertificate\DownloadApplePushNotificationCertificateSigningRequest\DownloadApplePushNotificationCertificateSigningRequestRequestBuilder; use Microsoft\Graph\Generated\Models\ApplePushNotificationCertificate; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property applePushNotificationCertificate for deviceManagement * @param ApplePushNotificationCertificateRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ApplePushNotificationCertificateRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the applePushNotificationCertificate object. * @param ApplePushNotificationCertificateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-applepushnotificationcertificate-get?view=graph-rest-1.0 Find more info here */ public function get(?ApplePushNotificationCertificateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplePushNotificationCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplePushNotificationCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a applePushNotificationCertificate object. * @param ApplePushNotificationCertificate $body The request body * @param ApplePushNotificationCertificateRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-applepushnotificationcertificate-update?view=graph-rest-1.0 Find more info here */ public function patch(ApplePushNotificationCertificate $body, ?ApplePushNotificationCertificateRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplePushNotificationCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplePushNotificationCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?ApplePushNotificationCertificateRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?ApplePushNotificationCertificateRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?ApplePushNotificationCertificateRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(ApplePushNotificationCertificate $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ApplePushNotificationCertificate/DownloadApplePushNotificationCertificateSigningRequest/DownloadApplePushNotificationCertificateSigningRequestRequestBuilder.php b/src/Generated/DeviceManagement/ApplePushNotificationCertificate/DownloadApplePushNotificationCertificateSigningRequest/DownloadApplePushNotificationCertificateSigningRequestRequestBuilder.php index 29ddeaaf96f..f17af960608 100644 --- a/src/Generated/DeviceManagement/ApplePushNotificationCertificate/DownloadApplePushNotificationCertificateSigningRequest/DownloadApplePushNotificationCertificateSigningRequestRequestBuilder.php +++ b/src/Generated/DeviceManagement/ApplePushNotificationCertificate/DownloadApplePushNotificationCertificateSigningRequest/DownloadApplePushNotificationCertificateSigningRequestRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Download Apple push notification certificate signing request * @param DownloadApplePushNotificationCertificateSigningRequestRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DownloadApplePushNotificationCertificateSigningRequestRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DownloadApplePushNotificationCertificateSigningRequestGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DownloadApplePushNotificationCertificateSigningRequestGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?DownloadApplePushNotificationCertificat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/AuditEvents/AuditEventsRequestBuilder.php b/src/Generated/DeviceManagement/AuditEvents/AuditEventsRequestBuilder.php index 84acf5c5e47..a52652b1f86 100644 --- a/src/Generated/DeviceManagement/AuditEvents/AuditEventsRequestBuilder.php +++ b/src/Generated/DeviceManagement/AuditEvents/AuditEventsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\AuditEvents\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\AuditEvents\GetAuditActivityTypesWithCategory\GetAuditActivityTypesWithCategoryRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\AuditEvents\GetAuditCategories\GetAuditCategoriesRequestBuilder; @@ -64,20 +63,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the auditEvent objects. * @param AuditEventsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-auditing-auditevent-list?view=graph-rest-1.0 Find more info here */ public function get(?AuditEventsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuditEventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuditEventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,20 +89,17 @@ public function getAuditActivityTypesWithCategory(string $category): GetAuditAct * Create a new auditEvent object. * @param AuditEvent $body The request body * @param AuditEventsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-auditing-auditevent-create?view=graph-rest-1.0 Find more info here */ public function post(AuditEvent $body, ?AuditEventsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuditEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuditEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,7 +112,6 @@ public function toGetRequestInformation(?AuditEventsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -127,6 +119,7 @@ public function toGetRequestInformation(?AuditEventsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -141,11 +134,11 @@ public function toPostRequestInformation(AuditEvent $body, ?AuditEventsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/AuditEvents/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/AuditEvents/Count/CountRequestBuilder.php index a753a49a08e..20c5afa351d 100644 --- a/src/Generated/DeviceManagement/AuditEvents/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/AuditEvents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/AuditEvents/GetAuditActivityTypesWithCategory/GetAuditActivityTypesWithCategoryRequestBuilder.php b/src/Generated/DeviceManagement/AuditEvents/GetAuditActivityTypesWithCategory/GetAuditActivityTypesWithCategoryRequestBuilder.php index c0c261ce9a9..ec50075ebc2 100644 --- a/src/Generated/DeviceManagement/AuditEvents/GetAuditActivityTypesWithCategory/GetAuditActivityTypesWithCategoryRequestBuilder.php +++ b/src/Generated/DeviceManagement/AuditEvents/GetAuditActivityTypesWithCategory/GetAuditActivityTypesWithCategoryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAuditActivityTypes * @param GetAuditActivityTypesWithCategoryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAuditActivityTypesWithCategoryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAuditActivityTypesWithCategoryGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAuditActivityTypesWithCategoryGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?GetAuditActivityTypesWithCategoryReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?GetAuditActivityTypesWithCategoryReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/AuditEvents/GetAuditCategories/GetAuditCategoriesRequestBuilder.php b/src/Generated/DeviceManagement/AuditEvents/GetAuditCategories/GetAuditCategoriesRequestBuilder.php index c716a41098a..8a3ba1907a9 100644 --- a/src/Generated/DeviceManagement/AuditEvents/GetAuditCategories/GetAuditCategoriesRequestBuilder.php +++ b/src/Generated/DeviceManagement/AuditEvents/GetAuditCategories/GetAuditCategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAuditCategories * @param GetAuditCategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAuditCategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAuditCategoriesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAuditCategoriesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAuditCategoriesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAuditCategoriesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/AuditEvents/Item/AuditEventItemRequestBuilder.php b/src/Generated/DeviceManagement/AuditEvents/Item/AuditEventItemRequestBuilder.php index cdd532b243c..dc70483dbaa 100644 --- a/src/Generated/DeviceManagement/AuditEvents/Item/AuditEventItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/AuditEvents/Item/AuditEventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuditEvent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a auditEvent. * @param AuditEventItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-auditing-auditevent-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AuditEventItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the auditEvent object. * @param AuditEventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-auditing-auditevent-get?view=graph-rest-1.0 Find more info here */ public function get(?AuditEventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuditEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuditEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a auditEvent object. * @param AuditEvent $body The request body * @param AuditEventItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-auditing-auditevent-update?view=graph-rest-1.0 Find more info here */ public function patch(AuditEvent $body, ?AuditEventItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuditEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuditEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?AuditEventItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?AuditEventItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?AuditEventItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(AuditEvent $body, ?AuditEventItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ComplianceManagementPartners/ComplianceManagementPartnersRequestBuilder.php b/src/Generated/DeviceManagement/ComplianceManagementPartners/ComplianceManagementPartnersRequestBuilder.php index e5a11bea304..9bf38fe4d0f 100644 --- a/src/Generated/DeviceManagement/ComplianceManagementPartners/ComplianceManagementPartnersRequestBuilder.php +++ b/src/Generated/DeviceManagement/ComplianceManagementPartners/ComplianceManagementPartnersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ComplianceManagementPartners\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\ComplianceManagementPartners\Item\ComplianceManagementPartnerItemRequestBuilder; use Microsoft\Graph\Generated\Models\ComplianceManagementPartner; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the complianceManagementPartner objects. * @param ComplianceManagementPartnersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-compliancemanagementpartner-list?view=graph-rest-1.0 Find more info here */ public function get(?ComplianceManagementPartnersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ComplianceManagementPartnerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ComplianceManagementPartnerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new complianceManagementPartner object. * @param ComplianceManagementPartner $body The request body * @param ComplianceManagementPartnersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-compliancemanagementpartner-create?view=graph-rest-1.0 Find more info here */ public function post(ComplianceManagementPartner $body, ?ComplianceManagementPartnersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ComplianceManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ComplianceManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ComplianceManagementPartnersRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ComplianceManagementPartnersRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ComplianceManagementPartner $body, ?Com $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ComplianceManagementPartners/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/ComplianceManagementPartners/Count/CountRequestBuilder.php index 80d54ccc30e..e5faf2f071b 100644 --- a/src/Generated/DeviceManagement/ComplianceManagementPartners/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/ComplianceManagementPartners/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ComplianceManagementPartners/Item/ComplianceManagementPartnerItemRequestBuilder.php b/src/Generated/DeviceManagement/ComplianceManagementPartners/Item/ComplianceManagementPartnerItemRequestBuilder.php index 48ba03ff128..8730afe9070 100644 --- a/src/Generated/DeviceManagement/ComplianceManagementPartners/Item/ComplianceManagementPartnerItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/ComplianceManagementPartners/Item/ComplianceManagementPartnerItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ComplianceManagementPartner; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a complianceManagementPartner. * @param ComplianceManagementPartnerItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-compliancemanagementpartner-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ComplianceManagementPartnerItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the complianceManagementPartner object. * @param ComplianceManagementPartnerItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-compliancemanagementpartner-get?view=graph-rest-1.0 Find more info here */ public function get(?ComplianceManagementPartnerItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ComplianceManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ComplianceManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a complianceManagementPartner object. * @param ComplianceManagementPartner $body The request body * @param ComplianceManagementPartnerItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-compliancemanagementpartner-update?view=graph-rest-1.0 Find more info here */ public function patch(ComplianceManagementPartner $body, ?ComplianceManagementPartnerItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ComplianceManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ComplianceManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ComplianceManagementPartnerItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ComplianceManagementPartnerItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ComplianceManagementPartnerItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ComplianceManagementPartner $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ConditionalAccessSettings/ConditionalAccessSettingsRequestBuilder.php b/src/Generated/DeviceManagement/ConditionalAccessSettings/ConditionalAccessSettingsRequestBuilder.php index 814f9243b11..5e3d4d176e0 100644 --- a/src/Generated/DeviceManagement/ConditionalAccessSettings/ConditionalAccessSettingsRequestBuilder.php +++ b/src/Generated/DeviceManagement/ConditionalAccessSettings/ConditionalAccessSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnPremisesConditionalAccessSettings; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property conditionalAccessSettings for deviceManagement * @param ConditionalAccessSettingsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ConditionalAccessSettingsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the onPremisesConditionalAccessSettings object. * @param ConditionalAccessSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-onpremisesconditionalaccesssettings-get?view=graph-rest-1.0 Find more info here */ public function get(?ConditionalAccessSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnPremisesConditionalAccessSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnPremisesConditionalAccessSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a onPremisesConditionalAccessSettings object. * @param OnPremisesConditionalAccessSettings $body The request body * @param ConditionalAccessSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-onpremisesconditionalaccesssettings-update?view=graph-rest-1.0 Find more info here */ public function patch(OnPremisesConditionalAccessSettings $body, ?ConditionalAccessSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnPremisesConditionalAccessSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnPremisesConditionalAccessSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ConditionalAccessSettingsRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ConditionalAccessSettingsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ConditionalAccessSettingsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(OnPremisesConditionalAccessSettings $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DetectedApps/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DetectedApps/Count/CountRequestBuilder.php index 3085e0e7788..ac2d53d42d0 100644 --- a/src/Generated/DeviceManagement/DetectedApps/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DetectedApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DetectedApps/DetectedAppsRequestBuilder.php b/src/Generated/DeviceManagement/DetectedApps/DetectedAppsRequestBuilder.php index 75bd019914e..97fefc7911e 100644 --- a/src/Generated/DeviceManagement/DetectedApps/DetectedAppsRequestBuilder.php +++ b/src/Generated/DeviceManagement/DetectedApps/DetectedAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DetectedApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DetectedApps\Item\DetectedAppItemRequestBuilder; use Microsoft\Graph\Generated\Models\DetectedApp; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the detectedApp objects. * @param DetectedAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-detectedapp-list?view=graph-rest-1.0 Find more info here */ public function get(?DetectedAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DetectedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DetectedAppCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new detectedApp object. * @param DetectedApp $body The request body * @param DetectedAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-detectedapp-create?view=graph-rest-1.0 Find more info here */ public function post(DetectedApp $body, ?DetectedAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DetectedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DetectedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DetectedAppsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DetectedAppsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DetectedApp $body, ?DetectedAppsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DetectedApps/Item/DetectedAppItemRequestBuilder.php b/src/Generated/DeviceManagement/DetectedApps/Item/DetectedAppItemRequestBuilder.php index 96093a2725d..971fe5e0fc2 100644 --- a/src/Generated/DeviceManagement/DetectedApps/Item/DetectedAppItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DetectedApps/Item/DetectedAppItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DetectedApps\Item\ManagedDevices\ManagedDevicesRequestBuilder; use Microsoft\Graph\Generated\Models\DetectedApp; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a detectedApp. * @param DetectedAppItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-detectedapp-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DetectedAppItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the detectedApp object. * @param DetectedAppItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-detectedapp-get?view=graph-rest-1.0 Find more info here */ public function get(?DetectedAppItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DetectedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DetectedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a detectedApp object. * @param DetectedApp $body The request body * @param DetectedAppItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-detectedapp-update?view=graph-rest-1.0 Find more info here */ public function patch(DetectedApp $body, ?DetectedAppItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DetectedApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DetectedApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?DetectedAppItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?DetectedAppItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?DetectedAppItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(DetectedApp $body, ?DetectedAppItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DetectedApps/Item/ManagedDevices/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DetectedApps/Item/ManagedDevices/Count/CountRequestBuilder.php index 76f2f505fa2..5f07661a6f4 100644 --- a/src/Generated/DeviceManagement/DetectedApps/Item/ManagedDevices/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DetectedApps/Item/ManagedDevices/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DetectedApps/Item/ManagedDevices/Item/ManagedDeviceItemRequestBuilder.php b/src/Generated/DeviceManagement/DetectedApps/Item/ManagedDevices/Item/ManagedDeviceItemRequestBuilder.php index 12403649ec1..69bcdf013b9 100644 --- a/src/Generated/DeviceManagement/DetectedApps/Item/ManagedDevices/Item/ManagedDeviceItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DetectedApps/Item/ManagedDevices/Item/ManagedDeviceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedDevice; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The devices that have the discovered application installed * @param ManagedDeviceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedDeviceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ManagedDeviceItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ManagedDeviceItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DetectedApps/Item/ManagedDevices/ManagedDevicesRequestBuilder.php b/src/Generated/DeviceManagement/DetectedApps/Item/ManagedDevices/ManagedDevicesRequestBuilder.php index d1a4f7288ef..50639dea0bc 100644 --- a/src/Generated/DeviceManagement/DetectedApps/Item/ManagedDevices/ManagedDevicesRequestBuilder.php +++ b/src/Generated/DeviceManagement/DetectedApps/Item/ManagedDevices/ManagedDevicesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DetectedApps\Item\ManagedDevices\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DetectedApps\Item\ManagedDevices\Item\ManagedDeviceItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedDeviceCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The devices that have the discovered application installed * @param ManagedDevicesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedDevicesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ManagedDevicesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ManagedDevicesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCategories/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCategories/Count/CountRequestBuilder.php index bf99d25ad01..c7888b202a1 100644 --- a/src/Generated/DeviceManagement/DeviceCategories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCategories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCategories/DeviceCategoriesRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCategories/DeviceCategoriesRequestBuilder.php index c4a7c2fe716..730fedaa348 100644 --- a/src/Generated/DeviceManagement/DeviceCategories/DeviceCategoriesRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCategories/DeviceCategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceCategories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceCategories\Item\DeviceCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceCategory; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceCategory objects. * @param DeviceCategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicecategory-list?view=graph-rest-1.0 Find more info here */ public function get(?DeviceCategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceCategory object. * @param DeviceCategory $body The request body * @param DeviceCategoriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicecategory-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceCategory $body, ?DeviceCategoriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DeviceCategoriesRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DeviceCategoriesRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceCategory $body, ?DeviceCategories $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCategories/Item/DeviceCategoryItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCategories/Item/DeviceCategoryItemRequestBuilder.php index 881f069bafa..fb1a8aba541 100644 --- a/src/Generated/DeviceManagement/DeviceCategories/Item/DeviceCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCategories/Item/DeviceCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceCategory. * @param DeviceCategoryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicecategory-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceCategoryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceCategory object. * @param DeviceCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicecategory-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceCategory object. * @param DeviceCategory $body The request body * @param DeviceCategoryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicecategory-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceCategory $body, ?DeviceCategoryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?DeviceCategoryItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?DeviceCategoryItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?DeviceCategoryItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(DeviceCategory $body, ?DeviceCategoryI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Count/CountRequestBuilder.php index 185d1d0a8d2..2156b760b05 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/DeviceCompliancePoliciesRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/DeviceCompliancePoliciesRequestBuilder.php index f69322d1d23..bab57551947 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/DeviceCompliancePoliciesRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/DeviceCompliancePoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\DeviceCompliancePolicyItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceCompliancePolicy; @@ -53,46 +52,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List properties and relationships of the windows81CompliancePolicy objects. + * List properties and relationships of the iosCompliancePolicy objects. * @param DeviceCompliancePoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-windows81compliancepolicy-list?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-ioscompliancepolicy-list?view=graph-rest-1.0 Find more info here */ public function get(?DeviceCompliancePoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create a new androidCompliancePolicy object. + * Create a new windows10MobileCompliancePolicy object. * @param DeviceCompliancePolicy $body The request body * @param DeviceCompliancePoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-androidcompliancepolicy-create?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-windows10mobilecompliancepolicy-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceCompliancePolicy $body, ?DeviceCompliancePoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List properties and relationships of the windows81CompliancePolicy objects. + * List properties and relationships of the iosCompliancePolicy objects. * @param DeviceCompliancePoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DeviceCompliancePoliciesRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,11 +101,12 @@ public function toGetRequestInformation(?DeviceCompliancePoliciesRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create a new androidCompliancePolicy object. + * Create a new windows10MobileCompliancePolicy object. * @param DeviceCompliancePolicy $body The request body * @param DeviceCompliancePoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceCompliancePolicy $body, ?DeviceCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/DeviceCompliancePoliciesRequestBuilderGetQueryParameters.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/DeviceCompliancePoliciesRequestBuilderGetQueryParameters.php index 6db7f8ebbde..991307a65ca 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/DeviceCompliancePoliciesRequestBuilderGetQueryParameters.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/DeviceCompliancePoliciesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List properties and relationships of the windows81CompliancePolicy objects. + * List properties and relationships of the iosCompliancePolicy objects. */ class DeviceCompliancePoliciesRequestBuilderGetQueryParameters { diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assign/AssignRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assign/AssignRequestBuilder.php index a467680f90f..c00e3cd32b1 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assign/AssignRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assign/AssignRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param AssignPostRequestBody $body The request body * @param AssignRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicy-assign?view=graph-rest-1.0 Find more info here */ public function post(AssignPostRequestBody $body, ?AssignRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AssignPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AssignPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AssignPostRequestBody $body, ?AssignReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assignments/AssignmentsRequestBuilder.php index 3c66d61ee72..fba26baeacd 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\Assignments\Item\DeviceCompliancePolicyAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceCompliancePolicyAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceCompliancePolicyAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicyassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceCompliancePolicyAssignment object. * @param DeviceCompliancePolicyAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicyassignment-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceCompliancePolicyAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceCompliancePolicyAssignment $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assignments/Count/CountRequestBuilder.php index 86ef7363afa..36a4ce586a2 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assignments/Item/DeviceCompliancePolicyAssignmentItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assignments/Item/DeviceCompliancePolicyAssignmentItemRequestBuilder.php index 1bcaf4539c9..97fd4c940a7 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assignments/Item/DeviceCompliancePolicyAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/Assignments/Item/DeviceCompliancePolicyAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceCompliancePolicyAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceCompliancePolicyAssignment. * @param DeviceCompliancePolicyAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicyassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceCompliancePolicyAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceCompliancePolicyAssignment object. * @param DeviceCompliancePolicyAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicyassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceCompliancePolicyAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceCompliancePolicyAssignment object. * @param DeviceCompliancePolicyAssignment $body The request body * @param DeviceCompliancePolicyAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicyassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceCompliancePolicyAssignment $body, ?DeviceCompliancePolicyAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?DeviceCompliancePolicyAssignmentItem $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?DeviceCompliancePolicyAssignmentItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?DeviceCompliancePolicyAssignmentItemReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(DeviceCompliancePolicyAssignment $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceCompliancePolicyItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceCompliancePolicyItemRequestBuilder.php index 68fe72f8ef8..44f74389c63 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceCompliancePolicyItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceCompliancePolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\Assign\AssignRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\DeviceSettingStateSummaries\DeviceSettingStateSummariesRequestBuilder; @@ -104,65 +103,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Deletes a iosCompliancePolicy. + * Deletes a windows10MobileCompliancePolicy. * @param DeviceCompliancePolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-ioscompliancepolicy-delete?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-windows10mobilecompliancepolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceCompliancePolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the macOSCompliancePolicy object. * @param DeviceCompliancePolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-macoscompliancepolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceCompliancePolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update the properties of a windows10CompliancePolicy object. + * Update the properties of a windows10MobileCompliancePolicy object. * @param DeviceCompliancePolicy $body The request body * @param DeviceCompliancePolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-windows10compliancepolicy-update?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-windows10mobilecompliancepolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceCompliancePolicy $body, ?DeviceCompliancePolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Deletes a iosCompliancePolicy. + * Deletes a windows10MobileCompliancePolicy. * @param DeviceCompliancePolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -175,6 +165,7 @@ public function toDeleteRequestInformation(?DeviceCompliancePolicyItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -188,7 +179,6 @@ public function toGetRequestInformation(?DeviceCompliancePolicyItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -196,11 +186,12 @@ public function toGetRequestInformation(?DeviceCompliancePolicyItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the properties of a windows10CompliancePolicy object. + * Update the properties of a windows10MobileCompliancePolicy object. * @param DeviceCompliancePolicy $body The request body * @param DeviceCompliancePolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -210,11 +201,11 @@ public function toPatchRequestInformation(DeviceCompliancePolicy $body, ?DeviceC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceSettingStateSummaries/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceSettingStateSummaries/Count/CountRequestBuilder.php index fabfa027422..ec0cf8091b5 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceSettingStateSummaries/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceSettingStateSummaries/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceSettingStateSummaries/DeviceSettingStateSummariesRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceSettingStateSummaries/DeviceSettingStateSummariesRequestBuilder.php index dd3626a81b9..fd964a1a3d2 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceSettingStateSummaries/DeviceSettingStateSummariesRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceSettingStateSummaries/DeviceSettingStateSummariesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\DeviceSettingStateSummaries\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\DeviceSettingStateSummaries\Item\SettingStateDeviceSummaryItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Compliance Setting State Device Summary * @param DeviceSettingStateSummariesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceSettingStateSummariesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to deviceSettingStateSummaries for deviceManagement * @param SettingStateDeviceSummary $body The request body * @param DeviceSettingStateSummariesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SettingStateDeviceSummary $body, ?DeviceSettingStateSummariesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DeviceSettingStateSummariesRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DeviceSettingStateSummariesRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(SettingStateDeviceSummary $body, ?Devic $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceSettingStateSummaries/Item/SettingStateDeviceSummaryItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceSettingStateSummaries/Item/SettingStateDeviceSummaryItemRequestBuilder.php index 6c90633e953..f1a205e0473 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceSettingStateSummaries/Item/SettingStateDeviceSummaryItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceSettingStateSummaries/Item/SettingStateDeviceSummaryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SettingStateDeviceSummary; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceSettingStateSummaries for deviceManagement * @param SettingStateDeviceSummaryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SettingStateDeviceSummaryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Compliance Setting State Device Summary * @param SettingStateDeviceSummaryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SettingStateDeviceSummaryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property deviceSettingStateSummaries in deviceManagement * @param SettingStateDeviceSummary $body The request body * @param SettingStateDeviceSummaryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SettingStateDeviceSummary $body, ?SettingStateDeviceSummaryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?SettingStateDeviceSummaryItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?SettingStateDeviceSummaryItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?SettingStateDeviceSummaryItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(SettingStateDeviceSummary $body, ?Sett $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatusOverview/DeviceStatusOverviewRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatusOverview/DeviceStatusOverviewRequestBuilder.php index f26a6dbbb6d..70c134e1ce0 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatusOverview/DeviceStatusOverviewRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatusOverview/DeviceStatusOverviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceComplianceDeviceOverview; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceStatusOverview for deviceManagement * @param DeviceStatusOverviewRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceStatusOverviewRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceComplianceDeviceOverview object. * @param DeviceStatusOverviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancedeviceoverview-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceStatusOverviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceDeviceOverview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceDeviceOverview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceComplianceDeviceOverview object. * @param DeviceComplianceDeviceOverview $body The request body * @param DeviceStatusOverviewRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancedeviceoverview-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceComplianceDeviceOverview $body, ?DeviceStatusOverviewRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceDeviceOverview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceDeviceOverview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DeviceStatusOverviewRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DeviceStatusOverviewRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DeviceStatusOverviewRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(DeviceComplianceDeviceOverview $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatuses/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatuses/Count/CountRequestBuilder.php index 33472421b9a..4fbd67d260e 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatuses/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatuses/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatuses/DeviceStatusesRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatuses/DeviceStatusesRequestBuilder.php index d0bc6495cbd..8dd799787c9 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatuses/DeviceStatusesRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatuses/DeviceStatusesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\DeviceStatuses\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\DeviceStatuses\Item\DeviceComplianceDeviceStatusItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceComplianceDeviceStatus; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceComplianceDeviceStatus objects. * @param DeviceStatusesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancedevicestatus-list?view=graph-rest-1.0 Find more info here */ public function get(?DeviceStatusesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceDeviceStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceDeviceStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceComplianceDeviceStatus object. * @param DeviceComplianceDeviceStatus $body The request body * @param DeviceStatusesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancedevicestatus-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceComplianceDeviceStatus $body, ?DeviceStatusesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DeviceStatusesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DeviceStatusesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceComplianceDeviceStatus $body, ?De $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatuses/Item/DeviceComplianceDeviceStatusItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatuses/Item/DeviceComplianceDeviceStatusItemRequestBuilder.php index 8d536bfc26a..305d01631cc 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatuses/Item/DeviceComplianceDeviceStatusItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/DeviceStatuses/Item/DeviceComplianceDeviceStatusItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceComplianceDeviceStatus; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceComplianceDeviceStatus. * @param DeviceComplianceDeviceStatusItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancedevicestatus-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceComplianceDeviceStatusItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceComplianceDeviceStatus object. * @param DeviceComplianceDeviceStatusItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancedevicestatus-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceComplianceDeviceStatusItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceComplianceDeviceStatus object. * @param DeviceComplianceDeviceStatus $body The request body * @param DeviceComplianceDeviceStatusItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancedevicestatus-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceComplianceDeviceStatus $body, ?DeviceComplianceDeviceStatusItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?DeviceComplianceDeviceStatusItemRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?DeviceComplianceDeviceStatusItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?DeviceComplianceDeviceStatusItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(DeviceComplianceDeviceStatus $body, ?D $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduleActionsForRules/ScheduleActionsForRulesRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduleActionsForRules/ScheduleActionsForRulesRequestBuilder.php index 9c6526c3f57..2695c348125 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduleActionsForRules/ScheduleActionsForRulesRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduleActionsForRules/ScheduleActionsForRulesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param ScheduleActionsForRulesPostRequestBody $body The request body * @param ScheduleActionsForRulesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicy-scheduleactionsforrules?view=graph-rest-1.0 Find more info here */ public function post(ScheduleActionsForRulesPostRequestBody $body, ?ScheduleActionsForRulesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ScheduleActionsForRulesPostRequestBody $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Count/CountRequestBuilder.php index 6e3904b9fef..1b87b82ab5c 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/DeviceComplianceScheduledActionForRuleItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/DeviceComplianceScheduledActionForRuleItemRequestBuilder.php index db84e6b9ecd..db4d9dcf406 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/DeviceComplianceScheduledActionForRuleItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/DeviceComplianceScheduledActionForRuleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\ScheduledActionsForRule\Item\ScheduledActionConfigurations\ScheduledActionConfigurationsRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceComplianceScheduledActionForRule; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceComplianceScheduledActionForRule. * @param DeviceComplianceScheduledActionForRuleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancescheduledactionforrule-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceComplianceScheduledActionForRuleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceComplianceScheduledActionForRule object. * @param DeviceComplianceScheduledActionForRuleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancescheduledactionforrule-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceComplianceScheduledActionForRuleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceScheduledActionForRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceScheduledActionForRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceComplianceScheduledActionForRule object. * @param DeviceComplianceScheduledActionForRule $body The request body * @param DeviceComplianceScheduledActionForRuleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancescheduledactionforrule-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceComplianceScheduledActionForRule $body, ?DeviceComplianceScheduledActionForRuleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceScheduledActionForRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceScheduledActionForRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?DeviceComplianceScheduledActionForRu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?DeviceComplianceScheduledActionForRuleI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?DeviceComplianceScheduledActionForRuleI } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(DeviceComplianceScheduledActionForRule $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/ScheduledActionConfigurations/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/ScheduledActionConfigurations/Count/CountRequestBuilder.php index b099bba5c33..f6bd55a1174 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/ScheduledActionConfigurations/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/ScheduledActionConfigurations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/ScheduledActionConfigurations/Item/DeviceComplianceActionItemItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/ScheduledActionConfigurations/Item/DeviceComplianceActionItemItemRequestBuilder.php index 584dafbe7c7..0f2bd1b1414 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/ScheduledActionConfigurations/Item/DeviceComplianceActionItemItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/ScheduledActionConfigurations/Item/DeviceComplianceActionItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceComplianceActionItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceComplianceActionItem. * @param DeviceComplianceActionItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecomplianceactionitem-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceComplianceActionItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceComplianceActionItem object. * @param DeviceComplianceActionItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecomplianceactionitem-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceComplianceActionItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceActionItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceActionItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceComplianceActionItem object. * @param DeviceComplianceActionItem $body The request body * @param DeviceComplianceActionItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecomplianceactionitem-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceComplianceActionItem $body, ?DeviceComplianceActionItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceActionItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceActionItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?DeviceComplianceActionItemItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?DeviceComplianceActionItemItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?DeviceComplianceActionItemItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(DeviceComplianceActionItem $body, ?Dev $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/ScheduledActionConfigurations/ScheduledActionConfigurationsRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/ScheduledActionConfigurations/ScheduledActionConfigurationsRequestBuilder.php index de9c07344f7..7ea8826c5d8 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/ScheduledActionConfigurations/ScheduledActionConfigurationsRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/Item/ScheduledActionConfigurations/ScheduledActionConfigurationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\ScheduledActionsForRule\Item\ScheduledActionConfigurations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\ScheduledActionsForRule\Item\ScheduledActionConfigurations\Item\DeviceComplianceActionItemItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceComplianceActionItem; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceComplianceActionItem objects. * @param ScheduledActionConfigurationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecomplianceactionitem-list?view=graph-rest-1.0 Find more info here */ public function get(?ScheduledActionConfigurationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceActionItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceActionItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceComplianceActionItem object. * @param DeviceComplianceActionItem $body The request body * @param ScheduledActionConfigurationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecomplianceactionitem-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceComplianceActionItem $body, ?ScheduledActionConfigurationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceActionItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceActionItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ScheduledActionConfigurationsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ScheduledActionConfigurationsRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceComplianceActionItem $body, ?Sche $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/ScheduledActionsForRuleRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/ScheduledActionsForRuleRequestBuilder.php index 2f78e8938a6..59eb5b4099d 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/ScheduledActionsForRuleRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/ScheduledActionsForRule/ScheduledActionsForRuleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\ScheduledActionsForRule\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\ScheduledActionsForRule\Item\DeviceComplianceScheduledActionForRuleItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceComplianceScheduledActionForRule; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceComplianceScheduledActionForRule objects. * @param ScheduledActionsForRuleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancescheduledactionforrule-list?view=graph-rest-1.0 Find more info here */ public function get(?ScheduledActionsForRuleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceScheduledActionForRuleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceScheduledActionForRuleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceComplianceScheduledActionForRule object. * @param DeviceComplianceScheduledActionForRule $body The request body * @param ScheduledActionsForRuleRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancescheduledactionforrule-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceComplianceScheduledActionForRule $body, ?ScheduledActionsForRuleRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceScheduledActionForRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceScheduledActionForRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ScheduledActionsForRuleRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ScheduledActionsForRuleRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceComplianceScheduledActionForRule $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatusOverview/UserStatusOverviewRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatusOverview/UserStatusOverviewRequestBuilder.php index 1bd67f16c4a..b7e0aa52e61 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatusOverview/UserStatusOverviewRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatusOverview/UserStatusOverviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceComplianceUserOverview; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userStatusOverview for deviceManagement * @param UserStatusOverviewRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserStatusOverviewRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceComplianceUserOverview object. * @param UserStatusOverviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecomplianceuseroverview-get?view=graph-rest-1.0 Find more info here */ public function get(?UserStatusOverviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceUserOverview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceUserOverview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceComplianceUserOverview object. * @param DeviceComplianceUserOverview $body The request body * @param UserStatusOverviewRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecomplianceuseroverview-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceComplianceUserOverview $body, ?UserStatusOverviewRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceUserOverview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceUserOverview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?UserStatusOverviewRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?UserStatusOverviewRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?UserStatusOverviewRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(DeviceComplianceUserOverview $body, ?U $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatuses/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatuses/Count/CountRequestBuilder.php index 247066aee9c..081561b4fd9 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatuses/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatuses/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatuses/Item/DeviceComplianceUserStatusItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatuses/Item/DeviceComplianceUserStatusItemRequestBuilder.php index 741317a094d..0a460070b45 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatuses/Item/DeviceComplianceUserStatusItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatuses/Item/DeviceComplianceUserStatusItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceComplianceUserStatus; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceComplianceUserStatus. * @param DeviceComplianceUserStatusItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecomplianceuserstatus-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceComplianceUserStatusItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceComplianceUserStatus object. * @param DeviceComplianceUserStatusItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecomplianceuserstatus-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceComplianceUserStatusItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceComplianceUserStatus object. * @param DeviceComplianceUserStatus $body The request body * @param DeviceComplianceUserStatusItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecomplianceuserstatus-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceComplianceUserStatus $body, ?DeviceComplianceUserStatusItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?DeviceComplianceUserStatusItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?DeviceComplianceUserStatusItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?DeviceComplianceUserStatusItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(DeviceComplianceUserStatus $body, ?Dev $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatuses/UserStatusesRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatuses/UserStatusesRequestBuilder.php index bedfe2e4336..a9d13f62f3c 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatuses/UserStatusesRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicies/Item/UserStatuses/UserStatusesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\UserStatuses\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicies\Item\UserStatuses\Item\DeviceComplianceUserStatusItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceComplianceUserStatus; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceComplianceUserStatus objects. * @param UserStatusesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecomplianceuserstatus-list?view=graph-rest-1.0 Find more info here */ public function get(?UserStatusesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceUserStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceUserStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceComplianceUserStatus object. * @param DeviceComplianceUserStatus $body The request body * @param UserStatusesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecomplianceuserstatus-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceComplianceUserStatus $body, ?UserStatusesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?UserStatusesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?UserStatusesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceComplianceUserStatus $body, ?User $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicyDeviceStateSummary/DeviceCompliancePolicyDeviceStateSummaryRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicyDeviceStateSummary/DeviceCompliancePolicyDeviceStateSummaryRequestBuilder.php index 7fbdbe34f42..1c2a82b7bcf 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicyDeviceStateSummary/DeviceCompliancePolicyDeviceStateSummaryRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicyDeviceStateSummary/DeviceCompliancePolicyDeviceStateSummaryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceCompliancePolicyDeviceStateSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceCompliancePolicyDeviceStateSummary for deviceManagement * @param DeviceCompliancePolicyDeviceStateSummaryRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceCompliancePolicyDeviceStateSummaryRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceCompliancePolicyDeviceStateSummary object. * @param DeviceCompliancePolicyDeviceStateSummaryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicydevicestatesummary-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceCompliancePolicyDeviceStateSummaryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyDeviceStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyDeviceStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceCompliancePolicyDeviceStateSummary object. * @param DeviceCompliancePolicyDeviceStateSummary $body The request body * @param DeviceCompliancePolicyDeviceStateSummaryRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicydevicestatesummary-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceCompliancePolicyDeviceStateSummary $body, ?DeviceCompliancePolicyDeviceStateSummaryRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyDeviceStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyDeviceStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DeviceCompliancePolicyDeviceStateSum $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DeviceCompliancePolicyDeviceStateSummar $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DeviceCompliancePolicyDeviceStateSummar } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(DeviceCompliancePolicyDeviceStateSumma $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Count/CountRequestBuilder.php index 13f777f3c0b..3fcb3371613 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/DeviceCompliancePolicySettingStateSummariesRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/DeviceCompliancePolicySettingStateSummariesRequestBuilder.php index 5c4e579f188..57ced8a10a8 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/DeviceCompliancePolicySettingStateSummariesRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/DeviceCompliancePolicySettingStateSummariesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicySettingStateSummaries\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicySettingStateSummaries\Item\DeviceCompliancePolicySettingStateSummaryItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceCompliancePolicySettingStateSummary; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceCompliancePolicySettingStateSummary objects. * @param DeviceCompliancePolicySettingStateSummariesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicysettingstatesummary-list?view=graph-rest-1.0 Find more info here */ public function get(?DeviceCompliancePolicySettingStateSummariesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicySettingStateSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicySettingStateSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceCompliancePolicySettingStateSummary object. * @param DeviceCompliancePolicySettingStateSummary $body The request body * @param DeviceCompliancePolicySettingStateSummariesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicysettingstatesummary-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceCompliancePolicySettingStateSummary $body, ?DeviceCompliancePolicySettingStateSummariesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicySettingStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicySettingStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DeviceCompliancePolicySettingStateSumma $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DeviceCompliancePolicySettingStateSumma } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceCompliancePolicySettingStateSumma $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceCompliancePolicySettingStateSummaryItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceCompliancePolicySettingStateSummaryItemRequestBuilder.php index 666d956083a..54a81b219ca 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceCompliancePolicySettingStateSummaryItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceCompliancePolicySettingStateSummaryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicySettingStateSummaries\Item\DeviceComplianceSettingStates\DeviceComplianceSettingStatesRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceCompliancePolicySettingStateSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceCompliancePolicySettingStateSummary. * @param DeviceCompliancePolicySettingStateSummaryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicysettingstatesummary-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceCompliancePolicySettingStateSummaryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceCompliancePolicySettingStateSummary object. * @param DeviceCompliancePolicySettingStateSummaryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicysettingstatesummary-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceCompliancePolicySettingStateSummaryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicySettingStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicySettingStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceCompliancePolicySettingStateSummary object. * @param DeviceCompliancePolicySettingStateSummary $body The request body * @param DeviceCompliancePolicySettingStateSummaryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancepolicysettingstatesummary-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceCompliancePolicySettingStateSummary $body, ?DeviceCompliancePolicySettingStateSummaryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicySettingStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicySettingStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?DeviceCompliancePolicySettingStateSu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?DeviceCompliancePolicySettingStateSumma $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?DeviceCompliancePolicySettingStateSumma } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(DeviceCompliancePolicySettingStateSumm $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceComplianceSettingStates/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceComplianceSettingStates/Count/CountRequestBuilder.php index 23d53264594..a17c3f23181 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceComplianceSettingStates/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceComplianceSettingStates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceComplianceSettingStates/DeviceComplianceSettingStatesRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceComplianceSettingStates/DeviceComplianceSettingStatesRequestBuilder.php index 73844b3e1e9..ab47ca1f2fe 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceComplianceSettingStates/DeviceComplianceSettingStatesRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceComplianceSettingStates/DeviceComplianceSettingStatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicySettingStateSummaries\Item\DeviceComplianceSettingStates\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceCompliancePolicySettingStateSummaries\Item\DeviceComplianceSettingStates\Item\DeviceComplianceSettingStateItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceComplianceSettingState; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceComplianceSettingState objects. * @param DeviceComplianceSettingStatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancesettingstate-list?view=graph-rest-1.0 Find more info here */ public function get(?DeviceComplianceSettingStatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceSettingStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceSettingStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceComplianceSettingState object. * @param DeviceComplianceSettingState $body The request body * @param DeviceComplianceSettingStatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancesettingstate-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceComplianceSettingState $body, ?DeviceComplianceSettingStatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceSettingState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceSettingState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DeviceComplianceSettingStatesRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DeviceComplianceSettingStatesRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceComplianceSettingState $body, ?De $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceComplianceSettingStates/Item/DeviceComplianceSettingStateItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceComplianceSettingStates/Item/DeviceComplianceSettingStateItemRequestBuilder.php index 1f06c475bbc..20b30b291de 100644 --- a/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceComplianceSettingStates/Item/DeviceComplianceSettingStateItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceCompliancePolicySettingStateSummaries/Item/DeviceComplianceSettingStates/Item/DeviceComplianceSettingStateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceComplianceSettingState; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceComplianceSettingState. * @param DeviceComplianceSettingStateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancesettingstate-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceComplianceSettingStateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceComplianceSettingState object. * @param DeviceComplianceSettingStateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancesettingstate-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceComplianceSettingStateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceSettingState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceSettingState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceComplianceSettingState object. * @param DeviceComplianceSettingState $body The request body * @param DeviceComplianceSettingStateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicecompliancesettingstate-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceComplianceSettingState $body, ?DeviceComplianceSettingStateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceSettingState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceComplianceSettingState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?DeviceComplianceSettingStateItemRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?DeviceComplianceSettingStateItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?DeviceComplianceSettingStateItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(DeviceComplianceSettingState $body, ?D $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurationDeviceStateSummaries/DeviceConfigurationDeviceStateSummariesRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurationDeviceStateSummaries/DeviceConfigurationDeviceStateSummariesRequestBuilder.php index e870f1543fb..31b16e1d2f7 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurationDeviceStateSummaries/DeviceConfigurationDeviceStateSummariesRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurationDeviceStateSummaries/DeviceConfigurationDeviceStateSummariesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceConfigurationDeviceStateSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceConfigurationDeviceStateSummaries for deviceManagement * @param DeviceConfigurationDeviceStateSummariesRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceConfigurationDeviceStateSummariesRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceConfigurationDeviceStateSummary object. * @param DeviceConfigurationDeviceStateSummariesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationdevicestatesummary-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceConfigurationDeviceStateSummariesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceConfigurationDeviceStateSummary object. * @param DeviceConfigurationDeviceStateSummary $body The request body * @param DeviceConfigurationDeviceStateSummariesRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationdevicestatesummary-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceConfigurationDeviceStateSummary $body, ?DeviceConfigurationDeviceStateSummariesRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceStateSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DeviceConfigurationDeviceStateSummar $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DeviceConfigurationDeviceStateSummaries $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DeviceConfigurationDeviceStateSummaries } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(DeviceConfigurationDeviceStateSummary $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Count/CountRequestBuilder.php index d9e90ad5a8b..c4b62ac1241 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/DeviceConfigurationsRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/DeviceConfigurationsRequestBuilder.php index fff112a0e3e..c8f365d0946 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/DeviceConfigurationsRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/DeviceConfigurationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceConfigurations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceConfigurations\Item\DeviceConfigurationItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceConfiguration; @@ -53,46 +52,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List properties and relationships of the windows10CustomConfiguration objects. + * List properties and relationships of the iosGeneralDeviceConfiguration objects. * @param DeviceConfigurationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-windows10customconfiguration-list?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-iosgeneraldeviceconfiguration-list?view=graph-rest-1.0 Find more info here */ public function get(?DeviceConfigurationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create a new iosUpdateConfiguration object. + * Create a new windows10SecureAssessmentConfiguration object. * @param DeviceConfiguration $body The request body * @param DeviceConfigurationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-iosupdateconfiguration-create?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-windows10secureassessmentconfiguration-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceConfiguration $body, ?DeviceConfigurationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List properties and relationships of the windows10CustomConfiguration objects. + * List properties and relationships of the iosGeneralDeviceConfiguration objects. * @param DeviceConfigurationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DeviceConfigurationsRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,11 +101,12 @@ public function toGetRequestInformation(?DeviceConfigurationsRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create a new iosUpdateConfiguration object. + * Create a new windows10SecureAssessmentConfiguration object. * @param DeviceConfiguration $body The request body * @param DeviceConfigurationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceConfiguration $body, ?DeviceConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/DeviceConfigurationsRequestBuilderGetQueryParameters.php b/src/Generated/DeviceManagement/DeviceConfigurations/DeviceConfigurationsRequestBuilderGetQueryParameters.php index 7e5c9788ee4..a4e0d961ce7 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/DeviceConfigurationsRequestBuilderGetQueryParameters.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/DeviceConfigurationsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List properties and relationships of the windows10CustomConfiguration objects. + * List properties and relationships of the iosGeneralDeviceConfiguration objects. */ class DeviceConfigurationsRequestBuilderGetQueryParameters { diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assign/AssignRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assign/AssignRequestBuilder.php index 42bf7349003..1cb0d53b48c 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assign/AssignRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assign/AssignRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param AssignPostRequestBody $body The request body * @param AssignRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfiguration-assign?view=graph-rest-1.0 Find more info here */ public function post(AssignPostRequestBody $body, ?AssignRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AssignPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AssignPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AssignPostRequestBody $body, ?AssignReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assignments/AssignmentsRequestBuilder.php index eea5eb6ed76..080cbc7fc8c 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceConfigurations\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceConfigurations\Item\Assignments\Item\DeviceConfigurationAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceConfigurationAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceConfigurationAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceConfigurationAssignment object. * @param DeviceConfigurationAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationassignment-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceConfigurationAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceConfigurationAssignment $body, ?A $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assignments/Count/CountRequestBuilder.php index e98d2456d4f..ba0eb56530f 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assignments/Item/DeviceConfigurationAssignmentItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assignments/Item/DeviceConfigurationAssignmentItemRequestBuilder.php index 8b0002bc232..791cf8d68b1 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assignments/Item/DeviceConfigurationAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/Assignments/Item/DeviceConfigurationAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceConfigurationAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceConfigurationAssignment. * @param DeviceConfigurationAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceConfigurationAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceConfigurationAssignment object. * @param DeviceConfigurationAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceConfigurationAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceConfigurationAssignment object. * @param DeviceConfigurationAssignment $body The request body * @param DeviceConfigurationAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceConfigurationAssignment $body, ?DeviceConfigurationAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?DeviceConfigurationAssignmentItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?DeviceConfigurationAssignmentItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?DeviceConfigurationAssignmentItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(DeviceConfigurationAssignment $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceConfigurationItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceConfigurationItemRequestBuilder.php index 32568e4bd49..e2575e11b07 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceConfigurationItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceConfigurationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceConfigurations\Item\Assign\AssignRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceConfigurations\Item\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceConfigurations\Item\DeviceSettingStateSummaries\DeviceSettingStateSummariesRequestBuilder; @@ -89,41 +88,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Deletes a editionUpgradeConfiguration. + * Deletes a windows10EnterpriseModernAppManagementConfiguration. * @param DeviceConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-editionupgradeconfiguration-delete?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-windows10enterprisemodernappmanagementconfiguration-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceConfigurationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read properties and relationships of the androidGeneralDeviceConfiguration object. + * Read properties and relationships of the windowsPhone81GeneralConfiguration object. * @param DeviceConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-androidgeneraldeviceconfiguration-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-windowsphone81generalconfiguration-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceConfigurationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -136,27 +129,24 @@ public function getOmaSettingPlainTextValueWithSecretReferenceValueId(string $se } /** - * Update the properties of a sharedPCConfiguration object. + * Update the properties of a androidWorkProfileGeneralDeviceConfiguration object. * @param DeviceConfiguration $body The request body * @param DeviceConfigurationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-sharedpcconfiguration-update?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-androidworkprofilegeneraldeviceconfiguration-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceConfiguration $body, ?DeviceConfigurationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Deletes a editionUpgradeConfiguration. + * Deletes a windows10EnterpriseModernAppManagementConfiguration. * @param DeviceConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -169,11 +159,12 @@ public function toDeleteRequestInformation(?DeviceConfigurationItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read properties and relationships of the androidGeneralDeviceConfiguration object. + * Read properties and relationships of the windowsPhone81GeneralConfiguration object. * @param DeviceConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -182,7 +173,6 @@ public function toGetRequestInformation(?DeviceConfigurationItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -190,11 +180,12 @@ public function toGetRequestInformation(?DeviceConfigurationItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the properties of a sharedPCConfiguration object. + * Update the properties of a androidWorkProfileGeneralDeviceConfiguration object. * @param DeviceConfiguration $body The request body * @param DeviceConfigurationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -204,11 +195,11 @@ public function toPatchRequestInformation(DeviceConfiguration $body, ?DeviceConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceConfigurationItemRequestBuilderGetQueryParameters.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceConfigurationItemRequestBuilderGetQueryParameters.php index fd620a06594..5ec9e83667a 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceConfigurationItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceConfigurationItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read properties and relationships of the androidGeneralDeviceConfiguration object. + * Read properties and relationships of the windowsPhone81GeneralConfiguration object. */ class DeviceConfigurationItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceSettingStateSummaries/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceSettingStateSummaries/Count/CountRequestBuilder.php index 71b9b0b7ea7..88b1af3cf85 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceSettingStateSummaries/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceSettingStateSummaries/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceSettingStateSummaries/DeviceSettingStateSummariesRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceSettingStateSummaries/DeviceSettingStateSummariesRequestBuilder.php index 72a237bfe40..e8ce84040fc 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceSettingStateSummaries/DeviceSettingStateSummariesRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceSettingStateSummaries/DeviceSettingStateSummariesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceConfigurations\Item\DeviceSettingStateSummaries\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceConfigurations\Item\DeviceSettingStateSummaries\Item\SettingStateDeviceSummaryItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the settingStateDeviceSummary objects. * @param DeviceSettingStateSummariesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-settingstatedevicesummary-list?view=graph-rest-1.0 Find more info here */ public function get(?DeviceSettingStateSummariesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new settingStateDeviceSummary object. * @param SettingStateDeviceSummary $body The request body * @param DeviceSettingStateSummariesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-settingstatedevicesummary-create?view=graph-rest-1.0 Find more info here */ public function post(SettingStateDeviceSummary $body, ?DeviceSettingStateSummariesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DeviceSettingStateSummariesRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DeviceSettingStateSummariesRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SettingStateDeviceSummary $body, ?Devic $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceSettingStateSummaries/Item/SettingStateDeviceSummaryItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceSettingStateSummaries/Item/SettingStateDeviceSummaryItemRequestBuilder.php index e57e2546fb5..015e164e45d 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceSettingStateSummaries/Item/SettingStateDeviceSummaryItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceSettingStateSummaries/Item/SettingStateDeviceSummaryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SettingStateDeviceSummary; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a settingStateDeviceSummary. * @param SettingStateDeviceSummaryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-settingstatedevicesummary-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SettingStateDeviceSummaryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the settingStateDeviceSummary object. * @param SettingStateDeviceSummaryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-settingstatedevicesummary-get?view=graph-rest-1.0 Find more info here */ public function get(?SettingStateDeviceSummaryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a settingStateDeviceSummary object. * @param SettingStateDeviceSummary $body The request body * @param SettingStateDeviceSummaryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-settingstatedevicesummary-update?view=graph-rest-1.0 Find more info here */ public function patch(SettingStateDeviceSummary $body, ?SettingStateDeviceSummaryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SettingStateDeviceSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?SettingStateDeviceSummaryItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?SettingStateDeviceSummaryItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?SettingStateDeviceSummaryItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(SettingStateDeviceSummary $body, ?Sett $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatusOverview/DeviceStatusOverviewRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatusOverview/DeviceStatusOverviewRequestBuilder.php index 64f3757cb16..85c11c8a8a4 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatusOverview/DeviceStatusOverviewRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatusOverview/DeviceStatusOverviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceConfigurationDeviceOverview; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceStatusOverview for deviceManagement * @param DeviceStatusOverviewRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceStatusOverviewRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceConfigurationDeviceOverview object. * @param DeviceStatusOverviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationdeviceoverview-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceStatusOverviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceOverview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceOverview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceConfigurationDeviceOverview object. * @param DeviceConfigurationDeviceOverview $body The request body * @param DeviceStatusOverviewRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationdeviceoverview-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceConfigurationDeviceOverview $body, ?DeviceStatusOverviewRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceOverview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceOverview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DeviceStatusOverviewRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DeviceStatusOverviewRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DeviceStatusOverviewRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(DeviceConfigurationDeviceOverview $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatuses/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatuses/Count/CountRequestBuilder.php index b151a4eac3d..079ce01d4dc 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatuses/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatuses/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatuses/DeviceStatusesRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatuses/DeviceStatusesRequestBuilder.php index c334b3c7aee..66f3065aba8 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatuses/DeviceStatusesRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatuses/DeviceStatusesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceConfigurations\Item\DeviceStatuses\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceConfigurations\Item\DeviceStatuses\Item\DeviceConfigurationDeviceStatusItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceConfigurationDeviceStatus; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceConfigurationDeviceStatus objects. * @param DeviceStatusesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationdevicestatus-list?view=graph-rest-1.0 Find more info here */ public function get(?DeviceStatusesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceConfigurationDeviceStatus object. * @param DeviceConfigurationDeviceStatus $body The request body * @param DeviceStatusesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationdevicestatus-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceConfigurationDeviceStatus $body, ?DeviceStatusesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DeviceStatusesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DeviceStatusesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceConfigurationDeviceStatus $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatuses/Item/DeviceConfigurationDeviceStatusItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatuses/Item/DeviceConfigurationDeviceStatusItemRequestBuilder.php index 031ae064346..29cdbb72c4e 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatuses/Item/DeviceConfigurationDeviceStatusItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/DeviceStatuses/Item/DeviceConfigurationDeviceStatusItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceConfigurationDeviceStatus; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceConfigurationDeviceStatus. * @param DeviceConfigurationDeviceStatusItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationdevicestatus-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceConfigurationDeviceStatusItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceConfigurationDeviceStatus object. * @param DeviceConfigurationDeviceStatusItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationdevicestatus-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceConfigurationDeviceStatusItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceConfigurationDeviceStatus object. * @param DeviceConfigurationDeviceStatus $body The request body * @param DeviceConfigurationDeviceStatusItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationdevicestatus-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceConfigurationDeviceStatus $body, ?DeviceConfigurationDeviceStatusItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?DeviceConfigurationDeviceStatusItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?DeviceConfigurationDeviceStatusItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?DeviceConfigurationDeviceStatusItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(DeviceConfigurationDeviceStatus $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/GetOmaSettingPlainTextValueWithSecretReferenceValueId/GetOmaSettingPlainTextValueWithSecretReferenceValueIdRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/GetOmaSettingPlainTextValueWithSecretReferenceValueId/GetOmaSettingPlainTextValueWithSecretReferenceValueIdRequestBuilder.php index 3b0f903b70d..2367b7fbe38 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/GetOmaSettingPlainTextValueWithSecretReferenceValueId/GetOmaSettingPlainTextValueWithSecretReferenceValueIdRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/GetOmaSettingPlainTextValueWithSecretReferenceValueId/GetOmaSettingPlainTextValueWithSecretReferenceValueIdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOmaSettingPlainTextValue * @param GetOmaSettingPlainTextValueWithSecretReferenceValueIdRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOmaSettingPlainTextValueWithSecretReferenceValueIdRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetOmaSettingPlainTextValueWithSecretReferenceValueIdGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetOmaSettingPlainTextValueWithSecretReferenceValueIdGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toGetRequestInformation(?GetOmaSettingPlainTextValueWithSecretRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatusOverview/UserStatusOverviewRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatusOverview/UserStatusOverviewRequestBuilder.php index bf823b6f80d..ebca1fd4f42 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatusOverview/UserStatusOverviewRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatusOverview/UserStatusOverviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceConfigurationUserOverview; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userStatusOverview for deviceManagement * @param UserStatusOverviewRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserStatusOverviewRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceConfigurationUserOverview object. * @param UserStatusOverviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationuseroverview-get?view=graph-rest-1.0 Find more info here */ public function get(?UserStatusOverviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationUserOverview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationUserOverview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceConfigurationUserOverview object. * @param DeviceConfigurationUserOverview $body The request body * @param UserStatusOverviewRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationuseroverview-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceConfigurationUserOverview $body, ?UserStatusOverviewRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationUserOverview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationUserOverview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?UserStatusOverviewRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?UserStatusOverviewRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?UserStatusOverviewRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(DeviceConfigurationUserOverview $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatuses/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatuses/Count/CountRequestBuilder.php index dda7bef7c0e..144d7bc65bf 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatuses/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatuses/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatuses/Item/DeviceConfigurationUserStatusItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatuses/Item/DeviceConfigurationUserStatusItemRequestBuilder.php index 0ecdf04673f..2feaad43687 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatuses/Item/DeviceConfigurationUserStatusItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatuses/Item/DeviceConfigurationUserStatusItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceConfigurationUserStatus; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceConfigurationUserStatus. * @param DeviceConfigurationUserStatusItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationuserstatus-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceConfigurationUserStatusItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceConfigurationUserStatus object. * @param DeviceConfigurationUserStatusItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationuserstatus-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceConfigurationUserStatusItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceConfigurationUserStatus object. * @param DeviceConfigurationUserStatus $body The request body * @param DeviceConfigurationUserStatusItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationuserstatus-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceConfigurationUserStatus $body, ?DeviceConfigurationUserStatusItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?DeviceConfigurationUserStatusItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?DeviceConfigurationUserStatusItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?DeviceConfigurationUserStatusItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(DeviceConfigurationUserStatus $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatuses/UserStatusesRequestBuilder.php b/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatuses/UserStatusesRequestBuilder.php index 3c7d3f69005..22757a32c8f 100644 --- a/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatuses/UserStatusesRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceConfigurations/Item/UserStatuses/UserStatusesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceConfigurations\Item\UserStatuses\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceConfigurations\Item\UserStatuses\Item\DeviceConfigurationUserStatusItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceConfigurationUserStatus; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceConfigurationUserStatus objects. * @param UserStatusesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationuserstatus-list?view=graph-rest-1.0 Find more info here */ public function get(?UserStatusesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationUserStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationUserStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceConfigurationUserStatus object. * @param DeviceConfigurationUserStatus $body The request body * @param UserStatusesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-deviceconfigurationuserstatus-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceConfigurationUserStatus $body, ?UserStatusesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationUserStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?UserStatusesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?UserStatusesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceConfigurationUserStatus $body, ?U $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Count/CountRequestBuilder.php index 227774d7296..34372eeca7d 100644 --- a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/DeviceEnrollmentConfigurationsRequestBuilder.php b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/DeviceEnrollmentConfigurationsRequestBuilder.php index d439c9461dc..62e2decfbb5 100644 --- a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/DeviceEnrollmentConfigurationsRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/DeviceEnrollmentConfigurationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceEnrollmentConfigurations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceEnrollmentConfigurations\Item\DeviceEnrollmentConfigurationItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceEnrollmentConfiguration; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceEnrollmentPlatformRestrictionsConfiguration objects. * @param DeviceEnrollmentConfigurationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-deviceenrollmentplatformrestrictionsconfiguration-list?view=graph-rest-1.0 Find more info here */ public function get(?DeviceEnrollmentConfigurationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceEnrollmentConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceEnrollmentConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create a new deviceEnrollmentPlatformRestrictionsConfiguration object. + * Create a new deviceEnrollmentWindowsHelloForBusinessConfiguration object. * @param DeviceEnrollmentConfiguration $body The request body * @param DeviceEnrollmentConfigurationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-onboarding-deviceenrollmentplatformrestrictionsconfiguration-create?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-onboarding-deviceenrollmentwindowshelloforbusinessconfiguration-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceEnrollmentConfiguration $body, ?DeviceEnrollmentConfigurationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceEnrollmentConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceEnrollmentConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DeviceEnrollmentConfigurationsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,11 +101,12 @@ public function toGetRequestInformation(?DeviceEnrollmentConfigurationsRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create a new deviceEnrollmentPlatformRestrictionsConfiguration object. + * Create a new deviceEnrollmentWindowsHelloForBusinessConfiguration object. * @param DeviceEnrollmentConfiguration $body The request body * @param DeviceEnrollmentConfigurationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceEnrollmentConfiguration $body, ?D $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assign/AssignRequestBuilder.php b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assign/AssignRequestBuilder.php index da6b7285a0c..9fdb5715d3d 100644 --- a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assign/AssignRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assign/AssignRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param AssignPostRequestBody $body The request body * @param AssignRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-deviceenrollmentconfiguration-assign?view=graph-rest-1.0 Find more info here */ public function post(AssignPostRequestBody $body, ?AssignRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AssignPostRequestBody $body, ?AssignReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assignments/AssignmentsRequestBuilder.php index 48d4c9bff09..38d937f9466 100644 --- a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceEnrollmentConfigurations\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceEnrollmentConfigurations\Item\Assignments\Item\EnrollmentConfigurationAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\EnrollmentConfigurationAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the enrollmentConfigurationAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-enrollmentconfigurationassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EnrollmentConfigurationAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EnrollmentConfigurationAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new enrollmentConfigurationAssignment object. * @param EnrollmentConfigurationAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-enrollmentconfigurationassignment-create?view=graph-rest-1.0 Find more info here */ public function post(EnrollmentConfigurationAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EnrollmentConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EnrollmentConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EnrollmentConfigurationAssignment $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assignments/Count/CountRequestBuilder.php index 3d82ec31055..cb874430069 100644 --- a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assignments/Item/EnrollmentConfigurationAssignmentItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assignments/Item/EnrollmentConfigurationAssignmentItemRequestBuilder.php index e7622eca757..e5963f50598 100644 --- a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assignments/Item/EnrollmentConfigurationAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/Assignments/Item/EnrollmentConfigurationAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EnrollmentConfigurationAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a enrollmentConfigurationAssignment. * @param EnrollmentConfigurationAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-enrollmentconfigurationassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EnrollmentConfigurationAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the enrollmentConfigurationAssignment object. * @param EnrollmentConfigurationAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-enrollmentconfigurationassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?EnrollmentConfigurationAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EnrollmentConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EnrollmentConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a enrollmentConfigurationAssignment object. * @param EnrollmentConfigurationAssignment $body The request body * @param EnrollmentConfigurationAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-enrollmentconfigurationassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(EnrollmentConfigurationAssignment $body, ?EnrollmentConfigurationAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EnrollmentConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EnrollmentConfigurationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?EnrollmentConfigurationAssignmentIte $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?EnrollmentConfigurationAssignmentItemRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?EnrollmentConfigurationAssignmentItemRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(EnrollmentConfigurationAssignment $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/DeviceEnrollmentConfigurationItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/DeviceEnrollmentConfigurationItemRequestBuilder.php index 19ab2ef48c9..d650ab851e7 100644 --- a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/DeviceEnrollmentConfigurationItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/DeviceEnrollmentConfigurationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceEnrollmentConfigurations\Item\Assign\AssignRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceEnrollmentConfigurations\Item\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceEnrollmentConfigurations\Item\SetPriority\SetPriorityRequestBuilder; @@ -56,65 +55,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Deletes a deviceEnrollmentPlatformRestrictionsConfiguration. + * Deletes a deviceEnrollmentLimitConfiguration. * @param DeviceEnrollmentConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-onboarding-deviceenrollmentplatformrestrictionsconfiguration-delete?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-onboarding-deviceenrollmentlimitconfiguration-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceEnrollmentConfigurationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceEnrollmentPlatformRestrictionsConfiguration object. * @param DeviceEnrollmentConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-deviceenrollmentplatformrestrictionsconfiguration-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceEnrollmentConfigurationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceEnrollmentConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceEnrollmentConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update the properties of a deviceEnrollmentPlatformRestrictionsConfiguration object. + * Update the properties of a deviceEnrollmentWindowsHelloForBusinessConfiguration object. * @param DeviceEnrollmentConfiguration $body The request body * @param DeviceEnrollmentConfigurationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-onboarding-deviceenrollmentplatformrestrictionsconfiguration-update?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-onboarding-deviceenrollmentwindowshelloforbusinessconfiguration-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceEnrollmentConfiguration $body, ?DeviceEnrollmentConfigurationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceEnrollmentConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceEnrollmentConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Deletes a deviceEnrollmentPlatformRestrictionsConfiguration. + * Deletes a deviceEnrollmentLimitConfiguration. * @param DeviceEnrollmentConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?DeviceEnrollmentConfigurationItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?DeviceEnrollmentConfigurationItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,11 +138,12 @@ public function toGetRequestInformation(?DeviceEnrollmentConfigurationItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the properties of a deviceEnrollmentPlatformRestrictionsConfiguration object. + * Update the properties of a deviceEnrollmentWindowsHelloForBusinessConfiguration object. * @param DeviceEnrollmentConfiguration $body The request body * @param DeviceEnrollmentConfigurationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -162,11 +153,11 @@ public function toPatchRequestInformation(DeviceEnrollmentConfiguration $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/SetPriority/SetPriorityRequestBuilder.php b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/SetPriority/SetPriorityRequestBuilder.php index 4a517973795..ea054bdf5c6 100644 --- a/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/SetPriority/SetPriorityRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceEnrollmentConfigurations/Item/SetPriority/SetPriorityRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param SetPriorityPostRequestBody $body The request body * @param SetPriorityRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-deviceenrollmentconfiguration-setpriority?view=graph-rest-1.0 Find more info here */ public function post(SetPriorityPostRequestBody $body, ?SetPriorityRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetPriorityPostRequestBody $body, ?SetP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceManagementPartners/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/DeviceManagementPartners/Count/CountRequestBuilder.php index c13f397a204..64cb65d7121 100644 --- a/src/Generated/DeviceManagement/DeviceManagementPartners/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceManagementPartners/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceManagementPartners/DeviceManagementPartnersRequestBuilder.php b/src/Generated/DeviceManagement/DeviceManagementPartners/DeviceManagementPartnersRequestBuilder.php index 81651270d91..444652b6efb 100644 --- a/src/Generated/DeviceManagement/DeviceManagementPartners/DeviceManagementPartnersRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceManagementPartners/DeviceManagementPartnersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceManagementPartners\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\DeviceManagementPartners\Item\DeviceManagementPartnerItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceManagementPartner; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceManagementPartner objects. * @param DeviceManagementPartnersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicemanagementpartner-list?view=graph-rest-1.0 Find more info here */ public function get(?DeviceManagementPartnersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementPartnerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementPartnerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceManagementPartner object. * @param DeviceManagementPartner $body The request body * @param DeviceManagementPartnersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicemanagementpartner-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceManagementPartner $body, ?DeviceManagementPartnersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DeviceManagementPartnersRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DeviceManagementPartnersRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceManagementPartner $body, ?DeviceM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceManagementPartners/Item/DeviceManagementPartnerItemRequestBuilder.php b/src/Generated/DeviceManagement/DeviceManagementPartners/Item/DeviceManagementPartnerItemRequestBuilder.php index f6f6cfbe95d..2d70b9c414f 100644 --- a/src/Generated/DeviceManagement/DeviceManagementPartners/Item/DeviceManagementPartnerItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceManagementPartners/Item/DeviceManagementPartnerItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\DeviceManagementPartners\Item\Terminate\TerminateRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceManagementPartner; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceManagementPartner. * @param DeviceManagementPartnerItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicemanagementpartner-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceManagementPartnerItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceManagementPartner object. * @param DeviceManagementPartnerItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicemanagementpartner-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceManagementPartnerItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceManagementPartner object. * @param DeviceManagementPartner $body The request body * @param DeviceManagementPartnerItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicemanagementpartner-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceManagementPartner $body, ?DeviceManagementPartnerItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?DeviceManagementPartnerItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?DeviceManagementPartnerItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?DeviceManagementPartnerItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(DeviceManagementPartner $body, ?Device $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceManagementPartners/Item/Terminate/TerminateRequestBuilder.php b/src/Generated/DeviceManagement/DeviceManagementPartners/Item/Terminate/TerminateRequestBuilder.php index d37bf27bc4b..8e8dc4bd6f2 100644 --- a/src/Generated/DeviceManagement/DeviceManagementPartners/Item/Terminate/TerminateRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceManagementPartners/Item/Terminate/TerminateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Not yet documented * @param TerminateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicemanagementpartner-terminate?view=graph-rest-1.0 Find more info here */ public function post(?TerminateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?TerminateRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/DeviceManagementRequestBuilder.php b/src/Generated/DeviceManagement/DeviceManagementRequestBuilder.php index 8d92079fb3c..005c3af405f 100644 --- a/src/Generated/DeviceManagement/DeviceManagementRequestBuilder.php +++ b/src/Generated/DeviceManagement/DeviceManagementRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ApplePushNotificationCertificate\ApplePushNotificationCertificateRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\AuditEvents\AuditEventsRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\ComplianceManagementPartners\ComplianceManagementPartnersRequestBuilder; @@ -500,20 +499,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read properties and relationships of the deviceManagement object. * @param DeviceManagementRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-devicemanagement-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-policyset-devicemanagement-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceManagementRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -529,20 +525,17 @@ public function getEffectivePermissionsWithScope(string $scope): GetEffectivePer * Update the properties of a deviceManagement object. * @param DeviceManagement $body The request body * @param DeviceManagementRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-androidforwork-devicemanagement-update?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-enrollment-devicemanagement-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceManagement $body, ?DeviceManagementRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -555,7 +548,6 @@ public function toGetRequestInformation(?DeviceManagementRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -563,6 +555,7 @@ public function toGetRequestInformation(?DeviceManagementRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -577,11 +570,11 @@ public function toPatchRequestInformation(DeviceManagement $body, ?DeviceManagem $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ExchangeConnectors/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/ExchangeConnectors/Count/CountRequestBuilder.php index b67458247b8..23fbfdd45fc 100644 --- a/src/Generated/DeviceManagement/ExchangeConnectors/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/ExchangeConnectors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ExchangeConnectors/ExchangeConnectorsRequestBuilder.php b/src/Generated/DeviceManagement/ExchangeConnectors/ExchangeConnectorsRequestBuilder.php index 0dd9cf36ae1..d8a37161800 100644 --- a/src/Generated/DeviceManagement/ExchangeConnectors/ExchangeConnectorsRequestBuilder.php +++ b/src/Generated/DeviceManagement/ExchangeConnectors/ExchangeConnectorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ExchangeConnectors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\ExchangeConnectors\Item\DeviceManagementExchangeConnectorItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceManagementExchangeConnector; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceManagementExchangeConnector objects. * @param ExchangeConnectorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicemanagementexchangeconnector-list?view=graph-rest-1.0 Find more info here */ public function get(?ExchangeConnectorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExchangeConnectorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExchangeConnectorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceManagementExchangeConnector object. * @param DeviceManagementExchangeConnector $body The request body * @param ExchangeConnectorsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicemanagementexchangeconnector-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceManagementExchangeConnector $body, ?ExchangeConnectorsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExchangeConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExchangeConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ExchangeConnectorsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ExchangeConnectorsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceManagementExchangeConnector $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ExchangeConnectors/Item/DeviceManagementExchangeConnectorItemRequestBuilder.php b/src/Generated/DeviceManagement/ExchangeConnectors/Item/DeviceManagementExchangeConnectorItemRequestBuilder.php index 2ea19822b21..5ed85004e4e 100644 --- a/src/Generated/DeviceManagement/ExchangeConnectors/Item/DeviceManagementExchangeConnectorItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/ExchangeConnectors/Item/DeviceManagementExchangeConnectorItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ExchangeConnectors\Item\Sync\SyncRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceManagementExchangeConnector; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceManagementExchangeConnector. * @param DeviceManagementExchangeConnectorItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicemanagementexchangeconnector-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceManagementExchangeConnectorItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceManagementExchangeConnector object. * @param DeviceManagementExchangeConnectorItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicemanagementexchangeconnector-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceManagementExchangeConnectorItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExchangeConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExchangeConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceManagementExchangeConnector object. * @param DeviceManagementExchangeConnector $body The request body * @param DeviceManagementExchangeConnectorItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicemanagementexchangeconnector-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceManagementExchangeConnector $body, ?DeviceManagementExchangeConnectorItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExchangeConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExchangeConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?DeviceManagementExchangeConnectorIte $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?DeviceManagementExchangeConnectorItemRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?DeviceManagementExchangeConnectorItemRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(DeviceManagementExchangeConnector $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ExchangeConnectors/Item/Sync/SyncRequestBuilder.php b/src/Generated/DeviceManagement/ExchangeConnectors/Item/Sync/SyncRequestBuilder.php index e9b0a8389d6..a575988161e 100644 --- a/src/Generated/DeviceManagement/ExchangeConnectors/Item/Sync/SyncRequestBuilder.php +++ b/src/Generated/DeviceManagement/ExchangeConnectors/Item/Sync/SyncRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param SyncPostRequestBody $body The request body * @param SyncRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-devicemanagementexchangeconnector-sync?view=graph-rest-1.0 Find more info here */ public function post(SyncPostRequestBody $body, ?SyncRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SyncPostRequestBody $body, ?SyncRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/GetEffectivePermissionsWithScope/GetEffectivePermissionsWithScopeRequestBuilder.php b/src/Generated/DeviceManagement/GetEffectivePermissionsWithScope/GetEffectivePermissionsWithScopeRequestBuilder.php index 0fd2398a6ad..79afd968def 100644 --- a/src/Generated/DeviceManagement/GetEffectivePermissionsWithScope/GetEffectivePermissionsWithScopeRequestBuilder.php +++ b/src/Generated/DeviceManagement/GetEffectivePermissionsWithScope/GetEffectivePermissionsWithScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieves the effective permissions of the currently authenticated user * @param GetEffectivePermissionsWithScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetEffectivePermissionsWithScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetEffectivePermissionsWithScopeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetEffectivePermissionsWithScopeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?GetEffectivePermissionsWithScopeRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?GetEffectivePermissionsWithScopeRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/Count/CountRequestBuilder.php index 6b266810060..262387d393c 100644 --- a/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/Import/ImportRequestBuilder.php b/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/Import/ImportRequestBuilder.php index 9d92b994625..fb1e95a975f 100644 --- a/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/Import/ImportRequestBuilder.php +++ b/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/Import/ImportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param ImportPostRequestBody $body The request body * @param ImportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-enrollment-importedwindowsautopilotdeviceidentity-import?view=graph-rest-1.0 Find more info here */ public function post(ImportPostRequestBody $body, ?ImportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ImportPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ImportPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImportPostRequestBody $body, ?ImportReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/ImportedWindowsAutopilotDeviceIdentitiesRequestBuilder.php b/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/ImportedWindowsAutopilotDeviceIdentitiesRequestBuilder.php index 8f226d17ee8..833e2dca860 100644 --- a/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/ImportedWindowsAutopilotDeviceIdentitiesRequestBuilder.php +++ b/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/ImportedWindowsAutopilotDeviceIdentitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ImportedWindowsAutopilotDeviceIdentities\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\ImportedWindowsAutopilotDeviceIdentities\Import\ImportRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\ImportedWindowsAutopilotDeviceIdentities\Item\ImportedWindowsAutopilotDeviceIdentityItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the importedWindowsAutopilotDeviceIdentity objects. * @param ImportedWindowsAutopilotDeviceIdentitiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-enrollment-importedwindowsautopilotdeviceidentity-list?view=graph-rest-1.0 Find more info here */ public function get(?ImportedWindowsAutopilotDeviceIdentitiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ImportedWindowsAutopilotDeviceIdentityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ImportedWindowsAutopilotDeviceIdentityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new importedWindowsAutopilotDeviceIdentity object. * @param ImportedWindowsAutopilotDeviceIdentity $body The request body * @param ImportedWindowsAutopilotDeviceIdentitiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-enrollment-importedwindowsautopilotdeviceidentity-create?view=graph-rest-1.0 Find more info here */ public function post(ImportedWindowsAutopilotDeviceIdentity $body, ?ImportedWindowsAutopilotDeviceIdentitiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ImportedWindowsAutopilotDeviceIdentity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ImportedWindowsAutopilotDeviceIdentity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ImportedWindowsAutopilotDeviceIdentitie $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ImportedWindowsAutopilotDeviceIdentitie } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ImportedWindowsAutopilotDeviceIdentity $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/Item/ImportedWindowsAutopilotDeviceIdentityItemRequestBuilder.php b/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/Item/ImportedWindowsAutopilotDeviceIdentityItemRequestBuilder.php index 2a853cfcf8f..5cb6efa2029 100644 --- a/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/Item/ImportedWindowsAutopilotDeviceIdentityItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/ImportedWindowsAutopilotDeviceIdentities/Item/ImportedWindowsAutopilotDeviceIdentityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ImportedWindowsAutopilotDeviceIdentity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a importedWindowsAutopilotDeviceIdentity. * @param ImportedWindowsAutopilotDeviceIdentityItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-enrollment-importedwindowsautopilotdeviceidentity-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ImportedWindowsAutopilotDeviceIdentityItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the importedWindowsAutopilotDeviceIdentity object. * @param ImportedWindowsAutopilotDeviceIdentityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-enrollment-importedwindowsautopilotdeviceidentity-get?view=graph-rest-1.0 Find more info here */ public function get(?ImportedWindowsAutopilotDeviceIdentityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ImportedWindowsAutopilotDeviceIdentity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ImportedWindowsAutopilotDeviceIdentity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property importedWindowsAutopilotDeviceIdentities in deviceManagement * @param ImportedWindowsAutopilotDeviceIdentity $body The request body * @param ImportedWindowsAutopilotDeviceIdentityItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ImportedWindowsAutopilotDeviceIdentity $body, ?ImportedWindowsAutopilotDeviceIdentityItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ImportedWindowsAutopilotDeviceIdentity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ImportedWindowsAutopilotDeviceIdentity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ImportedWindowsAutopilotDeviceIdenti $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ImportedWindowsAutopilotDeviceIdentityI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ImportedWindowsAutopilotDeviceIdentityI } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(ImportedWindowsAutopilotDeviceIdentity $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/IosUpdateStatuses/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/IosUpdateStatuses/Count/CountRequestBuilder.php index 76eebd42d9e..eff69370133 100644 --- a/src/Generated/DeviceManagement/IosUpdateStatuses/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/IosUpdateStatuses/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/IosUpdateStatuses/IosUpdateStatusesRequestBuilder.php b/src/Generated/DeviceManagement/IosUpdateStatuses/IosUpdateStatusesRequestBuilder.php index edf8b64e50b..fff14808c3b 100644 --- a/src/Generated/DeviceManagement/IosUpdateStatuses/IosUpdateStatusesRequestBuilder.php +++ b/src/Generated/DeviceManagement/IosUpdateStatuses/IosUpdateStatusesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\IosUpdateStatuses\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\IosUpdateStatuses\Item\IosUpdateDeviceStatusItemRequestBuilder; use Microsoft\Graph\Generated\Models\IosUpdateDeviceStatus; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the iosUpdateDeviceStatus objects. * @param IosUpdateStatusesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-iosupdatedevicestatus-list?view=graph-rest-1.0 Find more info here */ public function get(?IosUpdateStatusesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosUpdateDeviceStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosUpdateDeviceStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new iosUpdateDeviceStatus object. * @param IosUpdateDeviceStatus $body The request body * @param IosUpdateStatusesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-iosupdatedevicestatus-create?view=graph-rest-1.0 Find more info here */ public function post(IosUpdateDeviceStatus $body, ?IosUpdateStatusesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosUpdateDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosUpdateDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?IosUpdateStatusesRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?IosUpdateStatusesRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(IosUpdateDeviceStatus $body, ?IosUpdate $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/IosUpdateStatuses/Item/IosUpdateDeviceStatusItemRequestBuilder.php b/src/Generated/DeviceManagement/IosUpdateStatuses/Item/IosUpdateDeviceStatusItemRequestBuilder.php index ee3d3af3ac1..9fece3b5891 100644 --- a/src/Generated/DeviceManagement/IosUpdateStatuses/Item/IosUpdateDeviceStatusItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/IosUpdateStatuses/Item/IosUpdateDeviceStatusItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IosUpdateDeviceStatus; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a iosUpdateDeviceStatus. * @param IosUpdateDeviceStatusItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-iosupdatedevicestatus-delete?view=graph-rest-1.0 Find more info here */ public function delete(?IosUpdateDeviceStatusItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the iosUpdateDeviceStatus object. * @param IosUpdateDeviceStatusItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-iosupdatedevicestatus-get?view=graph-rest-1.0 Find more info here */ public function get(?IosUpdateDeviceStatusItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosUpdateDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosUpdateDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a iosUpdateDeviceStatus object. * @param IosUpdateDeviceStatus $body The request body * @param IosUpdateDeviceStatusItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-iosupdatedevicestatus-update?view=graph-rest-1.0 Find more info here */ public function patch(IosUpdateDeviceStatus $body, ?IosUpdateDeviceStatusItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IosUpdateDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IosUpdateDeviceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?IosUpdateDeviceStatusItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?IosUpdateDeviceStatusItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?IosUpdateDeviceStatusItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(IosUpdateDeviceStatus $body, ?IosUpdat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDeviceOverview/ManagedDeviceOverviewRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDeviceOverview/ManagedDeviceOverviewRequestBuilder.php index 96a3a92a522..224634d7f73 100644 --- a/src/Generated/DeviceManagement/ManagedDeviceOverview/ManagedDeviceOverviewRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDeviceOverview/ManagedDeviceOverviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedDeviceOverview; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read properties and relationships of the managedDeviceOverview object. * @param ManagedDeviceOverviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddeviceoverview-get?view=graph-rest-1.0 Find more info here */ public function get(?ManagedDeviceOverviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceOverview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceOverview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?ManagedDeviceOverviewRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?ManagedDeviceOverviewRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Count/CountRequestBuilder.php index cefe513f58f..f3749b9ce73 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/BypassActivationLock/BypassActivationLockRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/BypassActivationLock/BypassActivationLockRequestBuilder.php index 41e85d1efa7..3d2a8e713c6 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/BypassActivationLock/BypassActivationLockRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/BypassActivationLock/BypassActivationLockRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Bypass activation lock * @param BypassActivationLockRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-bypassactivationlock?view=graph-rest-1.0 Find more info here */ public function post(?BypassActivationLockRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?BypassActivationLockRequestBuilderPost $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/CleanWindowsDevice/CleanWindowsDeviceRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/CleanWindowsDevice/CleanWindowsDeviceRequestBuilder.php index efa63862d0f..4922108db10 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/CleanWindowsDevice/CleanWindowsDeviceRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/CleanWindowsDevice/CleanWindowsDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Clean Windows device * @param CleanWindowsDevicePostRequestBody $body The request body * @param CleanWindowsDeviceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-cleanwindowsdevice?view=graph-rest-1.0 Find more info here */ public function post(CleanWindowsDevicePostRequestBody $body, ?CleanWindowsDeviceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CleanWindowsDevicePostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/DeleteUserFromSharedAppleDevice/DeleteUserFromSharedAppleDeviceRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/DeleteUserFromSharedAppleDevice/DeleteUserFromSharedAppleDeviceRequestBuilder.php index 25d9d07421d..a0b04ff7831 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/DeleteUserFromSharedAppleDevice/DeleteUserFromSharedAppleDeviceRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/DeleteUserFromSharedAppleDevice/DeleteUserFromSharedAppleDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Delete user from shared Apple device * @param DeleteUserFromSharedAppleDevicePostRequestBody $body The request body * @param DeleteUserFromSharedAppleDeviceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-deleteuserfromsharedappledevice?view=graph-rest-1.0 Find more info here */ public function post(DeleteUserFromSharedAppleDevicePostRequestBody $body, ?DeleteUserFromSharedAppleDeviceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeleteUserFromSharedAppleDevicePostRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCategory/DeviceCategoryRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCategory/DeviceCategoryRequestBuilder.php index dc808df3867..d2de7945110 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCategory/DeviceCategoryRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCategory/DeviceCategoryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceCategory for deviceManagement * @param DeviceCategoryRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceCategoryRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceCategory object. * @param DeviceCategoryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-devicecategory-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceCategoryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceCategory object. * @param DeviceCategory $body The request body * @param DeviceCategoryRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-devicecategory-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceCategory $body, ?DeviceCategoryRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DeviceCategoryRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DeviceCategoryRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DeviceCategoryRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(DeviceCategory $body, ?DeviceCategoryR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCompliancePolicyStates/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCompliancePolicyStates/Count/CountRequestBuilder.php index 92c0315245a..98a6649ac68 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCompliancePolicyStates/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCompliancePolicyStates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCompliancePolicyStates/DeviceCompliancePolicyStatesRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCompliancePolicyStates/DeviceCompliancePolicyStatesRequestBuilder.php index 5dec806b72b..3d4fabcf6a7 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCompliancePolicyStates/DeviceCompliancePolicyStatesRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCompliancePolicyStates/DeviceCompliancePolicyStatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\DeviceCompliancePolicyStates\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\DeviceCompliancePolicyStates\Item\DeviceCompliancePolicyStateItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceCompliancePolicyState; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Device compliance policy states for this device. * @param DeviceCompliancePolicyStatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceCompliancePolicyStatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to deviceCompliancePolicyStates for deviceManagement * @param DeviceCompliancePolicyState $body The request body * @param DeviceCompliancePolicyStatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DeviceCompliancePolicyState $body, ?DeviceCompliancePolicyStatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DeviceCompliancePolicyStatesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DeviceCompliancePolicyStatesRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DeviceCompliancePolicyState $body, ?Dev $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCompliancePolicyStates/Item/DeviceCompliancePolicyStateItemRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCompliancePolicyStates/Item/DeviceCompliancePolicyStateItemRequestBuilder.php index b6cc0402429..2e79b61f5b0 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCompliancePolicyStates/Item/DeviceCompliancePolicyStateItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceCompliancePolicyStates/Item/DeviceCompliancePolicyStateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceCompliancePolicyState; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceCompliancePolicyStates for deviceManagement * @param DeviceCompliancePolicyStateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceCompliancePolicyStateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Device compliance policy states for this device. * @param DeviceCompliancePolicyStateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceCompliancePolicyStateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property deviceCompliancePolicyStates in deviceManagement * @param DeviceCompliancePolicyState $body The request body * @param DeviceCompliancePolicyStateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DeviceCompliancePolicyState $body, ?DeviceCompliancePolicyStateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DeviceCompliancePolicyStateItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DeviceCompliancePolicyStateItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DeviceCompliancePolicyStateItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(DeviceCompliancePolicyState $body, ?De $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceConfigurationStates/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceConfigurationStates/Count/CountRequestBuilder.php index 7dcfa4c551f..cdacfdea73b 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceConfigurationStates/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceConfigurationStates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceConfigurationStates/DeviceConfigurationStatesRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceConfigurationStates/DeviceConfigurationStatesRequestBuilder.php index 78a29165606..ecc0485eee0 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceConfigurationStates/DeviceConfigurationStatesRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceConfigurationStates/DeviceConfigurationStatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\DeviceConfigurationStates\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\DeviceConfigurationStates\Item\DeviceConfigurationStateItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceConfigurationState; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Device configuration states for this device. * @param DeviceConfigurationStatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceConfigurationStatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to deviceConfigurationStates for deviceManagement * @param DeviceConfigurationState $body The request body * @param DeviceConfigurationStatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DeviceConfigurationState $body, ?DeviceConfigurationStatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DeviceConfigurationStatesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DeviceConfigurationStatesRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DeviceConfigurationState $body, ?Device $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceConfigurationStates/Item/DeviceConfigurationStateItemRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceConfigurationStates/Item/DeviceConfigurationStateItemRequestBuilder.php index fb3f42f4d62..5ed9cb43b1e 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceConfigurationStates/Item/DeviceConfigurationStateItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/DeviceConfigurationStates/Item/DeviceConfigurationStateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceConfigurationState; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceConfigurationStates for deviceManagement * @param DeviceConfigurationStateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceConfigurationStateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Device configuration states for this device. * @param DeviceConfigurationStateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceConfigurationStateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property deviceConfigurationStates in deviceManagement * @param DeviceConfigurationState $body The request body * @param DeviceConfigurationStateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DeviceConfigurationState $body, ?DeviceConfigurationStateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DeviceConfigurationStateItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DeviceConfigurationStateItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DeviceConfigurationStateItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(DeviceConfigurationState $body, ?Devic $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/DisableLostMode/DisableLostModeRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/DisableLostMode/DisableLostModeRequestBuilder.php index 3a89f998580..137e45c2b7d 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/DisableLostMode/DisableLostModeRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/DisableLostMode/DisableLostModeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Disable lost mode * @param DisableLostModeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-disablelostmode?view=graph-rest-1.0 Find more info here */ public function post(?DisableLostModeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DisableLostModeRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/LocateDevice/LocateDeviceRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/LocateDevice/LocateDeviceRequestBuilder.php index e88c4a94a46..4caa04082b5 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/LocateDevice/LocateDeviceRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/LocateDevice/LocateDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Locate a device * @param LocateDeviceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-locatedevice?view=graph-rest-1.0 Find more info here */ public function post(?LocateDeviceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?LocateDeviceRequestBuilderPostRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/Count/CountRequestBuilder.php index 78501f193c8..fa16aacc7cb 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/Item/CreateDownloadUrl/CreateDownloadUrlRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/Item/CreateDownloadUrl/CreateDownloadUrlRequestBuilder.php index 6c82efc9caa..910472f3419 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/Item/CreateDownloadUrl/CreateDownloadUrlRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/Item/CreateDownloadUrl/CreateDownloadUrlRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action createDownloadUrl * @param CreateDownloadUrlRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?CreateDownloadUrlRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CreateDownloadUrlPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CreateDownloadUrlPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toPostRequestInformation(?CreateDownloadUrlRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/Item/DeviceLogCollectionResponseItemRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/Item/DeviceLogCollectionResponseItemRequestBuilder.php index bb0c1c7592c..01f2588c47f 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/Item/DeviceLogCollectionResponseItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/Item/DeviceLogCollectionResponseItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\LogCollectionRequests\Item\CreateDownloadUrl\CreateDownloadUrlRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceLogCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property logCollectionRequests for deviceManagement * @param DeviceLogCollectionResponseItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceLogCollectionResponseItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * List of log collection requests * @param DeviceLogCollectionResponseItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceLogCollectionResponseItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property logCollectionRequests in deviceManagement * @param DeviceLogCollectionResponse $body The request body * @param DeviceLogCollectionResponseItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DeviceLogCollectionResponse $body, ?DeviceLogCollectionResponseItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?DeviceLogCollectionResponseItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?DeviceLogCollectionResponseItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?DeviceLogCollectionResponseItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(DeviceLogCollectionResponse $body, ?De $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/LogCollectionRequestsRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/LogCollectionRequestsRequestBuilder.php index 08d57296fd3..f4c26921129 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/LogCollectionRequestsRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/LogCollectionRequests/LogCollectionRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\LogCollectionRequests\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\LogCollectionRequests\Item\DeviceLogCollectionResponseItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceLogCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List of log collection requests * @param LogCollectionRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LogCollectionRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to logCollectionRequests for deviceManagement * @param DeviceLogCollectionResponse $body The request body * @param LogCollectionRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DeviceLogCollectionResponse $body, ?LogCollectionRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?LogCollectionRequestsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?LogCollectionRequestsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DeviceLogCollectionResponse $body, ?Log $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/LogoutSharedAppleDeviceActiveUser/LogoutSharedAppleDeviceActiveUserRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/LogoutSharedAppleDeviceActiveUser/LogoutSharedAppleDeviceActiveUserRequestBuilder.php index 386105054e4..22c731139c1 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/LogoutSharedAppleDeviceActiveUser/LogoutSharedAppleDeviceActiveUserRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/LogoutSharedAppleDeviceActiveUser/LogoutSharedAppleDeviceActiveUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Logout shared Apple device active user * @param LogoutSharedAppleDeviceActiveUserRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-logoutsharedappledeviceactiveuser?view=graph-rest-1.0 Find more info here */ public function post(?LogoutSharedAppleDeviceActiveUserRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?LogoutSharedAppleDeviceActiveUserReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/ManagedDeviceItemRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/ManagedDeviceItemRequestBuilder.php index 5797608e49e..9fda112242a 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/ManagedDeviceItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/ManagedDeviceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\BypassActivationLock\BypassActivationLockRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\CleanWindowsDevice\CleanWindowsDeviceRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\DeleteUserFromSharedAppleDevice\DeleteUserFromSharedAppleDeviceRequestBuilder; @@ -226,59 +225,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a managedDevice. * @param ManagedDeviceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ManagedDeviceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the managedDevice object. * @param ManagedDeviceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-get?view=graph-rest-1.0 Find more info here */ public function get(?ManagedDeviceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a managedDevice object. * @param ManagedDevice $body The request body * @param ManagedDeviceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-update?view=graph-rest-1.0 Find more info here */ public function patch(ManagedDevice $body, ?ManagedDeviceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -295,6 +285,7 @@ public function toDeleteRequestInformation(?ManagedDeviceItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -308,7 +299,6 @@ public function toGetRequestInformation(?ManagedDeviceItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -316,6 +306,7 @@ public function toGetRequestInformation(?ManagedDeviceItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -330,11 +321,11 @@ public function toPatchRequestInformation(ManagedDevice $body, ?ManagedDeviceIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/RebootNow/RebootNowRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/RebootNow/RebootNowRequestBuilder.php index 21eac7ea949..90d6ce7ebba 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/RebootNow/RebootNowRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/RebootNow/RebootNowRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reboot device * @param RebootNowRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-rebootnow?view=graph-rest-1.0 Find more info here */ public function post(?RebootNowRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RebootNowRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/RecoverPasscode/RecoverPasscodeRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/RecoverPasscode/RecoverPasscodeRequestBuilder.php index 7991d658923..d677f875b72 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/RecoverPasscode/RecoverPasscodeRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/RecoverPasscode/RecoverPasscodeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Recover passcode * @param RecoverPasscodeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-recoverpasscode?view=graph-rest-1.0 Find more info here */ public function post(?RecoverPasscodeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RecoverPasscodeRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/RemoteLock/RemoteLockRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/RemoteLock/RemoteLockRequestBuilder.php index 39cca5d380c..4a43a19face 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/RemoteLock/RemoteLockRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/RemoteLock/RemoteLockRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remote lock * @param RemoteLockRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-remotelock?view=graph-rest-1.0 Find more info here */ public function post(?RemoteLockRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RemoteLockRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/RequestRemoteAssistance/RequestRemoteAssistanceRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/RequestRemoteAssistance/RequestRemoteAssistanceRequestBuilder.php index 2bbe872f8cc..6ee4c94ebe8 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/RequestRemoteAssistance/RequestRemoteAssistanceRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/RequestRemoteAssistance/RequestRemoteAssistanceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Request remote assistance * @param RequestRemoteAssistanceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-requestremoteassistance?view=graph-rest-1.0 Find more info here */ public function post(?RequestRemoteAssistanceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RequestRemoteAssistanceRequestBuilderP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/ResetPasscode/ResetPasscodeRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/ResetPasscode/ResetPasscodeRequestBuilder.php index ed507b7842c..79b19e89e58 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/ResetPasscode/ResetPasscodeRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/ResetPasscode/ResetPasscodeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reset passcode * @param ResetPasscodeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-resetpasscode?view=graph-rest-1.0 Find more info here */ public function post(?ResetPasscodeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ResetPasscodeRequestBuilderPostRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/Retire/RetireRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/Retire/RetireRequestBuilder.php index f9dc81fcc17..8c367dd2a85 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/Retire/RetireRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/Retire/RetireRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retire a device * @param RetireRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-retire?view=graph-rest-1.0 Find more info here */ public function post(?RetireRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RetireRequestBuilderPostRequestConfigu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/ShutDown/ShutDownRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/ShutDown/ShutDownRequestBuilder.php index 786d50e3bb0..78f16d25fb2 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/ShutDown/ShutDownRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/ShutDown/ShutDownRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Shut down device * @param ShutDownRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-shutdown?view=graph-rest-1.0 Find more info here */ public function post(?ShutDownRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ShutDownRequestBuilderPostRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/SyncDevice/SyncDeviceRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/SyncDevice/SyncDeviceRequestBuilder.php index 70a2e605b41..d9b1ba2cae5 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/SyncDevice/SyncDeviceRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/SyncDevice/SyncDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Not yet documented * @param SyncDeviceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-syncdevice?view=graph-rest-1.0 Find more info here */ public function post(?SyncDeviceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SyncDeviceRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/UpdateWindowsDeviceAccount/UpdateWindowsDeviceAccountRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/UpdateWindowsDeviceAccount/UpdateWindowsDeviceAccountRequestBuilder.php index 52a19207c00..ec99bf7c2ca 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/UpdateWindowsDeviceAccount/UpdateWindowsDeviceAccountRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/UpdateWindowsDeviceAccount/UpdateWindowsDeviceAccountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param UpdateWindowsDeviceAccountPostRequestBody $body The request body * @param UpdateWindowsDeviceAccountRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-updatewindowsdeviceaccount?view=graph-rest-1.0 Find more info here */ public function post(UpdateWindowsDeviceAccountPostRequestBody $body, ?UpdateWindowsDeviceAccountRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(UpdateWindowsDeviceAccountPostRequestBo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/Users/UsersRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/Users/UsersRequestBuilder.php index ee0edc0b44e..7d6bf7cb66e 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/Users/UsersRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/Users/UsersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the user objects. * @param UsersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-user-list?view=graph-rest-1.0 Find more info here */ public function get(?UsersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?UsersRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?UsersRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsDefenderScan/WindowsDefenderScanRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsDefenderScan/WindowsDefenderScanRequestBuilder.php index 46e4dd9eead..16dc6845dc3 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsDefenderScan/WindowsDefenderScanRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsDefenderScan/WindowsDefenderScanRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param WindowsDefenderScanPostRequestBody $body The request body * @param WindowsDefenderScanRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-windowsdefenderscan?view=graph-rest-1.0 Find more info here */ public function post(WindowsDefenderScanPostRequestBody $body, ?WindowsDefenderScanRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(WindowsDefenderScanPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsDefenderUpdateSignatures/WindowsDefenderUpdateSignaturesRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsDefenderUpdateSignatures/WindowsDefenderUpdateSignaturesRequestBuilder.php index c1e7f6971a2..137ec3c42f2 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsDefenderUpdateSignatures/WindowsDefenderUpdateSignaturesRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsDefenderUpdateSignatures/WindowsDefenderUpdateSignaturesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Not yet documented * @param WindowsDefenderUpdateSignaturesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-windowsdefenderupdatesignatures?view=graph-rest-1.0 Find more info here */ public function post(?WindowsDefenderUpdateSignaturesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?WindowsDefenderUpdateSignaturesRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Count/CountRequestBuilder.php index be4fd84a001..69c7aef82f4 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/DetectedMalwareStateRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/DetectedMalwareStateRequestBuilder.php index 8c506ca66c7..700223801dd 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/DetectedMalwareStateRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/DetectedMalwareStateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\WindowsProtectionState\DetectedMalwareState\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\WindowsProtectionState\DetectedMalwareState\Item\WindowsDeviceMalwareStateItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the windowsDeviceMalwareState objects. * @param DetectedMalwareStateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsdevicemalwarestate-list?view=graph-rest-1.0 Find more info here */ public function get(?DetectedMalwareStateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new windowsDeviceMalwareState object. * @param WindowsDeviceMalwareState $body The request body * @param DetectedMalwareStateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsdevicemalwarestate-create?view=graph-rest-1.0 Find more info here */ public function post(WindowsDeviceMalwareState $body, ?DetectedMalwareStateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DetectedMalwareStateRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DetectedMalwareStateRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(WindowsDeviceMalwareState $body, ?Detec $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Item/WindowsDeviceMalwareStateItemRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Item/WindowsDeviceMalwareStateItemRequestBuilder.php index fcdcf7a8dfb..3b00ecddd3f 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Item/WindowsDeviceMalwareStateItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Item/WindowsDeviceMalwareStateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsDeviceMalwareState; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a windowsDeviceMalwareState. * @param WindowsDeviceMalwareStateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsdevicemalwarestate-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WindowsDeviceMalwareStateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the windowsDeviceMalwareState object. * @param WindowsDeviceMalwareStateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsdevicemalwarestate-get?view=graph-rest-1.0 Find more info here */ public function get(?WindowsDeviceMalwareStateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a windowsDeviceMalwareState object. * @param WindowsDeviceMalwareState $body The request body * @param WindowsDeviceMalwareStateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsdevicemalwarestate-update?view=graph-rest-1.0 Find more info here */ public function patch(WindowsDeviceMalwareState $body, ?WindowsDeviceMalwareStateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?WindowsDeviceMalwareStateItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?WindowsDeviceMalwareStateItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?WindowsDeviceMalwareStateItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(WindowsDeviceMalwareState $body, ?Wind $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/WindowsProtectionStateRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/WindowsProtectionStateRequestBuilder.php index 3b922458872..df144858174 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/WindowsProtectionStateRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/WindowsProtectionState/WindowsProtectionStateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\WindowsProtectionState\DetectedMalwareState\DetectedMalwareStateRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsProtectionState; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property windowsProtectionState for deviceManagement * @param WindowsProtectionStateRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WindowsProtectionStateRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the windowsProtectionState object. * @param WindowsProtectionStateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsprotectionstate-get?view=graph-rest-1.0 Find more info here */ public function get(?WindowsProtectionStateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsProtectionState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsProtectionState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a windowsProtectionState object. * @param WindowsProtectionState $body The request body * @param WindowsProtectionStateRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsprotectionstate-update?view=graph-rest-1.0 Find more info here */ public function patch(WindowsProtectionState $body, ?WindowsProtectionStateRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsProtectionState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsProtectionState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?WindowsProtectionStateRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?WindowsProtectionStateRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?WindowsProtectionStateRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WindowsProtectionState $body, ?Windows $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/Item/Wipe/WipeRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/Item/Wipe/WipeRequestBuilder.php index e1a3b143bf2..5e1faee68ec 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/Item/Wipe/WipeRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/Item/Wipe/WipeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Wipe a device * @param WipePostRequestBody $body The request body * @param WipeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-wipe?view=graph-rest-1.0 Find more info here */ public function post(WipePostRequestBody $body, ?WipeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(WipePostRequestBody $body, ?WipeRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ManagedDevices/ManagedDevicesRequestBuilder.php b/src/Generated/DeviceManagement/ManagedDevices/ManagedDevicesRequestBuilder.php index 23e1c955abd..e9e72d225d8 100644 --- a/src/Generated/DeviceManagement/ManagedDevices/ManagedDevicesRequestBuilder.php +++ b/src/Generated/DeviceManagement/ManagedDevices/ManagedDevicesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\ManagedDevices\Item\ManagedDeviceItemRequestBuilder; use Microsoft\Graph\Generated\Models\ManagedDevice; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the managedDevice objects. * @param ManagedDevicesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-list?view=graph-rest-1.0 Find more info here */ public function get(?ManagedDevicesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new managedDevice object. * @param ManagedDevice $body The request body * @param ManagedDevicesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-create?view=graph-rest-1.0 Find more info here */ public function post(ManagedDevice $body, ?ManagedDevicesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ManagedDevicesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ManagedDevicesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ManagedDevice $body, ?ManagedDevicesReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Count/CountRequestBuilder.php index 46ecf8370cc..6ed3ba6e82b 100644 --- a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/AppLogCollectionRequestsRequestBuilder.php b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/AppLogCollectionRequestsRequestBuilder.php index 828b897bed1..d48fb064ce0 100644 --- a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/AppLogCollectionRequestsRequestBuilder.php +++ b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/AppLogCollectionRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\MobileAppTroubleshootingEvents\Item\AppLogCollectionRequests\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\MobileAppTroubleshootingEvents\Item\AppLogCollectionRequests\Item\AppLogCollectionRequestItemRequestBuilder; use Microsoft\Graph\Generated\Models\AppLogCollectionRequest; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the appLogCollectionRequest objects. * @param AppLogCollectionRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-applogcollectionrequest-list?view=graph-rest-1.0 Find more info here */ public function get(?AppLogCollectionRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppLogCollectionRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppLogCollectionRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new appLogCollectionRequest object. * @param AppLogCollectionRequest $body The request body * @param AppLogCollectionRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-applogcollectionrequest-create?view=graph-rest-1.0 Find more info here */ public function post(AppLogCollectionRequest $body, ?AppLogCollectionRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppLogCollectionRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppLogCollectionRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AppLogCollectionRequestsRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AppLogCollectionRequestsRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AppLogCollectionRequest $body, ?AppLogC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/Count/CountRequestBuilder.php index af9dc4efa7e..3cf38a962d7 100644 --- a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/Item/AppLogCollectionRequestItemRequestBuilder.php b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/Item/AppLogCollectionRequestItemRequestBuilder.php index 6cdc8cb0b3d..3788fc6b296 100644 --- a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/Item/AppLogCollectionRequestItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/Item/AppLogCollectionRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\MobileAppTroubleshootingEvents\Item\AppLogCollectionRequests\Item\CreateDownloadUrl\CreateDownloadUrlRequestBuilder; use Microsoft\Graph\Generated\Models\AppLogCollectionRequest; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a appLogCollectionRequest. * @param AppLogCollectionRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-applogcollectionrequest-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AppLogCollectionRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the appLogCollectionRequest object. * @param AppLogCollectionRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-applogcollectionrequest-get?view=graph-rest-1.0 Find more info here */ public function get(?AppLogCollectionRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppLogCollectionRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppLogCollectionRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a appLogCollectionRequest object. * @param AppLogCollectionRequest $body The request body * @param AppLogCollectionRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-applogcollectionrequest-update?view=graph-rest-1.0 Find more info here */ public function patch(AppLogCollectionRequest $body, ?AppLogCollectionRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppLogCollectionRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppLogCollectionRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?AppLogCollectionRequestItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?AppLogCollectionRequestItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?AppLogCollectionRequestItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(AppLogCollectionRequest $body, ?AppLog $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/Item/CreateDownloadUrl/CreateDownloadUrlRequestBuilder.php b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/Item/CreateDownloadUrl/CreateDownloadUrlRequestBuilder.php index e63fd02ca78..3898e73f33e 100644 --- a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/Item/CreateDownloadUrl/CreateDownloadUrlRequestBuilder.php +++ b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/AppLogCollectionRequests/Item/CreateDownloadUrl/CreateDownloadUrlRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppLogCollectionDownloadDetails; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Not yet documented * @param CreateDownloadUrlRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-applogcollectionrequest-createdownloadurl?view=graph-rest-1.0 Find more info here */ public function post(?CreateDownloadUrlRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppLogCollectionDownloadDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppLogCollectionDownloadDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?CreateDownloadUrlRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/MobileAppTroubleshootingEventItemRequestBuilder.php b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/MobileAppTroubleshootingEventItemRequestBuilder.php index 4efd2306e88..f40cba7b181 100644 --- a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/MobileAppTroubleshootingEventItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/Item/MobileAppTroubleshootingEventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\MobileAppTroubleshootingEvents\Item\AppLogCollectionRequests\AppLogCollectionRequestsRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppTroubleshootingEvent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileAppTroubleshootingEvent. * @param MobileAppTroubleshootingEventItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-mobileapptroubleshootingevent-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileAppTroubleshootingEventItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileAppTroubleshootingEvent object. * @param MobileAppTroubleshootingEventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-mobileapptroubleshootingevent-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppTroubleshootingEventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileAppTroubleshootingEvent object. * @param MobileAppTroubleshootingEvent $body The request body * @param MobileAppTroubleshootingEventItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-mobileapptroubleshootingevent-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileAppTroubleshootingEvent $body, ?MobileAppTroubleshootingEventItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?MobileAppTroubleshootingEventItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?MobileAppTroubleshootingEventItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?MobileAppTroubleshootingEventItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(MobileAppTroubleshootingEvent $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/MobileAppTroubleshootingEventsRequestBuilder.php b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/MobileAppTroubleshootingEventsRequestBuilder.php index 36fe525fe9d..16dab3f63d4 100644 --- a/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/MobileAppTroubleshootingEventsRequestBuilder.php +++ b/src/Generated/DeviceManagement/MobileAppTroubleshootingEvents/MobileAppTroubleshootingEventsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\MobileAppTroubleshootingEvents\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\MobileAppTroubleshootingEvents\Item\MobileAppTroubleshootingEventItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileAppTroubleshootingEvent; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileAppTroubleshootingEvent objects. * @param MobileAppTroubleshootingEventsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-mobileapptroubleshootingevent-list?view=graph-rest-1.0 Find more info here */ public function get(?MobileAppTroubleshootingEventsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppTroubleshootingEventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppTroubleshootingEventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileAppTroubleshootingEvent object. * @param MobileAppTroubleshootingEvent $body The request body * @param MobileAppTroubleshootingEventsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-mobileapptroubleshootingevent-create?view=graph-rest-1.0 Find more info here */ public function post(MobileAppTroubleshootingEvent $body, ?MobileAppTroubleshootingEventsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileAppTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileAppTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?MobileAppTroubleshootingEventsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?MobileAppTroubleshootingEventsRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileAppTroubleshootingEvent $body, ?M $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/MobileThreatDefenseConnectors/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/MobileThreatDefenseConnectors/Count/CountRequestBuilder.php index 226c8d5dc22..edf993fb621 100644 --- a/src/Generated/DeviceManagement/MobileThreatDefenseConnectors/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/MobileThreatDefenseConnectors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/MobileThreatDefenseConnectors/Item/MobileThreatDefenseConnectorItemRequestBuilder.php b/src/Generated/DeviceManagement/MobileThreatDefenseConnectors/Item/MobileThreatDefenseConnectorItemRequestBuilder.php index 07344dc987a..f5b63361e0f 100644 --- a/src/Generated/DeviceManagement/MobileThreatDefenseConnectors/Item/MobileThreatDefenseConnectorItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/MobileThreatDefenseConnectors/Item/MobileThreatDefenseConnectorItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MobileThreatDefenseConnector; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a mobileThreatDefenseConnector. * @param MobileThreatDefenseConnectorItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-mobilethreatdefenseconnector-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MobileThreatDefenseConnectorItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the mobileThreatDefenseConnector object. * @param MobileThreatDefenseConnectorItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-mobilethreatdefenseconnector-get?view=graph-rest-1.0 Find more info here */ public function get(?MobileThreatDefenseConnectorItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileThreatDefenseConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileThreatDefenseConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a mobileThreatDefenseConnector object. * @param MobileThreatDefenseConnector $body The request body * @param MobileThreatDefenseConnectorItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-mobilethreatdefenseconnector-update?view=graph-rest-1.0 Find more info here */ public function patch(MobileThreatDefenseConnector $body, ?MobileThreatDefenseConnectorItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileThreatDefenseConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileThreatDefenseConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MobileThreatDefenseConnectorItemRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MobileThreatDefenseConnectorItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MobileThreatDefenseConnectorItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MobileThreatDefenseConnector $body, ?M $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/MobileThreatDefenseConnectors/MobileThreatDefenseConnectorsRequestBuilder.php b/src/Generated/DeviceManagement/MobileThreatDefenseConnectors/MobileThreatDefenseConnectorsRequestBuilder.php index d3135621506..94769efea19 100644 --- a/src/Generated/DeviceManagement/MobileThreatDefenseConnectors/MobileThreatDefenseConnectorsRequestBuilder.php +++ b/src/Generated/DeviceManagement/MobileThreatDefenseConnectors/MobileThreatDefenseConnectorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\MobileThreatDefenseConnectors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\MobileThreatDefenseConnectors\Item\MobileThreatDefenseConnectorItemRequestBuilder; use Microsoft\Graph\Generated\Models\MobileThreatDefenseConnector; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the mobileThreatDefenseConnector objects. * @param MobileThreatDefenseConnectorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-mobilethreatdefenseconnector-list?view=graph-rest-1.0 Find more info here */ public function get(?MobileThreatDefenseConnectorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileThreatDefenseConnectorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileThreatDefenseConnectorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new mobileThreatDefenseConnector object. * @param MobileThreatDefenseConnector $body The request body * @param MobileThreatDefenseConnectorsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-mobilethreatdefenseconnector-create?view=graph-rest-1.0 Find more info here */ public function post(MobileThreatDefenseConnector $body, ?MobileThreatDefenseConnectorsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MobileThreatDefenseConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MobileThreatDefenseConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?MobileThreatDefenseConnectorsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?MobileThreatDefenseConnectorsRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MobileThreatDefenseConnector $body, ?Mo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/NotificationMessageTemplates/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/NotificationMessageTemplates/Count/CountRequestBuilder.php index 5da2746a8ff..abea11d7a8d 100644 --- a/src/Generated/DeviceManagement/NotificationMessageTemplates/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/NotificationMessageTemplates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/LocalizedNotificationMessages/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/LocalizedNotificationMessages/Count/CountRequestBuilder.php index e7e4d48fd7d..3e52acf3ca8 100644 --- a/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/LocalizedNotificationMessages/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/LocalizedNotificationMessages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/LocalizedNotificationMessages/Item/LocalizedNotificationMessageItemRequestBuilder.php b/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/LocalizedNotificationMessages/Item/LocalizedNotificationMessageItemRequestBuilder.php index ef028501851..5a7ab5a6d45 100644 --- a/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/LocalizedNotificationMessages/Item/LocalizedNotificationMessageItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/LocalizedNotificationMessages/Item/LocalizedNotificationMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LocalizedNotificationMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a localizedNotificationMessage. * @param LocalizedNotificationMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-notification-localizednotificationmessage-delete?view=graph-rest-1.0 Find more info here */ public function delete(?LocalizedNotificationMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the localizedNotificationMessage object. * @param LocalizedNotificationMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-notification-localizednotificationmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?LocalizedNotificationMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LocalizedNotificationMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LocalizedNotificationMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a localizedNotificationMessage object. * @param LocalizedNotificationMessage $body The request body * @param LocalizedNotificationMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-notification-localizednotificationmessage-update?view=graph-rest-1.0 Find more info here */ public function patch(LocalizedNotificationMessage $body, ?LocalizedNotificationMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LocalizedNotificationMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LocalizedNotificationMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?LocalizedNotificationMessageItemRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?LocalizedNotificationMessageItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?LocalizedNotificationMessageItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(LocalizedNotificationMessage $body, ?L $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/LocalizedNotificationMessages/LocalizedNotificationMessagesRequestBuilder.php b/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/LocalizedNotificationMessages/LocalizedNotificationMessagesRequestBuilder.php index e121d9d3e57..de7e9cd3745 100644 --- a/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/LocalizedNotificationMessages/LocalizedNotificationMessagesRequestBuilder.php +++ b/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/LocalizedNotificationMessages/LocalizedNotificationMessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\NotificationMessageTemplates\Item\LocalizedNotificationMessages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\NotificationMessageTemplates\Item\LocalizedNotificationMessages\Item\LocalizedNotificationMessageItemRequestBuilder; use Microsoft\Graph\Generated\Models\LocalizedNotificationMessage; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the localizedNotificationMessage objects. * @param LocalizedNotificationMessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-notification-localizednotificationmessage-list?view=graph-rest-1.0 Find more info here */ public function get(?LocalizedNotificationMessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LocalizedNotificationMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LocalizedNotificationMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new localizedNotificationMessage object. * @param LocalizedNotificationMessage $body The request body * @param LocalizedNotificationMessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-notification-localizednotificationmessage-create?view=graph-rest-1.0 Find more info here */ public function post(LocalizedNotificationMessage $body, ?LocalizedNotificationMessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LocalizedNotificationMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LocalizedNotificationMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?LocalizedNotificationMessagesRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?LocalizedNotificationMessagesRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(LocalizedNotificationMessage $body, ?Lo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/NotificationMessageTemplateItemRequestBuilder.php b/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/NotificationMessageTemplateItemRequestBuilder.php index 4101ac3e93a..7fc7ad20065 100644 --- a/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/NotificationMessageTemplateItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/NotificationMessageTemplateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\NotificationMessageTemplates\Item\LocalizedNotificationMessages\LocalizedNotificationMessagesRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\NotificationMessageTemplates\Item\SendTestMessage\SendTestMessageRequestBuilder; use Microsoft\Graph\Generated\Models\NotificationMessageTemplate; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a notificationMessageTemplate. * @param NotificationMessageTemplateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-notification-notificationmessagetemplate-delete?view=graph-rest-1.0 Find more info here */ public function delete(?NotificationMessageTemplateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the notificationMessageTemplate object. * @param NotificationMessageTemplateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-notification-notificationmessagetemplate-get?view=graph-rest-1.0 Find more info here */ public function get(?NotificationMessageTemplateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [NotificationMessageTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [NotificationMessageTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a notificationMessageTemplate object. * @param NotificationMessageTemplate $body The request body * @param NotificationMessageTemplateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-notification-notificationmessagetemplate-update?view=graph-rest-1.0 Find more info here */ public function patch(NotificationMessageTemplate $body, ?NotificationMessageTemplateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [NotificationMessageTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [NotificationMessageTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?NotificationMessageTemplateItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?NotificationMessageTemplateItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?NotificationMessageTemplateItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(NotificationMessageTemplate $body, ?No $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/SendTestMessage/SendTestMessageRequestBuilder.php b/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/SendTestMessage/SendTestMessageRequestBuilder.php index 5383a9a8fca..1bb048d434f 100644 --- a/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/SendTestMessage/SendTestMessageRequestBuilder.php +++ b/src/Generated/DeviceManagement/NotificationMessageTemplates/Item/SendTestMessage/SendTestMessageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Sends test message using the specified notificationMessageTemplate in the default locale * @param SendTestMessageRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-notification-notificationmessagetemplate-sendtestmessage?view=graph-rest-1.0 Find more info here */ public function post(?SendTestMessageRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SendTestMessageRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/NotificationMessageTemplates/NotificationMessageTemplatesRequestBuilder.php b/src/Generated/DeviceManagement/NotificationMessageTemplates/NotificationMessageTemplatesRequestBuilder.php index 10a0d941156..231e9aa979c 100644 --- a/src/Generated/DeviceManagement/NotificationMessageTemplates/NotificationMessageTemplatesRequestBuilder.php +++ b/src/Generated/DeviceManagement/NotificationMessageTemplates/NotificationMessageTemplatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\NotificationMessageTemplates\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\NotificationMessageTemplates\Item\NotificationMessageTemplateItemRequestBuilder; use Microsoft\Graph\Generated\Models\NotificationMessageTemplate; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the notificationMessageTemplate objects. * @param NotificationMessageTemplatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-notification-notificationmessagetemplate-list?view=graph-rest-1.0 Find more info here */ public function get(?NotificationMessageTemplatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [NotificationMessageTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [NotificationMessageTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new notificationMessageTemplate object. * @param NotificationMessageTemplate $body The request body * @param NotificationMessageTemplatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-notification-notificationmessagetemplate-create?view=graph-rest-1.0 Find more info here */ public function post(NotificationMessageTemplate $body, ?NotificationMessageTemplatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [NotificationMessageTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [NotificationMessageTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?NotificationMessageTemplatesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?NotificationMessageTemplatesRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(NotificationMessageTemplate $body, ?Not $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RemoteAssistancePartners/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/RemoteAssistancePartners/Count/CountRequestBuilder.php index 2fc7906a9ea..45a993f3c7f 100644 --- a/src/Generated/DeviceManagement/RemoteAssistancePartners/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/RemoteAssistancePartners/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RemoteAssistancePartners/Item/BeginOnboarding/BeginOnboardingRequestBuilder.php b/src/Generated/DeviceManagement/RemoteAssistancePartners/Item/BeginOnboarding/BeginOnboardingRequestBuilder.php index bc36c6c89ba..b62c405542b 100644 --- a/src/Generated/DeviceManagement/RemoteAssistancePartners/Item/BeginOnboarding/BeginOnboardingRequestBuilder.php +++ b/src/Generated/DeviceManagement/RemoteAssistancePartners/Item/BeginOnboarding/BeginOnboardingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A request to start onboarding. Must be coupled with the appropriate TeamViewer account information * @param BeginOnboardingRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-remoteassistance-remoteassistancepartner-beginonboarding?view=graph-rest-1.0 Find more info here */ public function post(?BeginOnboardingRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?BeginOnboardingRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RemoteAssistancePartners/Item/Disconnect/DisconnectRequestBuilder.php b/src/Generated/DeviceManagement/RemoteAssistancePartners/Item/Disconnect/DisconnectRequestBuilder.php index 2d1424fc5c0..2cee6ca3721 100644 --- a/src/Generated/DeviceManagement/RemoteAssistancePartners/Item/Disconnect/DisconnectRequestBuilder.php +++ b/src/Generated/DeviceManagement/RemoteAssistancePartners/Item/Disconnect/DisconnectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A request to remove the active TeamViewer connector * @param DisconnectRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-remoteassistance-remoteassistancepartner-disconnect?view=graph-rest-1.0 Find more info here */ public function post(?DisconnectRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DisconnectRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RemoteAssistancePartners/Item/RemoteAssistancePartnerItemRequestBuilder.php b/src/Generated/DeviceManagement/RemoteAssistancePartners/Item/RemoteAssistancePartnerItemRequestBuilder.php index dc5caca309f..6493344abf9 100644 --- a/src/Generated/DeviceManagement/RemoteAssistancePartners/Item/RemoteAssistancePartnerItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/RemoteAssistancePartners/Item/RemoteAssistancePartnerItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\RemoteAssistancePartners\Item\BeginOnboarding\BeginOnboardingRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\RemoteAssistancePartners\Item\Disconnect\DisconnectRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a remoteAssistancePartner. * @param RemoteAssistancePartnerItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-remoteassistance-remoteassistancepartner-delete?view=graph-rest-1.0 Find more info here */ public function delete(?RemoteAssistancePartnerItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the remoteAssistancePartner object. * @param RemoteAssistancePartnerItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-remoteassistance-remoteassistancepartner-get?view=graph-rest-1.0 Find more info here */ public function get(?RemoteAssistancePartnerItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RemoteAssistancePartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RemoteAssistancePartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a remoteAssistancePartner object. * @param RemoteAssistancePartner $body The request body * @param RemoteAssistancePartnerItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-remoteassistance-remoteassistancepartner-update?view=graph-rest-1.0 Find more info here */ public function patch(RemoteAssistancePartner $body, ?RemoteAssistancePartnerItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RemoteAssistancePartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RemoteAssistancePartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?RemoteAssistancePartnerItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?RemoteAssistancePartnerItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?RemoteAssistancePartnerItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(RemoteAssistancePartner $body, ?Remote $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RemoteAssistancePartners/RemoteAssistancePartnersRequestBuilder.php b/src/Generated/DeviceManagement/RemoteAssistancePartners/RemoteAssistancePartnersRequestBuilder.php index 8c299cd1136..fddfb6f3184 100644 --- a/src/Generated/DeviceManagement/RemoteAssistancePartners/RemoteAssistancePartnersRequestBuilder.php +++ b/src/Generated/DeviceManagement/RemoteAssistancePartners/RemoteAssistancePartnersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\RemoteAssistancePartners\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\RemoteAssistancePartners\Item\RemoteAssistancePartnerItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the remoteAssistancePartner objects. * @param RemoteAssistancePartnersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-remoteassistance-remoteassistancepartner-list?view=graph-rest-1.0 Find more info here */ public function get(?RemoteAssistancePartnersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RemoteAssistancePartnerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RemoteAssistancePartnerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new remoteAssistancePartner object. * @param RemoteAssistancePartner $body The request body * @param RemoteAssistancePartnersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-remoteassistance-remoteassistancepartner-create?view=graph-rest-1.0 Find more info here */ public function post(RemoteAssistancePartner $body, ?RemoteAssistancePartnersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RemoteAssistancePartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RemoteAssistancePartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?RemoteAssistancePartnersRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?RemoteAssistancePartnersRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(RemoteAssistancePartner $body, ?RemoteA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/ExportJobs/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/Reports/ExportJobs/Count/CountRequestBuilder.php index d538c2f138b..ee92b4412f3 100644 --- a/src/Generated/DeviceManagement/Reports/ExportJobs/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/ExportJobs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/ExportJobs/ExportJobsRequestBuilder.php b/src/Generated/DeviceManagement/Reports/ExportJobs/ExportJobsRequestBuilder.php index c335dd6dff2..5d34feb8436 100644 --- a/src/Generated/DeviceManagement/Reports/ExportJobs/ExportJobsRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/ExportJobs/ExportJobsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\Reports\ExportJobs\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\Reports\ExportJobs\Item\DeviceManagementExportJobItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceManagementExportJob; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceManagementExportJob objects. * @param ExportJobsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementexportjob-list?view=graph-rest-1.0 Find more info here */ public function get(?ExportJobsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExportJobCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExportJobCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceManagementExportJob object. * @param DeviceManagementExportJob $body The request body * @param ExportJobsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementexportjob-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceManagementExportJob $body, ?ExportJobsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExportJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExportJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ExportJobsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ExportJobsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceManagementExportJob $body, ?Expor $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/ExportJobs/Item/DeviceManagementExportJobItemRequestBuilder.php b/src/Generated/DeviceManagement/Reports/ExportJobs/Item/DeviceManagementExportJobItemRequestBuilder.php index e28c0c57ece..04cb0d5df95 100644 --- a/src/Generated/DeviceManagement/Reports/ExportJobs/Item/DeviceManagementExportJobItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/ExportJobs/Item/DeviceManagementExportJobItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceManagementExportJob; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceManagementExportJob. * @param DeviceManagementExportJobItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementexportjob-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceManagementExportJobItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceManagementExportJob object. * @param DeviceManagementExportJobItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementexportjob-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceManagementExportJobItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExportJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExportJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceManagementExportJob object. * @param DeviceManagementExportJob $body The request body * @param DeviceManagementExportJobItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementexportjob-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceManagementExportJob $body, ?DeviceManagementExportJobItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExportJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementExportJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?DeviceManagementExportJobItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?DeviceManagementExportJobItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?DeviceManagementExportJobItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(DeviceManagementExportJob $body, ?Devi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetCachedReport/GetCachedReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetCachedReport/GetCachedReportRequestBuilder.php index 0e332134376..7d6cae5c016 100644 --- a/src/Generated/DeviceManagement/Reports/GetCachedReport/GetCachedReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetCachedReport/GetCachedReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetCachedReportPostRequestBody $body The request body * @param GetCachedReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getcachedreport?view=graph-rest-1.0 Find more info here */ public function post(GetCachedReportPostRequestBody $body, ?GetCachedReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetCachedReportPostRequestBody $body, ? $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetCompliancePolicyNonComplianceReport/GetCompliancePolicyNonComplianceReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetCompliancePolicyNonComplianceReport/GetCompliancePolicyNonComplianceReportRequestBuilder.php index 52eaad5c5ca..f491bf5d7a3 100644 --- a/src/Generated/DeviceManagement/Reports/GetCompliancePolicyNonComplianceReport/GetCompliancePolicyNonComplianceReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetCompliancePolicyNonComplianceReport/GetCompliancePolicyNonComplianceReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetCompliancePolicyNonComplianceReportPostRequestBody $body The request body * @param GetCompliancePolicyNonComplianceReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getcompliancepolicynoncompliancereport?view=graph-rest-1.0 Find more info here */ public function post(GetCompliancePolicyNonComplianceReportPostRequestBody $body, ?GetCompliancePolicyNonComplianceReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetCompliancePolicyNonComplianceReportP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetCompliancePolicyNonComplianceSummaryReport/GetCompliancePolicyNonComplianceSummaryReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetCompliancePolicyNonComplianceSummaryReport/GetCompliancePolicyNonComplianceSummaryReportRequestBuilder.php index 142c00cff36..bfdafd6cce6 100644 --- a/src/Generated/DeviceManagement/Reports/GetCompliancePolicyNonComplianceSummaryReport/GetCompliancePolicyNonComplianceSummaryReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetCompliancePolicyNonComplianceSummaryReport/GetCompliancePolicyNonComplianceSummaryReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetCompliancePolicyNonComplianceSummaryReportPostRequestBody $body The request body * @param GetCompliancePolicyNonComplianceSummaryReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getcompliancepolicynoncompliancesummaryreport?view=graph-rest-1.0 Find more info here */ public function post(GetCompliancePolicyNonComplianceSummaryReportPostRequestBody $body, ?GetCompliancePolicyNonComplianceSummaryReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetCompliancePolicyNonComplianceSummary $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetComplianceSettingNonComplianceReport/GetComplianceSettingNonComplianceReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetComplianceSettingNonComplianceReport/GetComplianceSettingNonComplianceReportRequestBuilder.php index 0533330eb78..556c0aa01af 100644 --- a/src/Generated/DeviceManagement/Reports/GetComplianceSettingNonComplianceReport/GetComplianceSettingNonComplianceReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetComplianceSettingNonComplianceReport/GetComplianceSettingNonComplianceReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetComplianceSettingNonComplianceReportPostRequestBody $body The request body * @param GetComplianceSettingNonComplianceReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getcompliancesettingnoncompliancereport?view=graph-rest-1.0 Find more info here */ public function post(GetComplianceSettingNonComplianceReportPostRequestBody $body, ?GetComplianceSettingNonComplianceReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetComplianceSettingNonComplianceReport $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetConfigurationPolicyNonComplianceReport/GetConfigurationPolicyNonComplianceReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetConfigurationPolicyNonComplianceReport/GetConfigurationPolicyNonComplianceReportRequestBuilder.php index 3d2e71c97fa..4a92bb0d9ec 100644 --- a/src/Generated/DeviceManagement/Reports/GetConfigurationPolicyNonComplianceReport/GetConfigurationPolicyNonComplianceReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetConfigurationPolicyNonComplianceReport/GetConfigurationPolicyNonComplianceReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetConfigurationPolicyNonComplianceReportPostRequestBody $body The request body * @param GetConfigurationPolicyNonComplianceReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getconfigurationpolicynoncompliancereport?view=graph-rest-1.0 Find more info here */ public function post(GetConfigurationPolicyNonComplianceReportPostRequestBody $body, ?GetConfigurationPolicyNonComplianceReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetConfigurationPolicyNonComplianceRepo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetConfigurationPolicyNonComplianceSummaryReport/GetConfigurationPolicyNonComplianceSummaryReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetConfigurationPolicyNonComplianceSummaryReport/GetConfigurationPolicyNonComplianceSummaryReportRequestBuilder.php index 8adadce83fa..88baf794bf9 100644 --- a/src/Generated/DeviceManagement/Reports/GetConfigurationPolicyNonComplianceSummaryReport/GetConfigurationPolicyNonComplianceSummaryReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetConfigurationPolicyNonComplianceSummaryReport/GetConfigurationPolicyNonComplianceSummaryReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetConfigurationPolicyNonComplianceSummaryReportPostRequestBody $body The request body * @param GetConfigurationPolicyNonComplianceSummaryReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getconfigurationpolicynoncompliancesummaryreport?view=graph-rest-1.0 Find more info here */ public function post(GetConfigurationPolicyNonComplianceSummaryReportPostRequestBody $body, ?GetConfigurationPolicyNonComplianceSummaryReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetConfigurationPolicyNonComplianceSumm $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetConfigurationSettingNonComplianceReport/GetConfigurationSettingNonComplianceReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetConfigurationSettingNonComplianceReport/GetConfigurationSettingNonComplianceReportRequestBuilder.php index 4e2ef232c54..7a174f49fe6 100644 --- a/src/Generated/DeviceManagement/Reports/GetConfigurationSettingNonComplianceReport/GetConfigurationSettingNonComplianceReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetConfigurationSettingNonComplianceReport/GetConfigurationSettingNonComplianceReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetConfigurationSettingNonComplianceReportPostRequestBody $body The request body * @param GetConfigurationSettingNonComplianceReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getconfigurationsettingnoncompliancereport?view=graph-rest-1.0 Find more info here */ public function post(GetConfigurationSettingNonComplianceReportPostRequestBody $body, ?GetConfigurationSettingNonComplianceReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetConfigurationSettingNonComplianceRep $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetDeviceManagementIntentPerSettingContributingProfiles/GetDeviceManagementIntentPerSettingContributingProfilesRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetDeviceManagementIntentPerSettingContributingProfiles/GetDeviceManagementIntentPerSettingContributingProfilesRequestBuilder.php index 7d68eb9acfe..2bf291499f9 100644 --- a/src/Generated/DeviceManagement/Reports/GetDeviceManagementIntentPerSettingContributingProfiles/GetDeviceManagementIntentPerSettingContributingProfilesRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetDeviceManagementIntentPerSettingContributingProfiles/GetDeviceManagementIntentPerSettingContributingProfilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetDeviceManagementIntentPerSettingContributingProfilesPostRequestBody $body The request body * @param GetDeviceManagementIntentPerSettingContributingProfilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getdevicemanagementintentpersettingcontributingprofiles?view=graph-rest-1.0 Find more info here */ public function post(GetDeviceManagementIntentPerSettingContributingProfilesPostRequestBody $body, ?GetDeviceManagementIntentPerSettingContributingProfilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetDeviceManagementIntentPerSettingCont $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetDeviceManagementIntentSettingsReport/GetDeviceManagementIntentSettingsReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetDeviceManagementIntentSettingsReport/GetDeviceManagementIntentSettingsReportRequestBuilder.php index 424254000bf..69d4e6df37a 100644 --- a/src/Generated/DeviceManagement/Reports/GetDeviceManagementIntentSettingsReport/GetDeviceManagementIntentSettingsReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetDeviceManagementIntentSettingsReport/GetDeviceManagementIntentSettingsReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetDeviceManagementIntentSettingsReportPostRequestBody $body The request body * @param GetDeviceManagementIntentSettingsReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getdevicemanagementintentsettingsreport?view=graph-rest-1.0 Find more info here */ public function post(GetDeviceManagementIntentSettingsReportPostRequestBody $body, ?GetDeviceManagementIntentSettingsReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetDeviceManagementIntentSettingsReport $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetDeviceNonComplianceReport/GetDeviceNonComplianceReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetDeviceNonComplianceReport/GetDeviceNonComplianceReportRequestBuilder.php index 8acec42b43d..964c6f90d6d 100644 --- a/src/Generated/DeviceManagement/Reports/GetDeviceNonComplianceReport/GetDeviceNonComplianceReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetDeviceNonComplianceReport/GetDeviceNonComplianceReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetDeviceNonComplianceReportPostRequestBody $body The request body * @param GetDeviceNonComplianceReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getdevicenoncompliancereport?view=graph-rest-1.0 Find more info here */ public function post(GetDeviceNonComplianceReportPostRequestBody $body, ?GetDeviceNonComplianceReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetDeviceNonComplianceReportPostRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetDevicesWithoutCompliancePolicyReport/GetDevicesWithoutCompliancePolicyReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetDevicesWithoutCompliancePolicyReport/GetDevicesWithoutCompliancePolicyReportRequestBuilder.php index 19985a24e6a..1409e04df89 100644 --- a/src/Generated/DeviceManagement/Reports/GetDevicesWithoutCompliancePolicyReport/GetDevicesWithoutCompliancePolicyReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetDevicesWithoutCompliancePolicyReport/GetDevicesWithoutCompliancePolicyReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetDevicesWithoutCompliancePolicyReportPostRequestBody $body The request body * @param GetDevicesWithoutCompliancePolicyReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getdeviceswithoutcompliancepolicyreport?view=graph-rest-1.0 Find more info here */ public function post(GetDevicesWithoutCompliancePolicyReportPostRequestBody $body, ?GetDevicesWithoutCompliancePolicyReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetDevicesWithoutCompliancePolicyReport $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetHistoricalReport/GetHistoricalReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetHistoricalReport/GetHistoricalReportRequestBuilder.php index 2376fe2263f..6e100bf7a7b 100644 --- a/src/Generated/DeviceManagement/Reports/GetHistoricalReport/GetHistoricalReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetHistoricalReport/GetHistoricalReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetHistoricalReportPostRequestBody $body The request body * @param GetHistoricalReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-gethistoricalreport?view=graph-rest-1.0 Find more info here */ public function post(GetHistoricalReportPostRequestBody $body, ?GetHistoricalReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetHistoricalReportPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetNoncompliantDevicesAndSettingsReport/GetNoncompliantDevicesAndSettingsReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetNoncompliantDevicesAndSettingsReport/GetNoncompliantDevicesAndSettingsReportRequestBuilder.php index b68792ec361..d22b0a986e5 100644 --- a/src/Generated/DeviceManagement/Reports/GetNoncompliantDevicesAndSettingsReport/GetNoncompliantDevicesAndSettingsReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetNoncompliantDevicesAndSettingsReport/GetNoncompliantDevicesAndSettingsReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetNoncompliantDevicesAndSettingsReportPostRequestBody $body The request body * @param GetNoncompliantDevicesAndSettingsReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getnoncompliantdevicesandsettingsreport?view=graph-rest-1.0 Find more info here */ public function post(GetNoncompliantDevicesAndSettingsReportPostRequestBody $body, ?GetNoncompliantDevicesAndSettingsReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetNoncompliantDevicesAndSettingsReport $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetPolicyNonComplianceMetadata/GetPolicyNonComplianceMetadataRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetPolicyNonComplianceMetadata/GetPolicyNonComplianceMetadataRequestBuilder.php index 4adbbdc1375..a4ae84b1800 100644 --- a/src/Generated/DeviceManagement/Reports/GetPolicyNonComplianceMetadata/GetPolicyNonComplianceMetadataRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetPolicyNonComplianceMetadata/GetPolicyNonComplianceMetadataRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetPolicyNonComplianceMetadataPostRequestBody $body The request body * @param GetPolicyNonComplianceMetadataRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getpolicynoncompliancemetadata?view=graph-rest-1.0 Find more info here */ public function post(GetPolicyNonComplianceMetadataPostRequestBody $body, ?GetPolicyNonComplianceMetadataRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetPolicyNonComplianceMetadataPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetPolicyNonComplianceReport/GetPolicyNonComplianceReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetPolicyNonComplianceReport/GetPolicyNonComplianceReportRequestBuilder.php index a130944a972..5135755bd8c 100644 --- a/src/Generated/DeviceManagement/Reports/GetPolicyNonComplianceReport/GetPolicyNonComplianceReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetPolicyNonComplianceReport/GetPolicyNonComplianceReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetPolicyNonComplianceReportPostRequestBody $body The request body * @param GetPolicyNonComplianceReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getpolicynoncompliancereport?view=graph-rest-1.0 Find more info here */ public function post(GetPolicyNonComplianceReportPostRequestBody $body, ?GetPolicyNonComplianceReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetPolicyNonComplianceReportPostRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetPolicyNonComplianceSummaryReport/GetPolicyNonComplianceSummaryReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetPolicyNonComplianceSummaryReport/GetPolicyNonComplianceSummaryReportRequestBuilder.php index 2da63c92ecd..7ae0d1629cf 100644 --- a/src/Generated/DeviceManagement/Reports/GetPolicyNonComplianceSummaryReport/GetPolicyNonComplianceSummaryReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetPolicyNonComplianceSummaryReport/GetPolicyNonComplianceSummaryReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetPolicyNonComplianceSummaryReportPostRequestBody $body The request body * @param GetPolicyNonComplianceSummaryReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getpolicynoncompliancesummaryreport?view=graph-rest-1.0 Find more info here */ public function post(GetPolicyNonComplianceSummaryReportPostRequestBody $body, ?GetPolicyNonComplianceSummaryReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetPolicyNonComplianceSummaryReportPost $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetReportFilters/GetReportFiltersRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetReportFilters/GetReportFiltersRequestBuilder.php index 9ddf0738d43..84e5d8ebc77 100644 --- a/src/Generated/DeviceManagement/Reports/GetReportFilters/GetReportFiltersRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetReportFilters/GetReportFiltersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetReportFiltersPostRequestBody $body The request body * @param GetReportFiltersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getreportfilters?view=graph-rest-1.0 Find more info here */ public function post(GetReportFiltersPostRequestBody $body, ?GetReportFiltersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetReportFiltersPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/GetSettingNonComplianceReport/GetSettingNonComplianceReportRequestBuilder.php b/src/Generated/DeviceManagement/Reports/GetSettingNonComplianceReport/GetSettingNonComplianceReportRequestBuilder.php index 400449918c0..08ad9488e04 100644 --- a/src/Generated/DeviceManagement/Reports/GetSettingNonComplianceReport/GetSettingNonComplianceReportRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/GetSettingNonComplianceReport/GetSettingNonComplianceReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -35,20 +34,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param GetSettingNonComplianceReportPostRequestBody $body The request body * @param GetSettingNonComplianceReportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-getsettingnoncompliancereport?view=graph-rest-1.0 Find more info here */ public function post(GetSettingNonComplianceReportPostRequestBody $body, ?GetSettingNonComplianceReportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toPostRequestInformation(GetSettingNonComplianceReportPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/Reports/ReportsRequestBuilder.php b/src/Generated/DeviceManagement/Reports/ReportsRequestBuilder.php index fc00aea827d..795a5735a0c 100644 --- a/src/Generated/DeviceManagement/Reports/ReportsRequestBuilder.php +++ b/src/Generated/DeviceManagement/Reports/ReportsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\Reports\ExportJobs\ExportJobsRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\Reports\GetCachedReport\GetCachedReportRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\Reports\GetCompliancePolicyNonComplianceReport\GetCompliancePolicyNonComplianceReportRequestBuilder; @@ -186,58 +185,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property reports for deviceManagement * @param ReportsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ReportsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceManagementReports object. * @param ReportsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-get?view=graph-rest-1.0 Find more info here */ public function get(?ReportsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementReports::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementReports::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceManagementReports object. * @param DeviceManagementReports $body The request body * @param ReportsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-reporting-devicemanagementreports-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceManagementReports $body, ?ReportsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementReports::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementReports::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -254,6 +244,7 @@ public function toDeleteRequestInformation(?ReportsRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -267,7 +258,6 @@ public function toGetRequestInformation(?ReportsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -275,6 +265,7 @@ public function toGetRequestInformation(?ReportsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -289,11 +280,11 @@ public function toPatchRequestInformation(DeviceManagementReports $body, ?Report $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ResourceOperations/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/ResourceOperations/Count/CountRequestBuilder.php index 6e90b78e835..81a53fe981b 100644 --- a/src/Generated/DeviceManagement/ResourceOperations/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/ResourceOperations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ResourceOperations/Item/ResourceOperationItemRequestBuilder.php b/src/Generated/DeviceManagement/ResourceOperations/Item/ResourceOperationItemRequestBuilder.php index 95ec29fdde4..827d6b15031 100644 --- a/src/Generated/DeviceManagement/ResourceOperations/Item/ResourceOperationItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/ResourceOperations/Item/ResourceOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ResourceOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a resourceOperation. * @param ResourceOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-resourceoperation-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ResourceOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the resourceOperation object. * @param ResourceOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-resourceoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?ResourceOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a resourceOperation object. * @param ResourceOperation $body The request body * @param ResourceOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-resourceoperation-update?view=graph-rest-1.0 Find more info here */ public function patch(ResourceOperation $body, ?ResourceOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ResourceOperationItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ResourceOperationItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ResourceOperationItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ResourceOperation $body, ?ResourceOper $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/ResourceOperations/ResourceOperationsRequestBuilder.php b/src/Generated/DeviceManagement/ResourceOperations/ResourceOperationsRequestBuilder.php index 138da1d484a..922e2a40679 100644 --- a/src/Generated/DeviceManagement/ResourceOperations/ResourceOperationsRequestBuilder.php +++ b/src/Generated/DeviceManagement/ResourceOperations/ResourceOperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\ResourceOperations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\ResourceOperations\Item\ResourceOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the resourceOperation objects. * @param ResourceOperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-resourceoperation-list?view=graph-rest-1.0 Find more info here */ public function get(?ResourceOperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new resourceOperation object. * @param ResourceOperation $body The request body * @param ResourceOperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-resourceoperation-create?view=graph-rest-1.0 Find more info here */ public function post(ResourceOperation $body, ?ResourceOperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ResourceOperationsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ResourceOperationsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ResourceOperation $body, ?ResourceOpera $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RoleAssignments/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/RoleAssignments/Count/CountRequestBuilder.php index 9bbf00db9d6..bbe783039de 100644 --- a/src/Generated/DeviceManagement/RoleAssignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/RoleAssignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RoleAssignments/Item/DeviceAndAppManagementRoleAssignmentItemRequestBuilder.php b/src/Generated/DeviceManagement/RoleAssignments/Item/DeviceAndAppManagementRoleAssignmentItemRequestBuilder.php index 02ae9facd99..d233403cb53 100644 --- a/src/Generated/DeviceManagement/RoleAssignments/Item/DeviceAndAppManagementRoleAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/RoleAssignments/Item/DeviceAndAppManagementRoleAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\RoleAssignments\Item\RoleDefinition\RoleDefinitionRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceAndAppManagementRoleAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a deviceAndAppManagementRoleAssignment. * @param DeviceAndAppManagementRoleAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-deviceandappmanagementroleassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceAndAppManagementRoleAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceAndAppManagementRoleAssignment object. * @param DeviceAndAppManagementRoleAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-deviceandappmanagementroleassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceAndAppManagementRoleAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceAndAppManagementRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceAndAppManagementRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceAndAppManagementRoleAssignment object. * @param DeviceAndAppManagementRoleAssignment $body The request body * @param DeviceAndAppManagementRoleAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-deviceandappmanagementroleassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceAndAppManagementRoleAssignment $body, ?DeviceAndAppManagementRoleAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceAndAppManagementRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceAndAppManagementRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?DeviceAndAppManagementRoleAssignment $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?DeviceAndAppManagementRoleAssignmentIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?DeviceAndAppManagementRoleAssignmentIte } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(DeviceAndAppManagementRoleAssignment $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/DeviceManagement/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index 2b708445122..bbebf9a1f80 100644 --- a/src/Generated/DeviceManagement/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/DeviceManagement/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Role definition this assignment is part of. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RoleAssignments/RoleAssignmentsRequestBuilder.php b/src/Generated/DeviceManagement/RoleAssignments/RoleAssignmentsRequestBuilder.php index 4e2f8101179..3cadb42dd62 100644 --- a/src/Generated/DeviceManagement/RoleAssignments/RoleAssignmentsRequestBuilder.php +++ b/src/Generated/DeviceManagement/RoleAssignments/RoleAssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\RoleAssignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\RoleAssignments\Item\DeviceAndAppManagementRoleAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceAndAppManagementRoleAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceAndAppManagementRoleAssignment objects. * @param RoleAssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-deviceandappmanagementroleassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?RoleAssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceAndAppManagementRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceAndAppManagementRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceAndAppManagementRoleAssignment object. * @param DeviceAndAppManagementRoleAssignment $body The request body * @param RoleAssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-deviceandappmanagementroleassignment-create?view=graph-rest-1.0 Find more info here */ public function post(DeviceAndAppManagementRoleAssignment $body, ?RoleAssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceAndAppManagementRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceAndAppManagementRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?RoleAssignmentsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?RoleAssignmentsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DeviceAndAppManagementRoleAssignment $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RoleDefinitions/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/RoleDefinitions/Count/CountRequestBuilder.php index 4be9bd1b8f6..9c4b145fba3 100644 --- a/src/Generated/DeviceManagement/RoleDefinitions/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/RoleDefinitions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/Count/CountRequestBuilder.php index 93c292b0435..3737ca8d66c 100644 --- a/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/Item/RoleAssignmentItemRequestBuilder.php b/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/Item/RoleAssignmentItemRequestBuilder.php index f14ccdc395c..b95eadc7eb1 100644 --- a/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/Item/RoleAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/Item/RoleAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\RoleDefinitions\Item\RoleAssignments\Item\RoleDefinition\RoleDefinitionRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RoleAssignment; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a roleAssignment. * @param RoleAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-roleassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?RoleAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the roleAssignment object. * @param RoleAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-roleassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?RoleAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a roleAssignment object. * @param RoleAssignment $body The request body * @param RoleAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-roleassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(RoleAssignment $body, ?RoleAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?RoleAssignmentItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?RoleAssignmentItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?RoleAssignmentItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(RoleAssignment $body, ?RoleAssignmentI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index 18c33aca5dd..4f95d6635e0 100644 --- a/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Role definition this assignment is part of. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/RoleAssignmentsRequestBuilder.php b/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/RoleAssignmentsRequestBuilder.php index 35b6225ec6a..2b5e466275a 100644 --- a/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/RoleAssignmentsRequestBuilder.php +++ b/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleAssignments/RoleAssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\RoleDefinitions\Item\RoleAssignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\RoleDefinitions\Item\RoleAssignments\Item\RoleAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the roleAssignment objects. * @param RoleAssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-roleassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?RoleAssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new roleAssignment object. * @param RoleAssignment $body The request body * @param RoleAssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-roleassignment-create?view=graph-rest-1.0 Find more info here */ public function post(RoleAssignment $body, ?RoleAssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?RoleAssignmentsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?RoleAssignmentsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(RoleAssignment $body, ?RoleAssignmentsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleDefinitionItemRequestBuilder.php b/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleDefinitionItemRequestBuilder.php index 4363cd41617..66f754e38ec 100644 --- a/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleDefinitionItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\RoleDefinitions\Item\RoleAssignments\RoleAssignmentsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RoleDefinition; @@ -40,65 +39,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Deletes a deviceAndAppManagementRoleDefinition. + * Deletes a roleDefinition. * @param RoleDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-rbac-deviceandappmanagementroledefinition-delete?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-rbac-roledefinition-delete?view=graph-rest-1.0 Find more info here */ public function delete(?RoleDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read properties and relationships of the deviceAndAppManagementRoleDefinition object. + * Read properties and relationships of the roleDefinition object. * @param RoleDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-rbac-deviceandappmanagementroledefinition-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-rbac-roledefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?RoleDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a roleDefinition object. * @param RoleDefinition $body The request body * @param RoleDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-roledefinition-update?view=graph-rest-1.0 Find more info here */ public function patch(RoleDefinition $body, ?RoleDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Deletes a deviceAndAppManagementRoleDefinition. + * Deletes a roleDefinition. * @param RoleDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -111,11 +101,12 @@ public function toDeleteRequestInformation(?RoleDefinitionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read properties and relationships of the deviceAndAppManagementRoleDefinition object. + * Read properties and relationships of the roleDefinition object. * @param RoleDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -124,7 +115,6 @@ public function toGetRequestInformation(?RoleDefinitionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?RoleDefinitionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(RoleDefinition $body, ?RoleDefinitionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleDefinitionItemRequestBuilderGetQueryParameters.php b/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleDefinitionItemRequestBuilderGetQueryParameters.php index 66802fd4f88..6ab7af424b5 100644 --- a/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleDefinitionItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/DeviceManagement/RoleDefinitions/Item/RoleDefinitionItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read properties and relationships of the deviceAndAppManagementRoleDefinition object. + * Read properties and relationships of the roleDefinition object. */ class RoleDefinitionItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/DeviceManagement/RoleDefinitions/RoleDefinitionsRequestBuilder.php b/src/Generated/DeviceManagement/RoleDefinitions/RoleDefinitionsRequestBuilder.php index 6ddf5b929b3..c4ab09c572e 100644 --- a/src/Generated/DeviceManagement/RoleDefinitions/RoleDefinitionsRequestBuilder.php +++ b/src/Generated/DeviceManagement/RoleDefinitions/RoleDefinitionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\RoleDefinitions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\RoleDefinitions\Item\RoleDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the deviceAndAppManagementRoleDefinition objects. * @param RoleDefinitionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-deviceandappmanagementroledefinition-list?view=graph-rest-1.0 Find more info here */ public function get(?RoleDefinitionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoleDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoleDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new deviceAndAppManagementRoleDefinition object. * @param RoleDefinition $body The request body * @param RoleDefinitionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-rbac-deviceandappmanagementroledefinition-create?view=graph-rest-1.0 Find more info here */ public function post(RoleDefinition $body, ?RoleDefinitionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?RoleDefinitionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?RoleDefinitionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(RoleDefinition $body, ?RoleDefinitionsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/SoftwareUpdateStatusSummary/SoftwareUpdateStatusSummaryRequestBuilder.php b/src/Generated/DeviceManagement/SoftwareUpdateStatusSummary/SoftwareUpdateStatusSummaryRequestBuilder.php index 009d9e5fb0f..965d050ff89 100644 --- a/src/Generated/DeviceManagement/SoftwareUpdateStatusSummary/SoftwareUpdateStatusSummaryRequestBuilder.php +++ b/src/Generated/DeviceManagement/SoftwareUpdateStatusSummary/SoftwareUpdateStatusSummaryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SoftwareUpdateStatusSummary; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read properties and relationships of the softwareUpdateStatusSummary object. * @param SoftwareUpdateStatusSummaryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-softwareupdatestatussummary-get?view=graph-rest-1.0 Find more info here */ public function get(?SoftwareUpdateStatusSummaryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SoftwareUpdateStatusSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SoftwareUpdateStatusSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?SoftwareUpdateStatusSummaryRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?SoftwareUpdateStatusSummaryRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TelecomExpenseManagementPartners/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/TelecomExpenseManagementPartners/Count/CountRequestBuilder.php index 960293259db..5c7c43c2097 100644 --- a/src/Generated/DeviceManagement/TelecomExpenseManagementPartners/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/TelecomExpenseManagementPartners/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TelecomExpenseManagementPartners/Item/TelecomExpenseManagementPartnerItemRequestBuilder.php b/src/Generated/DeviceManagement/TelecomExpenseManagementPartners/Item/TelecomExpenseManagementPartnerItemRequestBuilder.php index 024a5bcca26..94cd9439295 100644 --- a/src/Generated/DeviceManagement/TelecomExpenseManagementPartners/Item/TelecomExpenseManagementPartnerItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/TelecomExpenseManagementPartners/Item/TelecomExpenseManagementPartnerItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TelecomExpenseManagementPartner; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a telecomExpenseManagementPartner. * @param TelecomExpenseManagementPartnerItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-tem-telecomexpensemanagementpartner-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TelecomExpenseManagementPartnerItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the telecomExpenseManagementPartner object. * @param TelecomExpenseManagementPartnerItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-tem-telecomexpensemanagementpartner-get?view=graph-rest-1.0 Find more info here */ public function get(?TelecomExpenseManagementPartnerItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TelecomExpenseManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TelecomExpenseManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a telecomExpenseManagementPartner object. * @param TelecomExpenseManagementPartner $body The request body * @param TelecomExpenseManagementPartnerItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-tem-telecomexpensemanagementpartner-update?view=graph-rest-1.0 Find more info here */ public function patch(TelecomExpenseManagementPartner $body, ?TelecomExpenseManagementPartnerItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TelecomExpenseManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TelecomExpenseManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?TelecomExpenseManagementPartnerItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?TelecomExpenseManagementPartnerItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?TelecomExpenseManagementPartnerItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(TelecomExpenseManagementPartner $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TelecomExpenseManagementPartners/TelecomExpenseManagementPartnersRequestBuilder.php b/src/Generated/DeviceManagement/TelecomExpenseManagementPartners/TelecomExpenseManagementPartnersRequestBuilder.php index 76660c3897b..eb96ec1b308 100644 --- a/src/Generated/DeviceManagement/TelecomExpenseManagementPartners/TelecomExpenseManagementPartnersRequestBuilder.php +++ b/src/Generated/DeviceManagement/TelecomExpenseManagementPartners/TelecomExpenseManagementPartnersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\TelecomExpenseManagementPartners\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\TelecomExpenseManagementPartners\Item\TelecomExpenseManagementPartnerItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the telecomExpenseManagementPartner objects. * @param TelecomExpenseManagementPartnersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-tem-telecomexpensemanagementpartner-list?view=graph-rest-1.0 Find more info here */ public function get(?TelecomExpenseManagementPartnersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TelecomExpenseManagementPartnerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TelecomExpenseManagementPartnerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new telecomExpenseManagementPartner object. * @param TelecomExpenseManagementPartner $body The request body * @param TelecomExpenseManagementPartnersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-tem-telecomexpensemanagementpartner-create?view=graph-rest-1.0 Find more info here */ public function post(TelecomExpenseManagementPartner $body, ?TelecomExpenseManagementPartnersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TelecomExpenseManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TelecomExpenseManagementPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TelecomExpenseManagementPartnersRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TelecomExpenseManagementPartnersRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TelecomExpenseManagementPartner $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TermsAndConditions/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/TermsAndConditions/Count/CountRequestBuilder.php index eed71e93f68..7bf29b1aaed 100644 --- a/src/Generated/DeviceManagement/TermsAndConditions/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/TermsAndConditions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/AcceptanceStatusesRequestBuilder.php b/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/AcceptanceStatusesRequestBuilder.php index 48124bd9088..b3849cd3419 100644 --- a/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/AcceptanceStatusesRequestBuilder.php +++ b/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/AcceptanceStatusesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\TermsAndConditions\Item\AcceptanceStatuses\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\TermsAndConditions\Item\AcceptanceStatuses\Item\TermsAndConditionsAcceptanceStatusItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the termsAndConditionsAcceptanceStatus objects. * @param AcceptanceStatusesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditionsacceptancestatus-list?view=graph-rest-1.0 Find more info here */ public function get(?AcceptanceStatusesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAcceptanceStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAcceptanceStatusCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new termsAndConditionsAcceptanceStatus object. * @param TermsAndConditionsAcceptanceStatus $body The request body * @param AcceptanceStatusesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditionsacceptancestatus-create?view=graph-rest-1.0 Find more info here */ public function post(TermsAndConditionsAcceptanceStatus $body, ?AcceptanceStatusesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAcceptanceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAcceptanceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AcceptanceStatusesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AcceptanceStatusesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TermsAndConditionsAcceptanceStatus $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/Count/CountRequestBuilder.php index 03656e08c2a..abc07f9d5a9 100644 --- a/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/Item/TermsAndConditions/TermsAndConditionsRequestBuilder.php b/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/Item/TermsAndConditions/TermsAndConditionsRequestBuilder.php index 337c69bc939..6a54a72fe6e 100644 --- a/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/Item/TermsAndConditions/TermsAndConditionsRequestBuilder.php +++ b/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/Item/TermsAndConditions/TermsAndConditionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermsAndConditions; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Navigation link to the terms and conditions that are assigned. * @param TermsAndConditionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsAndConditionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditions::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditions::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TermsAndConditionsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TermsAndConditionsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/Item/TermsAndConditionsAcceptanceStatusItemRequestBuilder.php b/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/Item/TermsAndConditionsAcceptanceStatusItemRequestBuilder.php index c65555c8418..ceed515a987 100644 --- a/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/Item/TermsAndConditionsAcceptanceStatusItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/TermsAndConditions/Item/AcceptanceStatuses/Item/TermsAndConditionsAcceptanceStatusItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\TermsAndConditions\Item\AcceptanceStatuses\Item\TermsAndConditions\TermsAndConditionsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermsAndConditionsAcceptanceStatus; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a termsAndConditionsAcceptanceStatus. * @param TermsAndConditionsAcceptanceStatusItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditionsacceptancestatus-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermsAndConditionsAcceptanceStatusItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the termsAndConditionsAcceptanceStatus object. * @param TermsAndConditionsAcceptanceStatusItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditionsacceptancestatus-get?view=graph-rest-1.0 Find more info here */ public function get(?TermsAndConditionsAcceptanceStatusItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAcceptanceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAcceptanceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a termsAndConditionsAcceptanceStatus object. * @param TermsAndConditionsAcceptanceStatus $body The request body * @param TermsAndConditionsAcceptanceStatusItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditionsacceptancestatus-update?view=graph-rest-1.0 Find more info here */ public function patch(TermsAndConditionsAcceptanceStatus $body, ?TermsAndConditionsAcceptanceStatusItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAcceptanceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAcceptanceStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TermsAndConditionsAcceptanceStatusIt $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TermsAndConditionsAcceptanceStatusItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TermsAndConditionsAcceptanceStatusItemR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TermsAndConditionsAcceptanceStatus $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TermsAndConditions/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/DeviceManagement/TermsAndConditions/Item/Assignments/AssignmentsRequestBuilder.php index b65e32cb429..94e06efb91e 100644 --- a/src/Generated/DeviceManagement/TermsAndConditions/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/DeviceManagement/TermsAndConditions/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\TermsAndConditions\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\TermsAndConditions\Item\Assignments\Item\TermsAndConditionsAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the termsAndConditionsAssignment objects. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditionsassignment-list?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new termsAndConditionsAssignment object. * @param TermsAndConditionsAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditionsassignment-create?view=graph-rest-1.0 Find more info here */ public function post(TermsAndConditionsAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TermsAndConditionsAssignment $body, ?As $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TermsAndConditions/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/TermsAndConditions/Item/Assignments/Count/CountRequestBuilder.php index bf5665dbab0..95420dac84f 100644 --- a/src/Generated/DeviceManagement/TermsAndConditions/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/TermsAndConditions/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TermsAndConditions/Item/Assignments/Item/TermsAndConditionsAssignmentItemRequestBuilder.php b/src/Generated/DeviceManagement/TermsAndConditions/Item/Assignments/Item/TermsAndConditionsAssignmentItemRequestBuilder.php index d9ce708bd96..45f36dba0a9 100644 --- a/src/Generated/DeviceManagement/TermsAndConditions/Item/Assignments/Item/TermsAndConditionsAssignmentItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/TermsAndConditions/Item/Assignments/Item/TermsAndConditionsAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermsAndConditionsAssignment; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a termsAndConditionsAssignment. * @param TermsAndConditionsAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditionsassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermsAndConditionsAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the termsAndConditionsAssignment object. * @param TermsAndConditionsAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditionsassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?TermsAndConditionsAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a termsAndConditionsAssignment object. * @param TermsAndConditionsAssignment $body The request body * @param TermsAndConditionsAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditionsassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(TermsAndConditionsAssignment $body, ?TermsAndConditionsAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?TermsAndConditionsAssignmentItemRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?TermsAndConditionsAssignmentItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?TermsAndConditionsAssignmentItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(TermsAndConditionsAssignment $body, ?T $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TermsAndConditions/Item/TermsAndConditionsItemRequestBuilder.php b/src/Generated/DeviceManagement/TermsAndConditions/Item/TermsAndConditionsItemRequestBuilder.php index 142fa840b9e..c89bf349818 100644 --- a/src/Generated/DeviceManagement/TermsAndConditions/Item/TermsAndConditionsItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/TermsAndConditions/Item/TermsAndConditionsItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\TermsAndConditions\Item\AcceptanceStatuses\AcceptanceStatusesRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\TermsAndConditions\Item\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a termsAndConditions. * @param TermsAndConditionsItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditions-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermsAndConditionsItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the termsAndConditions object. * @param TermsAndConditionsItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditions-get?view=graph-rest-1.0 Find more info here */ public function get(?TermsAndConditionsItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditions::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditions::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a termsAndConditions object. * @param TermsAndConditions $body The request body * @param TermsAndConditionsItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditions-update?view=graph-rest-1.0 Find more info here */ public function patch(TermsAndConditions $body, ?TermsAndConditionsItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditions::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditions::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?TermsAndConditionsItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?TermsAndConditionsItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?TermsAndConditionsItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(TermsAndConditions $body, ?TermsAndCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TermsAndConditions/TermsAndConditionsRequestBuilder.php b/src/Generated/DeviceManagement/TermsAndConditions/TermsAndConditionsRequestBuilder.php index b68b416fe45..9ae1a029eb6 100644 --- a/src/Generated/DeviceManagement/TermsAndConditions/TermsAndConditionsRequestBuilder.php +++ b/src/Generated/DeviceManagement/TermsAndConditions/TermsAndConditionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\TermsAndConditions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\TermsAndConditions\Item\TermsAndConditionsItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the termsAndConditions objects. * @param TermsAndConditionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditions-list?view=graph-rest-1.0 Find more info here */ public function get(?TermsAndConditionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditionsCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new termsAndConditions object. * @param TermsAndConditions $body The request body * @param TermsAndConditionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-companyterms-termsandconditions-create?view=graph-rest-1.0 Find more info here */ public function post(TermsAndConditions $body, ?TermsAndConditionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditions::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsAndConditions::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TermsAndConditionsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TermsAndConditionsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TermsAndConditions $body, ?TermsAndCond $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TroubleshootingEvents/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/TroubleshootingEvents/Count/CountRequestBuilder.php index 0d8ac507314..dea5b7e80d5 100644 --- a/src/Generated/DeviceManagement/TroubleshootingEvents/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/TroubleshootingEvents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TroubleshootingEvents/Item/DeviceManagementTroubleshootingEventItemRequestBuilder.php b/src/Generated/DeviceManagement/TroubleshootingEvents/Item/DeviceManagementTroubleshootingEventItemRequestBuilder.php index 6025722b074..ba082f4e4e0 100644 --- a/src/Generated/DeviceManagement/TroubleshootingEvents/Item/DeviceManagementTroubleshootingEventItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/TroubleshootingEvents/Item/DeviceManagementTroubleshootingEventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceManagementTroubleshootingEvent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property troubleshootingEvents for deviceManagement * @param DeviceManagementTroubleshootingEventItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceManagementTroubleshootingEventItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of troubleshooting events for the tenant. * @param DeviceManagementTroubleshootingEventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceManagementTroubleshootingEventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property troubleshootingEvents in deviceManagement * @param DeviceManagementTroubleshootingEvent $body The request body * @param DeviceManagementTroubleshootingEventItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DeviceManagementTroubleshootingEvent $body, ?DeviceManagementTroubleshootingEventItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DeviceManagementTroubleshootingEvent $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DeviceManagementTroubleshootingEventIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DeviceManagementTroubleshootingEventIte } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(DeviceManagementTroubleshootingEvent $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/TroubleshootingEvents/TroubleshootingEventsRequestBuilder.php b/src/Generated/DeviceManagement/TroubleshootingEvents/TroubleshootingEventsRequestBuilder.php index 15a31dd9c87..d42aeb17b04 100644 --- a/src/Generated/DeviceManagement/TroubleshootingEvents/TroubleshootingEventsRequestBuilder.php +++ b/src/Generated/DeviceManagement/TroubleshootingEvents/TroubleshootingEventsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\TroubleshootingEvents\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\TroubleshootingEvents\Item\DeviceManagementTroubleshootingEventItemRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceManagementTroubleshootingEvent; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of troubleshooting events for the tenant. * @param TroubleshootingEventsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TroubleshootingEventsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to troubleshootingEvents for deviceManagement * @param DeviceManagementTroubleshootingEvent $body The request body * @param TroubleshootingEventsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DeviceManagementTroubleshootingEvent $body, ?TroubleshootingEventsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TroubleshootingEventsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TroubleshootingEventsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DeviceManagementTroubleshootingEvent $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformance/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformance/Count/CountRequestBuilder.php index 621872cfb64..7946e53f9d2 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformance/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformance/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformance/Item/UserExperienceAnalyticsAppHealthApplicationPerformanceItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformance/Item/UserExperienceAnalyticsAppHealthApplicationPerformanceItemRequestBuilder.php index 59fccc513eb..79222f70982 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformance/Item/UserExperienceAnalyticsAppHealthApplicationPerformanceItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformance/Item/UserExperienceAnalyticsAppHealthApplicationPerformanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsAppHealthApplicationPerformance; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsAppHealthApplicationPerformance for deviceManagement * @param UserExperienceAnalyticsAppHealthApplicationPerformanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsAppHealthApplicationPerformanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics appHealth Application Performance * @param UserExperienceAnalyticsAppHealthApplicationPerformanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthApplicationPerformanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthApplicationPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthApplicationPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsAppHealthApplicationPerformance in deviceManagement * @param UserExperienceAnalyticsAppHealthApplicationPerformance $body The request body * @param UserExperienceAnalyticsAppHealthApplicationPerformanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsAppHealthApplicationPerformance $body, ?UserExperienceAnalyticsAppHealthApplicationPerformanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthApplicationPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthApplicationPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsAppHealthAppl $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthApplica $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthApplica } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsAppHealthApplic $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformance/UserExperienceAnalyticsAppHealthApplicationPerformanceRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformance/UserExperienceAnalyticsAppHealthApplicationPerformanceRequestBuilder.php index c6b67dcf30f..56c61e2fc80 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformance/UserExperienceAnalyticsAppHealthApplicationPerformanceRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformance/UserExperienceAnalyticsAppHealthApplicationPerformanceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthApplicationPerformance\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthApplicationPerformance\Item\UserExperienceAnalyticsAppHealthApplicationPerformanceItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics appHealth Application Performance * @param UserExperienceAnalyticsAppHealthApplicationPerformanceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthApplicationPerformanceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthApplicationPerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthApplicationPerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsAppHealthApplicationPerformance for deviceManagement * @param UserExperienceAnalyticsAppHealthApplicationPerformance $body The request body * @param UserExperienceAnalyticsAppHealthApplicationPerformanceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsAppHealthApplicationPerformance $body, ?UserExperienceAnalyticsAppHealthApplicationPerformanceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthApplicationPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthApplicationPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthApplica $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthApplica } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsAppHealthApplica $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails/Count/CountRequestBuilder.php index 6e01b0655ba..633976c601f 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails/Item/UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetailsItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails/Item/UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetailsItemRequestBuilder.php index 24449aad0df..1fb122e95a6 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails/Item/UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetailsItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails/Item/UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetailsItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails for deviceManagement * @param UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetailsItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetailsItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics appHealth Application Performance by App Version details * @param UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetailsItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetailsItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails in deviceManagement * @param UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetails $body The request body * @param UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetailsItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetails $body, ?UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetailsItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsAppHealthAppP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthAppPerf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthAppPerf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsAppHealthAppPer $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetailsRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetailsRequestBuilder.php index f45c8e7fa23..c881ed13430 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetailsRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails\Item\UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetailsItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics appHealth Application Performance by App Version details * @param UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetailsCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetailsCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetails for deviceManagement * @param UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetails $body The request body * @param UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetailsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetails $body, ?UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDetailsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthApplica $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthApplica } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsAppHealthAppPerf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId/Count/CountRequestBuilder.php index 1c1ba84c285..e2632909e86 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId/Item/UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceIdItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId/Item/UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceIdItemRequestBuilder.php index 164e28e8d15..77d58d5d3a8 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId/Item/UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceIdItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId/Item/UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceIdItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId for deviceManagement * @param UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceIdItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceIdItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics appHealth Application Performance by App Version Device Id * @param UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceIdItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceIdItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId in deviceManagement * @param UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId $body The request body * @param UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceIdItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId $body, ?UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceIdItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsAppHealthAppP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthAppPerf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthAppPerf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsAppHealthAppPer $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceIdRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceIdRequestBuilder.php index 508c25929c5..22096c38e45 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceIdRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId/UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceIdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId\Item\UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceIdItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics appHealth Application Performance by App Version Device Id * @param UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceIdRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceIdRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceIdCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceIdCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceId for deviceManagement * @param UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId $body The request body * @param UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceIdRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId $body, ?UserExperienceAnalyticsAppHealthApplicationPerformanceByAppVersionDeviceIdRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthApplica $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthApplica } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsAppHealthAppPerf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion/Count/CountRequestBuilder.php index 3298f94678b..a131bc68a22 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion/Item/UserExperienceAnalyticsAppHealthAppPerformanceByOSVersionItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion/Item/UserExperienceAnalyticsAppHealthAppPerformanceByOSVersionItemRequestBuilder.php index dc83c1bd7e7..b2aa292a15f 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion/Item/UserExperienceAnalyticsAppHealthAppPerformanceByOSVersionItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion/Item/UserExperienceAnalyticsAppHealthAppPerformanceByOSVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsAppHealthAppPerformanceByOSVersion; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion for deviceManagement * @param UserExperienceAnalyticsAppHealthAppPerformanceByOSVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsAppHealthAppPerformanceByOSVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics appHealth Application Performance by OS Version * @param UserExperienceAnalyticsAppHealthAppPerformanceByOSVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthAppPerformanceByOSVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByOSVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByOSVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion in deviceManagement * @param UserExperienceAnalyticsAppHealthAppPerformanceByOSVersion $body The request body * @param UserExperienceAnalyticsAppHealthAppPerformanceByOSVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsAppHealthAppPerformanceByOSVersion $body, ?UserExperienceAnalyticsAppHealthAppPerformanceByOSVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByOSVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByOSVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsAppHealthAppP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthAppPerf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthAppPerf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsAppHealthAppPer $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersionRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersionRequestBuilder.php index 45a886328ea..001e7c0fa38 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersionRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion/UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion\Item\UserExperienceAnalyticsAppHealthAppPerformanceByOSVersionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics appHealth Application Performance by OS Version * @param UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByOSVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByOSVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsAppHealthApplicationPerformanceByOSVersion for deviceManagement * @param UserExperienceAnalyticsAppHealthAppPerformanceByOSVersion $body The request body * @param UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsAppHealthAppPerformanceByOSVersion $body, ?UserExperienceAnalyticsAppHealthApplicationPerformanceByOSVersionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByOSVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthAppPerformanceByOSVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthApplica $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthApplica } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsAppHealthAppPerf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDeviceModelPerformance/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDeviceModelPerformance/Count/CountRequestBuilder.php index cf2411be993..80b401cf8c3 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDeviceModelPerformance/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDeviceModelPerformance/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDeviceModelPerformance/Item/UserExperienceAnalyticsAppHealthDeviceModelPerformanceItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDeviceModelPerformance/Item/UserExperienceAnalyticsAppHealthDeviceModelPerformanceItemRequestBuilder.php index b484543fd8a..540d1d00ca9 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDeviceModelPerformance/Item/UserExperienceAnalyticsAppHealthDeviceModelPerformanceItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDeviceModelPerformance/Item/UserExperienceAnalyticsAppHealthDeviceModelPerformanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsAppHealthDeviceModelPerformance; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsAppHealthDeviceModelPerformance for deviceManagement * @param UserExperienceAnalyticsAppHealthDeviceModelPerformanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsAppHealthDeviceModelPerformanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics appHealth Model Performance * @param UserExperienceAnalyticsAppHealthDeviceModelPerformanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthDeviceModelPerformanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDeviceModelPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDeviceModelPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsAppHealthDeviceModelPerformance in deviceManagement * @param UserExperienceAnalyticsAppHealthDeviceModelPerformance $body The request body * @param UserExperienceAnalyticsAppHealthDeviceModelPerformanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsAppHealthDeviceModelPerformance $body, ?UserExperienceAnalyticsAppHealthDeviceModelPerformanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDeviceModelPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDeviceModelPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsAppHealthDevi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthDeviceM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthDeviceM } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsAppHealthDevice $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDeviceModelPerformance/UserExperienceAnalyticsAppHealthDeviceModelPerformanceRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDeviceModelPerformance/UserExperienceAnalyticsAppHealthDeviceModelPerformanceRequestBuilder.php index 3d20a9ff002..aef4d6ee69c 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDeviceModelPerformance/UserExperienceAnalyticsAppHealthDeviceModelPerformanceRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDeviceModelPerformance/UserExperienceAnalyticsAppHealthDeviceModelPerformanceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthDeviceModelPerformance\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthDeviceModelPerformance\Item\UserExperienceAnalyticsAppHealthDeviceModelPerformanceItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics appHealth Model Performance * @param UserExperienceAnalyticsAppHealthDeviceModelPerformanceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthDeviceModelPerformanceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDeviceModelPerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDeviceModelPerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsAppHealthDeviceModelPerformance for deviceManagement * @param UserExperienceAnalyticsAppHealthDeviceModelPerformance $body The request body * @param UserExperienceAnalyticsAppHealthDeviceModelPerformanceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsAppHealthDeviceModelPerformance $body, ?UserExperienceAnalyticsAppHealthDeviceModelPerformanceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDeviceModelPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDeviceModelPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthDeviceM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthDeviceM } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsAppHealthDeviceM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformance/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformance/Count/CountRequestBuilder.php index 00ae21ab359..4d134e04a8e 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformance/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformance/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformance/Item/UserExperienceAnalyticsAppHealthDevicePerformanceItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformance/Item/UserExperienceAnalyticsAppHealthDevicePerformanceItemRequestBuilder.php index 2f55ebb4ce1..14a85b26262 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformance/Item/UserExperienceAnalyticsAppHealthDevicePerformanceItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformance/Item/UserExperienceAnalyticsAppHealthDevicePerformanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsAppHealthDevicePerformance; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsAppHealthDevicePerformance for deviceManagement * @param UserExperienceAnalyticsAppHealthDevicePerformanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsAppHealthDevicePerformanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics appHealth Device Performance * @param UserExperienceAnalyticsAppHealthDevicePerformanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthDevicePerformanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsAppHealthDevicePerformance in deviceManagement * @param UserExperienceAnalyticsAppHealthDevicePerformance $body The request body * @param UserExperienceAnalyticsAppHealthDevicePerformanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsAppHealthDevicePerformance $body, ?UserExperienceAnalyticsAppHealthDevicePerformanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsAppHealthDevi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthDeviceP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthDeviceP } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsAppHealthDevice $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformance/UserExperienceAnalyticsAppHealthDevicePerformanceRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformance/UserExperienceAnalyticsAppHealthDevicePerformanceRequestBuilder.php index 022ada11e3f..7a3aab19b6a 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformance/UserExperienceAnalyticsAppHealthDevicePerformanceRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformance/UserExperienceAnalyticsAppHealthDevicePerformanceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthDevicePerformance\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthDevicePerformance\Item\UserExperienceAnalyticsAppHealthDevicePerformanceItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics appHealth Device Performance * @param UserExperienceAnalyticsAppHealthDevicePerformanceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthDevicePerformanceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsAppHealthDevicePerformance for deviceManagement * @param UserExperienceAnalyticsAppHealthDevicePerformance $body The request body * @param UserExperienceAnalyticsAppHealthDevicePerformanceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsAppHealthDevicePerformance $body, ?UserExperienceAnalyticsAppHealthDevicePerformanceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthDeviceP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthDeviceP } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsAppHealthDeviceP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformanceDetails/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformanceDetails/Count/CountRequestBuilder.php index e8c42c2cdc7..d146160a562 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformanceDetails/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformanceDetails/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformanceDetails/Item/UserExperienceAnalyticsAppHealthDevicePerformanceDetailsItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformanceDetails/Item/UserExperienceAnalyticsAppHealthDevicePerformanceDetailsItemRequestBuilder.php index 1542a6d0e0b..85f670da15a 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformanceDetails/Item/UserExperienceAnalyticsAppHealthDevicePerformanceDetailsItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformanceDetails/Item/UserExperienceAnalyticsAppHealthDevicePerformanceDetailsItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsAppHealthDevicePerformanceDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsAppHealthDevicePerformanceDetails for deviceManagement * @param UserExperienceAnalyticsAppHealthDevicePerformanceDetailsItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsAppHealthDevicePerformanceDetailsItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics device performance details * @param UserExperienceAnalyticsAppHealthDevicePerformanceDetailsItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthDevicePerformanceDetailsItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformanceDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformanceDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsAppHealthDevicePerformanceDetails in deviceManagement * @param UserExperienceAnalyticsAppHealthDevicePerformanceDetails $body The request body * @param UserExperienceAnalyticsAppHealthDevicePerformanceDetailsItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsAppHealthDevicePerformanceDetails $body, ?UserExperienceAnalyticsAppHealthDevicePerformanceDetailsItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformanceDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformanceDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsAppHealthDevi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthDeviceP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthDeviceP } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsAppHealthDevice $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformanceDetails/UserExperienceAnalyticsAppHealthDevicePerformanceDetailsRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformanceDetails/UserExperienceAnalyticsAppHealthDevicePerformanceDetailsRequestBuilder.php index c24f61c1799..2067e07b298 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformanceDetails/UserExperienceAnalyticsAppHealthDevicePerformanceDetailsRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthDevicePerformanceDetails/UserExperienceAnalyticsAppHealthDevicePerformanceDetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthDevicePerformanceDetails\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthDevicePerformanceDetails\Item\UserExperienceAnalyticsAppHealthDevicePerformanceDetailsItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics device performance details * @param UserExperienceAnalyticsAppHealthDevicePerformanceDetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthDevicePerformanceDetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformanceDetailsCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformanceDetailsCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsAppHealthDevicePerformanceDetails for deviceManagement * @param UserExperienceAnalyticsAppHealthDevicePerformanceDetails $body The request body * @param UserExperienceAnalyticsAppHealthDevicePerformanceDetailsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsAppHealthDevicePerformanceDetails $body, ?UserExperienceAnalyticsAppHealthDevicePerformanceDetailsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformanceDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthDevicePerformanceDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthDeviceP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthDeviceP } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsAppHealthDeviceP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOSVersionPerformance/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOSVersionPerformance/Count/CountRequestBuilder.php index 71f77114fb1..12317757f10 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOSVersionPerformance/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOSVersionPerformance/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOSVersionPerformance/Item/UserExperienceAnalyticsAppHealthOSVersionPerformanceItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOSVersionPerformance/Item/UserExperienceAnalyticsAppHealthOSVersionPerformanceItemRequestBuilder.php index 7d558f73e5a..be12c49dcab 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOSVersionPerformance/Item/UserExperienceAnalyticsAppHealthOSVersionPerformanceItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOSVersionPerformance/Item/UserExperienceAnalyticsAppHealthOSVersionPerformanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsAppHealthOSVersionPerformance; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsAppHealthOSVersionPerformance for deviceManagement * @param UserExperienceAnalyticsAppHealthOSVersionPerformanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsAppHealthOSVersionPerformanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics appHealth OS version Performance * @param UserExperienceAnalyticsAppHealthOSVersionPerformanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthOSVersionPerformanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthOSVersionPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthOSVersionPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsAppHealthOSVersionPerformance in deviceManagement * @param UserExperienceAnalyticsAppHealthOSVersionPerformance $body The request body * @param UserExperienceAnalyticsAppHealthOSVersionPerformanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsAppHealthOSVersionPerformance $body, ?UserExperienceAnalyticsAppHealthOSVersionPerformanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthOSVersionPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthOSVersionPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsAppHealthOSVe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthOSVersi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthOSVersi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsAppHealthOSVers $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOSVersionPerformance/UserExperienceAnalyticsAppHealthOSVersionPerformanceRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOSVersionPerformance/UserExperienceAnalyticsAppHealthOSVersionPerformanceRequestBuilder.php index 968a27eb961..6a4a1f48ed7 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOSVersionPerformance/UserExperienceAnalyticsAppHealthOSVersionPerformanceRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOSVersionPerformance/UserExperienceAnalyticsAppHealthOSVersionPerformanceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthOSVersionPerformance\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthOSVersionPerformance\Item\UserExperienceAnalyticsAppHealthOSVersionPerformanceItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics appHealth OS version Performance * @param UserExperienceAnalyticsAppHealthOSVersionPerformanceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthOSVersionPerformanceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthOSVersionPerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthOSVersionPerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsAppHealthOSVersionPerformance for deviceManagement * @param UserExperienceAnalyticsAppHealthOSVersionPerformance $body The request body * @param UserExperienceAnalyticsAppHealthOSVersionPerformanceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsAppHealthOSVersionPerformance $body, ?UserExperienceAnalyticsAppHealthOSVersionPerformanceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthOSVersionPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsAppHealthOSVersionPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthOSVersi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthOSVersi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsAppHealthOSVersi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/MetricValues/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/MetricValues/Count/CountRequestBuilder.php index 46d659e21d8..cd143be0399 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/MetricValues/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/MetricValues/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/MetricValues/Item/UserExperienceAnalyticsMetricItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/MetricValues/Item/UserExperienceAnalyticsMetricItemRequestBuilder.php index 8c072b786fe..c8d5d43aae6 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/MetricValues/Item/UserExperienceAnalyticsMetricItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/MetricValues/Item/UserExperienceAnalyticsMetricItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsMetric; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property metricValues for deviceManagement * @param UserExperienceAnalyticsMetricItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsMetricItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The metric values for the user experience analytics category. Read-only. * @param UserExperienceAnalyticsMetricItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsMetricItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property metricValues in deviceManagement * @param UserExperienceAnalyticsMetric $body The request body * @param UserExperienceAnalyticsMetricItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsMetric $body, ?UserExperienceAnalyticsMetricItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsMetricItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsMetricItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsMetricItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsMetric $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/MetricValues/MetricValuesRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/MetricValues/MetricValuesRequestBuilder.php index 20fd779ebbd..d8e97641065 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/MetricValues/MetricValuesRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/MetricValues/MetricValuesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthOverview\MetricValues\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthOverview\MetricValues\Item\UserExperienceAnalyticsMetricItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The metric values for the user experience analytics category. Read-only. * @param MetricValuesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MetricValuesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetricCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetricCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to metricValues for deviceManagement * @param UserExperienceAnalyticsMetric $body The request body * @param MetricValuesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsMetric $body, ?MetricValuesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?MetricValuesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?MetricValuesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsMetric $body, ?M $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/UserExperienceAnalyticsAppHealthOverviewRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/UserExperienceAnalyticsAppHealthOverviewRequestBuilder.php index 5995c1f8c16..e62baead06a 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/UserExperienceAnalyticsAppHealthOverviewRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsAppHealthOverview/UserExperienceAnalyticsAppHealthOverviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsAppHealthOverview\MetricValues\MetricValuesRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsCategory; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsAppHealthOverview for deviceManagement * @param UserExperienceAnalyticsAppHealthOverviewRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsAppHealthOverviewRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics appHealth overview * @param UserExperienceAnalyticsAppHealthOverviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsAppHealthOverviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsAppHealthOverview in deviceManagement * @param UserExperienceAnalyticsCategory $body The request body * @param UserExperienceAnalyticsAppHealthOverviewRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsCategory $body, ?UserExperienceAnalyticsAppHealthOverviewRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsAppHealthOver $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthOvervie $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsAppHealthOvervie } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsCategory $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Count/CountRequestBuilder.php index b9fcda345b9..3832e117984 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/AppHealthMetrics/AppHealthMetricsRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/AppHealthMetrics/AppHealthMetricsRequestBuilder.php index 3987d469931..9c3b1d631c8 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/AppHealthMetrics/AppHealthMetricsRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/AppHealthMetrics/AppHealthMetricsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsCategory; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The scores and insights for the application health metrics. * @param AppHealthMetricsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppHealthMetricsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AppHealthMetricsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AppHealthMetricsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/BatteryHealthMetrics/BatteryHealthMetricsRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/BatteryHealthMetrics/BatteryHealthMetricsRequestBuilder.php index b48fc6d745d..1012db7bcbc 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/BatteryHealthMetrics/BatteryHealthMetricsRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/BatteryHealthMetrics/BatteryHealthMetricsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsCategory; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The scores and insights for the battery health metrics. * @param BatteryHealthMetricsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BatteryHealthMetricsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?BatteryHealthMetricsRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?BatteryHealthMetricsRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/BestPracticesMetrics/BestPracticesMetricsRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/BestPracticesMetrics/BestPracticesMetricsRequestBuilder.php index cdb56e5d3d5..3e5b7ff949c 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/BestPracticesMetrics/BestPracticesMetricsRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/BestPracticesMetrics/BestPracticesMetricsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsCategory; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The scores and insights for the best practices metrics. * @param BestPracticesMetricsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BestPracticesMetricsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?BestPracticesMetricsRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?BestPracticesMetricsRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/DeviceBootPerformanceMetrics/DeviceBootPerformanceMetricsRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/DeviceBootPerformanceMetrics/DeviceBootPerformanceMetricsRequestBuilder.php index b1245219b1e..a539b2332a9 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/DeviceBootPerformanceMetrics/DeviceBootPerformanceMetricsRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/DeviceBootPerformanceMetrics/DeviceBootPerformanceMetricsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsCategory; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The scores and insights for the device boot performance metrics. * @param DeviceBootPerformanceMetricsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceBootPerformanceMetricsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeviceBootPerformanceMetricsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeviceBootPerformanceMetricsRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/RebootAnalyticsMetrics/RebootAnalyticsMetricsRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/RebootAnalyticsMetrics/RebootAnalyticsMetricsRequestBuilder.php index 522069d91dc..7032440be96 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/RebootAnalyticsMetrics/RebootAnalyticsMetricsRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/RebootAnalyticsMetrics/RebootAnalyticsMetricsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsCategory; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The scores and insights for the reboot analytics metrics. * @param RebootAnalyticsMetricsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RebootAnalyticsMetricsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RebootAnalyticsMetricsRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RebootAnalyticsMetricsRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/ResourcePerformanceMetrics/ResourcePerformanceMetricsRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/ResourcePerformanceMetrics/ResourcePerformanceMetricsRequestBuilder.php index c5cdcf08a05..4e28d8ac79a 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/ResourcePerformanceMetrics/ResourcePerformanceMetricsRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/ResourcePerformanceMetrics/ResourcePerformanceMetricsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsCategory; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The scores and insights for the resource performance metrics. * @param ResourcePerformanceMetricsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourcePerformanceMetricsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ResourcePerformanceMetricsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ResourcePerformanceMetricsRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/UserExperienceAnalyticsBaselineItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/UserExperienceAnalyticsBaselineItemRequestBuilder.php index f2b628d95a5..424b14b6e69 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/UserExperienceAnalyticsBaselineItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/UserExperienceAnalyticsBaselineItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsBaselines\Item\AppHealthMetrics\AppHealthMetricsRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsBaselines\Item\BatteryHealthMetrics\BatteryHealthMetricsRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsBaselines\Item\BestPracticesMetrics\BestPracticesMetricsRequestBuilder; @@ -90,56 +89,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsBaselines for deviceManagement * @param UserExperienceAnalyticsBaselineItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsBaselineItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics baselines * @param UserExperienceAnalyticsBaselineItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsBaselineItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsBaseline::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsBaseline::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsBaselines in deviceManagement * @param UserExperienceAnalyticsBaseline $body The request body * @param UserExperienceAnalyticsBaselineItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsBaseline $body, ?UserExperienceAnalyticsBaselineItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsBaseline::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsBaseline::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -156,6 +146,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsBaselineItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -169,7 +160,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsBaselineItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -177,6 +167,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsBaselineItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -191,11 +182,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsBaseline $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/WorkFromAnywhereMetrics/WorkFromAnywhereMetricsRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/WorkFromAnywhereMetrics/WorkFromAnywhereMetricsRequestBuilder.php index fe8ba99de24..92584abc992 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/WorkFromAnywhereMetrics/WorkFromAnywhereMetricsRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/Item/WorkFromAnywhereMetrics/WorkFromAnywhereMetricsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsCategory; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The scores and insights for the work from anywhere metrics. * @param WorkFromAnywhereMetricsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WorkFromAnywhereMetricsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?WorkFromAnywhereMetricsRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?WorkFromAnywhereMetricsRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/UserExperienceAnalyticsBaselinesRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/UserExperienceAnalyticsBaselinesRequestBuilder.php index 3d008a39ee3..ceb8bed2359 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/UserExperienceAnalyticsBaselinesRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsBaselines/UserExperienceAnalyticsBaselinesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsBaselines\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsBaselines\Item\UserExperienceAnalyticsBaselineItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics baselines * @param UserExperienceAnalyticsBaselinesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsBaselinesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsBaselineCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsBaselineCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsBaselines for deviceManagement * @param UserExperienceAnalyticsBaseline $body The request body * @param UserExperienceAnalyticsBaselinesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsBaseline $body, ?UserExperienceAnalyticsBaselinesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsBaseline::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsBaseline::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsBaselinesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsBaselinesRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsBaseline $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Count/CountRequestBuilder.php index a1f8e9944f5..c9fcc044b88 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/MetricValues/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/MetricValues/Count/CountRequestBuilder.php index 66c385a2d9c..f3a5a2df70b 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/MetricValues/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/MetricValues/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/MetricValues/Item/UserExperienceAnalyticsMetricItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/MetricValues/Item/UserExperienceAnalyticsMetricItemRequestBuilder.php index bda72050648..7b72c734e13 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/MetricValues/Item/UserExperienceAnalyticsMetricItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/MetricValues/Item/UserExperienceAnalyticsMetricItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsMetric; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property metricValues for deviceManagement * @param UserExperienceAnalyticsMetricItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsMetricItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The metric values for the user experience analytics category. Read-only. * @param UserExperienceAnalyticsMetricItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsMetricItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property metricValues in deviceManagement * @param UserExperienceAnalyticsMetric $body The request body * @param UserExperienceAnalyticsMetricItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsMetric $body, ?UserExperienceAnalyticsMetricItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsMetricItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsMetricItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsMetricItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsMetric $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/MetricValues/MetricValuesRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/MetricValues/MetricValuesRequestBuilder.php index c45b05373b8..e9e278237e6 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/MetricValues/MetricValuesRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/MetricValues/MetricValuesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsCategories\Item\MetricValues\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsCategories\Item\MetricValues\Item\UserExperienceAnalyticsMetricItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The metric values for the user experience analytics category. Read-only. * @param MetricValuesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MetricValuesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetricCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetricCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to metricValues for deviceManagement * @param UserExperienceAnalyticsMetric $body The request body * @param MetricValuesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsMetric $body, ?MetricValuesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?MetricValuesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?MetricValuesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsMetric $body, ?M $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/UserExperienceAnalyticsCategoryItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/UserExperienceAnalyticsCategoryItemRequestBuilder.php index 04f346cde30..7c62e5a892b 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/UserExperienceAnalyticsCategoryItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/Item/UserExperienceAnalyticsCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsCategories\Item\MetricValues\MetricValuesRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsCategory; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsCategories for deviceManagement * @param UserExperienceAnalyticsCategoryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsCategoryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics categories * @param UserExperienceAnalyticsCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsCategories in deviceManagement * @param UserExperienceAnalyticsCategory $body The request body * @param UserExperienceAnalyticsCategoryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsCategory $body, ?UserExperienceAnalyticsCategoryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsCategoryItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsCategoryItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsCategoryItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsCategory $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/UserExperienceAnalyticsCategoriesRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/UserExperienceAnalyticsCategoriesRequestBuilder.php index 1b5202158f5..264ca9588f4 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/UserExperienceAnalyticsCategoriesRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsCategories/UserExperienceAnalyticsCategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsCategories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsCategories\Item\UserExperienceAnalyticsCategoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics categories * @param UserExperienceAnalyticsCategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsCategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsCategories for deviceManagement * @param UserExperienceAnalyticsCategory $body The request body * @param UserExperienceAnalyticsCategoriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsCategory $body, ?UserExperienceAnalyticsCategoriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsCategoriesReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsCategoriesReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsCategory $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/Count/CountRequestBuilder.php index a216ebb2df8..5403f3bb4a5 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/Item/UserExperienceAnalyticsDevicePerformanceItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/Item/UserExperienceAnalyticsDevicePerformanceItemRequestBuilder.php index 9249402642d..6938fd5e492 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/Item/UserExperienceAnalyticsDevicePerformanceItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/Item/UserExperienceAnalyticsDevicePerformanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsDevicePerformance; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsDevicePerformance for deviceManagement * @param UserExperienceAnalyticsDevicePerformanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsDevicePerformanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics device performance * @param UserExperienceAnalyticsDevicePerformanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsDevicePerformanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDevicePerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDevicePerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsDevicePerformance in deviceManagement * @param UserExperienceAnalyticsDevicePerformance $body The request body * @param UserExperienceAnalyticsDevicePerformanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsDevicePerformance $body, ?UserExperienceAnalyticsDevicePerformanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDevicePerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDevicePerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsDevicePerform $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDevicePerformanc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDevicePerformanc } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsDevicePerforman $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/SummarizeDevicePerformanceDevicesWithSummarizeBy/SummarizeDevicePerformanceDevicesWithSummarizeByRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/SummarizeDevicePerformanceDevicesWithSummarizeBy/SummarizeDevicePerformanceDevicesWithSummarizeByRequestBuilder.php index 54a59c48266..2e8e68adc21 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/SummarizeDevicePerformanceDevicesWithSummarizeBy/SummarizeDevicePerformanceDevicesWithSummarizeByRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/SummarizeDevicePerformanceDevicesWithSummarizeBy/SummarizeDevicePerformanceDevicesWithSummarizeByRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function summarizeDevicePerformanceDevices * @param SummarizeDevicePerformanceDevicesWithSummarizeByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SummarizeDevicePerformanceDevicesWithSummarizeByRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SummarizeDevicePerformanceDevicesWithSummarizeByGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SummarizeDevicePerformanceDevicesWithSummarizeByGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?SummarizeDevicePerformanceDevicesWithSu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?SummarizeDevicePerformanceDevicesWithSu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/UserExperienceAnalyticsDevicePerformanceRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/UserExperienceAnalyticsDevicePerformanceRequestBuilder.php index 1f85424fe11..6858fbe5eb3 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/UserExperienceAnalyticsDevicePerformanceRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDevicePerformance/UserExperienceAnalyticsDevicePerformanceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsDevicePerformance\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsDevicePerformance\Item\UserExperienceAnalyticsDevicePerformanceItemRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsDevicePerformance\SummarizeDevicePerformanceDevicesWithSummarizeBy\SummarizeDevicePerformanceDevicesWithSummarizeByRequestBuilder; @@ -56,38 +55,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics device performance * @param UserExperienceAnalyticsDevicePerformanceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsDevicePerformanceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDevicePerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDevicePerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsDevicePerformance for deviceManagement * @param UserExperienceAnalyticsDevicePerformance $body The request body * @param UserExperienceAnalyticsDevicePerformanceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsDevicePerformance $body, ?UserExperienceAnalyticsDevicePerformanceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDevicePerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDevicePerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDevicePerformanc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDevicePerformanc } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsDevicePerformanc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceScores/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceScores/Count/CountRequestBuilder.php index ffd50b7965a..13f72f52c07 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceScores/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceScores/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceScores/Item/UserExperienceAnalyticsDeviceScoresItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceScores/Item/UserExperienceAnalyticsDeviceScoresItemRequestBuilder.php index 63e9d387269..97402baba54 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceScores/Item/UserExperienceAnalyticsDeviceScoresItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceScores/Item/UserExperienceAnalyticsDeviceScoresItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsDeviceScores; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsDeviceScores for deviceManagement * @param UserExperienceAnalyticsDeviceScoresItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsDeviceScoresItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics device scores * @param UserExperienceAnalyticsDeviceScoresItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsDeviceScoresItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceScores::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceScores::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsDeviceScores in deviceManagement * @param UserExperienceAnalyticsDeviceScores $body The request body * @param UserExperienceAnalyticsDeviceScoresItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsDeviceScores $body, ?UserExperienceAnalyticsDeviceScoresItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceScores::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceScores::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsDeviceScoresI $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceScoresItem $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceScoresItem } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsDeviceScores $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceScores/UserExperienceAnalyticsDeviceScoresRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceScores/UserExperienceAnalyticsDeviceScoresRequestBuilder.php index 6532b26aaa5..5ee6b2235d5 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceScores/UserExperienceAnalyticsDeviceScoresRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceScores/UserExperienceAnalyticsDeviceScoresRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsDeviceScores\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsDeviceScores\Item\UserExperienceAnalyticsDeviceScoresItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics device scores * @param UserExperienceAnalyticsDeviceScoresRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsDeviceScoresRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceScoresCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceScoresCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsDeviceScores for deviceManagement * @param UserExperienceAnalyticsDeviceScores $body The request body * @param UserExperienceAnalyticsDeviceScoresRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsDeviceScores $body, ?UserExperienceAnalyticsDeviceScoresRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceScores::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceScores::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceScoresRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceScoresRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsDeviceScores $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupHistory/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupHistory/Count/CountRequestBuilder.php index c5c7e578286..6a0192e6b5e 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupHistory/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupHistory/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupHistory/Item/UserExperienceAnalyticsDeviceStartupHistoryItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupHistory/Item/UserExperienceAnalyticsDeviceStartupHistoryItemRequestBuilder.php index d0dbad814c8..20a16458ac7 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupHistory/Item/UserExperienceAnalyticsDeviceStartupHistoryItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupHistory/Item/UserExperienceAnalyticsDeviceStartupHistoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsDeviceStartupHistory; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsDeviceStartupHistory for deviceManagement * @param UserExperienceAnalyticsDeviceStartupHistoryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsDeviceStartupHistoryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics device Startup History * @param UserExperienceAnalyticsDeviceStartupHistoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsDeviceStartupHistoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupHistory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupHistory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsDeviceStartupHistory in deviceManagement * @param UserExperienceAnalyticsDeviceStartupHistory $body The request body * @param UserExperienceAnalyticsDeviceStartupHistoryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsDeviceStartupHistory $body, ?UserExperienceAnalyticsDeviceStartupHistoryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupHistory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupHistory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsDeviceStartup $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceStartupHis $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceStartupHis } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsDeviceStartupHi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupHistory/UserExperienceAnalyticsDeviceStartupHistoryRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupHistory/UserExperienceAnalyticsDeviceStartupHistoryRequestBuilder.php index 312724d7458..3d373718158 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupHistory/UserExperienceAnalyticsDeviceStartupHistoryRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupHistory/UserExperienceAnalyticsDeviceStartupHistoryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsDeviceStartupHistory\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsDeviceStartupHistory\Item\UserExperienceAnalyticsDeviceStartupHistoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics device Startup History * @param UserExperienceAnalyticsDeviceStartupHistoryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsDeviceStartupHistoryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupHistoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupHistoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsDeviceStartupHistory for deviceManagement * @param UserExperienceAnalyticsDeviceStartupHistory $body The request body * @param UserExperienceAnalyticsDeviceStartupHistoryRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsDeviceStartupHistory $body, ?UserExperienceAnalyticsDeviceStartupHistoryRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupHistory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupHistory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceStartupHis $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceStartupHis } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsDeviceStartupHis $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcessPerformance/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcessPerformance/Count/CountRequestBuilder.php index d8f1f0952f8..be2f2d8987e 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcessPerformance/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcessPerformance/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcessPerformance/Item/UserExperienceAnalyticsDeviceStartupProcessPerformanceItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcessPerformance/Item/UserExperienceAnalyticsDeviceStartupProcessPerformanceItemRequestBuilder.php index f70b7e739e5..8504e13aa91 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcessPerformance/Item/UserExperienceAnalyticsDeviceStartupProcessPerformanceItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcessPerformance/Item/UserExperienceAnalyticsDeviceStartupProcessPerformanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsDeviceStartupProcessPerformance; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsDeviceStartupProcessPerformance for deviceManagement * @param UserExperienceAnalyticsDeviceStartupProcessPerformanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsDeviceStartupProcessPerformanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics device Startup Process Performance * @param UserExperienceAnalyticsDeviceStartupProcessPerformanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsDeviceStartupProcessPerformanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcessPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcessPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsDeviceStartupProcessPerformance in deviceManagement * @param UserExperienceAnalyticsDeviceStartupProcessPerformance $body The request body * @param UserExperienceAnalyticsDeviceStartupProcessPerformanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsDeviceStartupProcessPerformance $body, ?UserExperienceAnalyticsDeviceStartupProcessPerformanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcessPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcessPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsDeviceStartup $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceStartupPro $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceStartupPro } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsDeviceStartupPr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcessPerformance/UserExperienceAnalyticsDeviceStartupProcessPerformanceRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcessPerformance/UserExperienceAnalyticsDeviceStartupProcessPerformanceRequestBuilder.php index 42ae38f7b37..ee3a930fc90 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcessPerformance/UserExperienceAnalyticsDeviceStartupProcessPerformanceRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcessPerformance/UserExperienceAnalyticsDeviceStartupProcessPerformanceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsDeviceStartupProcessPerformance\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsDeviceStartupProcessPerformance\Item\UserExperienceAnalyticsDeviceStartupProcessPerformanceItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics device Startup Process Performance * @param UserExperienceAnalyticsDeviceStartupProcessPerformanceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsDeviceStartupProcessPerformanceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcessPerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcessPerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsDeviceStartupProcessPerformance for deviceManagement * @param UserExperienceAnalyticsDeviceStartupProcessPerformance $body The request body * @param UserExperienceAnalyticsDeviceStartupProcessPerformanceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsDeviceStartupProcessPerformance $body, ?UserExperienceAnalyticsDeviceStartupProcessPerformanceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcessPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcessPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceStartupPro $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceStartupPro } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsDeviceStartupPro $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcesses/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcesses/Count/CountRequestBuilder.php index 251e633abac..e4b586968a6 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcesses/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcesses/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcesses/Item/UserExperienceAnalyticsDeviceStartupProcessItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcesses/Item/UserExperienceAnalyticsDeviceStartupProcessItemRequestBuilder.php index 76ea66dbf9a..07dbcb6b67f 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcesses/Item/UserExperienceAnalyticsDeviceStartupProcessItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcesses/Item/UserExperienceAnalyticsDeviceStartupProcessItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsDeviceStartupProcess; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsDeviceStartupProcesses for deviceManagement * @param UserExperienceAnalyticsDeviceStartupProcessItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsDeviceStartupProcessItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics device Startup Processes * @param UserExperienceAnalyticsDeviceStartupProcessItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsDeviceStartupProcessItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcess::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcess::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsDeviceStartupProcesses in deviceManagement * @param UserExperienceAnalyticsDeviceStartupProcess $body The request body * @param UserExperienceAnalyticsDeviceStartupProcessItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsDeviceStartupProcess $body, ?UserExperienceAnalyticsDeviceStartupProcessItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcess::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcess::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsDeviceStartup $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceStartupPro $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceStartupPro } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsDeviceStartupPr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcesses/UserExperienceAnalyticsDeviceStartupProcessesRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcesses/UserExperienceAnalyticsDeviceStartupProcessesRequestBuilder.php index 1724d497d89..6a16ea7874f 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcesses/UserExperienceAnalyticsDeviceStartupProcessesRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsDeviceStartupProcesses/UserExperienceAnalyticsDeviceStartupProcessesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsDeviceStartupProcesses\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsDeviceStartupProcesses\Item\UserExperienceAnalyticsDeviceStartupProcessItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics device Startup Processes * @param UserExperienceAnalyticsDeviceStartupProcessesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsDeviceStartupProcessesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcessCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcessCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsDeviceStartupProcesses for deviceManagement * @param UserExperienceAnalyticsDeviceStartupProcess $body The request body * @param UserExperienceAnalyticsDeviceStartupProcessesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsDeviceStartupProcess $body, ?UserExperienceAnalyticsDeviceStartupProcessesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcess::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsDeviceStartupProcess::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceStartupPro $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsDeviceStartupPro } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsDeviceStartupPro $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsMetricHistory/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsMetricHistory/Count/CountRequestBuilder.php index d63ff9c6edc..1cd2583b042 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsMetricHistory/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsMetricHistory/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsMetricHistory/Item/UserExperienceAnalyticsMetricHistoryItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsMetricHistory/Item/UserExperienceAnalyticsMetricHistoryItemRequestBuilder.php index 64ee9c03507..45b5a78f160 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsMetricHistory/Item/UserExperienceAnalyticsMetricHistoryItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsMetricHistory/Item/UserExperienceAnalyticsMetricHistoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsMetricHistory; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsMetricHistory for deviceManagement * @param UserExperienceAnalyticsMetricHistoryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsMetricHistoryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics metric history * @param UserExperienceAnalyticsMetricHistoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsMetricHistoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetricHistory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetricHistory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsMetricHistory in deviceManagement * @param UserExperienceAnalyticsMetricHistory $body The request body * @param UserExperienceAnalyticsMetricHistoryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsMetricHistory $body, ?UserExperienceAnalyticsMetricHistoryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetricHistory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetricHistory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsMetricHistory $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsMetricHistoryIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsMetricHistoryIte } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsMetricHistory $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsMetricHistory/UserExperienceAnalyticsMetricHistoryRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsMetricHistory/UserExperienceAnalyticsMetricHistoryRequestBuilder.php index ec9370cd003..f9fdf45e4a2 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsMetricHistory/UserExperienceAnalyticsMetricHistoryRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsMetricHistory/UserExperienceAnalyticsMetricHistoryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsMetricHistory\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsMetricHistory\Item\UserExperienceAnalyticsMetricHistoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics metric history * @param UserExperienceAnalyticsMetricHistoryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsMetricHistoryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetricHistoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetricHistoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsMetricHistory for deviceManagement * @param UserExperienceAnalyticsMetricHistory $body The request body * @param UserExperienceAnalyticsMetricHistoryRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsMetricHistory $body, ?UserExperienceAnalyticsMetricHistoryRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetricHistory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsMetricHistory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsMetricHistoryReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsMetricHistoryReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsMetricHistory $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsModelScores/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsModelScores/Count/CountRequestBuilder.php index 672f6e980ba..d1c812300d9 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsModelScores/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsModelScores/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsModelScores/Item/UserExperienceAnalyticsModelScoresItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsModelScores/Item/UserExperienceAnalyticsModelScoresItemRequestBuilder.php index 8fde94d63ed..56155deaf9f 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsModelScores/Item/UserExperienceAnalyticsModelScoresItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsModelScores/Item/UserExperienceAnalyticsModelScoresItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsModelScores; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsModelScores for deviceManagement * @param UserExperienceAnalyticsModelScoresItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsModelScoresItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics model scores * @param UserExperienceAnalyticsModelScoresItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsModelScoresItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsModelScores::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsModelScores::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsModelScores in deviceManagement * @param UserExperienceAnalyticsModelScores $body The request body * @param UserExperienceAnalyticsModelScoresItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsModelScores $body, ?UserExperienceAnalyticsModelScoresItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsModelScores::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsModelScores::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsModelScoresIt $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsModelScoresItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsModelScoresItemR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsModelScores $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsModelScores/UserExperienceAnalyticsModelScoresRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsModelScores/UserExperienceAnalyticsModelScoresRequestBuilder.php index 0e5f2e661ab..bcfa6de4198 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsModelScores/UserExperienceAnalyticsModelScoresRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsModelScores/UserExperienceAnalyticsModelScoresRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsModelScores\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsModelScores\Item\UserExperienceAnalyticsModelScoresItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics model scores * @param UserExperienceAnalyticsModelScoresRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsModelScoresRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsModelScoresCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsModelScoresCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsModelScores for deviceManagement * @param UserExperienceAnalyticsModelScores $body The request body * @param UserExperienceAnalyticsModelScoresRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsModelScores $body, ?UserExperienceAnalyticsModelScoresRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsModelScores::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsModelScores::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsModelScoresReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsModelScoresReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsModelScores $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsOverview/UserExperienceAnalyticsOverviewRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsOverview/UserExperienceAnalyticsOverviewRequestBuilder.php index 0e38d6a0b8f..6ca37ba6487 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsOverview/UserExperienceAnalyticsOverviewRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsOverview/UserExperienceAnalyticsOverviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsOverview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsOverview for deviceManagement * @param UserExperienceAnalyticsOverviewRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsOverviewRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics overview * @param UserExperienceAnalyticsOverviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsOverviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsOverview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsOverview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsOverview in deviceManagement * @param UserExperienceAnalyticsOverview $body The request body * @param UserExperienceAnalyticsOverviewRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsOverview $body, ?UserExperienceAnalyticsOverviewRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsOverview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsOverview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsOverviewReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsOverviewRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsOverviewRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsOverview $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsScoreHistory/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsScoreHistory/Count/CountRequestBuilder.php index 81d3bd87074..0bcc806ae79 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsScoreHistory/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsScoreHistory/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsScoreHistory/Item/UserExperienceAnalyticsScoreHistoryItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsScoreHistory/Item/UserExperienceAnalyticsScoreHistoryItemRequestBuilder.php index e6f5aa04148..5d47f0e72cc 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsScoreHistory/Item/UserExperienceAnalyticsScoreHistoryItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsScoreHistory/Item/UserExperienceAnalyticsScoreHistoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsScoreHistory; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsScoreHistory for deviceManagement * @param UserExperienceAnalyticsScoreHistoryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsScoreHistoryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics device Startup Score History * @param UserExperienceAnalyticsScoreHistoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsScoreHistoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsScoreHistory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsScoreHistory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsScoreHistory in deviceManagement * @param UserExperienceAnalyticsScoreHistory $body The request body * @param UserExperienceAnalyticsScoreHistoryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsScoreHistory $body, ?UserExperienceAnalyticsScoreHistoryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsScoreHistory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsScoreHistory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsScoreHistoryI $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsScoreHistoryItem $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsScoreHistoryItem } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsScoreHistory $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsScoreHistory/UserExperienceAnalyticsScoreHistoryRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsScoreHistory/UserExperienceAnalyticsScoreHistoryRequestBuilder.php index 07eaf574cae..c90beee5586 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsScoreHistory/UserExperienceAnalyticsScoreHistoryRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsScoreHistory/UserExperienceAnalyticsScoreHistoryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsScoreHistory\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsScoreHistory\Item\UserExperienceAnalyticsScoreHistoryItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics device Startup Score History * @param UserExperienceAnalyticsScoreHistoryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsScoreHistoryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsScoreHistoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsScoreHistoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsScoreHistory for deviceManagement * @param UserExperienceAnalyticsScoreHistory $body The request body * @param UserExperienceAnalyticsScoreHistoryRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsScoreHistory $body, ?UserExperienceAnalyticsScoreHistoryRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsScoreHistory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsScoreHistory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsScoreHistoryRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsScoreHistoryRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsScoreHistory $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsSummarizeWorkFromAnywhereDevices/UserExperienceAnalyticsSummarizeWorkFromAnywhereDevicesRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsSummarizeWorkFromAnywhereDevices/UserExperienceAnalyticsSummarizeWorkFromAnywhereDevicesRequestBuilder.php index 2a93cc4a2eb..c53c8b7aa46 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsSummarizeWorkFromAnywhereDevices/UserExperienceAnalyticsSummarizeWorkFromAnywhereDevicesRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsSummarizeWorkFromAnywhereDevices/UserExperienceAnalyticsSummarizeWorkFromAnywhereDevicesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsWorkFromAnywhereDevicesSummary; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function userExperienceAnalyticsSummarizeWorkFromAnywhereDevices * @param UserExperienceAnalyticsSummarizeWorkFromAnywhereDevicesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsSummarizeWorkFromAnywhereDevicesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereDevicesSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereDevicesSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?UserExperienceAnalyticsSummarizeWorkFro $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric/UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetricRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric/UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetricRequestBuilder.php index 485f7378784..097a9154ba7 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric/UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetricRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric/UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetricRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric for deviceManagement * @param UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetricRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetricRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics work from anywhere hardware readiness metrics. * @param UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetricRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetricRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric in deviceManagement * @param UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric $body The request body * @param UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetricRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric $body, ?UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetricRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsWorkFromAnywh $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsWorkFromAnywhere $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsWorkFromAnywhere } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsWorkFromAnywher $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Count/CountRequestBuilder.php index afbd57a3da4..0612504d859 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/MetricDevices/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/MetricDevices/Count/CountRequestBuilder.php index 89edaea3a9d..4118fe20db0 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/MetricDevices/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/MetricDevices/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/MetricDevices/Item/UserExperienceAnalyticsWorkFromAnywhereDeviceItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/MetricDevices/Item/UserExperienceAnalyticsWorkFromAnywhereDeviceItemRequestBuilder.php index a1e18477c96..8e0cddeb53c 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/MetricDevices/Item/UserExperienceAnalyticsWorkFromAnywhereDeviceItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/MetricDevices/Item/UserExperienceAnalyticsWorkFromAnywhereDeviceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsWorkFromAnywhereDevice; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property metricDevices for deviceManagement * @param UserExperienceAnalyticsWorkFromAnywhereDeviceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsWorkFromAnywhereDeviceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The work from anywhere metric devices. Read-only. * @param UserExperienceAnalyticsWorkFromAnywhereDeviceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsWorkFromAnywhereDeviceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereDevice::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereDevice::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property metricDevices in deviceManagement * @param UserExperienceAnalyticsWorkFromAnywhereDevice $body The request body * @param UserExperienceAnalyticsWorkFromAnywhereDeviceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsWorkFromAnywhereDevice $body, ?UserExperienceAnalyticsWorkFromAnywhereDeviceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereDevice::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereDevice::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsWorkFromAnywh $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsWorkFromAnywhere $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsWorkFromAnywhere } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsWorkFromAnywher $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/MetricDevices/MetricDevicesRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/MetricDevices/MetricDevicesRequestBuilder.php index 375d508b610..8142b76e9f7 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/MetricDevices/MetricDevicesRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/MetricDevices/MetricDevicesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsWorkFromAnywhereMetrics\Item\MetricDevices\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsWorkFromAnywhereMetrics\Item\MetricDevices\Item\UserExperienceAnalyticsWorkFromAnywhereDeviceItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The work from anywhere metric devices. Read-only. * @param MetricDevicesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MetricDevicesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereDeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereDeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to metricDevices for deviceManagement * @param UserExperienceAnalyticsWorkFromAnywhereDevice $body The request body * @param MetricDevicesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsWorkFromAnywhereDevice $body, ?MetricDevicesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereDevice::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereDevice::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?MetricDevicesRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?MetricDevicesRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsWorkFromAnywhere $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/UserExperienceAnalyticsWorkFromAnywhereMetricItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/UserExperienceAnalyticsWorkFromAnywhereMetricItemRequestBuilder.php index 5025d195800..2dd952849a6 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/UserExperienceAnalyticsWorkFromAnywhereMetricItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/Item/UserExperienceAnalyticsWorkFromAnywhereMetricItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsWorkFromAnywhereMetrics\Item\MetricDevices\MetricDevicesRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsWorkFromAnywhereMetric; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsWorkFromAnywhereMetrics for deviceManagement * @param UserExperienceAnalyticsWorkFromAnywhereMetricItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsWorkFromAnywhereMetricItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User experience analytics work from anywhere metrics. * @param UserExperienceAnalyticsWorkFromAnywhereMetricItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsWorkFromAnywhereMetricItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereMetric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereMetric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsWorkFromAnywhereMetrics in deviceManagement * @param UserExperienceAnalyticsWorkFromAnywhereMetric $body The request body * @param UserExperienceAnalyticsWorkFromAnywhereMetricItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsWorkFromAnywhereMetric $body, ?UserExperienceAnalyticsWorkFromAnywhereMetricItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereMetric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereMetric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsWorkFromAnywh $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsWorkFromAnywhere $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsWorkFromAnywhere } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsWorkFromAnywher $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/UserExperienceAnalyticsWorkFromAnywhereMetricsRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/UserExperienceAnalyticsWorkFromAnywhereMetricsRequestBuilder.php index ab7b7222e56..f427e24dc8f 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/UserExperienceAnalyticsWorkFromAnywhereMetricsRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereMetrics/UserExperienceAnalyticsWorkFromAnywhereMetricsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsWorkFromAnywhereMetrics\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsWorkFromAnywhereMetrics\Item\UserExperienceAnalyticsWorkFromAnywhereMetricItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * User experience analytics work from anywhere metrics. * @param UserExperienceAnalyticsWorkFromAnywhereMetricsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsWorkFromAnywhereMetricsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereMetricCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereMetricCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsWorkFromAnywhereMetrics for deviceManagement * @param UserExperienceAnalyticsWorkFromAnywhereMetric $body The request body * @param UserExperienceAnalyticsWorkFromAnywhereMetricsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsWorkFromAnywhereMetric $body, ?UserExperienceAnalyticsWorkFromAnywhereMetricsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereMetric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereMetric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsWorkFromAnywhere $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsWorkFromAnywhere } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsWorkFromAnywhere $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereModelPerformance/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereModelPerformance/Count/CountRequestBuilder.php index 8c072c34b8c..4264e87b274 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereModelPerformance/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereModelPerformance/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereModelPerformance/Item/UserExperienceAnalyticsWorkFromAnywhereModelPerformanceItemRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereModelPerformance/Item/UserExperienceAnalyticsWorkFromAnywhereModelPerformanceItemRequestBuilder.php index 4435b19d28d..b79dcddaf19 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereModelPerformance/Item/UserExperienceAnalyticsWorkFromAnywhereModelPerformanceItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereModelPerformance/Item/UserExperienceAnalyticsWorkFromAnywhereModelPerformanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserExperienceAnalyticsWorkFromAnywhereModelPerformance; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userExperienceAnalyticsWorkFromAnywhereModelPerformance for deviceManagement * @param UserExperienceAnalyticsWorkFromAnywhereModelPerformanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserExperienceAnalyticsWorkFromAnywhereModelPerformanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The user experience analytics work from anywhere model performance * @param UserExperienceAnalyticsWorkFromAnywhereModelPerformanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsWorkFromAnywhereModelPerformanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereModelPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereModelPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userExperienceAnalyticsWorkFromAnywhereModelPerformance in deviceManagement * @param UserExperienceAnalyticsWorkFromAnywhereModelPerformance $body The request body * @param UserExperienceAnalyticsWorkFromAnywhereModelPerformanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserExperienceAnalyticsWorkFromAnywhereModelPerformance $body, ?UserExperienceAnalyticsWorkFromAnywhereModelPerformanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereModelPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereModelPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserExperienceAnalyticsWorkFromAnywh $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsWorkFromAnywhere $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsWorkFromAnywhere } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserExperienceAnalyticsWorkFromAnywher $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereModelPerformance/UserExperienceAnalyticsWorkFromAnywhereModelPerformanceRequestBuilder.php b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereModelPerformance/UserExperienceAnalyticsWorkFromAnywhereModelPerformanceRequestBuilder.php index 4fa26b52916..f8c433525be 100644 --- a/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereModelPerformance/UserExperienceAnalyticsWorkFromAnywhereModelPerformanceRequestBuilder.php +++ b/src/Generated/DeviceManagement/UserExperienceAnalyticsWorkFromAnywhereModelPerformance/UserExperienceAnalyticsWorkFromAnywhereModelPerformanceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsWorkFromAnywhereModelPerformance\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\UserExperienceAnalyticsWorkFromAnywhereModelPerformance\Item\UserExperienceAnalyticsWorkFromAnywhereModelPerformanceItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The user experience analytics work from anywhere model performance * @param UserExperienceAnalyticsWorkFromAnywhereModelPerformanceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserExperienceAnalyticsWorkFromAnywhereModelPerformanceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereModelPerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereModelPerformanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userExperienceAnalyticsWorkFromAnywhereModelPerformance for deviceManagement * @param UserExperienceAnalyticsWorkFromAnywhereModelPerformance $body The request body * @param UserExperienceAnalyticsWorkFromAnywhereModelPerformanceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserExperienceAnalyticsWorkFromAnywhereModelPerformance $body, ?UserExperienceAnalyticsWorkFromAnywhereModelPerformanceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereModelPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserExperienceAnalyticsWorkFromAnywhereModelPerformance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?UserExperienceAnalyticsWorkFromAnywhere $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?UserExperienceAnalyticsWorkFromAnywhere } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserExperienceAnalyticsWorkFromAnywhere $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/VerifyWindowsEnrollmentAutoDiscoveryWithDomainName/VerifyWindowsEnrollmentAutoDiscoveryWithDomainNameRequestBuilder.php b/src/Generated/DeviceManagement/VerifyWindowsEnrollmentAutoDiscoveryWithDomainName/VerifyWindowsEnrollmentAutoDiscoveryWithDomainNameRequestBuilder.php index 23f5e886a57..d4e3109bd30 100644 --- a/src/Generated/DeviceManagement/VerifyWindowsEnrollmentAutoDiscoveryWithDomainName/VerifyWindowsEnrollmentAutoDiscoveryWithDomainNameRequestBuilder.php +++ b/src/Generated/DeviceManagement/VerifyWindowsEnrollmentAutoDiscoveryWithDomainName/VerifyWindowsEnrollmentAutoDiscoveryWithDomainNameRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function verifyWindowsEnrollmentAutoDiscovery * @param VerifyWindowsEnrollmentAutoDiscoveryWithDomainNameRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?VerifyWindowsEnrollmentAutoDiscoveryWithDomainNameRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [VerifyWindowsEnrollmentAutoDiscoveryWithDomainNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [VerifyWindowsEnrollmentAutoDiscoveryWithDomainNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toGetRequestInformation(?VerifyWindowsEnrollmentAutoDiscoveryWit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Count/CountRequestBuilder.php index 9efd2ed0331..36d2a915c8c 100644 --- a/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/AssignUserToDevice/AssignUserToDeviceRequestBuilder.php b/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/AssignUserToDevice/AssignUserToDeviceRequestBuilder.php index c70ac081e3a..0a058c83646 100644 --- a/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/AssignUserToDevice/AssignUserToDeviceRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/AssignUserToDevice/AssignUserToDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Assigns user to Autopilot devices. * @param AssignUserToDevicePostRequestBody $body The request body * @param AssignUserToDeviceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-enrollment-windowsautopilotdeviceidentity-assignusertodevice?view=graph-rest-1.0 Find more info here */ public function post(AssignUserToDevicePostRequestBody $body, ?AssignUserToDeviceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AssignUserToDevicePostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/UnassignUserFromDevice/UnassignUserFromDeviceRequestBuilder.php b/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/UnassignUserFromDevice/UnassignUserFromDeviceRequestBuilder.php index 2435fd41c73..094c58b85d5 100644 --- a/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/UnassignUserFromDevice/UnassignUserFromDeviceRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/UnassignUserFromDevice/UnassignUserFromDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unassigns the user from an Autopilot device. * @param UnassignUserFromDeviceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-enrollment-windowsautopilotdeviceidentity-unassignuserfromdevice?view=graph-rest-1.0 Find more info here */ public function post(?UnassignUserFromDeviceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnassignUserFromDeviceRequestBuilderPo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/UpdateDeviceProperties/UpdateDevicePropertiesRequestBuilder.php b/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/UpdateDeviceProperties/UpdateDevicePropertiesRequestBuilder.php index 5a0511bfb35..f6676775e4b 100644 --- a/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/UpdateDeviceProperties/UpdateDevicePropertiesRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/UpdateDeviceProperties/UpdateDevicePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Updates properties on Autopilot devices. * @param UpdateDevicePropertiesPostRequestBody $body The request body * @param UpdateDevicePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-enrollment-windowsautopilotdeviceidentity-updatedeviceproperties?view=graph-rest-1.0 Find more info here */ public function post(UpdateDevicePropertiesPostRequestBody $body, ?UpdateDevicePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(UpdateDevicePropertiesPostRequestBody $ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/WindowsAutopilotDeviceIdentityItemRequestBuilder.php b/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/WindowsAutopilotDeviceIdentityItemRequestBuilder.php index 96ca2e1cf87..aff858aa513 100644 --- a/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/WindowsAutopilotDeviceIdentityItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/Item/WindowsAutopilotDeviceIdentityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\WindowsAutopilotDeviceIdentities\Item\AssignUserToDevice\AssignUserToDeviceRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\WindowsAutopilotDeviceIdentities\Item\UnassignUserFromDevice\UnassignUserFromDeviceRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\WindowsAutopilotDeviceIdentities\Item\UpdateDeviceProperties\UpdateDevicePropertiesRequestBuilder; @@ -58,58 +57,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a windowsAutopilotDeviceIdentity. * @param WindowsAutopilotDeviceIdentityItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-enrollment-windowsautopilotdeviceidentity-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WindowsAutopilotDeviceIdentityItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the windowsAutopilotDeviceIdentity object. * @param WindowsAutopilotDeviceIdentityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-enrollment-windowsautopilotdeviceidentity-get?view=graph-rest-1.0 Find more info here */ public function get(?WindowsAutopilotDeviceIdentityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsAutopilotDeviceIdentity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsAutopilotDeviceIdentity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property windowsAutopilotDeviceIdentities in deviceManagement * @param WindowsAutopilotDeviceIdentity $body The request body * @param WindowsAutopilotDeviceIdentityItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WindowsAutopilotDeviceIdentity $body, ?WindowsAutopilotDeviceIdentityItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsAutopilotDeviceIdentity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsAutopilotDeviceIdentity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -126,6 +116,7 @@ public function toDeleteRequestInformation(?WindowsAutopilotDeviceIdentityItemRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -139,7 +130,6 @@ public function toGetRequestInformation(?WindowsAutopilotDeviceIdentityItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +137,7 @@ public function toGetRequestInformation(?WindowsAutopilotDeviceIdentityItemReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -161,11 +152,11 @@ public function toPatchRequestInformation(WindowsAutopilotDeviceIdentity $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/WindowsAutopilotDeviceIdentitiesRequestBuilder.php b/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/WindowsAutopilotDeviceIdentitiesRequestBuilder.php index 73d9115cb26..dd8e66d6ee5 100644 --- a/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/WindowsAutopilotDeviceIdentitiesRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsAutopilotDeviceIdentities/WindowsAutopilotDeviceIdentitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\WindowsAutopilotDeviceIdentities\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\WindowsAutopilotDeviceIdentities\Item\WindowsAutopilotDeviceIdentityItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the windowsAutopilotDeviceIdentity objects. * @param WindowsAutopilotDeviceIdentitiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-enrollment-windowsautopilotdeviceidentity-list?view=graph-rest-1.0 Find more info here */ public function get(?WindowsAutopilotDeviceIdentitiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsAutopilotDeviceIdentityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsAutopilotDeviceIdentityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new windowsAutopilotDeviceIdentity object. * @param WindowsAutopilotDeviceIdentity $body The request body * @param WindowsAutopilotDeviceIdentitiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-enrollment-windowsautopilotdeviceidentity-create?view=graph-rest-1.0 Find more info here */ public function post(WindowsAutopilotDeviceIdentity $body, ?WindowsAutopilotDeviceIdentitiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsAutopilotDeviceIdentity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsAutopilotDeviceIdentity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?WindowsAutopilotDeviceIdentitiesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?WindowsAutopilotDeviceIdentitiesRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(WindowsAutopilotDeviceIdentity $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsInformationProtectionAppLearningSummaries/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/WindowsInformationProtectionAppLearningSummaries/Count/CountRequestBuilder.php index 873ba76ecfb..72f9a82280d 100644 --- a/src/Generated/DeviceManagement/WindowsInformationProtectionAppLearningSummaries/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsInformationProtectionAppLearningSummaries/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsInformationProtectionAppLearningSummaries/Item/WindowsInformationProtectionAppLearningSummaryItemRequestBuilder.php b/src/Generated/DeviceManagement/WindowsInformationProtectionAppLearningSummaries/Item/WindowsInformationProtectionAppLearningSummaryItemRequestBuilder.php index 65a9c6ecd91..24815c898b2 100644 --- a/src/Generated/DeviceManagement/WindowsInformationProtectionAppLearningSummaries/Item/WindowsInformationProtectionAppLearningSummaryItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsInformationProtectionAppLearningSummaries/Item/WindowsInformationProtectionAppLearningSummaryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsInformationProtectionAppLearningSummary; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a windowsInformationProtectionAppLearningSummary. * @param WindowsInformationProtectionAppLearningSummaryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-wip-windowsinformationprotectionapplearningsummary-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WindowsInformationProtectionAppLearningSummaryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the windowsInformationProtectionAppLearningSummary object. * @param WindowsInformationProtectionAppLearningSummaryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-wip-windowsinformationprotectionapplearningsummary-get?view=graph-rest-1.0 Find more info here */ public function get(?WindowsInformationProtectionAppLearningSummaryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLearningSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLearningSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a windowsInformationProtectionAppLearningSummary object. * @param WindowsInformationProtectionAppLearningSummary $body The request body * @param WindowsInformationProtectionAppLearningSummaryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-wip-windowsinformationprotectionapplearningsummary-update?view=graph-rest-1.0 Find more info here */ public function patch(WindowsInformationProtectionAppLearningSummary $body, ?WindowsInformationProtectionAppLearningSummaryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLearningSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLearningSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?WindowsInformationProtectionAppLearn $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?WindowsInformationProtectionAppLearning $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?WindowsInformationProtectionAppLearning } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(WindowsInformationProtectionAppLearnin $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsInformationProtectionAppLearningSummaries/WindowsInformationProtectionAppLearningSummariesRequestBuilder.php b/src/Generated/DeviceManagement/WindowsInformationProtectionAppLearningSummaries/WindowsInformationProtectionAppLearningSummariesRequestBuilder.php index 7f94f6a7e62..c716d7f1125 100644 --- a/src/Generated/DeviceManagement/WindowsInformationProtectionAppLearningSummaries/WindowsInformationProtectionAppLearningSummariesRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsInformationProtectionAppLearningSummaries/WindowsInformationProtectionAppLearningSummariesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\WindowsInformationProtectionAppLearningSummaries\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\WindowsInformationProtectionAppLearningSummaries\Item\WindowsInformationProtectionAppLearningSummaryItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the windowsInformationProtectionAppLearningSummary objects. * @param WindowsInformationProtectionAppLearningSummariesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-wip-windowsinformationprotectionapplearningsummary-list?view=graph-rest-1.0 Find more info here */ public function get(?WindowsInformationProtectionAppLearningSummariesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLearningSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLearningSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new windowsInformationProtectionAppLearningSummary object. * @param WindowsInformationProtectionAppLearningSummary $body The request body * @param WindowsInformationProtectionAppLearningSummariesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-wip-windowsinformationprotectionapplearningsummary-create?view=graph-rest-1.0 Find more info here */ public function post(WindowsInformationProtectionAppLearningSummary $body, ?WindowsInformationProtectionAppLearningSummariesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLearningSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionAppLearningSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?WindowsInformationProtectionAppLearning $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?WindowsInformationProtectionAppLearning } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(WindowsInformationProtectionAppLearning $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsInformationProtectionNetworkLearningSummaries/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/WindowsInformationProtectionNetworkLearningSummaries/Count/CountRequestBuilder.php index e3a79c26a9d..e0e83ccce55 100644 --- a/src/Generated/DeviceManagement/WindowsInformationProtectionNetworkLearningSummaries/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsInformationProtectionNetworkLearningSummaries/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsInformationProtectionNetworkLearningSummaries/Item/WindowsInformationProtectionNetworkLearningSummaryItemRequestBuilder.php b/src/Generated/DeviceManagement/WindowsInformationProtectionNetworkLearningSummaries/Item/WindowsInformationProtectionNetworkLearningSummaryItemRequestBuilder.php index f09c8cbc767..26f074e8d3e 100644 --- a/src/Generated/DeviceManagement/WindowsInformationProtectionNetworkLearningSummaries/Item/WindowsInformationProtectionNetworkLearningSummaryItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsInformationProtectionNetworkLearningSummaries/Item/WindowsInformationProtectionNetworkLearningSummaryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsInformationProtectionNetworkLearningSummary; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a windowsInformationProtectionNetworkLearningSummary. * @param WindowsInformationProtectionNetworkLearningSummaryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-wip-windowsinformationprotectionnetworklearningsummary-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WindowsInformationProtectionNetworkLearningSummaryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the windowsInformationProtectionNetworkLearningSummary object. * @param WindowsInformationProtectionNetworkLearningSummaryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-wip-windowsinformationprotectionnetworklearningsummary-get?view=graph-rest-1.0 Find more info here */ public function get(?WindowsInformationProtectionNetworkLearningSummaryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionNetworkLearningSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionNetworkLearningSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a windowsInformationProtectionNetworkLearningSummary object. * @param WindowsInformationProtectionNetworkLearningSummary $body The request body * @param WindowsInformationProtectionNetworkLearningSummaryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-wip-windowsinformationprotectionnetworklearningsummary-update?view=graph-rest-1.0 Find more info here */ public function patch(WindowsInformationProtectionNetworkLearningSummary $body, ?WindowsInformationProtectionNetworkLearningSummaryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionNetworkLearningSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionNetworkLearningSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?WindowsInformationProtectionNetworkL $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?WindowsInformationProtectionNetworkLear $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?WindowsInformationProtectionNetworkLear } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(WindowsInformationProtectionNetworkLea $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsInformationProtectionNetworkLearningSummaries/WindowsInformationProtectionNetworkLearningSummariesRequestBuilder.php b/src/Generated/DeviceManagement/WindowsInformationProtectionNetworkLearningSummaries/WindowsInformationProtectionNetworkLearningSummariesRequestBuilder.php index 0d950d6874f..26a8cc8fb4a 100644 --- a/src/Generated/DeviceManagement/WindowsInformationProtectionNetworkLearningSummaries/WindowsInformationProtectionNetworkLearningSummariesRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsInformationProtectionNetworkLearningSummaries/WindowsInformationProtectionNetworkLearningSummariesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\WindowsInformationProtectionNetworkLearningSummaries\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\WindowsInformationProtectionNetworkLearningSummaries\Item\WindowsInformationProtectionNetworkLearningSummaryItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the windowsInformationProtectionNetworkLearningSummary objects. * @param WindowsInformationProtectionNetworkLearningSummariesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-wip-windowsinformationprotectionnetworklearningsummary-list?view=graph-rest-1.0 Find more info here */ public function get(?WindowsInformationProtectionNetworkLearningSummariesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionNetworkLearningSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionNetworkLearningSummaryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new windowsInformationProtectionNetworkLearningSummary object. * @param WindowsInformationProtectionNetworkLearningSummary $body The request body * @param WindowsInformationProtectionNetworkLearningSummariesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-wip-windowsinformationprotectionnetworklearningsummary-create?view=graph-rest-1.0 Find more info here */ public function post(WindowsInformationProtectionNetworkLearningSummary $body, ?WindowsInformationProtectionNetworkLearningSummariesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionNetworkLearningSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsInformationProtectionNetworkLearningSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?WindowsInformationProtectionNetworkLear $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?WindowsInformationProtectionNetworkLear } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(WindowsInformationProtectionNetworkLear $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsMalwareInformation/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/WindowsMalwareInformation/Count/CountRequestBuilder.php index fd0fda83fa8..3ef44f896e1 100644 --- a/src/Generated/DeviceManagement/WindowsMalwareInformation/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsMalwareInformation/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/DeviceMalwareStates/Count/CountRequestBuilder.php b/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/DeviceMalwareStates/Count/CountRequestBuilder.php index ec7391b321d..a0ce94e9db1 100644 --- a/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/DeviceMalwareStates/Count/CountRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/DeviceMalwareStates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/DeviceMalwareStates/DeviceMalwareStatesRequestBuilder.php b/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/DeviceMalwareStates/DeviceMalwareStatesRequestBuilder.php index 94d6301843a..d9817aa6be5 100644 --- a/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/DeviceMalwareStates/DeviceMalwareStatesRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/DeviceMalwareStates/DeviceMalwareStatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\WindowsMalwareInformation\Item\DeviceMalwareStates\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\WindowsMalwareInformation\Item\DeviceMalwareStates\Item\MalwareStateForWindowsDeviceItemRequestBuilder; use Microsoft\Graph\Generated\Models\MalwareStateForWindowsDevice; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the malwareStateForWindowsDevice objects. * @param DeviceMalwareStatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-malwarestateforwindowsdevice-list?view=graph-rest-1.0 Find more info here */ public function get(?DeviceMalwareStatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MalwareStateForWindowsDeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MalwareStateForWindowsDeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new malwareStateForWindowsDevice object. * @param MalwareStateForWindowsDevice $body The request body * @param DeviceMalwareStatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-malwarestateforwindowsdevice-create?view=graph-rest-1.0 Find more info here */ public function post(MalwareStateForWindowsDevice $body, ?DeviceMalwareStatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MalwareStateForWindowsDevice::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MalwareStateForWindowsDevice::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DeviceMalwareStatesRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DeviceMalwareStatesRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MalwareStateForWindowsDevice $body, ?De $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/DeviceMalwareStates/Item/MalwareStateForWindowsDeviceItemRequestBuilder.php b/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/DeviceMalwareStates/Item/MalwareStateForWindowsDeviceItemRequestBuilder.php index a61ac82d0ad..f3a4a6f5780 100644 --- a/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/DeviceMalwareStates/Item/MalwareStateForWindowsDeviceItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/DeviceMalwareStates/Item/MalwareStateForWindowsDeviceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MalwareStateForWindowsDevice; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a malwareStateForWindowsDevice. * @param MalwareStateForWindowsDeviceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-malwarestateforwindowsdevice-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MalwareStateForWindowsDeviceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the malwareStateForWindowsDevice object. * @param MalwareStateForWindowsDeviceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-malwarestateforwindowsdevice-get?view=graph-rest-1.0 Find more info here */ public function get(?MalwareStateForWindowsDeviceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MalwareStateForWindowsDevice::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MalwareStateForWindowsDevice::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a malwareStateForWindowsDevice object. * @param MalwareStateForWindowsDevice $body The request body * @param MalwareStateForWindowsDeviceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-malwarestateforwindowsdevice-update?view=graph-rest-1.0 Find more info here */ public function patch(MalwareStateForWindowsDevice $body, ?MalwareStateForWindowsDeviceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MalwareStateForWindowsDevice::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MalwareStateForWindowsDevice::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MalwareStateForWindowsDeviceItemRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MalwareStateForWindowsDeviceItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MalwareStateForWindowsDeviceItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MalwareStateForWindowsDevice $body, ?M $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/WindowsMalwareInformationItemRequestBuilder.php b/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/WindowsMalwareInformationItemRequestBuilder.php index 60845cc1933..79a2dfa5fb5 100644 --- a/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/WindowsMalwareInformationItemRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsMalwareInformation/Item/WindowsMalwareInformationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\WindowsMalwareInformation\Item\DeviceMalwareStates\DeviceMalwareStatesRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsMalwareInformation; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a windowsMalwareInformation. * @param WindowsMalwareInformationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsmalwareinformation-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WindowsMalwareInformationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the windowsMalwareInformation object. * @param WindowsMalwareInformationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsmalwareinformation-get?view=graph-rest-1.0 Find more info here */ public function get(?WindowsMalwareInformationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsMalwareInformation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsMalwareInformation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a windowsMalwareInformation object. * @param WindowsMalwareInformation $body The request body * @param WindowsMalwareInformationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsmalwareinformation-update?view=graph-rest-1.0 Find more info here */ public function patch(WindowsMalwareInformation $body, ?WindowsMalwareInformationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsMalwareInformation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsMalwareInformation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?WindowsMalwareInformationItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?WindowsMalwareInformationItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?WindowsMalwareInformationItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(WindowsMalwareInformation $body, ?Wind $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DeviceManagement/WindowsMalwareInformation/WindowsMalwareInformationRequestBuilder.php b/src/Generated/DeviceManagement/WindowsMalwareInformation/WindowsMalwareInformationRequestBuilder.php index ff9657cbe1a..2b3bcd5ea70 100644 --- a/src/Generated/DeviceManagement/WindowsMalwareInformation/WindowsMalwareInformationRequestBuilder.php +++ b/src/Generated/DeviceManagement/WindowsMalwareInformation/WindowsMalwareInformationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DeviceManagement\WindowsMalwareInformation\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DeviceManagement\WindowsMalwareInformation\Item\WindowsMalwareInformationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the windowsMalwareInformation objects. * @param WindowsMalwareInformationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsmalwareinformation-list?view=graph-rest-1.0 Find more info here */ public function get(?WindowsMalwareInformationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsMalwareInformationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsMalwareInformationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new windowsMalwareInformation object. * @param WindowsMalwareInformation $body The request body * @param WindowsMalwareInformationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsmalwareinformation-create?view=graph-rest-1.0 Find more info here */ public function post(WindowsMalwareInformation $body, ?WindowsMalwareInformationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsMalwareInformation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsMalwareInformation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?WindowsMalwareInformationRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?WindowsMalwareInformationRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(WindowsMalwareInformation $body, ?Windo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Devices/Count/CountRequestBuilder.php b/src/Generated/Devices/Count/CountRequestBuilder.php index da83e89cf2d..0c758db5cdd 100644 --- a/src/Generated/Devices/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Delta/DeltaRequestBuilder.php b/src/Generated/Devices/Delta/DeltaRequestBuilder.php index d673b2e252b..0d4700bcec2 100644 --- a/src/Generated/Devices/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Devices/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/DevicesRequestBuilder.php b/src/Generated/Devices/DevicesRequestBuilder.php index 414e06da45d..65a55e82798 100644 --- a/src/Generated/Devices/DevicesRequestBuilder.php +++ b/src/Generated/Devices/DevicesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Devices\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Devices\GetAvailableExtensionProperties\GetAvailableExtensionPropertiesRequestBuilder; @@ -87,40 +86,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of device objects registered in the organization. This API is available in the following national cloud deployments. * @param DevicesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-list?view=graph-rest-1.0 Find more info here */ public function get(?DevicesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create and register a new device in the organization. This API is available in the following national cloud deployments. * @param Device $body The request body * @param DevicesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-post-devices?view=graph-rest-1.0 Find more info here */ public function post(Device $body, ?DevicesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,7 +126,6 @@ public function toGetRequestInformation(?DevicesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -141,6 +133,7 @@ public function toGetRequestInformation(?DevicesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -155,11 +148,11 @@ public function toPostRequestInformation(Device $body, ?DevicesRequestBuilderPos $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Devices/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/Devices/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index 65ae9b0a8e2..87e02428eac 100644 --- a/src/Generated/Devices/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/Devices/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Devices/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/Devices/GetByIds/GetByIdsRequestBuilder.php index 0822ebc959d..5380f59bcdd 100644 --- a/src/Generated/Devices/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/Devices/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Devices/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/Devices/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index 28b121a8220..1e7296acc59 100644 --- a/src/Generated/Devices/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/Devices/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Devices/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/Devices/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index 69c82f16e06..aa7ace8605e 100644 --- a/src/Generated/Devices/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/Devices/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Devices/Item/DeviceItemRequestBuilder.php b/src/Generated/Devices/Item/DeviceItemRequestBuilder.php index d725c5a9c75..4bdeed41750 100644 --- a/src/Generated/Devices/Item/DeviceItemRequestBuilder.php +++ b/src/Generated/Devices/Item/DeviceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\CheckMemberGroups\CheckMemberGroupsRequestBuilder; use Microsoft\Graph\Generated\Devices\Item\CheckMemberObjects\CheckMemberObjectsRequestBuilder; use Microsoft\Graph\Generated\Devices\Item\Extensions\ExtensionsRequestBuilder; @@ -114,59 +113,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a registered device. This API is available in the following national cloud deployments. * @param DeviceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DeviceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a device object. This API is available in the following national cloud deployments. * @param DeviceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a registered device. Only certain properties of a device can be updated through approved Mobile Device Managment (MDM) apps. This API is available in the following national cloud deployments. * @param Device $body The request body * @param DeviceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-update?view=graph-rest-1.0 Find more info here */ public function patch(Device $body, ?DeviceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -183,6 +173,7 @@ public function toDeleteRequestInformation(?DeviceItemRequestBuilderDeleteReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -196,7 +187,6 @@ public function toGetRequestInformation(?DeviceItemRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -204,6 +194,7 @@ public function toGetRequestInformation(?DeviceItemRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -218,11 +209,11 @@ public function toPatchRequestInformation(Device $body, ?DeviceItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Devices/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/Extensions/Count/CountRequestBuilder.php index 57f48156d32..1c85348479e 100644 --- a/src/Generated/Devices/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Devices/Item/Extensions/ExtensionsRequestBuilder.php index 47ca8c4f8f9..af7d8f2da59 100644 --- a/src/Generated/Devices/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Devices/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Devices\Item\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of open extensions defined for the device. Read-only. Nullable. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for devices * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Devices/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Devices/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 09b46b03766..2a5308d7ffe 100644 --- a/src/Generated/Devices/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Devices/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for devices * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of open extensions defined for the device. Read-only. Nullable. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in devices * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Devices/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/Devices/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index 89f728c01cb..958b0d1df13 100644 --- a/src/Generated/Devices/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/Devices/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Devices/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/Devices/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index 2d1b23677d9..d9b0c04739f 100644 --- a/src/Generated/Devices/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/Devices/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Devices/Item/MemberOf/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/MemberOf/Count/CountRequestBuilder.php index 93c13e9d46d..509e0a9b2d7 100644 --- a/src/Generated/Devices/Item/MemberOf/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/MemberOf/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php index b1f85bb1856..b09e9d7816e 100644 --- a/src/Generated/Devices/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Devices/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index b731ecae506..f52cf867cfe 100644 --- a/src/Generated/Devices/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Devices/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\MemberOf\GraphAdministrativeUnit\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\AdministrativeUnitCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.administrativeUnit in the microsoft.graph.directoryObject collection * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php index 1aba62e0937..bece6a9d1e7 100644 --- a/src/Generated/Devices/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Devices/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php index 64ef8aad2bb..5c00119489e 100644 --- a/src/Generated/Devices/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Devices/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\MemberOf\GraphGroup\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Devices/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php index fb9fdc1dcd2..fc07729e847 100644 --- a/src/Generated/Devices/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Devices/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\MemberOf\Item\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; use Microsoft\Graph\Generated\Devices\Item\MemberOf\Item\GraphGroup\GraphGroupRequestBuilder; use Microsoft\Graph\Generated\Models\DirectoryObject; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Groups and administrative units that this device is a member of. Read-only. Nullable. Supports $expand. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Devices/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index e1fe76c1393..a21b453a4eb 100644 --- a/src/Generated/Devices/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Devices/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnit; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.administrativeUnit * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Devices/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php index 6bf703977f8..b5a41d99fa3 100644 --- a/src/Generated/Devices/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Devices/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/MemberOf/MemberOfRequestBuilder.php b/src/Generated/Devices/Item/MemberOf/MemberOfRequestBuilder.php index b34e07f9a03..ef141db3554 100644 --- a/src/Generated/Devices/Item/MemberOf/MemberOfRequestBuilder.php +++ b/src/Generated/Devices/Item/MemberOf/MemberOfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\MemberOf\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Devices\Item\MemberOf\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; use Microsoft\Graph\Generated\Devices\Item\MemberOf\GraphGroup\GraphGroupRequestBuilder; @@ -70,20 +69,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Groups and administrative units that this device is a member of. Read-only. Nullable. Supports $expand. * @param MemberOfRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-list-memberof?view=graph-rest-1.0 Find more info here */ public function get(?MemberOfRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -96,7 +92,6 @@ public function toGetRequestInformation(?MemberOfRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -104,6 +99,7 @@ public function toGetRequestInformation(?MemberOfRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/Count/CountRequestBuilder.php index eeea4ef592e..8adfc822752 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/GraphAppRoleAssignment/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/GraphAppRoleAssignment/Count/CountRequestBuilder.php index 504afcfae23..610520b9b44 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/GraphAppRoleAssignment/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/GraphAppRoleAssignment/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index 29737a01c46..ffcd3705d87 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\RegisteredOwners\GraphAppRoleAssignment\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\AppRoleAssignmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.appRoleAssignment in the microsoft.graph.directoryObject collection * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/GraphEndpoint/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/GraphEndpoint/Count/CountRequestBuilder.php index 1b17747ba1f..22fea307a88 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/GraphEndpoint/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/GraphEndpoint/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/GraphEndpoint/GraphEndpointRequestBuilder.php index b61a54e78f1..44aa8596560 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\RegisteredOwners\GraphEndpoint\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\EndpointCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.endpoint in the microsoft.graph.directoryObject collection * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/GraphServicePrincipal/Count/CountRequestBuilder.php index 812b9b6e5b8..8c6569741b9 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 207f0eaa355..29007d3576b 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\RegisteredOwners\GraphServicePrincipal\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/GraphUser/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/GraphUser/Count/CountRequestBuilder.php index 3665f334445..8d789327871 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/GraphUser/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/GraphUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/GraphUser/GraphUserRequestBuilder.php index 301f9c4dc46..28799703213 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\RegisteredOwners\GraphUser\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.user in the microsoft.graph.directoryObject collection * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index 5208a834a8c..c7524dc5115 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.appRoleAssignment * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/Item/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/Item/GraphEndpoint/GraphEndpointRequestBuilder.php index 1b8e85bf9aa..b99a7b2e1c4 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/Item/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/Item/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Endpoint; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.endpoint * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index c21d895061b..32342bb0231 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/Item/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/Item/GraphUser/GraphUserRequestBuilder.php index a633de299ae..3856624f126 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/Item/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/Item/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.user * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/Item/Ref/RefRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/Item/Ref/RefRequestBuilder.php index d5c28498b7a..65dfa8ed7cf 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a user as a registered owner of the device. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-delete-registeredowners?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/Ref/RefRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/Ref/RefRequestBuilder.php index f8c2f1c96e2..29754d40142 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/Ref/RefRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The user that cloud joined the device or registered their personal device. The registered owner is set at the time of registration. Read-only. Nullable. Supports $expand. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-list-registeredowners?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a user as a registered owner of the device. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-post-registeredowners?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredOwners/RegisteredOwnersRequestBuilder.php b/src/Generated/Devices/Item/RegisteredOwners/RegisteredOwnersRequestBuilder.php index aee5fc532ad..d9227e3296c 100644 --- a/src/Generated/Devices/Item/RegisteredOwners/RegisteredOwnersRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredOwners/RegisteredOwnersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\RegisteredOwners\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Devices\Item\RegisteredOwners\GraphAppRoleAssignment\GraphAppRoleAssignmentRequestBuilder; use Microsoft\Graph\Generated\Devices\Item\RegisteredOwners\GraphEndpoint\GraphEndpointRequestBuilder; @@ -94,20 +93,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The user that cloud joined the device or registered their personal device. The registered owner is set at the time of registration. Read-only. Nullable. Supports $expand. * @param RegisteredOwnersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-list-registeredowners?view=graph-rest-1.0 Find more info here */ public function get(?RegisteredOwnersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -120,7 +116,6 @@ public function toGetRequestInformation(?RegisteredOwnersRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -128,6 +123,7 @@ public function toGetRequestInformation(?RegisteredOwnersRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/Count/CountRequestBuilder.php index adb1da3a8ae..084b0d7b425 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/GraphAppRoleAssignment/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/GraphAppRoleAssignment/Count/CountRequestBuilder.php index c2f0c58aaa9..d7f1ffcbf63 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/GraphAppRoleAssignment/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/GraphAppRoleAssignment/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index ddb48a4ee23..40cd557f3c1 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\RegisteredUsers\GraphAppRoleAssignment\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\AppRoleAssignmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.appRoleAssignment in the microsoft.graph.directoryObject collection * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/GraphEndpoint/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/GraphEndpoint/Count/CountRequestBuilder.php index 76e4f8f8399..dfd7425d30d 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/GraphEndpoint/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/GraphEndpoint/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/GraphEndpoint/GraphEndpointRequestBuilder.php index 501111e71bc..50552a605c0 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\RegisteredUsers\GraphEndpoint\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\EndpointCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.endpoint in the microsoft.graph.directoryObject collection * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/GraphServicePrincipal/Count/CountRequestBuilder.php index 2009a29d170..ca03ccef52e 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index a052b5700fa..e87ba65319c 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\RegisteredUsers\GraphServicePrincipal\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/GraphUser/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/GraphUser/Count/CountRequestBuilder.php index 782b304de3d..885268f88ff 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/GraphUser/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/GraphUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/GraphUser/GraphUserRequestBuilder.php index a511f1f422c..5fa1a7df5ef 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\RegisteredUsers\GraphUser\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.user in the microsoft.graph.directoryObject collection * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index ae85d01dc28..f6e4b36b6c8 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.appRoleAssignment * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/Item/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/Item/GraphEndpoint/GraphEndpointRequestBuilder.php index 1f4a0940b4b..ee9e9603445 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/Item/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/Item/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Endpoint; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.endpoint * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index e4269e185ed..629b84e409b 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/Item/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/Item/GraphUser/GraphUserRequestBuilder.php index 03946c606cb..ec2b9f97cbe 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/Item/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/Item/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.user * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/Item/Ref/RefRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/Item/Ref/RefRequestBuilder.php index 48be6a3a11e..49613f2dfdf 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a user as a registered user of the device. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-delete-registeredusers?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/Ref/RefRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/Ref/RefRequestBuilder.php index bccff8c795e..12bbb97e336 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/Ref/RefRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of registered users of the device. For cloud joined devices and registered personal devices, registered users are set to the same value as registered owners at the time of registration. Read-only. Nullable. Supports $expand. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-list-registeredusers?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a registered user for the device. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-post-registeredusers?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Devices/Item/RegisteredUsers/RegisteredUsersRequestBuilder.php b/src/Generated/Devices/Item/RegisteredUsers/RegisteredUsersRequestBuilder.php index 35ad3107c43..979fa48b1d9 100644 --- a/src/Generated/Devices/Item/RegisteredUsers/RegisteredUsersRequestBuilder.php +++ b/src/Generated/Devices/Item/RegisteredUsers/RegisteredUsersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\RegisteredUsers\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Devices\Item\RegisteredUsers\GraphAppRoleAssignment\GraphAppRoleAssignmentRequestBuilder; use Microsoft\Graph\Generated\Devices\Item\RegisteredUsers\GraphEndpoint\GraphEndpointRequestBuilder; @@ -94,20 +93,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of registered users of the device. For cloud joined devices and registered personal devices, registered users are set to the same value as registered owners at the time of registration. Read-only. Nullable. Supports $expand. * @param RegisteredUsersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-list-registeredusers?view=graph-rest-1.0 Find more info here */ public function get(?RegisteredUsersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -120,7 +116,6 @@ public function toGetRequestInformation(?RegisteredUsersRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -128,6 +123,7 @@ public function toGetRequestInformation(?RegisteredUsersRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/Restore/RestoreRequestBuilder.php b/src/Generated/Devices/Item/Restore/RestoreRequestBuilder.php index 8b910e4cf33..8aca41b35df 100644 --- a/src/Generated/Devices/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/Devices/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/TransitiveMemberOf/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/TransitiveMemberOf/Count/CountRequestBuilder.php index d18b1ff9290..5a769bf5acc 100644 --- a/src/Generated/Devices/Item/TransitiveMemberOf/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/TransitiveMemberOf/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php index 85e1a814564..78a2236e5a2 100644 --- a/src/Generated/Devices/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Devices/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index 41f3e388217..0c43fdf5eaf 100644 --- a/src/Generated/Devices/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Devices/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\TransitiveMemberOf\GraphAdministrativeUnit\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\AdministrativeUnitCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.administrativeUnit in the microsoft.graph.directoryObject collection * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Devices/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php index 5b1496dddc5..014f9e15a07 100644 --- a/src/Generated/Devices/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Devices/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Devices/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php index ceafd9c7325..62f6abd1d4f 100644 --- a/src/Generated/Devices/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Devices/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\TransitiveMemberOf\GraphGroup\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Devices/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php index c53d7da0796..d8b364b0fa8 100644 --- a/src/Generated/Devices/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Devices/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\TransitiveMemberOf\Item\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; use Microsoft\Graph\Generated\Devices\Item\TransitiveMemberOf\Item\GraphGroup\GraphGroupRequestBuilder; use Microsoft\Graph\Generated\Models\DirectoryObject; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Groups and administrative units that the device is a member of. This operation is transitive. Supports $expand. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Devices/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index 2447e8faf8d..9c9ecc08b13 100644 --- a/src/Generated/Devices/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Devices/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnit; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.administrativeUnit * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Devices/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php index 89fc3b4d4de..dd49a5f17c3 100644 --- a/src/Generated/Devices/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Devices/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php b/src/Generated/Devices/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php index b548e0cd297..6069796b51a 100644 --- a/src/Generated/Devices/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php +++ b/src/Generated/Devices/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Devices\Item\TransitiveMemberOf\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Devices\Item\TransitiveMemberOf\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; use Microsoft\Graph\Generated\Devices\Item\TransitiveMemberOf\GraphGroup\GraphGroupRequestBuilder; @@ -70,20 +69,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Groups and administrative units that the device is a member of. This operation is transitive. Supports $expand. * @param TransitiveMemberOfRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-list-transitivememberof?view=graph-rest-1.0 Find more info here */ public function get(?TransitiveMemberOfRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -96,7 +92,6 @@ public function toGetRequestInformation(?TransitiveMemberOfRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -104,6 +99,7 @@ public function toGetRequestInformation(?TransitiveMemberOfRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Devices/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/Devices/ValidateProperties/ValidatePropertiesRequestBuilder.php index cc8dfdb680d..2470bcb9b24 100644 --- a/src/Generated/Devices/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/Devices/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DevicesWithDeviceId/DevicesWithDeviceIdRequestBuilder.php b/src/Generated/DevicesWithDeviceId/DevicesWithDeviceIdRequestBuilder.php index 01c60a5bbc1..d8def5439fa 100644 --- a/src/Generated/DevicesWithDeviceId/DevicesWithDeviceIdRequestBuilder.php +++ b/src/Generated/DevicesWithDeviceId/DevicesWithDeviceIdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Device; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,59 +36,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a registered device. This API is available in the following national cloud deployments. * @param DevicesWithDeviceIdRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DevicesWithDeviceIdRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a device object. This API is available in the following national cloud deployments. * @param DevicesWithDeviceIdRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-get?view=graph-rest-1.0 Find more info here */ public function get(?DevicesWithDeviceIdRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a registered device. Only certain properties of a device can be updated through approved Mobile Device Managment (MDM) apps. This API is available in the following national cloud deployments. * @param Device $body The request body * @param DevicesWithDeviceIdRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/device-update?view=graph-rest-1.0 Find more info here */ public function patch(Device $body, ?DevicesWithDeviceIdRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -106,6 +96,7 @@ public function toDeleteRequestInformation(?DevicesWithDeviceIdRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -119,7 +110,6 @@ public function toGetRequestInformation(?DevicesWithDeviceIdRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -127,6 +117,7 @@ public function toGetRequestInformation(?DevicesWithDeviceIdRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -141,11 +132,11 @@ public function toPatchRequestInformation(Device $body, ?DevicesWithDeviceIdRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/AdministrativeUnitsRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/AdministrativeUnitsRequestBuilder.php index 6fac29cdd37..8eea22224cf 100644 --- a/src/Generated/Directory/AdministrativeUnits/AdministrativeUnitsRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/AdministrativeUnitsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\AdministrativeUnitItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of administrativeUnit objects. This API is available in the following national cloud deployments. * @param AdministrativeUnitsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-list-administrativeunits?view=graph-rest-1.0 Find more info here */ public function get(?AdministrativeUnitsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new administrativeUnit. This API is available in the following national cloud deployments. * @param AdministrativeUnit $body The request body * @param AdministrativeUnitsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-post-administrativeunits?view=graph-rest-1.0 Find more info here */ public function post(AdministrativeUnit $body, ?AdministrativeUnitsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AdministrativeUnitsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AdministrativeUnitsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(AdministrativeUnit $body, ?Administrati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Count/CountRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Count/CountRequestBuilder.php index d656853a5a2..2a64aa4b2e6 100644 --- a/src/Generated/Directory/AdministrativeUnits/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Delta/DeltaRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Delta/DeltaRequestBuilder.php index f9b217316e3..fe22e7fe43e 100644 --- a/src/Generated/Directory/AdministrativeUnits/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/AdministrativeUnitItemRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/AdministrativeUnitItemRequestBuilder.php index 7d323deeba9..93265830e4f 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/AdministrativeUnitItemRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/AdministrativeUnitItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\Extensions\ExtensionsRequestBuilder; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\Members\MembersRequestBuilder; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\ScopedRoleMembers\ScopedRoleMembersRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an administrativeUnit. This API is available in the following national cloud deployments. * @param AdministrativeUnitItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/administrativeunit-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AdministrativeUnitItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an administrativeUnit object. This API is available in the following national cloud deployments. * @param AdministrativeUnitItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/administrativeunit-get?view=graph-rest-1.0 Find more info here */ public function get(?AdministrativeUnitItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an administrativeUnit object. This API is available in the following national cloud deployments. * @param AdministrativeUnit $body The request body * @param AdministrativeUnitItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/administrativeunit-update?view=graph-rest-1.0 Find more info here */ public function patch(AdministrativeUnit $body, ?AdministrativeUnitItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?AdministrativeUnitItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?AdministrativeUnitItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?AdministrativeUnitItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(AdministrativeUnit $body, ?Administrat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Extensions/Count/CountRequestBuilder.php index b3bb8aadf4f..50e2b562045 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Extensions/ExtensionsRequestBuilder.php index 8a4d2bb49cd..e8334e505a2 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of open extensions defined for this administrative unit. Nullable. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for directory * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Extensions/Item/ExtensionItemRequestBuilder.php index ddefc81b2ce..8b983f968aa 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for directory * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of open extensions defined for this administrative unit. Nullable. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in directory * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/Count/CountRequestBuilder.php index f0aacc03065..dfbfe46392e 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphApplication/Count/CountRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphApplication/Count/CountRequestBuilder.php index e66b386df9c..1e6e730db0b 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphApplication/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphApplication/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphApplication/GraphApplicationRequestBuilder.php index 6ddafac00bd..8073712508f 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\Members\GraphApplication\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ApplicationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.application in the microsoft.graph.directoryObject collection * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphDevice/Count/CountRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphDevice/Count/CountRequestBuilder.php index 798a3b7993d..af156fc4237 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphDevice/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphDevice/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphDevice/GraphDeviceRequestBuilder.php index 167c1df59c1..d7e0f0ebb26 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\Members\GraphDevice\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.device in the microsoft.graph.directoryObject collection * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphGroup/Count/CountRequestBuilder.php index 918b78f2319..26a16501c1d 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphGroup/GraphGroupRequestBuilder.php index ba958fb0091..8cdec1f485d 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\Members\GraphGroup\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphOrgContact/Count/CountRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphOrgContact/Count/CountRequestBuilder.php index e61ee9aa49c..c8222c8b759 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphOrgContact/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphOrgContact/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphOrgContact/GraphOrgContactRequestBuilder.php index 2da2f0daff7..7579851d666 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\Members\GraphOrgContact\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContactCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.orgContact in the microsoft.graph.directoryObject collection * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphServicePrincipal/Count/CountRequestBuilder.php index f38967a5db7..f8badb344b3 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 5c48726ae2b..3d3614fc2c8 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\Members\GraphServicePrincipal\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphUser/Count/CountRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphUser/Count/CountRequestBuilder.php index f893687a50a..c29290741f5 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphUser/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphUser/GraphUserRequestBuilder.php index 3a01894b6fb..eb63721e461 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\Members\GraphUser\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.user in the microsoft.graph.directoryObject collection * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphApplication/GraphApplicationRequestBuilder.php index dea148081e9..8d5adbf2c6b 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Application; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.application * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphDevice/GraphDeviceRequestBuilder.php index 06ee6c5d93f..645d5c283f9 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Device; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.device * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphGroup/GraphGroupRequestBuilder.php index b44a154c00c..d4e4e2e2b2f 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php index 3e6ccb262f9..798dd7727b6 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContact; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.orgContact * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 481f3649cbe..12a7f0cfd0b 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphUser/GraphUserRequestBuilder.php index e4bb8a5e8b5..f6b7b9ddd06 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.user * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/Ref/RefRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/Ref/RefRequestBuilder.php index 1525be34a53..0f1b2f2f75f 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Use this API to remove a member (user, group, or device) from an administrative unit. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/administrativeunit-delete-members?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/MembersRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/MembersRequestBuilder.php index ccd8157cb1a..1a9721ee071 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\Members\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\Members\GraphApplication\GraphApplicationRequestBuilder; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\Members\GraphDevice\GraphDeviceRequestBuilder; @@ -111,40 +110,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Users and groups that are members of this administrative unit. Supports $expand. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/administrativeunit-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to members for directory * @param DirectoryObject $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/administrativeunit-post-members?view=graph-rest-1.0 Find more info here */ public function post(DirectoryObject $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -157,7 +150,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -165,6 +157,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -179,11 +172,11 @@ public function toPostRequestInformation(DirectoryObject $body, ?MembersRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/Members/Ref/RefRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/Members/Ref/RefRequestBuilder.php index 32f89a1e231..1415f199b46 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/Members/Ref/RefRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/Members/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Users and groups that are members of this administrative unit. Supports $expand. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/administrativeunit-list-members?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property ref to members for directory * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/administrativeunit-post-members?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/Count/CountRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/Count/CountRequestBuilder.php index a9337072b9d..ea525ee4b96 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/Item/ScopedRoleMembershipItemRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/Item/ScopedRoleMembershipItemRequestBuilder.php index d7c4ea833e9..5fac38e0f9d 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/Item/ScopedRoleMembershipItemRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/Item/ScopedRoleMembershipItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ScopedRoleMembership; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,64 +31,55 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Remove an Azure Active Directory (Azure AD) role assignment with administrative unit scope. This API is available in the following national cloud deployments. + * Remove a Microsoft Entra role assignment with administrative unit scope. This API is available in the following national cloud deployments. * @param ScopedRoleMembershipItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/administrativeunit-delete-scopedrolemembers?view=graph-rest-1.0 Find more info here */ public function delete(?ScopedRoleMembershipItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Get an Azure Active Directory (Azure AD) role assignment with administrative unit scope. This API is available in the following national cloud deployments. + * Get a Microsoft Entra role assignment with administrative unit scope. This API is available in the following national cloud deployments. * @param ScopedRoleMembershipItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/administrativeunit-get-scopedrolemembers?view=graph-rest-1.0 Find more info here */ public function get(?ScopedRoleMembershipItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopedRoleMembers in directory * @param ScopedRoleMembership $body The request body * @param ScopedRoleMembershipItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ScopedRoleMembership $body, ?ScopedRoleMembershipItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Remove an Azure Active Directory (Azure AD) role assignment with administrative unit scope. This API is available in the following national cloud deployments. + * Remove a Microsoft Entra role assignment with administrative unit scope. This API is available in the following national cloud deployments. * @param ScopedRoleMembershipItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -102,11 +92,12 @@ public function toDeleteRequestInformation(?ScopedRoleMembershipItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Get an Azure Active Directory (Azure AD) role assignment with administrative unit scope. This API is available in the following national cloud deployments. + * Get a Microsoft Entra role assignment with administrative unit scope. This API is available in the following national cloud deployments. * @param ScopedRoleMembershipItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ScopedRoleMembershipItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ScopedRoleMembershipItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(ScopedRoleMembership $body, ?ScopedRol $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/Item/ScopedRoleMembershipItemRequestBuilderGetQueryParameters.php b/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/Item/ScopedRoleMembershipItemRequestBuilderGetQueryParameters.php index 3f914e18d93..bc75e6f7d4e 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/Item/ScopedRoleMembershipItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/Item/ScopedRoleMembershipItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get an Azure Active Directory (Azure AD) role assignment with administrative unit scope. This API is available in the following national cloud deployments. + * Get a Microsoft Entra role assignment with administrative unit scope. This API is available in the following national cloud deployments. */ class ScopedRoleMembershipItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/ScopedRoleMembersRequestBuilder.php b/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/ScopedRoleMembersRequestBuilder.php index f59636678d9..2eaed64b667 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/ScopedRoleMembersRequestBuilder.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/ScopedRoleMembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\ScopedRoleMembers\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\Item\ScopedRoleMembers\Item\ScopedRoleMembershipItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,46 +52,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List Azure Active Directory (Azure AD) role assignments with administrative unit scope. This API is available in the following national cloud deployments. + * List Microsoft Entra role assignments with administrative unit scope. This API is available in the following national cloud deployments. * @param ScopedRoleMembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/administrativeunit-list-scopedrolemembers?view=graph-rest-1.0 Find more info here */ public function get(?ScopedRoleMembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembershipCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembershipCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Assign an Azure Active Directory (Azure AD) role with administrative unit scope. For a list of roles that can be assigned with administrative unit scope, see Assign Azure AD roles with administrative unit scope. This API is available in the following national cloud deployments. + * Assign a Microsoft Entra role with administrative unit scope. For a list of roles that can be assigned with administrative unit scope, see Assign Microsoft Entra roles with administrative unit scope. This API is available in the following national cloud deployments. * @param ScopedRoleMembership $body The request body * @param ScopedRoleMembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/administrativeunit-post-scopedrolemembers?view=graph-rest-1.0 Find more info here */ public function post(ScopedRoleMembership $body, ?ScopedRoleMembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List Azure Active Directory (Azure AD) role assignments with administrative unit scope. This API is available in the following national cloud deployments. + * List Microsoft Entra role assignments with administrative unit scope. This API is available in the following national cloud deployments. * @param ScopedRoleMembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ScopedRoleMembersRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,11 +101,12 @@ public function toGetRequestInformation(?ScopedRoleMembersRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Assign an Azure Active Directory (Azure AD) role with administrative unit scope. For a list of roles that can be assigned with administrative unit scope, see Assign Azure AD roles with administrative unit scope. This API is available in the following national cloud deployments. + * Assign a Microsoft Entra role with administrative unit scope. For a list of roles that can be assigned with administrative unit scope, see Assign Microsoft Entra roles with administrative unit scope. This API is available in the following national cloud deployments. * @param ScopedRoleMembership $body The request body * @param ScopedRoleMembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -123,11 +116,11 @@ public function toPostRequestInformation(ScopedRoleMembership $body, ?ScopedRole $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/ScopedRoleMembersRequestBuilderGetQueryParameters.php b/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/ScopedRoleMembersRequestBuilderGetQueryParameters.php index 925fcbcf9b1..4f6561d7ab2 100644 --- a/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/ScopedRoleMembersRequestBuilderGetQueryParameters.php +++ b/src/Generated/Directory/AdministrativeUnits/Item/ScopedRoleMembers/ScopedRoleMembersRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List Azure Active Directory (Azure AD) role assignments with administrative unit scope. This API is available in the following national cloud deployments. + * List Microsoft Entra role assignments with administrative unit scope. This API is available in the following national cloud deployments. */ class ScopedRoleMembersRequestBuilderGetQueryParameters { diff --git a/src/Generated/Directory/AttributeSets/AttributeSetsRequestBuilder.php b/src/Generated/Directory/AttributeSets/AttributeSetsRequestBuilder.php index 865b6974b0c..07420db30cd 100644 --- a/src/Generated/Directory/AttributeSets/AttributeSetsRequestBuilder.php +++ b/src/Generated/Directory/AttributeSets/AttributeSetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\AttributeSets\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Directory\AttributeSets\Item\AttributeSetItemRequestBuilder; use Microsoft\Graph\Generated\Models\AttributeSet; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the attributeSet objects and their properties. This API is available in the following national cloud deployments. * @param AttributeSetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-list-attributesets?view=graph-rest-1.0 Find more info here */ public function get(?AttributeSetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttributeSetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttributeSetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new attributeSet object. This API is available in the following national cloud deployments. * @param AttributeSet $body The request body * @param AttributeSetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-post-attributesets?view=graph-rest-1.0 Find more info here */ public function post(AttributeSet $body, ?AttributeSetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttributeSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttributeSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AttributeSetsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AttributeSetsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AttributeSet $body, ?AttributeSetsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/AttributeSets/Count/CountRequestBuilder.php b/src/Generated/Directory/AttributeSets/Count/CountRequestBuilder.php index 5aba291dfdf..74508b225c4 100644 --- a/src/Generated/Directory/AttributeSets/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/AttributeSets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/AttributeSets/Item/AttributeSetItemRequestBuilder.php b/src/Generated/Directory/AttributeSets/Item/AttributeSetItemRequestBuilder.php index e91a3626587..58feaf024e0 100644 --- a/src/Generated/Directory/AttributeSets/Item/AttributeSetItemRequestBuilder.php +++ b/src/Generated/Directory/AttributeSets/Item/AttributeSetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AttributeSet; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attributeSets for directory * @param AttributeSetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttributeSetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an attributeSet object. This API is available in the following national cloud deployments. * @param AttributeSetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attributeset-get?view=graph-rest-1.0 Find more info here */ public function get(?AttributeSetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttributeSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttributeSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an attributeSet object. This API is available in the following national cloud deployments. * @param AttributeSet $body The request body * @param AttributeSetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attributeset-update?view=graph-rest-1.0 Find more info here */ public function patch(AttributeSet $body, ?AttributeSetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttributeSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttributeSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AttributeSetItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AttributeSetItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AttributeSetItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(AttributeSet $body, ?AttributeSetItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/CustomSecurityAttributeDefinitions/Count/CountRequestBuilder.php b/src/Generated/Directory/CustomSecurityAttributeDefinitions/Count/CountRequestBuilder.php index 058bd6da0dc..4ec4675804f 100644 --- a/src/Generated/Directory/CustomSecurityAttributeDefinitions/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/CustomSecurityAttributeDefinitions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/CustomSecurityAttributeDefinitions/CustomSecurityAttributeDefinitionsRequestBuilder.php b/src/Generated/Directory/CustomSecurityAttributeDefinitions/CustomSecurityAttributeDefinitionsRequestBuilder.php index 26fae8d0f4c..d0fb35fe7be 100644 --- a/src/Generated/Directory/CustomSecurityAttributeDefinitions/CustomSecurityAttributeDefinitionsRequestBuilder.php +++ b/src/Generated/Directory/CustomSecurityAttributeDefinitions/CustomSecurityAttributeDefinitionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\CustomSecurityAttributeDefinitions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Directory\CustomSecurityAttributeDefinitions\Item\CustomSecurityAttributeDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\CustomSecurityAttributeDefinition; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the customSecurityAttributeDefinition objects and their properties. This API is available in the following national cloud deployments. * @param CustomSecurityAttributeDefinitionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-list-customsecurityattributedefinitions?view=graph-rest-1.0 Find more info here */ public function get(?CustomSecurityAttributeDefinitionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomSecurityAttributeDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomSecurityAttributeDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new customSecurityAttributeDefinition object. This API is available in the following national cloud deployments. * @param CustomSecurityAttributeDefinition $body The request body * @param CustomSecurityAttributeDefinitionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-post-customsecurityattributedefinitions?view=graph-rest-1.0 Find more info here */ public function post(CustomSecurityAttributeDefinition $body, ?CustomSecurityAttributeDefinitionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomSecurityAttributeDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomSecurityAttributeDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CustomSecurityAttributeDefinitionsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CustomSecurityAttributeDefinitionsReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(CustomSecurityAttributeDefinition $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/AllowedValues/AllowedValuesRequestBuilder.php b/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/AllowedValues/AllowedValuesRequestBuilder.php index 5b08072a3e7..d64d451ba64 100644 --- a/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/AllowedValues/AllowedValuesRequestBuilder.php +++ b/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/AllowedValues/AllowedValuesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\CustomSecurityAttributeDefinitions\Item\AllowedValues\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Directory\CustomSecurityAttributeDefinitions\Item\AllowedValues\Item\AllowedValueItemRequestBuilder; use Microsoft\Graph\Generated\Models\AllowedValue; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the allowedValue objects and their properties. This API is available in the following national cloud deployments. * @param AllowedValuesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/customsecurityattributedefinition-list-allowedvalues?view=graph-rest-1.0 Find more info here */ public function get(?AllowedValuesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AllowedValueCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AllowedValueCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new allowedValue object. This API is available in the following national cloud deployments. * @param AllowedValue $body The request body * @param AllowedValuesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/customsecurityattributedefinition-post-allowedvalues?view=graph-rest-1.0 Find more info here */ public function post(AllowedValue $body, ?AllowedValuesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AllowedValue::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AllowedValue::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AllowedValuesRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AllowedValuesRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AllowedValue $body, ?AllowedValuesReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/AllowedValues/Count/CountRequestBuilder.php b/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/AllowedValues/Count/CountRequestBuilder.php index 2c39bdaa204..256a583a413 100644 --- a/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/AllowedValues/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/AllowedValues/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/AllowedValues/Item/AllowedValueItemRequestBuilder.php b/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/AllowedValues/Item/AllowedValueItemRequestBuilder.php index 7a64e366e26..fe91bf1fab6 100644 --- a/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/AllowedValues/Item/AllowedValueItemRequestBuilder.php +++ b/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/AllowedValues/Item/AllowedValueItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AllowedValue; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property allowedValues for directory * @param AllowedValueItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AllowedValueItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an allowedValue object. This API is available in the following national cloud deployments. * @param AllowedValueItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/allowedvalue-get?view=graph-rest-1.0 Find more info here */ public function get(?AllowedValueItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AllowedValue::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AllowedValue::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an allowedValue object. This API is available in the following national cloud deployments. * @param AllowedValue $body The request body * @param AllowedValueItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/allowedvalue-update?view=graph-rest-1.0 Find more info here */ public function patch(AllowedValue $body, ?AllowedValueItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AllowedValue::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AllowedValue::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AllowedValueItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AllowedValueItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AllowedValueItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(AllowedValue $body, ?AllowedValueItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/CustomSecurityAttributeDefinitionItemRequestBuilder.php b/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/CustomSecurityAttributeDefinitionItemRequestBuilder.php index 5bd16adf468..11957466b06 100644 --- a/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/CustomSecurityAttributeDefinitionItemRequestBuilder.php +++ b/src/Generated/Directory/CustomSecurityAttributeDefinitions/Item/CustomSecurityAttributeDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\CustomSecurityAttributeDefinitions\Item\AllowedValues\AllowedValuesRequestBuilder; use Microsoft\Graph\Generated\Models\CustomSecurityAttributeDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property customSecurityAttributeDefinitions for directory * @param CustomSecurityAttributeDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CustomSecurityAttributeDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a customSecurityAttributeDefinition object. This API is available in the following national cloud deployments. * @param CustomSecurityAttributeDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/customsecurityattributedefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?CustomSecurityAttributeDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomSecurityAttributeDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomSecurityAttributeDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a customSecurityAttributeDefinition object. This API is available in the following national cloud deployments. * @param CustomSecurityAttributeDefinition $body The request body * @param CustomSecurityAttributeDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/customsecurityattributedefinition-update?view=graph-rest-1.0 Find more info here */ public function patch(CustomSecurityAttributeDefinition $body, ?CustomSecurityAttributeDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomSecurityAttributeDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomSecurityAttributeDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?CustomSecurityAttributeDefinitionIte $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?CustomSecurityAttributeDefinitionItemRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?CustomSecurityAttributeDefinitionItemRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(CustomSecurityAttributeDefinition $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/Count/CountRequestBuilder.php b/src/Generated/Directory/DeletedItems/Count/CountRequestBuilder.php index a9e90fee86c..4235e9681f7 100644 --- a/src/Generated/Directory/DeletedItems/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/DeletedItemsRequestBuilder.php b/src/Generated/Directory/DeletedItems/DeletedItemsRequestBuilder.php index b509f8e9213..97e545197be 100644 --- a/src/Generated/Directory/DeletedItems/DeletedItemsRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/DeletedItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\DeletedItems\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Directory\DeletedItems\GetAvailableExtensionProperties\GetAvailableExtensionPropertiesRequestBuilder; use Microsoft\Graph\Generated\Directory\DeletedItems\GetByIds\GetByIdsRequestBuilder; @@ -126,19 +125,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties of a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. This API is available in the following national cloud deployments. * @param DeletedItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeletedItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -151,7 +147,6 @@ public function toGetRequestInformation(?DeletedItemsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -159,6 +154,7 @@ public function toGetRequestInformation(?DeletedItemsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/Directory/DeletedItems/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index 6e0baeeff7a..2340f36cc73 100644 --- a/src/Generated/Directory/DeletedItems/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/Directory/DeletedItems/GetByIds/GetByIdsRequestBuilder.php index cce0010d1d0..7ff6559142a 100644 --- a/src/Generated/Directory/DeletedItems/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GraphAdministrativeUnit/Count/CountRequestBuilder.php b/src/Generated/Directory/DeletedItems/GraphAdministrativeUnit/Count/CountRequestBuilder.php index 294dfa1eb19..4b4cca1f0a9 100644 --- a/src/Generated/Directory/DeletedItems/GraphAdministrativeUnit/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GraphAdministrativeUnit/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Directory/DeletedItems/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index 957be42e040..72787403866 100644 --- a/src/Generated/Directory/DeletedItems/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\DeletedItems\GraphAdministrativeUnit\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\AdministrativeUnitCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.administrativeUnit in the microsoft.graph.directoryObject collection * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GraphApplication/Count/CountRequestBuilder.php b/src/Generated/Directory/DeletedItems/GraphApplication/Count/CountRequestBuilder.php index c414e8da1a5..b4875e72650 100644 --- a/src/Generated/Directory/DeletedItems/GraphApplication/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GraphApplication/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Directory/DeletedItems/GraphApplication/GraphApplicationRequestBuilder.php index 4c87979b96b..4b10c45cbbb 100644 --- a/src/Generated/Directory/DeletedItems/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\DeletedItems\GraphApplication\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ApplicationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.application in the microsoft.graph.directoryObject collection * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GraphDevice/Count/CountRequestBuilder.php b/src/Generated/Directory/DeletedItems/GraphDevice/Count/CountRequestBuilder.php index cb7e24798fd..4c20025dd83 100644 --- a/src/Generated/Directory/DeletedItems/GraphDevice/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GraphDevice/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Directory/DeletedItems/GraphDevice/GraphDeviceRequestBuilder.php index 1818d16f27a..85afa87bd64 100644 --- a/src/Generated/Directory/DeletedItems/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\DeletedItems\GraphDevice\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.device in the microsoft.graph.directoryObject collection * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Directory/DeletedItems/GraphGroup/Count/CountRequestBuilder.php index 25ac23bcecb..4914564092f 100644 --- a/src/Generated/Directory/DeletedItems/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Directory/DeletedItems/GraphGroup/GraphGroupRequestBuilder.php index 6ff50f2a725..120b7503671 100644 --- a/src/Generated/Directory/DeletedItems/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\DeletedItems\GraphGroup\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/Directory/DeletedItems/GraphServicePrincipal/Count/CountRequestBuilder.php index c4d18c0da26..1a378770776 100644 --- a/src/Generated/Directory/DeletedItems/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Directory/DeletedItems/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index a3f1a555fe7..6aa27e6445c 100644 --- a/src/Generated/Directory/DeletedItems/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\DeletedItems\GraphServicePrincipal\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GraphUser/Count/CountRequestBuilder.php b/src/Generated/Directory/DeletedItems/GraphUser/Count/CountRequestBuilder.php index 9d42e939645..5483c62ed69 100644 --- a/src/Generated/Directory/DeletedItems/GraphUser/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GraphUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Directory/DeletedItems/GraphUser/GraphUserRequestBuilder.php index af1c2d3e850..db6e5a83502 100644 --- a/src/Generated/Directory/DeletedItems/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\DeletedItems\GraphUser\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.user in the microsoft.graph.directoryObject collection * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/Directory/DeletedItems/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index 4fa56575ac6..6967efa229a 100644 --- a/src/Generated/Directory/DeletedItems/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/Directory/DeletedItems/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index b705a291c56..59ea9328796 100644 --- a/src/Generated/Directory/DeletedItems/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Directory/DeletedItems/Item/DirectoryObjectItemRequestBuilder.php index 5833b15fd4d..ef7b3709628 100644 --- a/src/Generated/Directory/DeletedItems/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\DeletedItems\Item\CheckMemberGroups\CheckMemberGroupsRequestBuilder; use Microsoft\Graph\Generated\Directory\DeletedItems\Item\CheckMemberObjects\CheckMemberObjectsRequestBuilder; use Microsoft\Graph\Generated\Directory\DeletedItems\Item\GetMemberGroups\GetMemberGroupsRequestBuilder; @@ -122,39 +121,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Permanently delete a recently deleted application, group, servicePrincipal, or user object from deleted items. After an item is permanently deleted, it cannot be restored. Administrative units cannot be permanently deleted by using the deletedItems API. Soft-deleted administrative units will be permanently deleted 30 days after initial deletion unless they are restored. This API is available in the following national cloud deployments. * @param DirectoryObjectItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DirectoryObjectItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. This API is available in the following national cloud deployments. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-get?view=graph-rest-1.0 Find more info here */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -171,6 +164,7 @@ public function toDeleteRequestInformation(?DirectoryObjectItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -184,7 +178,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -192,6 +185,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/Directory/DeletedItems/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index dde6c529f0c..4c81e2d0a39 100644 --- a/src/Generated/Directory/DeletedItems/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/Directory/DeletedItems/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index 1c0c31862ff..0c2ae8a359e 100644 --- a/src/Generated/Directory/DeletedItems/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Directory/DeletedItems/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index 3e29a7d16c8..ab051b21d60 100644 --- a/src/Generated/Directory/DeletedItems/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnit; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.administrativeUnit * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/Item/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Directory/DeletedItems/Item/GraphApplication/GraphApplicationRequestBuilder.php index 7439ae27d46..932c356f9db 100644 --- a/src/Generated/Directory/DeletedItems/Item/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/Item/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Application; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.application * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/Item/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Directory/DeletedItems/Item/GraphDevice/GraphDeviceRequestBuilder.php index f00132af3ec..14b715bfdc2 100644 --- a/src/Generated/Directory/DeletedItems/Item/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/Item/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Device; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.device * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Directory/DeletedItems/Item/GraphGroup/GraphGroupRequestBuilder.php index 7f474eaa24a..9e75d2b1887 100644 --- a/src/Generated/Directory/DeletedItems/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Directory/DeletedItems/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 00e67f3ddef..e7a00ca4bb0 100644 --- a/src/Generated/Directory/DeletedItems/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/Item/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Directory/DeletedItems/Item/GraphUser/GraphUserRequestBuilder.php index b12efc3a569..5d8f39ee36b 100644 --- a/src/Generated/Directory/DeletedItems/Item/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/Item/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.user * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/Item/Restore/RestoreRequestBuilder.php b/src/Generated/Directory/DeletedItems/Item/Restore/RestoreRequestBuilder.php index a1697e1473d..94caf07f51a 100644 --- a/src/Generated/Directory/DeletedItems/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/DeletedItems/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/Directory/DeletedItems/ValidateProperties/ValidatePropertiesRequestBuilder.php index de4794b75fd..6f3c86d9d0e 100644 --- a/src/Generated/Directory/DeletedItems/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/Directory/DeletedItems/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Photos/Count/CountRequestBuilder.php b/src/Generated/Directory/DeviceLocalCredentials/Count/CountRequestBuilder.php similarity index 80% rename from src/Generated/Users/Item/Photos/Count/CountRequestBuilder.php rename to src/Generated/Directory/DeviceLocalCredentials/Count/CountRequestBuilder.php index 22c2d9abe77..1fc91b6703a 100644 --- a/src/Generated/Users/Item/Photos/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/DeviceLocalCredentials/Count/CountRequestBuilder.php @@ -1,10 +1,9 @@ pathParameters = $pathParametersOrRawUrl; } else { @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Photos/Count/CountRequestBuilderGetQueryParameters.php b/src/Generated/Directory/DeviceLocalCredentials/Count/CountRequestBuilderGetQueryParameters.php similarity index 55% rename from src/Generated/Users/Item/Photos/Count/CountRequestBuilderGetQueryParameters.php rename to src/Generated/Directory/DeviceLocalCredentials/Count/CountRequestBuilderGetQueryParameters.php index 22c52a132de..11f41534126 100644 --- a/src/Generated/Users/Item/Photos/Count/CountRequestBuilderGetQueryParameters.php +++ b/src/Generated/Directory/DeviceLocalCredentials/Count/CountRequestBuilderGetQueryParameters.php @@ -1,6 +1,6 @@ filter = $filter; + $this->search = $search; } } diff --git a/src/Generated/Users/Item/Photos/Count/CountRequestBuilderGetRequestConfiguration.php b/src/Generated/Directory/DeviceLocalCredentials/Count/CountRequestBuilderGetRequestConfiguration.php similarity index 86% rename from src/Generated/Users/Item/Photos/Count/CountRequestBuilderGetRequestConfiguration.php rename to src/Generated/Directory/DeviceLocalCredentials/Count/CountRequestBuilderGetRequestConfiguration.php index 054a4bfae99..781f08b9fbb 100644 --- a/src/Generated/Users/Item/Photos/Count/CountRequestBuilderGetRequestConfiguration.php +++ b/src/Generated/Directory/DeviceLocalCredentials/Count/CountRequestBuilderGetRequestConfiguration.php @@ -1,6 +1,6 @@ pathParameters, $this->requestAdapter); + } + + /** + * Provides operations to manage the deviceLocalCredentials property of the microsoft.graph.directory entity. + * @param string $deviceLocalCredentialInfoId The unique identifier of deviceLocalCredentialInfo + * @return DeviceLocalCredentialInfoItemRequestBuilder + */ + public function byDeviceLocalCredentialInfoId(string $deviceLocalCredentialInfoId): DeviceLocalCredentialInfoItemRequestBuilder { + $urlTplParams = $this->pathParameters; + $urlTplParams['deviceLocalCredentialInfo%2Did'] = $deviceLocalCredentialInfoId; + return new DeviceLocalCredentialInfoItemRequestBuilder($urlTplParams, $this->requestAdapter); + } + + /** + * Instantiates a new DeviceLocalCredentialsRequestBuilder and sets the default values. + * @param array|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/directory/deviceLocalCredentials{?%24top,%24search,%24filter,%24count,%24orderby,%24select}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * Get a list of the deviceLocalCredentialInfo objects and their properties, excluding the credentials property. + * @param DeviceLocalCredentialsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/directory-list-devicelocalcredentials?view=graph-rest-1.0 Find more info here + */ + public function get(?DeviceLocalCredentialsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceLocalCredentialInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Create new navigation property to deviceLocalCredentials for directory + * @param DeviceLocalCredentialInfo $body The request body + * @param DeviceLocalCredentialsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function post(DeviceLocalCredentialInfo $body, ?DeviceLocalCredentialsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceLocalCredentialInfo::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Get a list of the deviceLocalCredentialInfo objects and their properties, excluding the credentials property. + * @param DeviceLocalCredentialsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?DeviceLocalCredentialsRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + return $requestInfo; + } + + /** + * Create new navigation property to deviceLocalCredentials for directory + * @param DeviceLocalCredentialInfo $body The request body + * @param DeviceLocalCredentialsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toPostRequestInformation(DeviceLocalCredentialInfo $body, ?DeviceLocalCredentialsRequestBuilderPostRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::POST; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return DeviceLocalCredentialsRequestBuilder + */ + public function withUrl(string $rawUrl): DeviceLocalCredentialsRequestBuilder { + return new DeviceLocalCredentialsRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/Directory/DeviceLocalCredentials/DeviceLocalCredentialsRequestBuilderGetQueryParameters.php b/src/Generated/Directory/DeviceLocalCredentials/DeviceLocalCredentialsRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..97c615322c1 --- /dev/null +++ b/src/Generated/Directory/DeviceLocalCredentials/DeviceLocalCredentialsRequestBuilderGetQueryParameters.php @@ -0,0 +1,66 @@ +|null $orderby Order items by property values + */ + public ?array $orderby = null; + + /** + * @QueryParameter("%24search") + * @var string|null $search Search items by search phrases + */ + public ?string $search = null; + + /** + * @QueryParameter("%24select") + * @var array|null $select Select properties to be returned + */ + public ?array $select = null; + + /** + * @QueryParameter("%24top") + * @var int|null $top Show only the first n items + */ + public ?int $top = null; + + /** + * Instantiates a new deviceLocalCredentialsRequestBuilderGetQueryParameters and sets the default values. + * @param bool|null $count Include count of items + * @param string|null $filter Filter items by property values + * @param array|null $orderby Order items by property values + * @param string|null $search Search items by search phrases + * @param array|null $select Select properties to be returned + * @param int|null $top Show only the first n items + */ + public function __construct(?bool $count = null, ?string $filter = null, ?array $orderby = null, ?string $search = null, ?array $select = null, ?int $top = null) { + $this->count = $count; + $this->filter = $filter; + $this->orderby = $orderby; + $this->search = $search; + $this->select = $select; + $this->top = $top; + } + +} diff --git a/src/Generated/Directory/DeviceLocalCredentials/DeviceLocalCredentialsRequestBuilderGetRequestConfiguration.php b/src/Generated/Directory/DeviceLocalCredentials/DeviceLocalCredentialsRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..fb096415fb9 --- /dev/null +++ b/src/Generated/Directory/DeviceLocalCredentials/DeviceLocalCredentialsRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,43 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param DeviceLocalCredentialsRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?DeviceLocalCredentialsRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new deviceLocalCredentialsRequestBuilderGetQueryParameters. + * @param bool|null $count Include count of items + * @param string|null $filter Filter items by property values + * @param array|null $orderby Order items by property values + * @param string|null $search Search items by search phrases + * @param array|null $select Select properties to be returned + * @param int|null $top Show only the first n items + * @return DeviceLocalCredentialsRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?bool $count = null, ?string $filter = null, ?array $orderby = null, ?string $search = null, ?array $select = null, ?int $top = null): DeviceLocalCredentialsRequestBuilderGetQueryParameters { + return new DeviceLocalCredentialsRequestBuilderGetQueryParameters($count, $filter, $orderby, $search, $select, $top); + } + +} diff --git a/src/Generated/Directory/DeviceLocalCredentials/DeviceLocalCredentialsRequestBuilderPostRequestConfiguration.php b/src/Generated/Directory/DeviceLocalCredentials/DeviceLocalCredentialsRequestBuilderPostRequestConfiguration.php new file mode 100644 index 00000000000..7d2690e650e --- /dev/null +++ b/src/Generated/Directory/DeviceLocalCredentials/DeviceLocalCredentialsRequestBuilderPostRequestConfiguration.php @@ -0,0 +1,22 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + */ + public function __construct(?array $headers = null, ?array $options = null) { + parent::__construct($headers ?? [], $options ?? []); + } + +} diff --git a/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilder.php b/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilder.php new file mode 100644 index 00000000000..1fca2c46208 --- /dev/null +++ b/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilder.php @@ -0,0 +1,148 @@ +|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/directory/deviceLocalCredentials/{deviceLocalCredentialInfo%2Did}{?%24select}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * Delete navigation property deviceLocalCredentials for directory + * @param DeviceLocalCredentialInfoItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function delete(?DeviceLocalCredentialInfoItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); + } + + /** + * Retrieve the properties of a deviceLocalCredentialInfo for a specified device object. + * @param DeviceLocalCredentialInfoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/devicelocalcredentialinfo-get?view=graph-rest-1.0 Find more info here + */ + public function get(?DeviceLocalCredentialInfoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceLocalCredentialInfo::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Update the navigation property deviceLocalCredentials in directory + * @param DeviceLocalCredentialInfo $body The request body + * @param DeviceLocalCredentialInfoItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function patch(DeviceLocalCredentialInfo $body, ?DeviceLocalCredentialInfoItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceLocalCredentialInfo::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Delete navigation property deviceLocalCredentials for directory + * @param DeviceLocalCredentialInfoItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toDeleteRequestInformation(?DeviceLocalCredentialInfoItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::DELETE; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + return $requestInfo; + } + + /** + * Retrieve the properties of a deviceLocalCredentialInfo for a specified device object. + * @param DeviceLocalCredentialInfoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?DeviceLocalCredentialInfoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + return $requestInfo; + } + + /** + * Update the navigation property deviceLocalCredentials in directory + * @param DeviceLocalCredentialInfo $body The request body + * @param DeviceLocalCredentialInfoItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toPatchRequestInformation(DeviceLocalCredentialInfo $body, ?DeviceLocalCredentialInfoItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::PATCH; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return DeviceLocalCredentialInfoItemRequestBuilder + */ + public function withUrl(string $rawUrl): DeviceLocalCredentialInfoItemRequestBuilder { + return new DeviceLocalCredentialInfoItemRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderDeleteRequestConfiguration.php b/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderDeleteRequestConfiguration.php new file mode 100644 index 00000000000..99701ae9ec1 --- /dev/null +++ b/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderDeleteRequestConfiguration.php @@ -0,0 +1,22 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + */ + public function __construct(?array $headers = null, ?array $options = null) { + parent::__construct($headers ?? [], $options ?? []); + } + +} diff --git a/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderGetQueryParameters.php b/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..2af0c1b6c6d --- /dev/null +++ b/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderGetQueryParameters.php @@ -0,0 +1,26 @@ +|null $select Select properties to be returned + */ + public ?array $select = null; + + /** + * Instantiates a new DeviceLocalCredentialInfoItemRequestBuilderGetQueryParameters and sets the default values. + * @param array|null $select Select properties to be returned + */ + public function __construct(?array $select = null) { + $this->select = $select; + } + +} diff --git a/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderGetRequestConfiguration.php b/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..0adcd7f8763 --- /dev/null +++ b/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,38 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param DeviceLocalCredentialInfoItemRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?DeviceLocalCredentialInfoItemRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new DeviceLocalCredentialInfoItemRequestBuilderGetQueryParameters. + * @param array|null $select Select properties to be returned + * @return DeviceLocalCredentialInfoItemRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?array $select = null): DeviceLocalCredentialInfoItemRequestBuilderGetQueryParameters { + return new DeviceLocalCredentialInfoItemRequestBuilderGetQueryParameters($select); + } + +} diff --git a/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderPatchRequestConfiguration.php b/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderPatchRequestConfiguration.php new file mode 100644 index 00000000000..e642b7521fc --- /dev/null +++ b/src/Generated/Directory/DeviceLocalCredentials/Item/DeviceLocalCredentialInfoItemRequestBuilderPatchRequestConfiguration.php @@ -0,0 +1,22 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + */ + public function __construct(?array $headers = null, ?array $options = null) { + parent::__construct($headers ?? [], $options ?? []); + } + +} diff --git a/src/Generated/Directory/DirectoryRequestBuilder.php b/src/Generated/Directory/DirectoryRequestBuilder.php index 9457b386175..6c69398a6db 100644 --- a/src/Generated/Directory/DirectoryRequestBuilder.php +++ b/src/Generated/Directory/DirectoryRequestBuilder.php @@ -4,11 +4,11 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\AdministrativeUnits\AdministrativeUnitsRequestBuilder; use Microsoft\Graph\Generated\Directory\AttributeSets\AttributeSetsRequestBuilder; use Microsoft\Graph\Generated\Directory\CustomSecurityAttributeDefinitions\CustomSecurityAttributeDefinitionsRequestBuilder; use Microsoft\Graph\Generated\Directory\DeletedItems\DeletedItemsRequestBuilder; +use Microsoft\Graph\Generated\Directory\DeviceLocalCredentials\DeviceLocalCredentialsRequestBuilder; use Microsoft\Graph\Generated\Directory\FederationConfigurations\FederationConfigurationsRequestBuilder; use Microsoft\Graph\Generated\Directory\OnPremisesSynchronization\OnPremisesSynchronizationRequestBuilder; use Microsoft\Graph\Generated\Models\Directory; @@ -51,6 +51,13 @@ public function deletedItems(): DeletedItemsRequestBuilder { return new DeletedItemsRequestBuilder($this->pathParameters, $this->requestAdapter); } + /** + * Provides operations to manage the deviceLocalCredentials property of the microsoft.graph.directory entity. + */ + public function deviceLocalCredentials(): DeviceLocalCredentialsRequestBuilder { + return new DeviceLocalCredentialsRequestBuilder($this->pathParameters, $this->requestAdapter); + } + /** * Provides operations to manage the federationConfigurations property of the microsoft.graph.directory entity. */ @@ -82,38 +89,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get directory * @param DirectoryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Directory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Directory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update directory * @param Directory $body The request body * @param DirectoryRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Directory $body, ?DirectoryRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Directory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Directory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -126,7 +127,6 @@ public function toGetRequestInformation(?DirectoryRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -134,6 +134,7 @@ public function toGetRequestInformation(?DirectoryRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -148,11 +149,11 @@ public function toPatchRequestInformation(Directory $body, ?DirectoryRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/FederationConfigurations/AvailableProviderTypes/AvailableProviderTypesRequestBuilder.php b/src/Generated/Directory/FederationConfigurations/AvailableProviderTypes/AvailableProviderTypesRequestBuilder.php index 06f019c6ae9..ea4ed3142cd 100644 --- a/src/Generated/Directory/FederationConfigurations/AvailableProviderTypes/AvailableProviderTypesRequestBuilder.php +++ b/src/Generated/Directory/FederationConfigurations/AvailableProviderTypes/AvailableProviderTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function availableProviderTypes * @param AvailableProviderTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AvailableProviderTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AvailableProviderTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AvailableProviderTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?AvailableProviderTypesRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?AvailableProviderTypesRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Directory/FederationConfigurations/Count/CountRequestBuilder.php b/src/Generated/Directory/FederationConfigurations/Count/CountRequestBuilder.php index c19c73c5274..ee1fbf55780 100644 --- a/src/Generated/Directory/FederationConfigurations/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/FederationConfigurations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/FederationConfigurations/FederationConfigurationsRequestBuilder.php b/src/Generated/Directory/FederationConfigurations/FederationConfigurationsRequestBuilder.php index 0296e5d8a76..2c2ec4ee602 100644 --- a/src/Generated/Directory/FederationConfigurations/FederationConfigurationsRequestBuilder.php +++ b/src/Generated/Directory/FederationConfigurations/FederationConfigurationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\FederationConfigurations\AvailableProviderTypes\AvailableProviderTypesRequestBuilder; use Microsoft\Graph\Generated\Directory\FederationConfigurations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Directory\FederationConfigurations\Item\IdentityProviderBaseItemRequestBuilder; @@ -63,38 +62,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Configure domain federation with organizations whose identity provider (IdP) supports either the SAML or WS-Fed protocol. * @param FederationConfigurationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FederationConfigurationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to federationConfigurations for directory * @param IdentityProviderBase $body The request body * @param FederationConfigurationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IdentityProviderBase $body, ?FederationConfigurationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -107,7 +100,6 @@ public function toGetRequestInformation(?FederationConfigurationsRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -115,6 +107,7 @@ public function toGetRequestInformation(?FederationConfigurationsRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -129,11 +122,11 @@ public function toPostRequestInformation(IdentityProviderBase $body, ?Federation $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/FederationConfigurations/Item/IdentityProviderBaseItemRequestBuilder.php b/src/Generated/Directory/FederationConfigurations/Item/IdentityProviderBaseItemRequestBuilder.php index ea8339bcf5e..0e067ec0399 100644 --- a/src/Generated/Directory/FederationConfigurations/Item/IdentityProviderBaseItemRequestBuilder.php +++ b/src/Generated/Directory/FederationConfigurations/Item/IdentityProviderBaseItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityProviderBase; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a samlOrWsFedExternalDomainFederation object. This API is available in the following national cloud deployments. * @param IdentityProviderBaseItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/samlorwsfedexternaldomainfederation-delete?view=graph-rest-1.0 Find more info here */ public function delete(?IdentityProviderBaseItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Configure domain federation with organizations whose identity provider (IdP) supports either the SAML or WS-Fed protocol. * @param IdentityProviderBaseItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IdentityProviderBaseItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property federationConfigurations in directory * @param IdentityProviderBase $body The request body * @param IdentityProviderBaseItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(IdentityProviderBase $body, ?IdentityProviderBaseItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?IdentityProviderBaseItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?IdentityProviderBaseItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?IdentityProviderBaseItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(IdentityProviderBase $body, ?IdentityP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/OnPremisesSynchronization/Count/CountRequestBuilder.php b/src/Generated/Directory/OnPremisesSynchronization/Count/CountRequestBuilder.php index 1eee8d50e9e..6e05fa5002f 100644 --- a/src/Generated/Directory/OnPremisesSynchronization/Count/CountRequestBuilder.php +++ b/src/Generated/Directory/OnPremisesSynchronization/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Directory/OnPremisesSynchronization/Item/OnPremisesDirectorySynchronizationItemRequestBuilder.php b/src/Generated/Directory/OnPremisesSynchronization/Item/OnPremisesDirectorySynchronizationItemRequestBuilder.php index 53ef831512f..66c9505f614 100644 --- a/src/Generated/Directory/OnPremisesSynchronization/Item/OnPremisesDirectorySynchronizationItemRequestBuilder.php +++ b/src/Generated/Directory/OnPremisesSynchronization/Item/OnPremisesDirectorySynchronizationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnPremisesDirectorySynchronization; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property onPremisesSynchronization for directory * @param OnPremisesDirectorySynchronizationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnPremisesDirectorySynchronizationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an onPremisesDirectorySynchronization object. This API is available in the following national cloud deployments. * @param OnPremisesDirectorySynchronizationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onpremisesdirectorysynchronization-get?view=graph-rest-1.0 Find more info here */ public function get(?OnPremisesDirectorySynchronizationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnPremisesDirectorySynchronization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnPremisesDirectorySynchronization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an onPremisesDirectorySynchronization object. This API is available in the following national cloud deployments. * @param OnPremisesDirectorySynchronization $body The request body * @param OnPremisesDirectorySynchronizationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onpremisesdirectorysynchronization-update?view=graph-rest-1.0 Find more info here */ public function patch(OnPremisesDirectorySynchronization $body, ?OnPremisesDirectorySynchronizationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnPremisesDirectorySynchronization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnPremisesDirectorySynchronization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?OnPremisesDirectorySynchronizationIt $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?OnPremisesDirectorySynchronizationItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?OnPremisesDirectorySynchronizationItemR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(OnPremisesDirectorySynchronization $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Directory/OnPremisesSynchronization/OnPremisesSynchronizationRequestBuilder.php b/src/Generated/Directory/OnPremisesSynchronization/OnPremisesSynchronizationRequestBuilder.php index 463af873964..a8ccbadad73 100644 --- a/src/Generated/Directory/OnPremisesSynchronization/OnPremisesSynchronizationRequestBuilder.php +++ b/src/Generated/Directory/OnPremisesSynchronization/OnPremisesSynchronizationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Directory\OnPremisesSynchronization\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Directory\OnPremisesSynchronization\Item\OnPremisesDirectorySynchronizationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of an onPremisesDirectorySynchronization object. This API is available in the following national cloud deployments. * @param OnPremisesSynchronizationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnPremisesSynchronizationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnPremisesDirectorySynchronizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnPremisesDirectorySynchronizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to onPremisesSynchronization for directory * @param OnPremisesDirectorySynchronization $body The request body * @param OnPremisesSynchronizationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnPremisesDirectorySynchronization $body, ?OnPremisesSynchronizationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnPremisesDirectorySynchronization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnPremisesDirectorySynchronization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OnPremisesSynchronizationRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OnPremisesSynchronizationRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(OnPremisesDirectorySynchronization $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryObjects/Count/CountRequestBuilder.php b/src/Generated/DirectoryObjects/Count/CountRequestBuilder.php index c57db4e2757..e256a633e8a 100644 --- a/src/Generated/DirectoryObjects/Count/CountRequestBuilder.php +++ b/src/Generated/DirectoryObjects/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DirectoryObjects/Delta/DeltaRequestBuilder.php b/src/Generated/DirectoryObjects/Delta/DeltaRequestBuilder.php index 6ffad3a5793..0c16d0a30b7 100644 --- a/src/Generated/DirectoryObjects/Delta/DeltaRequestBuilder.php +++ b/src/Generated/DirectoryObjects/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryObjects/DirectoryObjectsRequestBuilder.php b/src/Generated/DirectoryObjects/DirectoryObjectsRequestBuilder.php index e45f2dcec76..fde0d63e388 100644 --- a/src/Generated/DirectoryObjects/DirectoryObjectsRequestBuilder.php +++ b/src/Generated/DirectoryObjects/DirectoryObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryObjects\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DirectoryObjects\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\DirectoryObjects\GetAvailableExtensionProperties\GetAvailableExtensionPropertiesRequestBuilder; @@ -87,38 +86,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from directoryObjects * @param DirectoryObjectsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to directoryObjects * @param DirectoryObject $body The request body * @param DirectoryObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DirectoryObject $body, ?DirectoryObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -131,7 +124,6 @@ public function toGetRequestInformation(?DirectoryObjectsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +131,7 @@ public function toGetRequestInformation(?DirectoryObjectsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +146,11 @@ public function toPostRequestInformation(DirectoryObject $body, ?DirectoryObject $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryObjects/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/DirectoryObjects/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index 533d787ff7f..7eca633789e 100644 --- a/src/Generated/DirectoryObjects/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/DirectoryObjects/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryObjects/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/DirectoryObjects/GetByIds/GetByIdsRequestBuilder.php index ac170458559..cd39b07a6fe 100644 --- a/src/Generated/DirectoryObjects/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/DirectoryObjects/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryObjects/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/DirectoryObjects/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index 1fb2d277ae3..938fca01161 100644 --- a/src/Generated/DirectoryObjects/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/DirectoryObjects/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryObjects/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/DirectoryObjects/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index 4bae6c8fe5f..0b351976794 100644 --- a/src/Generated/DirectoryObjects/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/DirectoryObjects/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryObjects/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/DirectoryObjects/Item/DirectoryObjectItemRequestBuilder.php index bc9fd6f4493..09229e6c40b 100644 --- a/src/Generated/DirectoryObjects/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/DirectoryObjects/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryObjects\Item\CheckMemberGroups\CheckMemberGroupsRequestBuilder; use Microsoft\Graph\Generated\DirectoryObjects\Item\CheckMemberObjects\CheckMemberObjectsRequestBuilder; use Microsoft\Graph\Generated\DirectoryObjects\Item\GetMemberGroups\GetMemberGroupsRequestBuilder; @@ -74,58 +73,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a directory object, for example, a group, user, application, or service principal. This API is available in the following national cloud deployments. * @param DirectoryObjectItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DirectoryObjectItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a directoryObject object. This API is available in the following national cloud deployments. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-get?view=graph-rest-1.0 Find more info here */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in directoryObjects * @param DirectoryObject $body The request body * @param DirectoryObjectItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DirectoryObject $body, ?DirectoryObjectItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -142,6 +132,7 @@ public function toDeleteRequestInformation(?DirectoryObjectItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -155,7 +146,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -163,6 +153,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -177,11 +168,11 @@ public function toPatchRequestInformation(DirectoryObject $body, ?DirectoryObjec $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryObjects/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/DirectoryObjects/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index 4f2405bd322..7efb08c7658 100644 --- a/src/Generated/DirectoryObjects/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/DirectoryObjects/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryObjects/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/DirectoryObjects/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index 86bfb5aa79a..c22422d62d8 100644 --- a/src/Generated/DirectoryObjects/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/DirectoryObjects/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryObjects/Item/Restore/RestoreRequestBuilder.php b/src/Generated/DirectoryObjects/Item/Restore/RestoreRequestBuilder.php index 053b322b8a8..b69ae4f29ca 100644 --- a/src/Generated/DirectoryObjects/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/DirectoryObjects/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryObjects/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/DirectoryObjects/ValidateProperties/ValidatePropertiesRequestBuilder.php index 95a0a8635b6..563a7f8bb52 100644 --- a/src/Generated/DirectoryObjects/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/DirectoryObjects/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoleTemplates/Count/CountRequestBuilder.php b/src/Generated/DirectoryRoleTemplates/Count/CountRequestBuilder.php index a0085fe5b60..0855d8bcef8 100644 --- a/src/Generated/DirectoryRoleTemplates/Count/CountRequestBuilder.php +++ b/src/Generated/DirectoryRoleTemplates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoleTemplates/Delta/DeltaRequestBuilder.php b/src/Generated/DirectoryRoleTemplates/Delta/DeltaRequestBuilder.php index d397a8274ce..8c321224549 100644 --- a/src/Generated/DirectoryRoleTemplates/Delta/DeltaRequestBuilder.php +++ b/src/Generated/DirectoryRoleTemplates/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoleTemplates/DirectoryRoleTemplatesRequestBuilder.php b/src/Generated/DirectoryRoleTemplates/DirectoryRoleTemplatesRequestBuilder.php index fce9d7c3bb8..9d6c295d00a 100644 --- a/src/Generated/DirectoryRoleTemplates/DirectoryRoleTemplatesRequestBuilder.php +++ b/src/Generated/DirectoryRoleTemplates/DirectoryRoleTemplatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryRoleTemplates\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DirectoryRoleTemplates\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\DirectoryRoleTemplates\GetAvailableExtensionProperties\GetAvailableExtensionPropertiesRequestBuilder; @@ -87,39 +86,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of directoryRoleTemplate objects. This API is available in the following national cloud deployments. * @param DirectoryRoleTemplatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryroletemplate-list?view=graph-rest-1.0 Find more info here */ public function get(?DirectoryRoleTemplatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to directoryRoleTemplates * @param DirectoryRoleTemplate $body The request body * @param DirectoryRoleTemplatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DirectoryRoleTemplate $body, ?DirectoryRoleTemplatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,7 +125,6 @@ public function toGetRequestInformation(?DirectoryRoleTemplatesRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +132,7 @@ public function toGetRequestInformation(?DirectoryRoleTemplatesRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +147,11 @@ public function toPostRequestInformation(DirectoryRoleTemplate $body, ?Directory $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoleTemplates/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/DirectoryRoleTemplates/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index b72f5673a64..dcba892ce0c 100644 --- a/src/Generated/DirectoryRoleTemplates/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/DirectoryRoleTemplates/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoleTemplates/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/DirectoryRoleTemplates/GetByIds/GetByIdsRequestBuilder.php index 34f60b645de..05f9919fd3c 100644 --- a/src/Generated/DirectoryRoleTemplates/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/DirectoryRoleTemplates/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoleTemplates/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/DirectoryRoleTemplates/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index 49e28507d6f..d1875ca5e51 100644 --- a/src/Generated/DirectoryRoleTemplates/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/DirectoryRoleTemplates/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoleTemplates/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/DirectoryRoleTemplates/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index 58826f8fbb6..2a49b2b7a17 100644 --- a/src/Generated/DirectoryRoleTemplates/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/DirectoryRoleTemplates/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoleTemplates/Item/DirectoryRoleTemplateItemRequestBuilder.php b/src/Generated/DirectoryRoleTemplates/Item/DirectoryRoleTemplateItemRequestBuilder.php index 6f42b405f4a..ced34cdd0f5 100644 --- a/src/Generated/DirectoryRoleTemplates/Item/DirectoryRoleTemplateItemRequestBuilder.php +++ b/src/Generated/DirectoryRoleTemplates/Item/DirectoryRoleTemplateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryRoleTemplates\Item\CheckMemberGroups\CheckMemberGroupsRequestBuilder; use Microsoft\Graph\Generated\DirectoryRoleTemplates\Item\CheckMemberObjects\CheckMemberObjectsRequestBuilder; use Microsoft\Graph\Generated\DirectoryRoleTemplates\Item\GetMemberGroups\GetMemberGroupsRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from directoryRoleTemplates * @param DirectoryRoleTemplateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DirectoryRoleTemplateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a directoryroletemplate object. This API is available in the following national cloud deployments. * @param DirectoryRoleTemplateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryroletemplate-get?view=graph-rest-1.0 Find more info here */ public function get(?DirectoryRoleTemplateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in directoryRoleTemplates * @param DirectoryRoleTemplate $body The request body * @param DirectoryRoleTemplateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DirectoryRoleTemplate $body, ?DirectoryRoleTemplateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?DirectoryRoleTemplateItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?DirectoryRoleTemplateItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?DirectoryRoleTemplateItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(DirectoryRoleTemplate $body, ?Director $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoleTemplates/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/DirectoryRoleTemplates/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index b19377f7436..fe9aa018286 100644 --- a/src/Generated/DirectoryRoleTemplates/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/DirectoryRoleTemplates/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoleTemplates/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/DirectoryRoleTemplates/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index dadfa0d7cc7..faad7d42870 100644 --- a/src/Generated/DirectoryRoleTemplates/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/DirectoryRoleTemplates/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoleTemplates/Item/Restore/RestoreRequestBuilder.php b/src/Generated/DirectoryRoleTemplates/Item/Restore/RestoreRequestBuilder.php index f5ed9874847..1f7a28996e6 100644 --- a/src/Generated/DirectoryRoleTemplates/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/DirectoryRoleTemplates/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoleTemplates/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/DirectoryRoleTemplates/ValidateProperties/ValidatePropertiesRequestBuilder.php index 69ae86365b8..e55095263ce 100644 --- a/src/Generated/DirectoryRoleTemplates/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/DirectoryRoleTemplates/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Count/CountRequestBuilder.php b/src/Generated/DirectoryRoles/Count/CountRequestBuilder.php index 210c447dc6a..4ffabab2a26 100644 --- a/src/Generated/DirectoryRoles/Count/CountRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Delta/DeltaRequestBuilder.php b/src/Generated/DirectoryRoles/Delta/DeltaRequestBuilder.php index 2d9f18d2bad..6a9b6414f4f 100644 --- a/src/Generated/DirectoryRoles/Delta/DeltaRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/DirectoryRolesRequestBuilder.php b/src/Generated/DirectoryRoles/DirectoryRolesRequestBuilder.php index ec7587f69de..9d1b3d9cefd 100644 --- a/src/Generated/DirectoryRoles/DirectoryRolesRequestBuilder.php +++ b/src/Generated/DirectoryRoles/DirectoryRolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryRoles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DirectoryRoles\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\DirectoryRoles\GetAvailableExtensionProperties\GetAvailableExtensionPropertiesRequestBuilder; @@ -85,46 +84,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List the directory roles that are activated in the tenant. This operation only returns roles that have been activated. A role becomes activated when an admin activates the role using the Activate directoryRole API. Not all built-in roles are initially activated. When assigning a role using the Microsoft Entra admin center, the role activation step is implicitly done on the admin's behalf. To get the full list of roles that are available in Azure AD, use List directoryRoleTemplates. This API is available in the following national cloud deployments. + * List the directory roles that are activated in the tenant. This operation only returns roles that have been activated. A role becomes activated when an admin activates the role using the Activate directoryRole API. Not all built-in roles are initially activated. When assigning a role using the Microsoft Entra admin center, the role activation step is implicitly done on the admin's behalf. To get the full list of roles that are available in Microsoft Entra ID, use List directoryRoleTemplates. This API is available in the following national cloud deployments. * @param DirectoryRolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryrole-list?view=graph-rest-1.0 Find more info here */ public function get(?DirectoryRolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Activate a directory role. To read a directory role or update its members, it must first be activated in the tenant. The Company Administrators and the implicit user directory roles (User, Guest User, and Restricted Guest User roles) are activated by default. To access and assign members to other directory roles, you must first activate it with its corresponding directory role template ID. This API is available in the following national cloud deployments. * @param DirectoryRole $body The request body * @param DirectoryRolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryrole-post-directoryroles?view=graph-rest-1.0 Find more info here */ public function post(DirectoryRole $body, ?DirectoryRolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List the directory roles that are activated in the tenant. This operation only returns roles that have been activated. A role becomes activated when an admin activates the role using the Activate directoryRole API. Not all built-in roles are initially activated. When assigning a role using the Microsoft Entra admin center, the role activation step is implicitly done on the admin's behalf. To get the full list of roles that are available in Azure AD, use List directoryRoleTemplates. This API is available in the following national cloud deployments. + * List the directory roles that are activated in the tenant. This operation only returns roles that have been activated. A role becomes activated when an admin activates the role using the Activate directoryRole API. Not all built-in roles are initially activated. When assigning a role using the Microsoft Entra admin center, the role activation step is implicitly done on the admin's behalf. To get the full list of roles that are available in Microsoft Entra ID, use List directoryRoleTemplates. This API is available in the following national cloud deployments. * @param DirectoryRolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -133,7 +126,6 @@ public function toGetRequestInformation(?DirectoryRolesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -141,6 +133,7 @@ public function toGetRequestInformation(?DirectoryRolesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -155,11 +148,11 @@ public function toPostRequestInformation(DirectoryRole $body, ?DirectoryRolesReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/DirectoryRolesRequestBuilderGetQueryParameters.php b/src/Generated/DirectoryRoles/DirectoryRolesRequestBuilderGetQueryParameters.php index db5a4c3f251..c26522b21cc 100644 --- a/src/Generated/DirectoryRoles/DirectoryRolesRequestBuilderGetQueryParameters.php +++ b/src/Generated/DirectoryRoles/DirectoryRolesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List the directory roles that are activated in the tenant. This operation only returns roles that have been activated. A role becomes activated when an admin activates the role using the Activate directoryRole API. Not all built-in roles are initially activated. When assigning a role using the Microsoft Entra admin center, the role activation step is implicitly done on the admin's behalf. To get the full list of roles that are available in Azure AD, use List directoryRoleTemplates. This API is available in the following national cloud deployments. + * List the directory roles that are activated in the tenant. This operation only returns roles that have been activated. A role becomes activated when an admin activates the role using the Activate directoryRole API. Not all built-in roles are initially activated. When assigning a role using the Microsoft Entra admin center, the role activation step is implicitly done on the admin's behalf. To get the full list of roles that are available in Microsoft Entra ID, use List directoryRoleTemplates. This API is available in the following national cloud deployments. */ class DirectoryRolesRequestBuilderGetQueryParameters { diff --git a/src/Generated/DirectoryRoles/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/DirectoryRoles/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index 3e527bbd56e..d30db64184d 100644 --- a/src/Generated/DirectoryRoles/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/DirectoryRoles/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/DirectoryRoles/GetByIds/GetByIdsRequestBuilder.php index 7ed96fac72f..11f6423cc72 100644 --- a/src/Generated/DirectoryRoles/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/DirectoryRoles/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/DirectoryRoles/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index 509757ae7a9..5c11c3e9f44 100644 --- a/src/Generated/DirectoryRoles/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/DirectoryRoles/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index b11ed8c2f5c..f2df7441354 100644 --- a/src/Generated/DirectoryRoles/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/DirectoryRoleItemRequestBuilder.php b/src/Generated/DirectoryRoles/Item/DirectoryRoleItemRequestBuilder.php index 84080d28f20..7a131bedbbf 100644 --- a/src/Generated/DirectoryRoles/Item/DirectoryRoleItemRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/DirectoryRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryRoles\Item\CheckMemberGroups\CheckMemberGroupsRequestBuilder; use Microsoft\Graph\Generated\DirectoryRoles\Item\CheckMemberObjects\CheckMemberObjectsRequestBuilder; use Microsoft\Graph\Generated\DirectoryRoles\Item\GetMemberGroups\GetMemberGroupsRequestBuilder; @@ -90,57 +89,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from directoryRoles * @param DirectoryRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DirectoryRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of a directoryRole object. The role must be activated in tenant for a successful response. You can use both the object ID and template ID of the directoryRole with this API. The template ID of a built-in role is immutable and can be seen in the role description on the Microsoft Entra admin center. For details, see Role template IDs. This API is available in the following national cloud deployments. * @param DirectoryRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryrole-get?view=graph-rest-1.0 Find more info here */ public function get(?DirectoryRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in directoryRoles * @param DirectoryRole $body The request body * @param DirectoryRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DirectoryRole $body, ?DirectoryRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -157,6 +147,7 @@ public function toDeleteRequestInformation(?DirectoryRoleItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -170,7 +161,6 @@ public function toGetRequestInformation(?DirectoryRoleItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -178,6 +168,7 @@ public function toGetRequestInformation(?DirectoryRoleItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -192,11 +183,11 @@ public function toPatchRequestInformation(DirectoryRole $body, ?DirectoryRoleIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/DirectoryRoles/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index 112d280c109..10b3b516bc3 100644 --- a/src/Generated/DirectoryRoles/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/DirectoryRoles/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index a696d88047f..dd6c057f97a 100644 --- a/src/Generated/DirectoryRoles/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/Count/CountRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/Count/CountRequestBuilder.php index 08951e3a61f..8af856bb4b2 100644 --- a/src/Generated/DirectoryRoles/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/GraphApplication/Count/CountRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/GraphApplication/Count/CountRequestBuilder.php index ec80d8709a1..6a79c86dca1 100644 --- a/src/Generated/DirectoryRoles/Item/Members/GraphApplication/Count/CountRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/GraphApplication/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/GraphApplication/GraphApplicationRequestBuilder.php index ccf05eee6ff..17123424969 100644 --- a/src/Generated/DirectoryRoles/Item/Members/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryRoles\Item\Members\GraphApplication\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ApplicationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.application in the microsoft.graph.directoryObject collection * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/GraphDevice/Count/CountRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/GraphDevice/Count/CountRequestBuilder.php index 908ac312613..d5b7216df46 100644 --- a/src/Generated/DirectoryRoles/Item/Members/GraphDevice/Count/CountRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/GraphDevice/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/GraphDevice/GraphDeviceRequestBuilder.php index 0bb2728f309..9d2fb7f15ce 100644 --- a/src/Generated/DirectoryRoles/Item/Members/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryRoles\Item\Members\GraphDevice\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.device in the microsoft.graph.directoryObject collection * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/GraphGroup/Count/CountRequestBuilder.php index 8c08e215d28..9607edd23de 100644 --- a/src/Generated/DirectoryRoles/Item/Members/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/GraphGroup/GraphGroupRequestBuilder.php index 70fc503ae0e..6e48b98a565 100644 --- a/src/Generated/DirectoryRoles/Item/Members/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryRoles\Item\Members\GraphGroup\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/GraphOrgContact/Count/CountRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/GraphOrgContact/Count/CountRequestBuilder.php index d89d3de6c25..ab6ad59d65c 100644 --- a/src/Generated/DirectoryRoles/Item/Members/GraphOrgContact/Count/CountRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/GraphOrgContact/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/GraphOrgContact/GraphOrgContactRequestBuilder.php index efef1c9277c..aad244b0d01 100644 --- a/src/Generated/DirectoryRoles/Item/Members/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryRoles\Item\Members\GraphOrgContact\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContactCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.orgContact in the microsoft.graph.directoryObject collection * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/GraphServicePrincipal/Count/CountRequestBuilder.php index aedf7552e6f..8ae4855631a 100644 --- a/src/Generated/DirectoryRoles/Item/Members/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 84db54e5b35..ebd106a3e78 100644 --- a/src/Generated/DirectoryRoles/Item/Members/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryRoles\Item\Members\GraphServicePrincipal\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/GraphUser/Count/CountRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/GraphUser/Count/CountRequestBuilder.php index 8974861107d..92208e2c436 100644 --- a/src/Generated/DirectoryRoles/Item/Members/GraphUser/Count/CountRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/GraphUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/GraphUser/GraphUserRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/GraphUser/GraphUserRequestBuilder.php index c4a5f3114c3..9762ee4a3c5 100644 --- a/src/Generated/DirectoryRoles/Item/Members/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryRoles\Item\Members\GraphUser\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.user in the microsoft.graph.directoryObject collection * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/Item/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/Item/GraphApplication/GraphApplicationRequestBuilder.php index bbfae50f228..b3917d8cbb5 100644 --- a/src/Generated/DirectoryRoles/Item/Members/Item/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/Item/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Application; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.application * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/Item/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/Item/GraphDevice/GraphDeviceRequestBuilder.php index cdc17cf397e..482b57081e5 100644 --- a/src/Generated/DirectoryRoles/Item/Members/Item/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/Item/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Device; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.device * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/Item/GraphGroup/GraphGroupRequestBuilder.php index 7dab09c7b8d..d9d5189fd1d 100644 --- a/src/Generated/DirectoryRoles/Item/Members/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php index 27a4188a8fc..cf34ce0cfc7 100644 --- a/src/Generated/DirectoryRoles/Item/Members/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContact; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.orgContact * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index b65209ccb19..3c39b7b3b22 100644 --- a/src/Generated/DirectoryRoles/Item/Members/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/Item/GraphUser/GraphUserRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/Item/GraphUser/GraphUserRequestBuilder.php index 33312eaeb33..132d47e5a0c 100644 --- a/src/Generated/DirectoryRoles/Item/Members/Item/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/Item/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.user * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/Item/Ref/RefRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/Item/Ref/RefRequestBuilder.php index d7c555e77fb..476c3e8e117 100644 --- a/src/Generated/DirectoryRoles/Item/Members/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a member from a directoryRole. You can use both the object ID and template ID of the directoryRole with this API. The template ID of a built-in role is immutable and can be seen in the role description on the Microsoft Entra admin center. For details, see Role template IDs. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryrole-delete-member?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/MembersRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/MembersRequestBuilder.php index b8d3c63ad9f..927210f66e9 100644 --- a/src/Generated/DirectoryRoles/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryRoles\Item\Members\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DirectoryRoles\Item\Members\GraphApplication\GraphApplicationRequestBuilder; use Microsoft\Graph\Generated\DirectoryRoles\Item\Members\GraphDevice\GraphDeviceRequestBuilder; @@ -110,20 +109,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Users that are members of this directory role. HTTP Methods: GET, POST, DELETE. Read-only. Nullable. Supports $expand. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryrole-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -136,7 +132,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -144,6 +139,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Members/Ref/RefRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Members/Ref/RefRequestBuilder.php index b626c8b2137..271f3423fff 100644 --- a/src/Generated/DirectoryRoles/Item/Members/Ref/RefRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Members/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Users that are members of this directory role. HTTP Methods: GET, POST, DELETE. Read-only. Nullable. Supports $expand. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryrole-list-members?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new directory role member. You can use both the object ID and template ID of the directoryRole with this API. The template ID of a built-in role is immutable and can be seen in the role description on the Microsoft Entra admin center. For details, see Role template IDs. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryrole-post-members?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/Restore/RestoreRequestBuilder.php b/src/Generated/DirectoryRoles/Item/Restore/RestoreRequestBuilder.php index 7ab4f85646d..703b89fe70b 100644 --- a/src/Generated/DirectoryRoles/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/ScopedMembers/Count/CountRequestBuilder.php b/src/Generated/DirectoryRoles/Item/ScopedMembers/Count/CountRequestBuilder.php index e9a1ef7e608..3bbca02c6aa 100644 --- a/src/Generated/DirectoryRoles/Item/ScopedMembers/Count/CountRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/ScopedMembers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/ScopedMembers/Item/ScopedRoleMembershipItemRequestBuilder.php b/src/Generated/DirectoryRoles/Item/ScopedMembers/Item/ScopedRoleMembershipItemRequestBuilder.php index fb8c0504671..a6736789441 100644 --- a/src/Generated/DirectoryRoles/Item/ScopedMembers/Item/ScopedRoleMembershipItemRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/ScopedMembers/Item/ScopedRoleMembershipItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ScopedRoleMembership; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopedMembers for directoryRoles * @param ScopedRoleMembershipItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ScopedRoleMembershipItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Members of this directory role that are scoped to administrative units. Read-only. Nullable. * @param ScopedRoleMembershipItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopedRoleMembershipItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopedMembers in directoryRoles * @param ScopedRoleMembership $body The request body * @param ScopedRoleMembershipItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ScopedRoleMembership $body, ?ScopedRoleMembershipItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ScopedRoleMembershipItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ScopedRoleMembershipItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ScopedRoleMembershipItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ScopedRoleMembership $body, ?ScopedRol $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/Item/ScopedMembers/ScopedMembersRequestBuilder.php b/src/Generated/DirectoryRoles/Item/ScopedMembers/ScopedMembersRequestBuilder.php index f6af0f4a22c..bf417fd34b1 100644 --- a/src/Generated/DirectoryRoles/Item/ScopedMembers/ScopedMembersRequestBuilder.php +++ b/src/Generated/DirectoryRoles/Item/ScopedMembers/ScopedMembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DirectoryRoles\Item\ScopedMembers\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DirectoryRoles\Item\ScopedMembers\Item\ScopedRoleMembershipItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of scopedRoleMembership objects for a directory role. This API is available in the following national cloud deployments. * @param ScopedMembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryrole-list-scopedmembers?view=graph-rest-1.0 Find more info here */ public function get(?ScopedMembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembershipCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembershipCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopedMembers for directoryRoles * @param ScopedRoleMembership $body The request body * @param ScopedMembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ScopedRoleMembership $body, ?ScopedMembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ScopedMembersRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ScopedMembersRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ScopedRoleMembership $body, ?ScopedMemb $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRoles/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/DirectoryRoles/ValidateProperties/ValidatePropertiesRequestBuilder.php index d50d08bd115..f18c37f25e4 100644 --- a/src/Generated/DirectoryRoles/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/DirectoryRoles/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DirectoryRolesWithRoleTemplateId/DirectoryRolesWithRoleTemplateIdRequestBuilder.php b/src/Generated/DirectoryRolesWithRoleTemplateId/DirectoryRolesWithRoleTemplateIdRequestBuilder.php index fdceaa652f3..6cf1b09fe81 100644 --- a/src/Generated/DirectoryRolesWithRoleTemplateId/DirectoryRolesWithRoleTemplateIdRequestBuilder.php +++ b/src/Generated/DirectoryRolesWithRoleTemplateId/DirectoryRolesWithRoleTemplateIdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,57 +36,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from directoryRoles by roleTemplateId * @param DirectoryRolesWithRoleTemplateIdRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DirectoryRolesWithRoleTemplateIdRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of a directoryRole object. The role must be activated in tenant for a successful response. You can use both the object ID and template ID of the directoryRole with this API. The template ID of a built-in role is immutable and can be seen in the role description on the Microsoft Entra admin center. For details, see Role template IDs. This API is available in the following national cloud deployments. * @param DirectoryRolesWithRoleTemplateIdRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryrole-get?view=graph-rest-1.0 Find more info here */ public function get(?DirectoryRolesWithRoleTemplateIdRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in directoryRoles by roleTemplateId * @param DirectoryRole $body The request body * @param DirectoryRolesWithRoleTemplateIdRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DirectoryRole $body, ?DirectoryRolesWithRoleTemplateIdRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -104,6 +94,7 @@ public function toDeleteRequestInformation(?DirectoryRolesWithRoleTemplateIdRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -117,7 +108,6 @@ public function toGetRequestInformation(?DirectoryRolesWithRoleTemplateIdRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -125,6 +115,7 @@ public function toGetRequestInformation(?DirectoryRolesWithRoleTemplateIdRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -139,11 +130,11 @@ public function toPatchRequestInformation(DirectoryRole $body, ?DirectoryRolesWi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DomainDnsRecords/Count/CountRequestBuilder.php b/src/Generated/DomainDnsRecords/Count/CountRequestBuilder.php index fc0175cbd27..6aa66db6e51 100644 --- a/src/Generated/DomainDnsRecords/Count/CountRequestBuilder.php +++ b/src/Generated/DomainDnsRecords/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/DomainDnsRecords/DomainDnsRecordsRequestBuilder.php b/src/Generated/DomainDnsRecords/DomainDnsRecordsRequestBuilder.php index cee44e43717..6f6da81e952 100644 --- a/src/Generated/DomainDnsRecords/DomainDnsRecordsRequestBuilder.php +++ b/src/Generated/DomainDnsRecords/DomainDnsRecordsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\DomainDnsRecords\Count\CountRequestBuilder; use Microsoft\Graph\Generated\DomainDnsRecords\Item\DomainDnsRecordItemRequestBuilder; use Microsoft\Graph\Generated\Models\DomainDnsRecord; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from domainDnsRecords * @param DomainDnsRecordsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DomainDnsRecordsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to domainDnsRecords * @param DomainDnsRecord $body The request body * @param DomainDnsRecordsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DomainDnsRecord $body, ?DomainDnsRecordsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DomainDnsRecordsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DomainDnsRecordsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DomainDnsRecord $body, ?DomainDnsRecord $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/DomainDnsRecords/Item/DomainDnsRecordItemRequestBuilder.php b/src/Generated/DomainDnsRecords/Item/DomainDnsRecordItemRequestBuilder.php index 13991dc9032..7251aca8c31 100644 --- a/src/Generated/DomainDnsRecords/Item/DomainDnsRecordItemRequestBuilder.php +++ b/src/Generated/DomainDnsRecords/Item/DomainDnsRecordItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DomainDnsRecord; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from domainDnsRecords * @param DomainDnsRecordItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DomainDnsRecordItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entity from domainDnsRecords by key * @param DomainDnsRecordItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DomainDnsRecordItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in domainDnsRecords * @param DomainDnsRecord $body The request body * @param DomainDnsRecordItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DomainDnsRecord $body, ?DomainDnsRecordItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DomainDnsRecordItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DomainDnsRecordItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DomainDnsRecordItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(DomainDnsRecord $body, ?DomainDnsRecor $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Domains/Count/CountRequestBuilder.php b/src/Generated/Domains/Count/CountRequestBuilder.php index aa57609c433..aa374989256 100644 --- a/src/Generated/Domains/Count/CountRequestBuilder.php +++ b/src/Generated/Domains/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Domains/DomainsRequestBuilder.php b/src/Generated/Domains/DomainsRequestBuilder.php index 6b3a3c38387..a8bdf77ea8c 100644 --- a/src/Generated/Domains/DomainsRequestBuilder.php +++ b/src/Generated/Domains/DomainsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Domains\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Domains\Item\DomainItemRequestBuilder; use Microsoft\Graph\Generated\Models\Domain; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of domain objects. This API is available in the following national cloud deployments. * @param DomainsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/domain-list?view=graph-rest-1.0 Find more info here */ public function get(?DomainsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DomainCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DomainCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Adds a domain to the tenant. Important: You cannot use an associated domain with your Azure AD tenant until ownership is verified. See List verificationDnsRecords for details. Root domains require verification. For example, contoso.com requires verification. If a root domain is verified, subdomains of the root domain are automatically verified. For example, subdomain.contoso.com is automatically be verified if contoso.com has been verified. This API is available in the following national cloud deployments. + * Adds a domain to the tenant. Important: You cannot use an associated domain with your Microsoft Entra tenant until ownership is verified. See List verificationDnsRecords for details. Root domains require verification. For example, contoso.com requires verification. If a root domain is verified, subdomains of the root domain are automatically verified. For example, subdomain.contoso.com is automatically be verified if contoso.com has been verified. This API is available in the following national cloud deployments. * @param Domain $body The request body * @param DomainsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/domain-post-domains?view=graph-rest-1.0 Find more info here */ public function post(Domain $body, ?DomainsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Domain::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Domain::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DomainsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,11 +101,12 @@ public function toGetRequestInformation(?DomainsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Adds a domain to the tenant. Important: You cannot use an associated domain with your Azure AD tenant until ownership is verified. See List verificationDnsRecords for details. Root domains require verification. For example, contoso.com requires verification. If a root domain is verified, subdomains of the root domain are automatically verified. For example, subdomain.contoso.com is automatically be verified if contoso.com has been verified. This API is available in the following national cloud deployments. + * Adds a domain to the tenant. Important: You cannot use an associated domain with your Microsoft Entra tenant until ownership is verified. See List verificationDnsRecords for details. Root domains require verification. For example, contoso.com requires verification. If a root domain is verified, subdomains of the root domain are automatically verified. For example, subdomain.contoso.com is automatically be verified if contoso.com has been verified. This API is available in the following national cloud deployments. * @param Domain $body The request body * @param DomainsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -123,11 +116,11 @@ public function toPostRequestInformation(Domain $body, ?DomainsRequestBuilderPos $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Domains/Item/DomainItemRequestBuilder.php b/src/Generated/Domains/Item/DomainItemRequestBuilder.php index 508db2ce384..58e0799fd2e 100644 --- a/src/Generated/Domains/Item/DomainItemRequestBuilder.php +++ b/src/Generated/Domains/Item/DomainItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Domains\Item\DomainNameReferences\DomainNameReferencesRequestBuilder; use Microsoft\Graph\Generated\Domains\Item\FederationConfiguration\FederationConfigurationRequestBuilder; use Microsoft\Graph\Generated\Domains\Item\ForceDelete\ForceDeleteRequestBuilder; @@ -90,59 +89,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a domain from a tenant. This API is available in the following national cloud deployments. * @param DomainItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/domain-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DomainItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of domain object. This API is available in the following national cloud deployments. * @param DomainItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/domain-get?view=graph-rest-1.0 Find more info here */ public function get(?DomainItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Domain::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Domain::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of domain object. This API is available in the following national cloud deployments. * @param Domain $body The request body * @param DomainItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/domain-update?view=graph-rest-1.0 Find more info here */ public function patch(Domain $body, ?DomainItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Domain::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Domain::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -159,6 +149,7 @@ public function toDeleteRequestInformation(?DomainItemRequestBuilderDeleteReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -172,7 +163,6 @@ public function toGetRequestInformation(?DomainItemRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -180,6 +170,7 @@ public function toGetRequestInformation(?DomainItemRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -194,11 +185,11 @@ public function toPatchRequestInformation(Domain $body, ?DomainItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Domains/Item/DomainNameReferences/Count/CountRequestBuilder.php b/src/Generated/Domains/Item/DomainNameReferences/Count/CountRequestBuilder.php index 2cec124afc5..033882770a3 100644 --- a/src/Generated/Domains/Item/DomainNameReferences/Count/CountRequestBuilder.php +++ b/src/Generated/Domains/Item/DomainNameReferences/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Domains/Item/DomainNameReferences/DomainNameReferencesRequestBuilder.php b/src/Generated/Domains/Item/DomainNameReferences/DomainNameReferencesRequestBuilder.php index ff4748f07ea..a8682d1d143 100644 --- a/src/Generated/Domains/Item/DomainNameReferences/DomainNameReferencesRequestBuilder.php +++ b/src/Generated/Domains/Item/DomainNameReferences/DomainNameReferencesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Domains\Item\DomainNameReferences\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Domains\Item\DomainNameReferences\Item\DirectoryObjectItemRequestBuilder; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of directoryObject with a reference to the domain. The returned list will contain all directory objects that have a dependency on the domain. This API is available in the following national cloud deployments. * @param DomainNameReferencesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/domain-list-domainnamereferences?view=graph-rest-1.0 Find more info here */ public function get(?DomainNameReferencesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?DomainNameReferencesRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?DomainNameReferencesRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Domains/Item/DomainNameReferences/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Domains/Item/DomainNameReferences/Item/DirectoryObjectItemRequestBuilder.php index f2088c00b1d..a75b8596b36 100644 --- a/src/Generated/Domains/Item/DomainNameReferences/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Domains/Item/DomainNameReferences/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The objects such as users and groups that reference the domain ID. Read-only, Nullable. Supports $expand and $filter by the OData type of objects returned. For example /domains/{domainId}/domainNameReferences/microsoft.graph.user and /domains/{domainId}/domainNameReferences/microsoft.graph.group. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Domains/Item/FederationConfiguration/Count/CountRequestBuilder.php b/src/Generated/Domains/Item/FederationConfiguration/Count/CountRequestBuilder.php index 794bcc77040..1a6a2e04bce 100644 --- a/src/Generated/Domains/Item/FederationConfiguration/Count/CountRequestBuilder.php +++ b/src/Generated/Domains/Item/FederationConfiguration/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Domains/Item/FederationConfiguration/FederationConfigurationRequestBuilder.php b/src/Generated/Domains/Item/FederationConfiguration/FederationConfigurationRequestBuilder.php index 0b1c9c80bdb..627ba0c3993 100644 --- a/src/Generated/Domains/Item/FederationConfiguration/FederationConfigurationRequestBuilder.php +++ b/src/Generated/Domains/Item/FederationConfiguration/FederationConfigurationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Domains\Item\FederationConfiguration\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Domains\Item\FederationConfiguration\Item\InternalDomainFederationItemRequestBuilder; use Microsoft\Graph\Generated\Models\InternalDomainFederation; @@ -53,45 +52,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Read the properties and relationships of an internalDomainFederation object. This API is available in the following national cloud deployments. + * Read the properties of the internalDomainFederation objects for the domain. This API returns only one object in the collection. This API is available in the following national cloud deployments. * @param FederationConfigurationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/domain-list-federationconfiguration?view=graph-rest-1.0 Find more info here */ public function get(?FederationConfigurationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InternalDomainFederationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InternalDomainFederationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new internalDomainFederation object. This API is available in the following national cloud deployments. * @param InternalDomainFederation $body The request body * @param FederationConfigurationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/domain-post-federationconfiguration?view=graph-rest-1.0 Find more info here */ public function post(InternalDomainFederation $body, ?FederationConfigurationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InternalDomainFederation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InternalDomainFederation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Read the properties and relationships of an internalDomainFederation object. This API is available in the following national cloud deployments. + * Read the properties of the internalDomainFederation objects for the domain. This API returns only one object in the collection. This API is available in the following national cloud deployments. * @param FederationConfigurationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +94,6 @@ public function toGetRequestInformation(?FederationConfigurationRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +101,7 @@ public function toGetRequestInformation(?FederationConfigurationRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +116,11 @@ public function toPostRequestInformation(InternalDomainFederation $body, ?Federa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Domains/Item/FederationConfiguration/FederationConfigurationRequestBuilderGetQueryParameters.php b/src/Generated/Domains/Item/FederationConfiguration/FederationConfigurationRequestBuilderGetQueryParameters.php index 0cfd59ae1d7..029fb25460b 100644 --- a/src/Generated/Domains/Item/FederationConfiguration/FederationConfigurationRequestBuilderGetQueryParameters.php +++ b/src/Generated/Domains/Item/FederationConfiguration/FederationConfigurationRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read the properties and relationships of an internalDomainFederation object. This API is available in the following national cloud deployments. + * Read the properties of the internalDomainFederation objects for the domain. This API returns only one object in the collection. This API is available in the following national cloud deployments. */ class FederationConfigurationRequestBuilderGetQueryParameters { diff --git a/src/Generated/Domains/Item/FederationConfiguration/Item/InternalDomainFederationItemRequestBuilder.php b/src/Generated/Domains/Item/FederationConfiguration/Item/InternalDomainFederationItemRequestBuilder.php index 18376672225..6742cf6d73c 100644 --- a/src/Generated/Domains/Item/FederationConfiguration/Item/InternalDomainFederationItemRequestBuilder.php +++ b/src/Generated/Domains/Item/FederationConfiguration/Item/InternalDomainFederationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\InternalDomainFederation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an internalDomainFederation object. This API is available in the following national cloud deployments. * @param InternalDomainFederationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/internaldomainfederation-delete?view=graph-rest-1.0 Find more info here */ public function delete(?InternalDomainFederationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an internalDomainFederation object. This API is available in the following national cloud deployments. * @param InternalDomainFederationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/internaldomainfederation-get?view=graph-rest-1.0 Find more info here */ public function get(?InternalDomainFederationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InternalDomainFederation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InternalDomainFederation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an internalDomainFederation object. This API is available in the following national cloud deployments. * @param InternalDomainFederation $body The request body * @param InternalDomainFederationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/internaldomainfederation-update?view=graph-rest-1.0 Find more info here */ public function patch(InternalDomainFederation $body, ?InternalDomainFederationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InternalDomainFederation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InternalDomainFederation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?InternalDomainFederationItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?InternalDomainFederationItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?InternalDomainFederationItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(InternalDomainFederation $body, ?Inter $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Domains/Item/ForceDelete/ForceDeleteRequestBuilder.php b/src/Generated/Domains/Item/ForceDelete/ForceDeleteRequestBuilder.php index ea9a82b5851..8fc1bf77048 100644 --- a/src/Generated/Domains/Item/ForceDelete/ForceDeleteRequestBuilder.php +++ b/src/Generated/Domains/Item/ForceDelete/ForceDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Deletes a domain using an asynchronous long-running operation. Prior to calling forceDelete, you must update or remove any references to Exchange as the provisioning service. The following actions are performed as part of this operation: After the domain deletion completes, API operations for the deleted domain will return an HTTP 404 status code. To verify deletion of a domain, you can perform a get domain operation. This API is available in the following national cloud deployments. * @param ForceDeletePostRequestBody $body The request body * @param ForceDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/domain-forcedelete?view=graph-rest-1.0 Find more info here */ public function post(ForceDeletePostRequestBody $body, ?ForceDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForceDeletePostRequestBody $body, ?Forc $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Domains/Item/Promote/PromoteRequestBuilder.php b/src/Generated/Domains/Item/Promote/PromoteRequestBuilder.php index bc4f9a95e73..de9ba7dab1e 100644 --- a/src/Generated/Domains/Item/Promote/PromoteRequestBuilder.php +++ b/src/Generated/Domains/Item/Promote/PromoteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Promote a verified subdomain to the root domain. A verified domain has its isVerified property set to true. This API is available in the following national cloud deployments. * @param PromoteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/domain-promote?view=graph-rest-1.0 Find more info here */ public function post(?PromoteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PromotePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PromotePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toPostRequestInformation(?PromoteRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Domains/Item/ServiceConfigurationRecords/Count/CountRequestBuilder.php b/src/Generated/Domains/Item/ServiceConfigurationRecords/Count/CountRequestBuilder.php index b9fa7731f1c..de5a05d0c2c 100644 --- a/src/Generated/Domains/Item/ServiceConfigurationRecords/Count/CountRequestBuilder.php +++ b/src/Generated/Domains/Item/ServiceConfigurationRecords/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Domains/Item/ServiceConfigurationRecords/Item/DomainDnsRecordItemRequestBuilder.php b/src/Generated/Domains/Item/ServiceConfigurationRecords/Item/DomainDnsRecordItemRequestBuilder.php index ae286ef9ad4..809743efa35 100644 --- a/src/Generated/Domains/Item/ServiceConfigurationRecords/Item/DomainDnsRecordItemRequestBuilder.php +++ b/src/Generated/Domains/Item/ServiceConfigurationRecords/Item/DomainDnsRecordItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DomainDnsRecord; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property serviceConfigurationRecords for domains * @param DomainDnsRecordItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DomainDnsRecordItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * DNS records the customer adds to the DNS zone file of the domain before the domain can be used by Microsoft Online services. Read-only, Nullable. Supports $expand. * @param DomainDnsRecordItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DomainDnsRecordItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property serviceConfigurationRecords in domains * @param DomainDnsRecord $body The request body * @param DomainDnsRecordItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DomainDnsRecord $body, ?DomainDnsRecordItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DomainDnsRecordItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DomainDnsRecordItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DomainDnsRecordItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(DomainDnsRecord $body, ?DomainDnsRecor $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Domains/Item/ServiceConfigurationRecords/ServiceConfigurationRecordsRequestBuilder.php b/src/Generated/Domains/Item/ServiceConfigurationRecords/ServiceConfigurationRecordsRequestBuilder.php index 98e32dae59f..ccbb47b0c30 100644 --- a/src/Generated/Domains/Item/ServiceConfigurationRecords/ServiceConfigurationRecordsRequestBuilder.php +++ b/src/Generated/Domains/Item/ServiceConfigurationRecords/ServiceConfigurationRecordsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Domains\Item\ServiceConfigurationRecords\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Domains\Item\ServiceConfigurationRecords\Item\DomainDnsRecordItemRequestBuilder; use Microsoft\Graph\Generated\Models\DomainDnsRecord; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieves a list of domainDnsRecord objects needed to enable services for the domain. Use the returned list to add records to the zone file of the domain. This can be done through the domain registrar or DNS server configuration. This API is available in the following national cloud deployments. * @param ServiceConfigurationRecordsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/domain-list-serviceconfigurationrecords?view=graph-rest-1.0 Find more info here */ public function get(?ServiceConfigurationRecordsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to serviceConfigurationRecords for domains * @param DomainDnsRecord $body The request body * @param ServiceConfigurationRecordsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DomainDnsRecord $body, ?ServiceConfigurationRecordsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ServiceConfigurationRecordsRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ServiceConfigurationRecordsRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(DomainDnsRecord $body, ?ServiceConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Domains/Item/VerificationDnsRecords/Count/CountRequestBuilder.php b/src/Generated/Domains/Item/VerificationDnsRecords/Count/CountRequestBuilder.php index a5b89faa543..bad6a1435fe 100644 --- a/src/Generated/Domains/Item/VerificationDnsRecords/Count/CountRequestBuilder.php +++ b/src/Generated/Domains/Item/VerificationDnsRecords/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Domains/Item/VerificationDnsRecords/Item/DomainDnsRecordItemRequestBuilder.php b/src/Generated/Domains/Item/VerificationDnsRecords/Item/DomainDnsRecordItemRequestBuilder.php index 49e741d037c..8c8ed68fb1b 100644 --- a/src/Generated/Domains/Item/VerificationDnsRecords/Item/DomainDnsRecordItemRequestBuilder.php +++ b/src/Generated/Domains/Item/VerificationDnsRecords/Item/DomainDnsRecordItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DomainDnsRecord; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property verificationDnsRecords for domains * @param DomainDnsRecordItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DomainDnsRecordItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * DNS records that the customer adds to the DNS zone file of the domain before the customer can complete domain ownership verification with Azure AD. Read-only, Nullable. Supports $expand. + * DNS records that the customer adds to the DNS zone file of the domain before the customer can complete domain ownership verification with Microsoft Entra ID. Read-only, Nullable. Supports $expand. * @param DomainDnsRecordItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DomainDnsRecordItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property verificationDnsRecords in domains * @param DomainDnsRecord $body The request body * @param DomainDnsRecordItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DomainDnsRecord $body, ?DomainDnsRecordItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,11 +90,12 @@ public function toDeleteRequestInformation(?DomainDnsRecordItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * DNS records that the customer adds to the DNS zone file of the domain before the customer can complete domain ownership verification with Azure AD. Read-only, Nullable. Supports $expand. + * DNS records that the customer adds to the DNS zone file of the domain before the customer can complete domain ownership verification with Microsoft Entra ID. Read-only, Nullable. Supports $expand. * @param DomainDnsRecordItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DomainDnsRecordItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DomainDnsRecordItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(DomainDnsRecord $body, ?DomainDnsRecor $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Domains/Item/VerificationDnsRecords/Item/DomainDnsRecordItemRequestBuilderGetQueryParameters.php b/src/Generated/Domains/Item/VerificationDnsRecords/Item/DomainDnsRecordItemRequestBuilderGetQueryParameters.php index fda04dd3e85..7896ff24c5b 100644 --- a/src/Generated/Domains/Item/VerificationDnsRecords/Item/DomainDnsRecordItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Domains/Item/VerificationDnsRecords/Item/DomainDnsRecordItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * DNS records that the customer adds to the DNS zone file of the domain before the customer can complete domain ownership verification with Azure AD. Read-only, Nullable. Supports $expand. + * DNS records that the customer adds to the DNS zone file of the domain before the customer can complete domain ownership verification with Microsoft Entra ID. Read-only, Nullable. Supports $expand. */ class DomainDnsRecordItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Domains/Item/VerificationDnsRecords/VerificationDnsRecordsRequestBuilder.php b/src/Generated/Domains/Item/VerificationDnsRecords/VerificationDnsRecordsRequestBuilder.php index 340c50fea44..ecbff57eae9 100644 --- a/src/Generated/Domains/Item/VerificationDnsRecords/VerificationDnsRecordsRequestBuilder.php +++ b/src/Generated/Domains/Item/VerificationDnsRecords/VerificationDnsRecordsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Domains\Item\VerificationDnsRecords\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Domains\Item\VerificationDnsRecords\Item\DomainDnsRecordItemRequestBuilder; use Microsoft\Graph\Generated\Models\DomainDnsRecord; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve a list of domainDnsRecord objects. You cannot use an associated domain with your Azure AD tenant until ownership is verified. To verify the ownership of the domain, retrieve the domain verification records and add the details to the zone file of the domain. This can be done through the domain registrar or DNS server configuration. Root domains require verification. For example, contoso.com requires verification. If a root domain is verified, subdomains of the root domain are automatically verified. For example, subdomain.contoso.com is automatically be verified if contoso.com has been verified. This API is available in the following national cloud deployments. + * Retrieve a list of domainDnsRecord objects. You cannot use an associated domain with your Microsoft Entra tenant until ownership is verified. To verify the ownership of the domain, retrieve the domain verification records and add the details to the zone file of the domain. This can be done through the domain registrar or DNS server configuration. Root domains require verification. For example, contoso.com requires verification. If a root domain is verified, subdomains of the root domain are automatically verified. For example, subdomain.contoso.com is automatically be verified if contoso.com has been verified. This API is available in the following national cloud deployments. * @param VerificationDnsRecordsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/domain-list-verificationdnsrecords?view=graph-rest-1.0 Find more info here */ public function get(?VerificationDnsRecordsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to verificationDnsRecords for domains * @param DomainDnsRecord $body The request body * @param VerificationDnsRecordsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DomainDnsRecord $body, ?VerificationDnsRecordsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DomainDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve a list of domainDnsRecord objects. You cannot use an associated domain with your Azure AD tenant until ownership is verified. To verify the ownership of the domain, retrieve the domain verification records and add the details to the zone file of the domain. This can be done through the domain registrar or DNS server configuration. Root domains require verification. For example, contoso.com requires verification. If a root domain is verified, subdomains of the root domain are automatically verified. For example, subdomain.contoso.com is automatically be verified if contoso.com has been verified. This API is available in the following national cloud deployments. + * Retrieve a list of domainDnsRecord objects. You cannot use an associated domain with your Microsoft Entra tenant until ownership is verified. To verify the ownership of the domain, retrieve the domain verification records and add the details to the zone file of the domain. This can be done through the domain registrar or DNS server configuration. Root domains require verification. For example, contoso.com requires verification. If a root domain is verified, subdomains of the root domain are automatically verified. For example, subdomain.contoso.com is automatically be verified if contoso.com has been verified. This API is available in the following national cloud deployments. * @param VerificationDnsRecordsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?VerificationDnsRecordsRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?VerificationDnsRecordsRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(DomainDnsRecord $body, ?VerificationDns $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Domains/Item/VerificationDnsRecords/VerificationDnsRecordsRequestBuilderGetQueryParameters.php b/src/Generated/Domains/Item/VerificationDnsRecords/VerificationDnsRecordsRequestBuilderGetQueryParameters.php index 62cdf4db863..b6886291bd2 100644 --- a/src/Generated/Domains/Item/VerificationDnsRecords/VerificationDnsRecordsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Domains/Item/VerificationDnsRecords/VerificationDnsRecordsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve a list of domainDnsRecord objects. You cannot use an associated domain with your Azure AD tenant until ownership is verified. To verify the ownership of the domain, retrieve the domain verification records and add the details to the zone file of the domain. This can be done through the domain registrar or DNS server configuration. Root domains require verification. For example, contoso.com requires verification. If a root domain is verified, subdomains of the root domain are automatically verified. For example, subdomain.contoso.com is automatically be verified if contoso.com has been verified. This API is available in the following national cloud deployments. + * Retrieve a list of domainDnsRecord objects. You cannot use an associated domain with your Microsoft Entra tenant until ownership is verified. To verify the ownership of the domain, retrieve the domain verification records and add the details to the zone file of the domain. This can be done through the domain registrar or DNS server configuration. Root domains require verification. For example, contoso.com requires verification. If a root domain is verified, subdomains of the root domain are automatically verified. For example, subdomain.contoso.com is automatically be verified if contoso.com has been verified. This API is available in the following national cloud deployments. */ class VerificationDnsRecordsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Domains/Item/Verify/VerifyRequestBuilder.php b/src/Generated/Domains/Item/Verify/VerifyRequestBuilder.php index 293bee8bcff..f6792a960e9 100644 --- a/src/Generated/Domains/Item/Verify/VerifyRequestBuilder.php +++ b/src/Generated/Domains/Item/Verify/VerifyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Domain; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Validates the ownership of the domain. This API is available in the following national cloud deployments. * @param VerifyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/domain-verify?view=graph-rest-1.0 Find more info here */ public function post(?VerifyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Domain::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Domain::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?VerifyRequestBuilderPostRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/DrivesRequestBuilder.php b/src/Generated/Drives/DrivesRequestBuilder.php index 5b93fe61cff..e809f36454a 100644 --- a/src/Generated/Drives/DrivesRequestBuilder.php +++ b/src/Generated/Drives/DrivesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\DriveItemRequestBuilder; use Microsoft\Graph\Generated\Models\Drive; use Microsoft\Graph\Generated\Models\DriveCollectionResponse; @@ -47,38 +46,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from drives * @param DrivesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DrivesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to drives * @param Drive $body The request body * @param DrivesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Drive $body, ?DrivesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -91,7 +84,6 @@ public function toGetRequestInformation(?DrivesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -99,6 +91,7 @@ public function toGetRequestInformation(?DrivesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -113,11 +106,11 @@ public function toPostRequestInformation(Drive $body, ?DrivesRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Bundles/BundlesRequestBuilder.php b/src/Generated/Drives/Item/Bundles/BundlesRequestBuilder.php index 68427ba7f66..118a51466ad 100644 --- a/src/Generated/Drives/Item/Bundles/BundlesRequestBuilder.php +++ b/src/Generated/Drives/Item/Bundles/BundlesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Bundles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Bundles\Item\DriveItemItemRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of [bundles][bundle] (albums and multi-select-shared sets of items). Only in personal OneDrive. * @param BundlesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BundlesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to bundles for drives * @param DriveItem $body The request body * @param BundlesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DriveItem $body, ?BundlesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?BundlesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?BundlesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DriveItem $body, ?BundlesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Bundles/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Bundles/Count/CountRequestBuilder.php index f3df0a7ecb4..c9ce9b7d33d 100644 --- a/src/Generated/Drives/Item/Bundles/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Bundles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Bundles/Item/Content/ContentRequestBuilder.php b/src/Generated/Drives/Item/Bundles/Item/Content/ContentRequestBuilder.php index 3cf41f6809a..3cc8f7743b6 100644 --- a/src/Generated/Drives/Item/Bundles/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Drives/Item/Bundles/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Bundles/Item/DriveItemItemRequestBuilder.php b/src/Generated/Drives/Item/Bundles/Item/DriveItemItemRequestBuilder.php index 236a566b7fd..7be061e5e25 100644 --- a/src/Generated/Drives/Item/Bundles/Item/DriveItemItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Bundles/Item/DriveItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Bundles\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of [bundles][bundle] (albums and multi-select-shared sets of items). Only in personal OneDrive. * @param DriveItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?DriveItemItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?DriveItemItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/CreatedByUser/CreatedByUserRequestBuilder.php b/src/Generated/Drives/Item/CreatedByUser/CreatedByUserRequestBuilder.php index 860d913fbbc..77036624482 100644 --- a/src/Generated/Drives/Item/CreatedByUser/CreatedByUserRequestBuilder.php +++ b/src/Generated/Drives/Item/CreatedByUser/CreatedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\CreatedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\CreatedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who created the item. Read-only. * @param CreatedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Drives/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 4a350ba56bb..bc5d890b73d 100644 --- a/src/Generated/Drives/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Drives/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index e07ff742e53..bf971f1f508 100644 --- a/src/Generated/Drives/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Drives/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index a7c47df62ce..0eb08d339ac 100644 --- a/src/Generated/Drives/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Drives/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\CreatedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/DriveItemRequestBuilder.php b/src/Generated/Drives/Item/DriveItemRequestBuilder.php index e2fcf8074fb..a70cb86de3e 100644 --- a/src/Generated/Drives/Item/DriveItemRequestBuilder.php +++ b/src/Generated/Drives/Item/DriveItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Bundles\BundlesRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\CreatedByUser\CreatedByUserRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ListRequestBuilder; @@ -115,56 +114,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from drives * @param DriveItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DriveItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entity from drives by key * @param DriveItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in drives * @param Drive $body The request body * @param DriveItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Drive $body, ?DriveItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -190,6 +180,7 @@ public function toDeleteRequestInformation(?DriveItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -203,7 +194,6 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -211,6 +201,7 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -225,11 +216,11 @@ public function toPatchRequestInformation(Drive $body, ?DriveItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Columns/ColumnsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Columns/ColumnsRequestBuilder.php index 5f52620740e..5412270dba1 100644 --- a/src/Generated/Drives/Item/EscapedList/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Columns\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Columns\Item\ColumnDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinition; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of columns represented as columnDefinition][columnDefinition] resources in a [list][list]. This API is available in the following [national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a column for a list][list] with a request that specifies a [columnDefinition][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-post-columns?view=graph-rest-1.0 Find more info here */ public function post(ColumnDefinition $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ColumnDefinition $body, ?ColumnsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Columns/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Columns/Count/CountRequestBuilder.php index 03e3956a4f0..c7f0b522990 100644 --- a/src/Generated/Drives/Item/EscapedList/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Columns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Columns/Item/ColumnDefinitionItemRequestBuilder.php index 8b0584c2aa9..1133ffd6af5 100644 --- a/src/Generated/Drives/Item/EscapedList/Columns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Columns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Columns\Item\SourceColumn\SourceColumnRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property columns for drives * @param ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of field definitions for this list. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property columns in drives * @param ColumnDefinition $body The request body * @param ColumnDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ColumnDefinition $body, ?ColumnDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ColumnDefinitionItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ColumnDefinition $body, ?ColumnDefinit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php index 7d1247730ff..096bbcd88fa 100644 --- a/src/Generated/Drives/Item/EscapedList/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The source column for the content type column. * @param SourceColumnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SourceColumnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/AddCopy/AddCopyRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/AddCopy/AddCopyRequestBuilder.php index 9927cb54497..917aec1c2dc 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/AddCopy/AddCopyRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/AddCopy/AddCopyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add a copy of a content type][contentType] from a [site][site] to a [list][list]. This API is available in the following [national cloud deployments. * @param AddCopyPostRequestBody $body The request body * @param AddCopyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-addcopy?view=graph-rest-1.0 Find more info here */ public function post(AddCopyPostRequestBody $body, ?AddCopyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddCopyPostRequestBody $body, ?AddCopyR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php index eff4e64fcad..16da33ba95a 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add or sync a copy of a published content type from the content type hub to a target site or a list. This method is part of the content type publishing changes to optimize the syncing of published content types to sites and lists, effectively switching from a 'push everywhere' to 'pull as needed' approach. The method allows users to pull content types directly from the content type hub to a site or list. For more information, see contentType: getCompatibleHubContentTypes and the blog post Syntex Product Updates – August 2021. This API is available in the following national cloud deployments. * @param AddCopyFromContentTypeHubPostRequestBody $body The request body * @param AddCopyFromContentTypeHubRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-addcopyfromcontenttypehub?view=graph-rest-1.0 Find more info here */ public function post(AddCopyFromContentTypeHubPostRequestBody $body, ?AddCopyFromContentTypeHubRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddCopyFromContentTypeHubPostRequestBod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/ContentTypesRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/ContentTypesRequestBuilder.php index 035b837feb2..b939e8f9af2 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/ContentTypesRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/ContentTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\AddCopy\AddCopyRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\AddCopyFromContentTypeHub\AddCopyFromContentTypeHubRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\Count\CountRequestBuilder; @@ -79,39 +78,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of contentType][contentType] resources in a [list][]. This API is available in the following [national cloud deployments. * @param ContentTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-list-contenttypes?view=graph-rest-1.0 Find more info here */ public function get(?ContentTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentTypes for drives * @param ContentType $body The request body * @param ContentTypesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ContentType $body, ?ContentTypesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,7 +117,6 @@ public function toGetRequestInformation(?ContentTypesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +124,7 @@ public function toGetRequestInformation(?ContentTypesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +139,11 @@ public function toPostRequestInformation(ContentType $body, ?ContentTypesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Count/CountRequestBuilder.php index d0e6ea5fc5a..28b0c846c0a 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php index a6cde6677fc..b1df090d45e 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getCompatibleHubContentTypes * @param GetCompatibleHubContentTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetCompatibleHubContentTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetCompatibleHubContentTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetCompatibleHubContentTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetCompatibleHubContentTypesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetCompatibleHubContentTypesRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php index 7dce8bbe4c4..066c4885615 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Associate a published content type][contentType] present in a content type hub with a list of hub sites. This API is available in the following [national cloud deployments. * @param AssociateWithHubSitesPostRequestBody $body The request body * @param AssociateWithHubSitesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-associatewithhubsites?view=graph-rest-1.0 Find more info here */ public function post(AssociateWithHubSitesPostRequestBody $body, ?AssociateWithHubSitesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AssociateWithHubSitesPostRequestBody $b $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php index 60a18d40654..6dfe6b28392 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Parent contentType from which this content type is derived. * @param BaseRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?BaseRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?BaseRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php index f53aeee3abb..e481f07c0a0 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\Item\BaseTypes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\Item\BaseTypes\Item\ContentTypeItemRequestBuilder; use Microsoft\Graph\Generated\Models\ContentTypeCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of content types that are ancestors of this content type. * @param BaseTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?BaseTypesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?BaseTypesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php index d257aafa9ed..38502436dbe 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php index 90e35e24a01..611665a0e99 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of content types that are ancestors of this content type. * @param ContentTypeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentTypeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php index 7a1e087788b..426d2f23d7e 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\Item\ColumnLinks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\Item\ColumnLinks\Item\ColumnLinkItemRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnLink; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of columns that are required by this content type. * @param ColumnLinksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnLinksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLinkCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLinkCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to columnLinks for drives * @param ColumnLink $body The request body * @param ColumnLinksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ColumnLink $body, ?ColumnLinksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ColumnLinksRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ColumnLinksRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ColumnLink $body, ?ColumnLinksRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php index 28f6d112646..3a72b047f48 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php index b464d647714..35fbfd1667b 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnLink; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property columnLinks for drives * @param ColumnLinkItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ColumnLinkItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of columns that are required by this content type. * @param ColumnLinkItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnLinkItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property columnLinks in drives * @param ColumnLink $body The request body * @param ColumnLinkItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ColumnLink $body, ?ColumnLinkItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ColumnLinkItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ColumnLinkItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ColumnLinkItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ColumnLink $body, ?ColumnLinkItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php index 4a3ff193250..c1dd19eba12 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\Item\ColumnPositions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\Item\ColumnPositions\Item\ColumnDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Column order information in a content type. * @param ColumnPositionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnPositionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ColumnPositionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ColumnPositionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php index 7c9d8f43b31..4b0505d3e26 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php index 26e9afa7215..344a54cd1b9 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Column order information in a content type. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/ColumnsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/ColumnsRequestBuilder.php index ec613455f07..ef9bec757a1 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\Item\Columns\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\Item\Columns\Item\ColumnDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinition; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of columns represented as columnDefinition][columnDefinition] resources in a [content type][contentType]. This API is available in the following [national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a column to a content type][contentType] in a site, or a list with a request that specifies a [columnDefinition][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-post-columns?view=graph-rest-1.0 Find more info here */ public function post(ColumnDefinition $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ColumnDefinition $body, ?ColumnsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/Count/CountRequestBuilder.php index 0ffa7c02615..21313c155cd 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php index 5c389ea3d1c..57fc01d13d8 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\Item\Columns\Item\SourceColumn\SourceColumnRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a column][columndefinition] from a [site][], a [list][], or a [content type][contentType]. This API is available in the following [national cloud deployments. * @param ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the metadata for a site][], a [list][], or a [contentType][] [column][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a site][], a [list][], or a [content type][contentType] [column][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-update?view=graph-rest-1.0 Find more info here */ public function patch(ColumnDefinition $body, ?ColumnDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?ColumnDefinitionItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(ColumnDefinition $body, ?ColumnDefinit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php index f9767277c67..4db3d2c1b5d 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The source column for the content type column. * @param SourceColumnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SourceColumnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ContentTypeItemRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ContentTypeItemRequestBuilder.php index 2eef878a098..1c6704554f0 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ContentTypeItemRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/ContentTypeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\Item\AssociateWithHubSites\AssociateWithHubSitesRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\Item\Base\EscapedBaseRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\Item\BaseTypes\BaseTypesRequestBuilder; @@ -114,56 +113,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentTypes for drives * @param ContentTypeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ContentTypeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of content types present in this list. * @param ContentTypeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentTypeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentTypes in drives * @param ContentType $body The request body * @param ContentTypeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ContentType $body, ?ContentTypeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -180,6 +170,7 @@ public function toDeleteRequestInformation(?ContentTypeItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -193,7 +184,6 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -201,6 +191,7 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -215,11 +206,11 @@ public function toPatchRequestInformation(ContentType $body, ?ContentTypeItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php index 539e39827b9..dd57216ed06 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a file to a default content location in a content type][contentType]. The file can then be added as a default file or template via a POST operation. This API is available in the following [national cloud deployments. * @param CopyToDefaultContentLocationPostRequestBody $body The request body * @param CopyToDefaultContentLocationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-copytodefaultcontentlocation?view=graph-rest-1.0 Find more info here */ public function post(CopyToDefaultContentLocationPostRequestBody $body, ?CopyToDefaultContentLocationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CopyToDefaultContentLocationPostRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php index 49f78168d8d..c007ca8650d 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function isPublished * @param IsPublishedRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IsPublishedRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IsPublishedGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IsPublishedGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?IsPublishedRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Publish/PublishRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Publish/PublishRequestBuilder.php index 37f5b92f062..fe285592f8c 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Publish/PublishRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Publish/PublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Publishes a contentType][] present in the content type hub site. This API is available in the following [national cloud deployments. * @param PublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-publish?view=graph-rest-1.0 Find more info here */ public function post(?PublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?PublishRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php index a8c9b97ead6..ffeb24aaa53 100644 --- a/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unpublish a contentType][] from a content type hub site. This API is available in the following [national cloud deployments. * @param UnpublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-unpublish?view=graph-rest-1.0 Find more info here */ public function post(?UnpublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnpublishRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/CreatedByUser/CreatedByUserRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/CreatedByUser/CreatedByUserRequestBuilder.php index 7ed0be393c0..de5c47c596f 100644 --- a/src/Generated/Drives/Item/EscapedList/CreatedByUser/CreatedByUserRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/CreatedByUser/CreatedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\CreatedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\CreatedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who created the item. Read-only. * @param CreatedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index afa1d5f2896..1745335af0a 100644 --- a/src/Generated/Drives/Item/EscapedList/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 731df67e6ec..98c367688bf 100644 --- a/src/Generated/Drives/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index ce915279c6a..8645cf32477 100644 --- a/src/Generated/Drives/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\CreatedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Drive/DriveRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Drive/DriveRequestBuilder.php index 656e1188e08..89f215e668b 100644 --- a/src/Generated/Drives/Item/EscapedList/Drive/DriveRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Drive/DriveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Drive; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Allows access to the list as a drive resource with driveItems. Only present on document libraries. * @param DriveRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Count/CountRequestBuilder.php index 03020721f58..4db1e76beea 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/Analytics/AnalyticsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/Analytics/AnalyticsRequestBuilder.php index 77b10e6c0c9..d164b268c80 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/Analytics/AnalyticsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/Analytics/AnalyticsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemAnalytics; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Analytics about the view activities that took place on this item. * @param AnalyticsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AnalyticsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php index 6dcdba4678e..a6b94ab2710 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\CreatedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\CreatedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who created the item. Read-only. * @param CreatedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 21bd2003631..79820fcb1ae 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index a0d89342ad4..d312222168f 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 724135b4f07..b2247f400bf 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\CreatedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php index 9eceb81f4f8..d9dc552a7dc 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php index 944b4210480..f004291d2d5 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\DocumentSetVersions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\DocumentSetVersions\Item\DocumentSetVersionItemRequestBuilder; use Microsoft\Graph\Generated\Models\DocumentSetVersion; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the versions of a document set item in a list. This API is available in the following national cloud deployments. * @param DocumentSetVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-list-documentsetversions?view=graph-rest-1.0 Find more info here */ public function get(?DocumentSetVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new version of a document set item in a list. This API is available in the following national cloud deployments. * @param DocumentSetVersion $body The request body * @param DocumentSetVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-post-documentsetversions?view=graph-rest-1.0 Find more info here */ public function post(DocumentSetVersion $body, ?DocumentSetVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DocumentSetVersionsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DocumentSetVersionsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DocumentSetVersion $body, ?DocumentSetV $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php index f8994a2a70f..b6985955018 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\DocumentSetVersions\Item\Fields\FieldsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\DocumentSetVersions\Item\Restore\RestoreRequestBuilder; use Microsoft\Graph\Generated\Models\DocumentSetVersion; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a version of a document set in a list. This API is available in the following national cloud deployments. * @param DocumentSetVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/documentsetversion-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DocumentSetVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a documentSetVersion object. This API is available in the following national cloud deployments. * @param DocumentSetVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/documentsetversion-get?view=graph-rest-1.0 Find more info here */ public function get(?DocumentSetVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property documentSetVersions in drives * @param DocumentSetVersion $body The request body * @param DocumentSetVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DocumentSetVersion $body, ?DocumentSetVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?DocumentSetVersionItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?DocumentSetVersionItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?DocumentSetVersionItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(DocumentSetVersion $body, ?DocumentSet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php index 3e18213dd2d..545da7d7299 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FieldValueSet; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fields for drives * @param FieldsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FieldsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of the fields and values for this version of the list item. * @param FieldsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FieldsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fields in drives * @param FieldValueSet $body The request body * @param FieldsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(FieldValueSet $body, ?FieldsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FieldsRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(FieldValueSet $body, ?FieldsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php index 669a867c800..9d781f8da94 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a document set version. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/documentsetversion-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/DriveItem/Content/ContentRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/DriveItem/Content/ContentRequestBuilder.php index 0350998e1bd..88018ba9bac 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/DriveItem/Content/ContentRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/DriveItem/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/DriveItem/DriveItemRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/DriveItem/DriveItemRequestBuilder.php index 1712c46e6f1..2e397e283ae 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/DriveItem/DriveItemRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/DriveItem/DriveItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\DriveItem\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * For document libraries, the driveItem relationship exposes the listItem as a [driveItem][] * @param DriveItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/Fields/FieldsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/Fields/FieldsRequestBuilder.php index 835fa06721a..d2b119f69a7 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/Fields/FieldsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/Fields/FieldsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FieldValueSet; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fields for drives * @param FieldsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FieldsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The values of the columns set on this list item. * @param FieldsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FieldsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties on a listItem][]. This API is available in the following [national cloud deployments. * @param FieldValueSet $body The request body * @param FieldsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-update?view=graph-rest-1.0 Find more info here */ public function patch(FieldValueSet $body, ?FieldsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?FieldsRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(FieldValueSet $body, ?FieldsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php index 352f1021101..56379a0478b 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php index 14c955554a1..546ab7d5e4a 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,7 +61,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -73,6 +68,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php index 49c8bb9b390..a2c7c7c7ac1 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\LastModifiedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\LastModifiedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who last modified the item. Read-only. * @param LastModifiedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 00e6e861e09..8fe6990b15b 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index f87045d0e34..e7dcb75dfad 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index e3aa75482ff..b6af9079852 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\LastModifiedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/ListItemItemRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/ListItemItemRequestBuilder.php index 6a40c973aa7..6d3479aa9e1 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/ListItemItemRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/ListItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\Analytics\AnalyticsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\CreatedByUser\CreatedByUserRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\DocumentSetVersions\DocumentSetVersionsRequestBuilder; @@ -99,39 +98,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Removes an item from a list][]. This API is available in the following [national cloud deployments. * @param ListItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ListItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns the metadata for an item][] in a [list][]. This API is available in the following [national cloud deployments. * @param ListItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-get?view=graph-rest-1.0 Find more info here */ public function get(?ListItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -149,19 +142,16 @@ public function getActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInter * Update the navigation property items in drives * @param ListItem $body The request body * @param ListItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ListItem $body, ?ListItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -178,6 +168,7 @@ public function toDeleteRequestInformation(?ListItemItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -191,7 +182,6 @@ public function toGetRequestInformation(?ListItemItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -199,6 +189,7 @@ public function toGetRequestInformation(?ListItemItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -213,11 +204,11 @@ public function toPatchRequestInformation(ListItem $body, ?ListItemItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Count/CountRequestBuilder.php index c3bde6d4102..ceff66f15e6 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php index aaadffa77b8..28568c1a99a 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FieldValueSet; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fields for drives * @param FieldsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FieldsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of the fields and values for this version of the list item. * @param FieldsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FieldsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fields in drives * @param FieldValueSet $body The request body * @param FieldsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(FieldValueSet $body, ?FieldsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FieldsRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(FieldValueSet $body, ?FieldsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php index 6ce6c43220b..51497ac36df 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\Versions\Item\Fields\FieldsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\Versions\Item\RestoreVersion\RestoreVersionRequestBuilder; use Microsoft\Graph\Generated\Models\ListItemVersion; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property versions for drives * @param ListItemVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ListItemVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the metadata for a specific version of a ListItem. This API is available in the following national cloud deployments. * @param ListItemVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitemversion-get?view=graph-rest-1.0 Find more info here */ public function get(?ListItemVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property versions in drives * @param ListItemVersion $body The request body * @param ListItemVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ListItemVersion $body, ?ListItemVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?ListItemVersionItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?ListItemVersionItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?ListItemVersionItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(ListItemVersion $body, ?ListItemVersio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php index 7b92fe667bd..d4f71f0bfba 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a previous version of a ListItem to be the current version. This will create a new version with the contents of the previous version, but preserves all existing versions of the item. This API is available in the following national cloud deployments. * @param RestoreVersionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitemversion-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreVersionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RestoreVersionRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/VersionsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/VersionsRequestBuilder.php index 34ac9777f90..6afecdfe079 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/VersionsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/Item/Versions/VersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\Versions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\Versions\Item\ListItemVersionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ListItemVersion; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * SharePoint can be configured to retain the history for list items. Previous versions may be retained for a finite period of time depending on admin settings which may be unique per user or location. This API is available in the following national cloud deployments. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-list-versions?view=graph-rest-1.0 Find more info here */ public function get(?VersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to versions for drives * @param ListItemVersion $body The request body * @param VersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ListItemVersion $body, ?VersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ListItemVersion $body, ?VersionsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Items/ItemsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Items/ItemsRequestBuilder.php index cc4b5c6b5d8..86c6906af2a 100644 --- a/src/Generated/Drives/Item/EscapedList/Items/ItemsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Items/ItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Items\Item\ListItemItemRequestBuilder; use Microsoft\Graph\Generated\Models\ListItem; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of items][item] in a [list][]. This API is available in the following [national cloud deployments. * @param ItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-list?view=graph-rest-1.0 Find more info here */ public function get(?ItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new listItem][] in a [list][]. This API is available in the following [national cloud deployments. * @param ListItem $body The request body * @param ItemsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-create?view=graph-rest-1.0 Find more info here */ public function post(ListItem $body, ?ItemsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ListItem $body, ?ItemsRequestBuilderPos $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/LastModifiedByUserRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/LastModifiedByUserRequestBuilder.php index 62104139ae4..6fe459a9b49 100644 --- a/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/LastModifiedByUserRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/LastModifiedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\LastModifiedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\LastModifiedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who last modified the item. Read-only. * @param LastModifiedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index c97720ecbc8..7ecfbd4b99b 100644 --- a/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 695ef97b8b4..0f7c4f8bf2b 100644 --- a/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 119d1e65911..3ad6961e25b 100644 --- a/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\LastModifiedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/ListRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/ListRequestBuilder.php index b3208568b49..62305a6dd09 100644 --- a/src/Generated/Drives/Item/EscapedList/ListRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/ListRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Columns\ColumnsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\ContentTypes\ContentTypesRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\CreatedByUser\CreatedByUserRequestBuilder; @@ -98,56 +97,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property list for drives * @param ListRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ListRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * For drives in SharePoint, the underlying document library list. Read-only. Nullable. * @param ListRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ListRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property list in drives * @param EscapedList $body The request body * @param ListRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EscapedList $body, ?ListRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -164,6 +154,7 @@ public function toDeleteRequestInformation(?ListRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -177,7 +168,6 @@ public function toGetRequestInformation(?ListRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -185,6 +175,7 @@ public function toGetRequestInformation(?ListRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -199,11 +190,11 @@ public function toPatchRequestInformation(EscapedList $body, ?ListRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Operations/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Operations/Count/CountRequestBuilder.php index ee0a6c0b4be..068c3ccf325 100644 --- a/src/Generated/Drives/Item/EscapedList/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Operations/Item/RichLongRunningOperationItemRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Operations/Item/RichLongRunningOperationItemRequestBuilder.php index 438d85b1651..ae3c75948c9 100644 --- a/src/Generated/Drives/Item/EscapedList/Operations/Item/RichLongRunningOperationItemRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Operations/Item/RichLongRunningOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RichLongRunningOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for drives * @param RichLongRunningOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RichLongRunningOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of long-running operations on the list. * @param RichLongRunningOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RichLongRunningOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in drives * @param RichLongRunningOperation $body The request body * @param RichLongRunningOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RichLongRunningOperation $body, ?RichLongRunningOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?RichLongRunningOperationItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?RichLongRunningOperationItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?RichLongRunningOperationItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(RichLongRunningOperation $body, ?RichL $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Operations/OperationsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Operations/OperationsRequestBuilder.php index 1b26bb23e07..7a0714c0cd7 100644 --- a/src/Generated/Drives/Item/EscapedList/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Operations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Operations\Item\RichLongRunningOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of long-running operations on the list. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for drives * @param RichLongRunningOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RichLongRunningOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(RichLongRunningOperation $body, ?Operat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Subscriptions/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Subscriptions/Count/CountRequestBuilder.php index 2c26714fa13..d7c519170b6 100644 --- a/src/Generated/Drives/Item/EscapedList/Subscriptions/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Subscriptions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php index a0262e0fe40..84651f6ce20 100644 --- a/src/Generated/Drives/Item/EscapedList/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reauthorize a subscription when you receive a reauthorizationRequired challenge. This API is available in the following national cloud deployments. * @param ReauthorizeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subscription-reauthorize?view=graph-rest-1.0 Find more info here */ public function post(?ReauthorizeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ReauthorizeRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Subscriptions/Item/SubscriptionItemRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Subscriptions/Item/SubscriptionItemRequestBuilder.php index 05190826704..46dc28ea329 100644 --- a/src/Generated/Drives/Item/EscapedList/Subscriptions/Item/SubscriptionItemRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Subscriptions/Item/SubscriptionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Subscriptions\Item\Reauthorize\ReauthorizeRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Subscription; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property subscriptions for drives * @param SubscriptionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SubscriptionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The set of subscriptions on the list. * @param SubscriptionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubscriptionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property subscriptions in drives * @param Subscription $body The request body * @param SubscriptionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Subscription $body, ?SubscriptionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?SubscriptionItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?SubscriptionItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?SubscriptionItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Subscription $body, ?SubscriptionItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/EscapedList/Subscriptions/SubscriptionsRequestBuilder.php b/src/Generated/Drives/Item/EscapedList/Subscriptions/SubscriptionsRequestBuilder.php index 93a401148f7..140bb2a84de 100644 --- a/src/Generated/Drives/Item/EscapedList/Subscriptions/SubscriptionsRequestBuilder.php +++ b/src/Generated/Drives/Item/EscapedList/Subscriptions/SubscriptionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Subscriptions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\EscapedList\Subscriptions\Item\SubscriptionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The set of subscriptions on the list. * @param SubscriptionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubscriptionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubscriptionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubscriptionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to subscriptions for drives * @param Subscription $body The request body * @param SubscriptionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Subscription $body, ?SubscriptionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?SubscriptionsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?SubscriptionsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Subscription $body, ?SubscriptionsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Following/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Following/Count/CountRequestBuilder.php index b0219390840..b5633736b05 100644 --- a/src/Generated/Drives/Item/Following/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Following/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Following/FollowingRequestBuilder.php b/src/Generated/Drives/Item/Following/FollowingRequestBuilder.php index 2306d66fba7..02e2fe0814e 100644 --- a/src/Generated/Drives/Item/Following/FollowingRequestBuilder.php +++ b/src/Generated/Drives/Item/Following/FollowingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Following\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Following\Item\DriveItemItemRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItemCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the items that have been followed by the signed in user.This collection includes items that are in the user's drive as well as items they have access to from other drives. This API is available in the following national cloud deployments. * @param FollowingRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/drive-list-following?view=graph-rest-1.0 Find more info here */ public function get(?FollowingRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?FollowingRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?FollowingRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Following/Item/Content/ContentRequestBuilder.php b/src/Generated/Drives/Item/Following/Item/Content/ContentRequestBuilder.php index 43bcfd4d9c0..b215843fbfb 100644 --- a/src/Generated/Drives/Item/Following/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Drives/Item/Following/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/drive-list-following?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Following/Item/DriveItemItemRequestBuilder.php b/src/Generated/Drives/Item/Following/Item/DriveItemItemRequestBuilder.php index f18c138e494..934b5a964ef 100644 --- a/src/Generated/Drives/Item/Following/Item/DriveItemItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Following/Item/DriveItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Following\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of items the user is following. Only in OneDrive for Business. * @param DriveItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?DriveItemItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?DriveItemItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Count/CountRequestBuilder.php index 75a951453a8..9c8101d8079 100644 --- a/src/Generated/Drives/Item/Items/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Analytics/AllTime/AllTimeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Analytics/AllTime/AllTimeRequestBuilder.php index f56045ca577..80e0cd1b7a3 100644 --- a/src/Generated/Drives/Item/Items/Item/Analytics/AllTime/AllTimeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Analytics/AllTime/AllTimeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemActivityStat; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get [itemAnalytics][] about the views that took place under this resource.The itemAnalytics resource is a convenient way to get activity stats for allTime and the lastSevenDays.For a custom time range or interval, use the getActivitiesByInterval][] API. This API is available in the following [national cloud deployments. * @param AllTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/itemanalytics-get?view=graph-rest-1.0 Find more info here */ public function get(?AllTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?AllTimeRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?AllTimeRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Analytics/AnalyticsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Analytics/AnalyticsRequestBuilder.php index 9f209dc5638..1bed7c8fde1 100644 --- a/src/Generated/Drives/Item/Items/Item/Analytics/AnalyticsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Analytics/AnalyticsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Analytics\AllTime\AllTimeRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Analytics\ItemActivityStats\ItemActivityStatsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Analytics\LastSevenDays\LastSevenDaysRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property analytics for drives * @param AnalyticsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AnalyticsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Analytics about the view activities that took place on this item. * @param AnalyticsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AnalyticsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property analytics in drives * @param ItemAnalytics $body The request body * @param AnalyticsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ItemAnalytics $body, ?AnalyticsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?AnalyticsRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(ItemAnalytics $body, ?AnalyticsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Count/CountRequestBuilder.php index 35a36a39197..0152edde303 100644 --- a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/ActivitiesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/ActivitiesRequestBuilder.php index 73d90ce7176..c4116c068a1 100644 --- a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/ActivitiesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/ActivitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Analytics\ItemActivityStats\Item\Activities\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Analytics\ItemActivityStats\Item\Activities\Item\ItemActivityItemRequestBuilder; use Microsoft\Graph\Generated\Models\ItemActivity; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Exposes the itemActivities represented in this itemActivityStat resource. * @param ActivitiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivitiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to activities for drives * @param ItemActivity $body The request body * @param ActivitiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ItemActivity $body, ?ActivitiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ActivitiesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ActivitiesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ItemActivity $body, ?ActivitiesRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Count/CountRequestBuilder.php index f39d2919e45..d86d3effb27 100644 --- a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/Content/ContentRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/Content/ContentRequestBuilder.php index 33fbf0c037d..424171aca2e 100644 --- a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/Content/ContentRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/DriveItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/DriveItemRequestBuilder.php index fe7609b1c9d..e403e63d6ba 100644 --- a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/DriveItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/DriveItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Analytics\ItemActivityStats\Item\Activities\Item\DriveItem\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Exposes the driveItem that was the target of this activity. * @param DriveItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Item/ItemActivityItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Item/ItemActivityItemRequestBuilder.php index 5758acacda9..c1b51a6da9f 100644 --- a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Item/ItemActivityItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/Activities/Item/ItemActivityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Analytics\ItemActivityStats\Item\Activities\Item\DriveItem\DriveItemRequestBuilder; use Microsoft\Graph\Generated\Models\ItemActivity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property activities for drives * @param ItemActivityItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ItemActivityItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Exposes the itemActivities represented in this itemActivityStat resource. * @param ItemActivityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemActivityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property activities in drives * @param ItemActivity $body The request body * @param ItemActivityItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ItemActivity $body, ?ItemActivityItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ItemActivityItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ItemActivityItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ItemActivityItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ItemActivity $body, ?ItemActivityItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/ItemActivityStatItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/ItemActivityStatItemRequestBuilder.php index d238ae4f52a..eb3d506605d 100644 --- a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/ItemActivityStatItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/Item/ItemActivityStatItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Analytics\ItemActivityStats\Item\Activities\ActivitiesRequestBuilder; use Microsoft\Graph\Generated\Models\ItemActivityStat; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property itemActivityStats for drives * @param ItemActivityStatItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ItemActivityStatItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get itemActivityStats from drives * @param ItemActivityStatItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemActivityStatItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property itemActivityStats in drives * @param ItemActivityStat $body The request body * @param ItemActivityStatItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ItemActivityStat $body, ?ItemActivityStatItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ItemActivityStatItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ItemActivityStatItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ItemActivityStatItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ItemActivityStat $body, ?ItemActivityS $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/ItemActivityStatsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/ItemActivityStatsRequestBuilder.php index cb840597292..1cf044cdbfc 100644 --- a/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/ItemActivityStatsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Analytics/ItemActivityStats/ItemActivityStatsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Analytics\ItemActivityStats\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Analytics\ItemActivityStats\Item\ItemActivityStatItemRequestBuilder; use Microsoft\Graph\Generated\Models\ItemActivityStat; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get itemActivityStats from drives * @param ItemActivityStatsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemActivityStatsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStatCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStatCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to itemActivityStats for drives * @param ItemActivityStat $body The request body * @param ItemActivityStatsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ItemActivityStat $body, ?ItemActivityStatsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ItemActivityStatsRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ItemActivityStatsRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ItemActivityStat $body, ?ItemActivitySt $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Analytics/LastSevenDays/LastSevenDaysRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Analytics/LastSevenDays/LastSevenDaysRequestBuilder.php index 98fe9887ff6..cc57aa3a14f 100644 --- a/src/Generated/Drives/Item/Items/Item/Analytics/LastSevenDays/LastSevenDaysRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Analytics/LastSevenDays/LastSevenDaysRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemActivityStat; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get lastSevenDays from drives * @param LastSevenDaysRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastSevenDaysRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?LastSevenDaysRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?LastSevenDaysRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/AssignSensitivityLabel/AssignSensitivityLabelRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/AssignSensitivityLabel/AssignSensitivityLabelRequestBuilder.php index 680fa075c9c..7bf62a8ec4e 100644 --- a/src/Generated/Drives/Item/Items/Item/AssignSensitivityLabel/AssignSensitivityLabelRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/AssignSensitivityLabel/AssignSensitivityLabelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action assignSensitivityLabel * @param AssignSensitivityLabelPostRequestBody $body The request body * @param AssignSensitivityLabelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AssignSensitivityLabelPostRequestBody $body, ?AssignSensitivityLabelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(AssignSensitivityLabelPostRequestBody $ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Checkin/CheckinRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Checkin/CheckinRequestBuilder.php index 898d815e2e7..d0ac3612bd6 100644 --- a/src/Generated/Drives/Item/Items/Item/Checkin/CheckinRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Checkin/CheckinRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Check in a checked out driveItem resource, which makes the version of the document available to others. This API is available in the following national cloud deployments. * @param CheckinPostRequestBody $body The request body * @param CheckinRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-checkin?view=graph-rest-1.0 Find more info here */ public function post(CheckinPostRequestBody $body, ?CheckinRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CheckinPostRequestBody $body, ?CheckinR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Checkout/CheckoutRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Checkout/CheckoutRequestBuilder.php index e1b4aff5bca..4898d1cac39 100644 --- a/src/Generated/Drives/Item/Items/Item/Checkout/CheckoutRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Checkout/CheckoutRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Check out a driveItem resource to prevent others from editing the document, and prevent your changes from being visible until the documented is checked in. This API is available in the following national cloud deployments. * @param CheckoutRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-checkout?view=graph-rest-1.0 Find more info here */ public function post(?CheckoutRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CheckoutRequestBuilderPostRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Children/ChildrenRequestBuilder.php index 3131108f8f3..92739610c17 100644 --- a/src/Generated/Drives/Item/Items/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Children\Item\DriveItemItemRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Return a collection of DriveItems in the children relationship of a DriveItem. DriveItems with a non-null folder or package facet can have one or more child DriveItems. This API is available in the following national cloud deployments. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for drives * @param DriveItem $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-post-children?view=graph-rest-1.0 Find more info here */ public function post(DriveItem $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DriveItem $body, ?ChildrenRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Children/Count/CountRequestBuilder.php index 0486b2d4b3f..56765b4b2ca 100644 --- a/src/Generated/Drives/Item/Items/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Children/Item/Content/ContentRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Children/Item/Content/ContentRequestBuilder.php index f8bb02e77be..086f0053010 100644 --- a/src/Generated/Drives/Item/Items/Item/Children/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Children/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Children/Item/DriveItemItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Children/Item/DriveItemItemRequestBuilder.php index 9b9ef4afc76..c2091a513dc 100644 --- a/src/Generated/Drives/Item/Items/Item/Children/Item/DriveItemItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Children/Item/DriveItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Children\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection containing Item objects for the immediate children of Item. Only items representing folders have children. Read-only. Nullable. * @param DriveItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?DriveItemItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?DriveItemItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Content/ContentRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Content/ContentRequestBuilder.php index 40d801fef34..53c10c4ba0a 100644 --- a/src/Generated/Drives/Item/Items/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Copy/CopyRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Copy/CopyRequestBuilder.php index 75b765bc31f..a5d80fe1bb7 100644 --- a/src/Generated/Drives/Item/Items/Item/Copy/CopyRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Copy/CopyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Asynchronously creates a copy of an driveItem][item-resource] (including any children), under a new parent item or with a new name. This API is available in the following [national cloud deployments. * @param CopyPostRequestBody $body The request body * @param CopyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-copy?view=graph-rest-1.0 Find more info here */ public function post(CopyPostRequestBody $body, ?CopyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyPostRequestBody $body, ?CopyRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/CreateLink/CreateLinkRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/CreateLink/CreateLinkRequestBuilder.php index c535fed44d0..edd1c64cc8b 100644 --- a/src/Generated/Drives/Item/Items/Item/CreateLink/CreateLinkRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/CreateLink/CreateLinkRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Permission; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * You can use createLink action to share a DriveItem via a sharing link. The createLink action will create a new sharing link if the specified link type doesn't already exist for the calling application.If a sharing link of the specified type already exists for the app, the existing sharing link will be returned. DriveItem resources inherit sharing permissions from their ancestors. This API is available in the following national cloud deployments. * @param CreateLinkPostRequestBody $body The request body * @param CreateLinkRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-createlink?view=graph-rest-1.0 Find more info here */ public function post(CreateLinkPostRequestBody $body, ?CreateLinkRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateLinkPostRequestBody $body, ?Creat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/CreateUploadSession/CreateUploadSessionRequestBuilder.php index c52ac96a3a7..4d63c927147 100644 --- a/src/Generated/Drives/Item/Items/Item/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action createUploadSession * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php index 71c873e06cb..52ac742f52c 100644 --- a/src/Generated/Drives/Item/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\CreatedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\CreatedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who created the item. Read-only. * @param CreatedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index d0b26b732f0..86f4e90b0cb 100644 --- a/src/Generated/Drives/Item/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 220dd3ba724..233436b388a 100644 --- a/src/Generated/Drives/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 21fc1e2f578..465e97022bf 100644 --- a/src/Generated/Drives/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\CreatedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Delta/DeltaRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Delta/DeltaRequestBuilder.php index 4bc6e342696..8c72c693eab 100644 --- a/src/Generated/Drives/Item/Items/Item/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/DeltaWithToken/DeltaWithTokenRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/DeltaWithToken/DeltaWithTokenRequestBuilder.php index e5c3bca4cf4..4d66a64cbea 100644 --- a/src/Generated/Drives/Item/Items/Item/DeltaWithToken/DeltaWithTokenRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/DeltaWithToken/DeltaWithTokenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaWithTokenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaWithTokenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaWithTokenGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaWithTokenGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?DeltaWithTokenRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?DeltaWithTokenRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/DriveItemItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/DriveItemItemRequestBuilder.php index c35d22c6a03..e6b800963d0 100644 --- a/src/Generated/Drives/Item/Items/Item/DriveItemItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/DriveItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Analytics\AnalyticsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\AssignSensitivityLabel\AssignSensitivityLabelRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Checkin\CheckinRequestBuilder; @@ -253,20 +252,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a DriveItem by using its ID or path.Deleting items using this method moves the items to the recycle bin instead of permanently deleting the item. This API is available in the following national cloud deployments. * @param DriveItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DriveItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -281,19 +277,16 @@ public function deltaWithToken(string $token): DeltaWithTokenRequestBuilder { /** * All items contained in the drive. Read-only. Nullable. * @param DriveItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -308,23 +301,20 @@ public function getActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInter } /** - * Update the metadata for a driveItem by ID or path. You can also use update to move an item to another parent by updating the item's parentReference property. This API is available in the following national cloud deployments. + * To move a DriveItem to a new parent item, your app requests to update the parentReference of the DriveItem to move. This is a special case of the Update method.Your app can combine moving an item to a new container and updating other properties of the item into a single request. Items cannot be moved between Drives using this request. This API is available in the following national cloud deployments. * @param DriveItem $body The request body * @param DriveItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/driveitem-update?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/driveitem-move?view=graph-rest-1.0 Find more info here */ public function patch(DriveItem $body, ?DriveItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -350,6 +340,7 @@ public function toDeleteRequestInformation(?DriveItemItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -363,7 +354,6 @@ public function toGetRequestInformation(?DriveItemItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -371,11 +361,12 @@ public function toGetRequestInformation(?DriveItemItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the metadata for a driveItem by ID or path. You can also use update to move an item to another parent by updating the item's parentReference property. This API is available in the following national cloud deployments. + * To move a DriveItem to a new parent item, your app requests to update the parentReference of the DriveItem to move. This is a special case of the Update method.Your app can combine moving an item to a new container and updating other properties of the item into a single request. Items cannot be moved between Drives using this request. This API is available in the following national cloud deployments. * @param DriveItem $body The request body * @param DriveItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -385,11 +376,11 @@ public function toPatchRequestInformation(DriveItem $body, ?DriveItemItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/ExtractSensitivityLabels/ExtractSensitivityLabelsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/ExtractSensitivityLabels/ExtractSensitivityLabelsRequestBuilder.php index 794b6214202..4cb1875fb99 100644 --- a/src/Generated/Drives/Item/Items/Item/ExtractSensitivityLabels/ExtractSensitivityLabelsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/ExtractSensitivityLabels/ExtractSensitivityLabelsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ExtractSensitivityLabelsResult; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action extractSensitivityLabels * @param ExtractSensitivityLabelsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?ExtractSensitivityLabelsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtractSensitivityLabelsResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtractSensitivityLabelsResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toPostRequestInformation(?ExtractSensitivityLabelsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Follow/FollowRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Follow/FollowRequestBuilder.php index 7785b11326e..ea9a0acce6b 100644 --- a/src/Generated/Drives/Item/Items/Item/Follow/FollowRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Follow/FollowRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Follow a driveItem. This API is available in the following national cloud deployments. * @param FollowRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-follow?view=graph-rest-1.0 Find more info here */ public function post(?FollowRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?FollowRequestBuilderPostRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php index 6fcf772b375..3e90cb33376 100644 --- a/src/Generated/Drives/Item/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php index 82ad7bca0f5..c01e1b10761 100644 --- a/src/Generated/Drives/Item/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,7 +61,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -73,6 +68,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Invite/InviteRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Invite/InviteRequestBuilder.php index 7d642b38293..f03abf1eafb 100644 --- a/src/Generated/Drives/Item/Items/Item/Invite/InviteRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Invite/InviteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Sends a sharing invitation for a driveItem.A sharing invitation provides permissions to the recipients and optionally sends them an email with a sharing link][]. This API is available in the following [national cloud deployments. * @param InvitePostRequestBody $body The request body * @param InviteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-invite?view=graph-rest-1.0 Find more info here */ public function post(InvitePostRequestBody $body, ?InviteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InvitePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InvitePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(InvitePostRequestBody $body, ?InviteReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php index d4a8383da73..e74a32b8397 100644 --- a/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\LastModifiedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\LastModifiedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who last modified the item. Read-only. * @param LastModifiedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 138ea75295c..45e199aeba5 100644 --- a/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index d76fc6ed6fb..3963194dff0 100644 --- a/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index daac07991e3..3ba520fa410 100644 --- a/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\LastModifiedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/ListItem/ListItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/ListItem/ListItemRequestBuilder.php index 0d9e78db9bc..7cad0cf2f37 100644 --- a/src/Generated/Drives/Item/Items/Item/ListItem/ListItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/ListItem/ListItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ListItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * For drives in SharePoint, the associated document library list item. Read-only. Nullable. * @param ListItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ListItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ListItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ListItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/PermanentDelete/PermanentDeleteRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/PermanentDelete/PermanentDeleteRequestBuilder.php index 8f13e22aa21..bec34a775e0 100644 --- a/src/Generated/Drives/Item/Items/Item/PermanentDelete/PermanentDeleteRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/PermanentDelete/PermanentDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action permanentDelete * @param PermanentDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?PermanentDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?PermanentDeleteRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Permissions/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Permissions/Count/CountRequestBuilder.php index c51985f347c..61aaff055a9 100644 --- a/src/Generated/Drives/Item/Items/Item/Permissions/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Permissions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Permissions/Item/Grant/GrantRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Permissions/Item/Grant/GrantRequestBuilder.php index e4f3cf2bcb5..730015c6852 100644 --- a/src/Generated/Drives/Item/Items/Item/Permissions/Item/Grant/GrantRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Permissions/Item/Grant/GrantRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Grant users access to a link represented by a permission][]. This API is available in the following [national cloud deployments. * @param GrantPostRequestBody $body The request body * @param GrantRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permission-grant?view=graph-rest-1.0 Find more info here */ public function post(GrantPostRequestBody $body, ?GrantRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GrantPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GrantPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GrantPostRequestBody $body, ?GrantReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Permissions/Item/PermissionItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Permissions/Item/PermissionItemRequestBuilder.php index 05c9dcb3a37..8779e75cd7b 100644 --- a/src/Generated/Drives/Item/Items/Item/Permissions/Item/PermissionItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Permissions/Item/PermissionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Permissions\Item\Grant\GrantRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Permission; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove access to a DriveItem. Only sharing permissions that are not inherited can be deleted.The inheritedFrom property must be null. This API is available in the following national cloud deployments. * @param PermissionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permission-delete?view=graph-rest-1.0 Find more info here */ public function delete(?PermissionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Return the effective sharing permission for a particular permission resource. Effective permissions of an item can come from two sources: permissions set directly on the item itself or permissions that are inherited from the item's ancestors. Callers can differentiate if the permission is inherited or not by checking the inheritedFrom property.This property is an ItemReference resource referencing the ancestor that the permission is inherited from. This API is available in the following national cloud deployments. * @param PermissionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permission-get?view=graph-rest-1.0 Find more info here */ public function get(?PermissionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a sharing permission by patching the permission resource. Only the roles property can be modified this way. This API is available in the following national cloud deployments. * @param Permission $body The request body * @param PermissionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permission-update?view=graph-rest-1.0 Find more info here */ public function patch(Permission $body, ?PermissionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?PermissionItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?PermissionItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?PermissionItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(Permission $body, ?PermissionItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Permissions/PermissionsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Permissions/PermissionsRequestBuilder.php index 177b631780e..e46c7fc6f1b 100644 --- a/src/Generated/Drives/Item/Items/Item/Permissions/PermissionsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Permissions/PermissionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Permissions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Permissions\Item\PermissionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the effective sharing permissions on a driveItem. This API is available in the following national cloud deployments. * @param PermissionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-list-permissions?view=graph-rest-1.0 Find more info here */ public function get(?PermissionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to permissions for drives * @param Permission $body The request body * @param PermissionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Permission $body, ?PermissionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?PermissionsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?PermissionsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Permission $body, ?PermissionsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Preview/PreviewRequestBuilder.php index 7557587cdd9..6213bc369e3 100644 --- a/src/Generated/Drives/Item/Items/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemPreviewInfo; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action preview * @param PreviewPostRequestBody $body The request body * @param PreviewRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PreviewPostRequestBody $body, ?PreviewRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemPreviewInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemPreviewInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PreviewPostRequestBody $body, ?PreviewR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Restore/RestoreRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Restore/RestoreRequestBuilder.php index 89a924e85e0..51008c8fb26 100644 --- a/src/Generated/Drives/Item/Items/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Restore a driveItem that has been deleted and is currently in the recycle bin. NOTE: This functionality is currently only available for OneDrive Personal. This API is available in the following national cloud deployments. * @param RestorePostRequestBody $body The request body * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-restore?view=graph-rest-1.0 Find more info here */ public function post(RestorePostRequestBody $body, ?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(RestorePostRequestBody $body, ?RestoreR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/SearchWithQ/SearchWithQRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/SearchWithQ/SearchWithQRequestBuilder.php index af69be6790c..376dfa09540 100644 --- a/src/Generated/Drives/Item/Items/Item/SearchWithQ/SearchWithQRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/SearchWithQ/SearchWithQRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function search * @param SearchWithQRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SearchWithQRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SearchWithQGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SearchWithQGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?SearchWithQRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?SearchWithQRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Subscriptions/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Subscriptions/Count/CountRequestBuilder.php index 9e08ba0c6df..ea2e88a9b7d 100644 --- a/src/Generated/Drives/Item/Items/Item/Subscriptions/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Subscriptions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php index 4324e769906..929668e1886 100644 --- a/src/Generated/Drives/Item/Items/Item/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reauthorize a subscription when you receive a reauthorizationRequired challenge. This API is available in the following national cloud deployments. * @param ReauthorizeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subscription-reauthorize?view=graph-rest-1.0 Find more info here */ public function post(?ReauthorizeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ReauthorizeRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Subscriptions/Item/SubscriptionItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Subscriptions/Item/SubscriptionItemRequestBuilder.php index 570ac744689..0a5d7fc4909 100644 --- a/src/Generated/Drives/Item/Items/Item/Subscriptions/Item/SubscriptionItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Subscriptions/Item/SubscriptionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Subscriptions\Item\Reauthorize\ReauthorizeRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Subscription; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property subscriptions for drives * @param SubscriptionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SubscriptionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The set of subscriptions on the item. Only supported on the root of a drive. * @param SubscriptionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubscriptionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property subscriptions in drives * @param Subscription $body The request body * @param SubscriptionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Subscription $body, ?SubscriptionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?SubscriptionItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?SubscriptionItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?SubscriptionItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Subscription $body, ?SubscriptionItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Subscriptions/SubscriptionsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Subscriptions/SubscriptionsRequestBuilder.php index 9cc2bcd79bf..4bba86c342e 100644 --- a/src/Generated/Drives/Item/Items/Item/Subscriptions/SubscriptionsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Subscriptions/SubscriptionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Subscriptions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Subscriptions\Item\SubscriptionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The set of subscriptions on the item. Only supported on the root of a drive. * @param SubscriptionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubscriptionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubscriptionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubscriptionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to subscriptions for drives * @param Subscription $body The request body * @param SubscriptionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Subscription $body, ?SubscriptionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?SubscriptionsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?SubscriptionsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Subscription $body, ?SubscriptionsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Thumbnails/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Thumbnails/Count/CountRequestBuilder.php index 344b5277d75..f568142797d 100644 --- a/src/Generated/Drives/Item/Items/Item/Thumbnails/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Thumbnails/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Thumbnails/Item/ThumbnailSetItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Thumbnails/Item/ThumbnailSetItemRequestBuilder.php index 5a8dd03412d..e7d290e64a0 100644 --- a/src/Generated/Drives/Item/Items/Item/Thumbnails/Item/ThumbnailSetItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Thumbnails/Item/ThumbnailSetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ThumbnailSet; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property thumbnails for drives * @param ThumbnailSetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ThumbnailSetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Collection containing [ThumbnailSet][] objects associated with the item. For more info, see [getting thumbnails][]. Read-only. Nullable. * @param ThumbnailSetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ThumbnailSetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThumbnailSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThumbnailSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property thumbnails in drives * @param ThumbnailSet $body The request body * @param ThumbnailSetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ThumbnailSet $body, ?ThumbnailSetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThumbnailSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThumbnailSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ThumbnailSetItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ThumbnailSetItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ThumbnailSetItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ThumbnailSet $body, ?ThumbnailSetItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Thumbnails/ThumbnailsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Thumbnails/ThumbnailsRequestBuilder.php index 67cf16e3d9a..112223f654e 100644 --- a/src/Generated/Drives/Item/Items/Item/Thumbnails/ThumbnailsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Thumbnails/ThumbnailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Thumbnails\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Thumbnails\Item\ThumbnailSetItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a collection of ThumbnailSet resources for a DriveItem resource. A DriveItem can be represented by zero or more ThumbnailSet resources.Each thumbnailSet can have one or more thumbnail objects, which are images that represent the item.For example, a thumbnailSet may include thumbnail objects, such as common ones including small, medium, or large. There are many ways to work with thumbnails on OneDrive.Here are the most common ones: This API is available in the following national cloud deployments. * @param ThumbnailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-list-thumbnails?view=graph-rest-1.0 Find more info here */ public function get(?ThumbnailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThumbnailSetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThumbnailSetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to thumbnails for drives * @param ThumbnailSet $body The request body * @param ThumbnailsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ThumbnailSet $body, ?ThumbnailsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThumbnailSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThumbnailSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ThumbnailsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ThumbnailsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ThumbnailSet $body, ?ThumbnailsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Unfollow/UnfollowRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Unfollow/UnfollowRequestBuilder.php index dd354f15cee..5a3bd889161 100644 --- a/src/Generated/Drives/Item/Items/Item/Unfollow/UnfollowRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Unfollow/UnfollowRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unfollow a driveItem. This API is available in the following national cloud deployments. * @param UnfollowRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-unfollow?view=graph-rest-1.0 Find more info here */ public function post(?UnfollowRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnfollowRequestBuilderPostRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/ValidatePermission/ValidatePermissionRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/ValidatePermission/ValidatePermissionRequestBuilder.php index 0cf893a8466..d0baaf9b9a3 100644 --- a/src/Generated/Drives/Item/Items/Item/ValidatePermission/ValidatePermissionRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/ValidatePermission/ValidatePermissionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action validatePermission * @param ValidatePermissionPostRequestBody $body The request body * @param ValidatePermissionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ValidatePermissionPostRequestBody $body, ?ValidatePermissionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ValidatePermissionPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Versions/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Versions/Count/CountRequestBuilder.php index a8b56fcbfa9..09c47801e2e 100644 --- a/src/Generated/Drives/Item/Items/Item/Versions/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Versions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Versions/Item/Content/ContentRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Versions/Item/Content/ContentRequestBuilder.php index b5ff09732a8..2c8a6de22de 100644 --- a/src/Generated/Drives/Item/Items/Item/Versions/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Versions/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItemVersion; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream for this version of the item. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-list-versions?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream for this version of the item. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Versions/Item/DriveItemVersionItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Versions/Item/DriveItemVersionItemRequestBuilder.php index 7af92c95490..0c74b160e64 100644 --- a/src/Generated/Drives/Item/Items/Item/Versions/Item/DriveItemVersionItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Versions/Item/DriveItemVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Versions\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Versions\Item\RestoreVersion\RestoreVersionRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItemVersion; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property versions for drives * @param DriveItemVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DriveItemVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the metadata for a specific version of a DriveItem. This API is available in the following national cloud deployments. * @param DriveItemVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitemversion-get?view=graph-rest-1.0 Find more info here */ public function get(?DriveItemVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property versions in drives * @param DriveItemVersion $body The request body * @param DriveItemVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DriveItemVersion $body, ?DriveItemVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?DriveItemVersionItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?DriveItemVersionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?DriveItemVersionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(DriveItemVersion $body, ?DriveItemVers $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php index fcc323a002d..258b0451ba2 100644 --- a/src/Generated/Drives/Item/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a previous version of a DriveItem to be the current version. This will create a new version with the contents of the previous version, but preserves all existing versions of the file. This API is available in the following national cloud deployments. * @param RestoreVersionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitemversion-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreVersionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RestoreVersionRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Versions/VersionsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Versions/VersionsRequestBuilder.php index 0b678f1de2c..dc4288aaac0 100644 --- a/src/Generated/Drives/Item/Items/Item/Versions/VersionsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Versions/VersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Versions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Versions\Item\DriveItemVersionItemRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItemVersion; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * OneDrive and SharePoint can be configured to retain the history for files.Depending on the service and configuration, a new version can be created for each edit, each time the file is saved, manually, or never. Previous versions of a document may be retained for a finite period of time depending on admin settings that may be unique per user or location. This API is available in the following national cloud deployments. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-list-versions?view=graph-rest-1.0 Find more info here */ public function get(?VersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItemVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItemVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to versions for drives * @param DriveItemVersion $body The request body * @param VersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DriveItemVersion $body, ?VersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(DriveItemVersion $body, ?VersionsReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Application/ApplicationRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Application/ApplicationRequestBuilder.php index 19d6e26018f..83337d1e759 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Application/ApplicationRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Application/ApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Application\Calculate\CalculateRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookApplication; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property application for drives * @param ApplicationRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ApplicationRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a workbookApplication object. This API is available in the following national cloud deployments. * @param ApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workbookapplication-get?view=graph-rest-1.0 Find more info here */ public function get(?ApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookApplication::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookApplication::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property application in drives * @param WorkbookApplication $body The request body * @param ApplicationRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookApplication $body, ?ApplicationRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookApplication::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookApplication::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ApplicationRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ApplicationRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ApplicationRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(WorkbookApplication $body, ?Applicatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Application/Calculate/CalculateRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Application/Calculate/CalculateRequestBuilder.php index 4c04ab90b21..2e85f4910f8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Application/Calculate/CalculateRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Application/Calculate/CalculateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Recalculate all currently opened workbooks in Excel. This API is available in the following national cloud deployments. * @param CalculatePostRequestBody $body The request body * @param CalculateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workbookapplication-calculate?view=graph-rest-1.0 Find more info here */ public function post(CalculatePostRequestBody $body, ?CalculateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CalculatePostRequestBody $body, ?Calcul $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/CloseSession/CloseSessionRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/CloseSession/CloseSessionRequestBuilder.php index b92073979f6..2468c56fe5a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/CloseSession/CloseSessionRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/CloseSession/CloseSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Use this API to close an existing workbook session. This API is available in the following national cloud deployments. * @param CloseSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workbook-closesession?view=graph-rest-1.0 Find more info here */ public function post(?CloseSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CloseSessionRequestBuilderPostRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Comments/CommentsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Comments/CommentsRequestBuilder.php index 954a67e236d..c8ef3ba04be 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Comments/CommentsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Comments/CommentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Comments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Comments\Item\WorkbookCommentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents a collection of comments in a workbook. * @param CommentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CommentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookCommentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookCommentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to comments for drives * @param WorkbookComment $body The request body * @param CommentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WorkbookComment $body, ?CommentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookComment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookComment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?CommentsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?CommentsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(WorkbookComment $body, ?CommentsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Count/CountRequestBuilder.php index bd613e3d397..256dfd5a81d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/Replies/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/Replies/Count/CountRequestBuilder.php index 5fd16e00560..23949d9ab88 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/Replies/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/Replies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/Replies/Item/WorkbookCommentReplyItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/Replies/Item/WorkbookCommentReplyItemRequestBuilder.php index 748705731c6..8542758effe 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/Replies/Item/WorkbookCommentReplyItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/Replies/Item/WorkbookCommentReplyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookCommentReply; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property replies for drives * @param WorkbookCommentReplyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WorkbookCommentReplyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of workbookCommentReply object. This API is available in the following national cloud deployments. * @param WorkbookCommentReplyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workbookcommentreply-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkbookCommentReplyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookCommentReply::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookCommentReply::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property replies in drives * @param WorkbookCommentReply $body The request body * @param WorkbookCommentReplyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookCommentReply $body, ?WorkbookCommentReplyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookCommentReply::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookCommentReply::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?WorkbookCommentReplyItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?WorkbookCommentReplyItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?WorkbookCommentReplyItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(WorkbookCommentReply $body, ?WorkbookC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/Replies/RepliesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/Replies/RepliesRequestBuilder.php index cc0654b0851..71e750dbcdc 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/Replies/RepliesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/Replies/RepliesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Comments\Item\Replies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Comments\Item\Replies\Item\WorkbookCommentReplyItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of workbookCommentReply object. This API is available in the following national cloud deployments. * @param RepliesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RepliesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookCommentReplyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookCommentReplyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to replies for drives * @param WorkbookCommentReply $body The request body * @param RepliesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WorkbookCommentReply $body, ?RepliesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookCommentReply::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookCommentReply::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(WorkbookCommentReply $body, ?RepliesReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/WorkbookCommentItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/WorkbookCommentItemRequestBuilder.php index c6c1aa44ae6..6c3960f7256 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/WorkbookCommentItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Comments/Item/WorkbookCommentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Comments\Item\Replies\RepliesRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookComment; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property comments for drives * @param WorkbookCommentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WorkbookCommentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents a collection of comments in a workbook. * @param WorkbookCommentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WorkbookCommentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookComment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookComment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property comments in drives * @param WorkbookComment $body The request body * @param WorkbookCommentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookComment $body, ?WorkbookCommentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookComment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookComment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?WorkbookCommentItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?WorkbookCommentItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?WorkbookCommentItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookComment $body, ?WorkbookCommen $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/CreateSession/CreateSessionRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/CreateSession/CreateSessionRequestBuilder.php index 43a63fc8e4e..8da146f3af7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/CreateSession/CreateSessionRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/CreateSession/CreateSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookSessionInfo; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a new workbook session. Excel APIs can be called in one of two modes: To represent the session in the API, use the workbook-session-id: {session-id} header. In some cases, creating a new session requires an indeterminate time to complete. Microsoft Graph also provides a long running operations pattern. This pattern provides a way to poll for creation status updates, without waiting for the creation to complete. The following are the steps: This API is available in the following national cloud deployments. * @param CreateSessionPostRequestBody $body The request body * @param CreateSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workbook-createsession?view=graph-rest-1.0 Find more info here */ public function post(CreateSessionPostRequestBody $body, ?CreateSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookSessionInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookSessionInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateSessionPostRequestBody $body, ?Cr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Abs/AbsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Abs/AbsRequestBuilder.php index 393ff6d4d30..2af6dc4b03e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Abs/AbsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Abs/AbsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action abs * @param AbsPostRequestBody $body The request body * @param AbsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AbsPostRequestBody $body, ?AbsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AbsPostRequestBody $body, ?AbsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AccrInt/AccrIntRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AccrInt/AccrIntRequestBuilder.php index 2a00aa9cf9c..11eff9750d3 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AccrInt/AccrIntRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AccrInt/AccrIntRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action accrInt * @param AccrIntPostRequestBody $body The request body * @param AccrIntRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccrIntPostRequestBody $body, ?AccrIntRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AccrIntPostRequestBody $body, ?AccrIntR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AccrIntM/AccrIntMRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AccrIntM/AccrIntMRequestBuilder.php index 02b97bb2bbc..7ca6219a7ff 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AccrIntM/AccrIntMRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AccrIntM/AccrIntMRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action accrIntM * @param AccrIntMPostRequestBody $body The request body * @param AccrIntMRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccrIntMPostRequestBody $body, ?AccrIntMRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AccrIntMPostRequestBody $body, ?AccrInt $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acos/AcosRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acos/AcosRequestBuilder.php index c77a57b3c2b..d2ec6983ed2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acos/AcosRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acos/AcosRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action acos * @param AcosPostRequestBody $body The request body * @param AcosRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AcosPostRequestBody $body, ?AcosRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AcosPostRequestBody $body, ?AcosRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acosh/AcoshRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acosh/AcoshRequestBuilder.php index bbc5b0426e0..9177e80579c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acosh/AcoshRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acosh/AcoshRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action acosh * @param AcoshPostRequestBody $body The request body * @param AcoshRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AcoshPostRequestBody $body, ?AcoshRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AcoshPostRequestBody $body, ?AcoshReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acot/AcotRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acot/AcotRequestBuilder.php index 844157100dd..edc812ca5ed 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acot/AcotRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acot/AcotRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action acot * @param AcotPostRequestBody $body The request body * @param AcotRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AcotPostRequestBody $body, ?AcotRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AcotPostRequestBody $body, ?AcotRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acoth/AcothRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acoth/AcothRequestBuilder.php index 005532f827b..8f9e2999b0b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acoth/AcothRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Acoth/AcothRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action acoth * @param AcothPostRequestBody $body The request body * @param AcothRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AcothPostRequestBody $body, ?AcothRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AcothPostRequestBody $body, ?AcothReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AmorDegrc/AmorDegrcRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AmorDegrc/AmorDegrcRequestBuilder.php index 8c9cb29dc08..39723a005be 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AmorDegrc/AmorDegrcRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AmorDegrc/AmorDegrcRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action amorDegrc * @param AmorDegrcPostRequestBody $body The request body * @param AmorDegrcRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AmorDegrcPostRequestBody $body, ?AmorDegrcRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AmorDegrcPostRequestBody $body, ?AmorDe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AmorLinc/AmorLincRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AmorLinc/AmorLincRequestBuilder.php index 7930a88ef32..e45d10c7e7e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AmorLinc/AmorLincRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AmorLinc/AmorLincRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action amorLinc * @param AmorLincPostRequestBody $body The request body * @param AmorLincRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AmorLincPostRequestBody $body, ?AmorLincRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AmorLincPostRequestBody $body, ?AmorLin $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Arabic/ArabicRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Arabic/ArabicRequestBuilder.php index 842e6f236cf..55daaae993f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Arabic/ArabicRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Arabic/ArabicRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action arabic * @param ArabicPostRequestBody $body The request body * @param ArabicRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ArabicPostRequestBody $body, ?ArabicRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ArabicPostRequestBody $body, ?ArabicReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Areas/AreasRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Areas/AreasRequestBuilder.php index 9f7c83555c0..7da38c2103f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Areas/AreasRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Areas/AreasRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action areas * @param AreasPostRequestBody $body The request body * @param AreasRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AreasPostRequestBody $body, ?AreasRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AreasPostRequestBody $body, ?AreasReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Asc/AscRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Asc/AscRequestBuilder.php index bf141fe5230..31d3aae0bc4 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Asc/AscRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Asc/AscRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action asc * @param AscPostRequestBody $body The request body * @param AscRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AscPostRequestBody $body, ?AscRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AscPostRequestBody $body, ?AscRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Asin/AsinRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Asin/AsinRequestBuilder.php index e634539cc3c..8f91e458334 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Asin/AsinRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Asin/AsinRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action asin * @param AsinPostRequestBody $body The request body * @param AsinRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AsinPostRequestBody $body, ?AsinRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AsinPostRequestBody $body, ?AsinRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Asinh/AsinhRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Asinh/AsinhRequestBuilder.php index 4513c74c7f3..7f3f4e53358 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Asinh/AsinhRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Asinh/AsinhRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action asinh * @param AsinhPostRequestBody $body The request body * @param AsinhRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AsinhPostRequestBody $body, ?AsinhRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AsinhPostRequestBody $body, ?AsinhReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Atan/AtanRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Atan/AtanRequestBuilder.php index a59f03bea32..ea5796aad72 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Atan/AtanRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Atan/AtanRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action atan * @param AtanPostRequestBody $body The request body * @param AtanRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AtanPostRequestBody $body, ?AtanRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AtanPostRequestBody $body, ?AtanRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Atan2/Atan2RequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Atan2/Atan2RequestBuilder.php index f1a585654e9..d07a53249f5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Atan2/Atan2RequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Atan2/Atan2RequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action atan2 * @param Atan2PostRequestBody $body The request body * @param Atan2RequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Atan2PostRequestBody $body, ?Atan2RequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Atan2PostRequestBody $body, ?Atan2Reque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Atanh/AtanhRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Atanh/AtanhRequestBuilder.php index a0cee3a7510..13f4183977a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Atanh/AtanhRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Atanh/AtanhRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action atanh * @param AtanhPostRequestBody $body The request body * @param AtanhRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AtanhPostRequestBody $body, ?AtanhRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AtanhPostRequestBody $body, ?AtanhReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AveDev/AveDevRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AveDev/AveDevRequestBuilder.php index b813975582d..b6b403cba01 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AveDev/AveDevRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AveDev/AveDevRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action aveDev * @param AveDevPostRequestBody $body The request body * @param AveDevRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AveDevPostRequestBody $body, ?AveDevRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AveDevPostRequestBody $body, ?AveDevReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Average/AverageRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Average/AverageRequestBuilder.php index 711b39bf018..e761959c194 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Average/AverageRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Average/AverageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action average * @param AveragePostRequestBody $body The request body * @param AverageRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AveragePostRequestBody $body, ?AverageRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AveragePostRequestBody $body, ?AverageR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AverageA/AverageARequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AverageA/AverageARequestBuilder.php index f380844ff21..83520d85cf8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AverageA/AverageARequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AverageA/AverageARequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action averageA * @param AverageAPostRequestBody $body The request body * @param AverageARequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AverageAPostRequestBody $body, ?AverageARequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AverageAPostRequestBody $body, ?Average $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AverageIf/AverageIfRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AverageIf/AverageIfRequestBuilder.php index b882955ddbd..fe4d73e0f6c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AverageIf/AverageIfRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AverageIf/AverageIfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action averageIf * @param AverageIfPostRequestBody $body The request body * @param AverageIfRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AverageIfPostRequestBody $body, ?AverageIfRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AverageIfPostRequestBody $body, ?Averag $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AverageIfs/AverageIfsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AverageIfs/AverageIfsRequestBuilder.php index ea3309c11b9..360e8301751 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AverageIfs/AverageIfsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/AverageIfs/AverageIfsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action averageIfs * @param AverageIfsPostRequestBody $body The request body * @param AverageIfsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AverageIfsPostRequestBody $body, ?AverageIfsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AverageIfsPostRequestBody $body, ?Avera $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BahtText/BahtTextRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BahtText/BahtTextRequestBuilder.php index 873e68b83b6..7a4b7714cbd 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BahtText/BahtTextRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BahtText/BahtTextRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action bahtText * @param BahtTextPostRequestBody $body The request body * @param BahtTextRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(BahtTextPostRequestBody $body, ?BahtTextRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(BahtTextPostRequestBody $body, ?BahtTex $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Base/EscapedBaseRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Base/EscapedBaseRequestBuilder.php index 0adbb736c31..ec6b1647fa2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Base/EscapedBaseRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Base/EscapedBaseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action base * @param BasePostRequestBody $body The request body * @param BaseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(BasePostRequestBody $body, ?BaseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(BasePostRequestBody $body, ?BaseRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselI/BesselIRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselI/BesselIRequestBuilder.php index 7baba11e149..42e70de9595 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselI/BesselIRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselI/BesselIRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action besselI * @param BesselIPostRequestBody $body The request body * @param BesselIRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(BesselIPostRequestBody $body, ?BesselIRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(BesselIPostRequestBody $body, ?BesselIR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselJ/BesselJRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselJ/BesselJRequestBuilder.php index 265e849e923..6f7fa0429d5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselJ/BesselJRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselJ/BesselJRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action besselJ * @param BesselJPostRequestBody $body The request body * @param BesselJRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(BesselJPostRequestBody $body, ?BesselJRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(BesselJPostRequestBody $body, ?BesselJR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselK/BesselKRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselK/BesselKRequestBuilder.php index 33ec37c5528..6828851c54a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselK/BesselKRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselK/BesselKRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action besselK * @param BesselKPostRequestBody $body The request body * @param BesselKRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(BesselKPostRequestBody $body, ?BesselKRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(BesselKPostRequestBody $body, ?BesselKR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselY/BesselYRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselY/BesselYRequestBuilder.php index d58a3c2ce3b..2e6eefa67e4 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselY/BesselYRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/BesselY/BesselYRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action besselY * @param BesselYPostRequestBody $body The request body * @param BesselYRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(BesselYPostRequestBody $body, ?BesselYRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(BesselYPostRequestBody $body, ?BesselYR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Beta_Dist/Beta_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Beta_Dist/Beta_DistRequestBuilder.php index 2ccc091bded..b86ced6a61e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Beta_Dist/Beta_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Beta_Dist/Beta_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action beta_Dist * @param Beta_DistPostRequestBody $body The request body * @param Beta_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Beta_DistPostRequestBody $body, ?Beta_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Beta_DistPostRequestBody $body, ?Beta_D $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Beta_Inv/Beta_InvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Beta_Inv/Beta_InvRequestBuilder.php index 7c0efe76276..1835829f779 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Beta_Inv/Beta_InvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Beta_Inv/Beta_InvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action beta_Inv * @param Beta_InvPostRequestBody $body The request body * @param Beta_InvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Beta_InvPostRequestBody $body, ?Beta_InvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Beta_InvPostRequestBody $body, ?Beta_In $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bin2Dec/Bin2DecRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bin2Dec/Bin2DecRequestBuilder.php index bbb7a96d645..2e735bde474 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bin2Dec/Bin2DecRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bin2Dec/Bin2DecRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action bin2Dec * @param Bin2DecPostRequestBody $body The request body * @param Bin2DecRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Bin2DecPostRequestBody $body, ?Bin2DecRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Bin2DecPostRequestBody $body, ?Bin2DecR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bin2Hex/Bin2HexRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bin2Hex/Bin2HexRequestBuilder.php index f906e8b39a1..8fa82930b1c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bin2Hex/Bin2HexRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bin2Hex/Bin2HexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action bin2Hex * @param Bin2HexPostRequestBody $body The request body * @param Bin2HexRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Bin2HexPostRequestBody $body, ?Bin2HexRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Bin2HexPostRequestBody $body, ?Bin2HexR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bin2Oct/Bin2OctRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bin2Oct/Bin2OctRequestBuilder.php index d7bb6a0d04e..8dc40b1c78c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bin2Oct/Bin2OctRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bin2Oct/Bin2OctRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action bin2Oct * @param Bin2OctPostRequestBody $body The request body * @param Bin2OctRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Bin2OctPostRequestBody $body, ?Bin2OctRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Bin2OctPostRequestBody $body, ?Bin2OctR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Binom_Dist/Binom_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Binom_Dist/Binom_DistRequestBuilder.php index dbee62eddcc..234ad3b7a2f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Binom_Dist/Binom_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Binom_Dist/Binom_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action binom_Dist * @param Binom_DistPostRequestBody $body The request body * @param Binom_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Binom_DistPostRequestBody $body, ?Binom_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Binom_DistPostRequestBody $body, ?Binom $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Binom_Dist_Range/Binom_Dist_RangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Binom_Dist_Range/Binom_Dist_RangeRequestBuilder.php index 3d9b05bcadc..5d2c7f6c0ba 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Binom_Dist_Range/Binom_Dist_RangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Binom_Dist_Range/Binom_Dist_RangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action binom_Dist_Range * @param Binom_Dist_RangePostRequestBody $body The request body * @param Binom_Dist_RangeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Binom_Dist_RangePostRequestBody $body, ?Binom_Dist_RangeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Binom_Dist_RangePostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Binom_Inv/Binom_InvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Binom_Inv/Binom_InvRequestBuilder.php index 193414d4889..d09d3ba832a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Binom_Inv/Binom_InvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Binom_Inv/Binom_InvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action binom_Inv * @param Binom_InvPostRequestBody $body The request body * @param Binom_InvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Binom_InvPostRequestBody $body, ?Binom_InvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Binom_InvPostRequestBody $body, ?Binom_ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitand/BitandRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitand/BitandRequestBuilder.php index 5a2070c2fe5..d6a7cbb90da 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitand/BitandRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitand/BitandRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action bitand * @param BitandPostRequestBody $body The request body * @param BitandRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(BitandPostRequestBody $body, ?BitandRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(BitandPostRequestBody $body, ?BitandReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitlshift/BitlshiftRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitlshift/BitlshiftRequestBuilder.php index cba947aca1d..56ee2649cd7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitlshift/BitlshiftRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitlshift/BitlshiftRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action bitlshift * @param BitlshiftPostRequestBody $body The request body * @param BitlshiftRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(BitlshiftPostRequestBody $body, ?BitlshiftRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(BitlshiftPostRequestBody $body, ?Bitlsh $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitor/BitorRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitor/BitorRequestBuilder.php index a75d25d3a13..a38163d7dd8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitor/BitorRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitor/BitorRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action bitor * @param BitorPostRequestBody $body The request body * @param BitorRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(BitorPostRequestBody $body, ?BitorRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(BitorPostRequestBody $body, ?BitorReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitrshift/BitrshiftRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitrshift/BitrshiftRequestBuilder.php index bfe3d7c573b..acef846cd43 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitrshift/BitrshiftRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitrshift/BitrshiftRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action bitrshift * @param BitrshiftPostRequestBody $body The request body * @param BitrshiftRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(BitrshiftPostRequestBody $body, ?BitrshiftRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(BitrshiftPostRequestBody $body, ?Bitrsh $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitxor/BitxorRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitxor/BitxorRequestBuilder.php index 069b1240316..8e601293f47 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitxor/BitxorRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Bitxor/BitxorRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action bitxor * @param BitxorPostRequestBody $body The request body * @param BitxorRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(BitxorPostRequestBody $body, ?BitxorRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(BitxorPostRequestBody $body, ?BitxorReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ceiling_Math/Ceiling_MathRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ceiling_Math/Ceiling_MathRequestBuilder.php index 21f330496ec..e901a6aa790 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ceiling_Math/Ceiling_MathRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ceiling_Math/Ceiling_MathRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action ceiling_Math * @param Ceiling_MathPostRequestBody $body The request body * @param Ceiling_MathRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Ceiling_MathPostRequestBody $body, ?Ceiling_MathRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Ceiling_MathPostRequestBody $body, ?Cei $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ceiling_Precise/Ceiling_PreciseRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ceiling_Precise/Ceiling_PreciseRequestBuilder.php index d4a6ff8bfdf..4c511b78a5f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ceiling_Precise/Ceiling_PreciseRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ceiling_Precise/Ceiling_PreciseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action ceiling_Precise * @param Ceiling_PrecisePostRequestBody $body The request body * @param Ceiling_PreciseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Ceiling_PrecisePostRequestBody $body, ?Ceiling_PreciseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Ceiling_PrecisePostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Char/CharRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Char/CharRequestBuilder.php index 6e1e21ab281..0fd241f1ae9 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Char/CharRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Char/CharRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action char * @param CharPostRequestBody $body The request body * @param CharRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CharPostRequestBody $body, ?CharRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CharPostRequestBody $body, ?CharRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Dist/ChiSq_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Dist/ChiSq_DistRequestBuilder.php index c338438ae3f..34c998e6c6a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Dist/ChiSq_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Dist/ChiSq_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action chiSq_Dist * @param ChiSq_DistPostRequestBody $body The request body * @param ChiSq_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChiSq_DistPostRequestBody $body, ?ChiSq_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ChiSq_DistPostRequestBody $body, ?ChiSq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Dist_RT/ChiSq_Dist_RTRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Dist_RT/ChiSq_Dist_RTRequestBuilder.php index ce692dc29c2..f1956dc3189 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Dist_RT/ChiSq_Dist_RTRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Dist_RT/ChiSq_Dist_RTRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action chiSq_Dist_RT * @param ChiSq_Dist_RTPostRequestBody $body The request body * @param ChiSq_Dist_RTRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChiSq_Dist_RTPostRequestBody $body, ?ChiSq_Dist_RTRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ChiSq_Dist_RTPostRequestBody $body, ?Ch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Inv/ChiSq_InvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Inv/ChiSq_InvRequestBuilder.php index 7d4f76c2f68..203406d2ebe 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Inv/ChiSq_InvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Inv/ChiSq_InvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action chiSq_Inv * @param ChiSq_InvPostRequestBody $body The request body * @param ChiSq_InvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChiSq_InvPostRequestBody $body, ?ChiSq_InvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ChiSq_InvPostRequestBody $body, ?ChiSq_ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Inv_RT/ChiSq_Inv_RTRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Inv_RT/ChiSq_Inv_RTRequestBuilder.php index e4ee3228e23..04def93ef1e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Inv_RT/ChiSq_Inv_RTRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ChiSq_Inv_RT/ChiSq_Inv_RTRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action chiSq_Inv_RT * @param ChiSq_Inv_RTPostRequestBody $body The request body * @param ChiSq_Inv_RTRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChiSq_Inv_RTPostRequestBody $body, ?ChiSq_Inv_RTRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ChiSq_Inv_RTPostRequestBody $body, ?Chi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Choose/ChooseRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Choose/ChooseRequestBuilder.php index d538352889d..4f2924bc983 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Choose/ChooseRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Choose/ChooseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action choose * @param ChoosePostRequestBody $body The request body * @param ChooseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChoosePostRequestBody $body, ?ChooseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ChoosePostRequestBody $body, ?ChooseReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Clean/CleanRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Clean/CleanRequestBuilder.php index f86a81fb205..43017564aa0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Clean/CleanRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Clean/CleanRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action clean * @param CleanPostRequestBody $body The request body * @param CleanRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CleanPostRequestBody $body, ?CleanRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CleanPostRequestBody $body, ?CleanReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Code/CodeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Code/CodeRequestBuilder.php index 54306cf5b96..0c9aff7ea2f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Code/CodeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Code/CodeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action code * @param CodePostRequestBody $body The request body * @param CodeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CodePostRequestBody $body, ?CodeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CodePostRequestBody $body, ?CodeRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Columns/ColumnsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Columns/ColumnsRequestBuilder.php index 560962e58dd..46f7278207d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action columns * @param ColumnsPostRequestBody $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ColumnsPostRequestBody $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ColumnsPostRequestBody $body, ?ColumnsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Combin/CombinRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Combin/CombinRequestBuilder.php index 1bc70210a4e..307fb5333a3 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Combin/CombinRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Combin/CombinRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action combin * @param CombinPostRequestBody $body The request body * @param CombinRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CombinPostRequestBody $body, ?CombinRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CombinPostRequestBody $body, ?CombinReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Combina/CombinaRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Combina/CombinaRequestBuilder.php index 30a9ffb5a5c..d19214ea1b2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Combina/CombinaRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Combina/CombinaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action combina * @param CombinaPostRequestBody $body The request body * @param CombinaRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CombinaPostRequestBody $body, ?CombinaRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CombinaPostRequestBody $body, ?CombinaR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Complex/ComplexRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Complex/ComplexRequestBuilder.php index 975adfeef94..ff52b2c97e6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Complex/ComplexRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Complex/ComplexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action complex * @param ComplexPostRequestBody $body The request body * @param ComplexRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ComplexPostRequestBody $body, ?ComplexRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ComplexPostRequestBody $body, ?ComplexR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Concatenate/ConcatenateRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Concatenate/ConcatenateRequestBuilder.php index 5a8a348c626..8f1c470d5f3 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Concatenate/ConcatenateRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Concatenate/ConcatenateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action concatenate * @param ConcatenatePostRequestBody $body The request body * @param ConcatenateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ConcatenatePostRequestBody $body, ?ConcatenateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ConcatenatePostRequestBody $body, ?Conc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Confidence_Norm/Confidence_NormRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Confidence_Norm/Confidence_NormRequestBuilder.php index 8ccc5a42cdc..6fb7048327f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Confidence_Norm/Confidence_NormRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Confidence_Norm/Confidence_NormRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action confidence_Norm * @param Confidence_NormPostRequestBody $body The request body * @param Confidence_NormRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Confidence_NormPostRequestBody $body, ?Confidence_NormRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Confidence_NormPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Confidence_T/Confidence_TRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Confidence_T/Confidence_TRequestBuilder.php index 4b0e6a3acf3..9ce4b3dcccb 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Confidence_T/Confidence_TRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Confidence_T/Confidence_TRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action confidence_T * @param Confidence_TPostRequestBody $body The request body * @param Confidence_TRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Confidence_TPostRequestBody $body, ?Confidence_TRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Confidence_TPostRequestBody $body, ?Con $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Convert/ConvertRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Convert/ConvertRequestBuilder.php index 893b45b0371..5c902ae3c48 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Convert/ConvertRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Convert/ConvertRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action convert * @param ConvertPostRequestBody $body The request body * @param ConvertRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ConvertPostRequestBody $body, ?ConvertRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ConvertPostRequestBody $body, ?ConvertR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Cos/CosRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Cos/CosRequestBuilder.php index ca34e7f3021..bfc2f55d96b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Cos/CosRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Cos/CosRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action cos * @param CosPostRequestBody $body The request body * @param CosRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CosPostRequestBody $body, ?CosRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CosPostRequestBody $body, ?CosRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Cosh/CoshRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Cosh/CoshRequestBuilder.php index cee50cd1d4f..83e95f20a88 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Cosh/CoshRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Cosh/CoshRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action cosh * @param CoshPostRequestBody $body The request body * @param CoshRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CoshPostRequestBody $body, ?CoshRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CoshPostRequestBody $body, ?CoshRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Cot/CotRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Cot/CotRequestBuilder.php index 1816e450654..2ea97b24e35 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Cot/CotRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Cot/CotRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action cot * @param CotPostRequestBody $body The request body * @param CotRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CotPostRequestBody $body, ?CotRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CotPostRequestBody $body, ?CotRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Coth/CothRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Coth/CothRequestBuilder.php index f496204aa89..8a3a802ac53 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Coth/CothRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Coth/CothRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action coth * @param CothPostRequestBody $body The request body * @param CothRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CothPostRequestBody $body, ?CothRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CothPostRequestBody $body, ?CothRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Count/CountRequestBuilder.php index f612a04da3e..bc3d7cb713e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action count * @param CountPostRequestBody $body The request body * @param CountRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CountPostRequestBody $body, ?CountRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CountPostRequestBody $body, ?CountReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountA/CountARequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountA/CountARequestBuilder.php index c8239e269f4..210ea1658fb 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountA/CountARequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountA/CountARequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action countA * @param CountAPostRequestBody $body The request body * @param CountARequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CountAPostRequestBody $body, ?CountARequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CountAPostRequestBody $body, ?CountAReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountBlank/CountBlankRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountBlank/CountBlankRequestBuilder.php index 9c59296abd4..ba562368bbf 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountBlank/CountBlankRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountBlank/CountBlankRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action countBlank * @param CountBlankPostRequestBody $body The request body * @param CountBlankRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CountBlankPostRequestBody $body, ?CountBlankRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CountBlankPostRequestBody $body, ?Count $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountIf/CountIfRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountIf/CountIfRequestBuilder.php index bf82d273318..fc5fe51940a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountIf/CountIfRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountIf/CountIfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action countIf * @param CountIfPostRequestBody $body The request body * @param CountIfRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CountIfPostRequestBody $body, ?CountIfRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CountIfPostRequestBody $body, ?CountIfR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountIfs/CountIfsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountIfs/CountIfsRequestBuilder.php index d061f5004d5..3d50e24e065 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountIfs/CountIfsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CountIfs/CountIfsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action countIfs * @param CountIfsPostRequestBody $body The request body * @param CountIfsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CountIfsPostRequestBody $body, ?CountIfsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CountIfsPostRequestBody $body, ?CountIf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupDayBs/CoupDayBsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupDayBs/CoupDayBsRequestBuilder.php index 6644464ab36..ace82ca5242 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupDayBs/CoupDayBsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupDayBs/CoupDayBsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action coupDayBs * @param CoupDayBsPostRequestBody $body The request body * @param CoupDayBsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CoupDayBsPostRequestBody $body, ?CoupDayBsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CoupDayBsPostRequestBody $body, ?CoupDa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupDays/CoupDaysRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupDays/CoupDaysRequestBuilder.php index a2c28bde0fe..e3c396fd079 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupDays/CoupDaysRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupDays/CoupDaysRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action coupDays * @param CoupDaysPostRequestBody $body The request body * @param CoupDaysRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CoupDaysPostRequestBody $body, ?CoupDaysRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CoupDaysPostRequestBody $body, ?CoupDay $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupDaysNc/CoupDaysNcRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupDaysNc/CoupDaysNcRequestBuilder.php index 4f5ff5afd32..1a461ef795b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupDaysNc/CoupDaysNcRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupDaysNc/CoupDaysNcRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action coupDaysNc * @param CoupDaysNcPostRequestBody $body The request body * @param CoupDaysNcRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CoupDaysNcPostRequestBody $body, ?CoupDaysNcRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CoupDaysNcPostRequestBody $body, ?CoupD $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupNcd/CoupNcdRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupNcd/CoupNcdRequestBuilder.php index 538b8d835b6..ff710e2ad29 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupNcd/CoupNcdRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupNcd/CoupNcdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action coupNcd * @param CoupNcdPostRequestBody $body The request body * @param CoupNcdRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CoupNcdPostRequestBody $body, ?CoupNcdRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CoupNcdPostRequestBody $body, ?CoupNcdR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupNum/CoupNumRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupNum/CoupNumRequestBuilder.php index 65fdb699b55..7ce699cc259 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupNum/CoupNumRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupNum/CoupNumRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action coupNum * @param CoupNumPostRequestBody $body The request body * @param CoupNumRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CoupNumPostRequestBody $body, ?CoupNumRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CoupNumPostRequestBody $body, ?CoupNumR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupPcd/CoupPcdRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupPcd/CoupPcdRequestBuilder.php index 7a2820f86db..772246f4920 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupPcd/CoupPcdRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CoupPcd/CoupPcdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action coupPcd * @param CoupPcdPostRequestBody $body The request body * @param CoupPcdRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CoupPcdPostRequestBody $body, ?CoupPcdRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CoupPcdPostRequestBody $body, ?CoupPcdR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Csc/CscRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Csc/CscRequestBuilder.php index f9ecf14a082..ab34768e6e9 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Csc/CscRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Csc/CscRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action csc * @param CscPostRequestBody $body The request body * @param CscRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CscPostRequestBody $body, ?CscRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CscPostRequestBody $body, ?CscRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Csch/CschRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Csch/CschRequestBuilder.php index 0713df31371..7d30d107ba1 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Csch/CschRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Csch/CschRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action csch * @param CschPostRequestBody $body The request body * @param CschRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CschPostRequestBody $body, ?CschRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CschPostRequestBody $body, ?CschRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CumIPmt/CumIPmtRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CumIPmt/CumIPmtRequestBuilder.php index 3e28ecf213a..0ba7aeeffec 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CumIPmt/CumIPmtRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CumIPmt/CumIPmtRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action cumIPmt * @param CumIPmtPostRequestBody $body The request body * @param CumIPmtRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CumIPmtPostRequestBody $body, ?CumIPmtRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CumIPmtPostRequestBody $body, ?CumIPmtR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CumPrinc/CumPrincRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CumPrinc/CumPrincRequestBuilder.php index 1a5e79c351d..449539b387d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CumPrinc/CumPrincRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/CumPrinc/CumPrincRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action cumPrinc * @param CumPrincPostRequestBody $body The request body * @param CumPrincRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CumPrincPostRequestBody $body, ?CumPrincRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(CumPrincPostRequestBody $body, ?CumPrin $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Date/DateRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Date/DateRequestBuilder.php index e2652fc4c38..1f779764be2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Date/DateRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Date/DateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action date * @param DatePostRequestBody $body The request body * @param DateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DatePostRequestBody $body, ?DateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DatePostRequestBody $body, ?DateRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Datevalue/DatevalueRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Datevalue/DatevalueRequestBuilder.php index 838200e9899..bd715402e54 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Datevalue/DatevalueRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Datevalue/DatevalueRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action datevalue * @param DatevaluePostRequestBody $body The request body * @param DatevalueRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DatevaluePostRequestBody $body, ?DatevalueRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DatevaluePostRequestBody $body, ?Dateva $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Daverage/DaverageRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Daverage/DaverageRequestBuilder.php index 8172bb90fe2..a1b7031e5f4 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Daverage/DaverageRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Daverage/DaverageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action daverage * @param DaveragePostRequestBody $body The request body * @param DaverageRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DaveragePostRequestBody $body, ?DaverageRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DaveragePostRequestBody $body, ?Daverag $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Day/DayRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Day/DayRequestBuilder.php index 43ea7fbf806..7981db8e48b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Day/DayRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Day/DayRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action day * @param DayPostRequestBody $body The request body * @param DayRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DayPostRequestBody $body, ?DayRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DayPostRequestBody $body, ?DayRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Days/DaysRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Days/DaysRequestBuilder.php index 5b640fcf42d..f90fb9b47e6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Days/DaysRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Days/DaysRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action days * @param DaysPostRequestBody $body The request body * @param DaysRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DaysPostRequestBody $body, ?DaysRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DaysPostRequestBody $body, ?DaysRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Days360/Days360RequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Days360/Days360RequestBuilder.php index e77d600a63c..c0c378f113c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Days360/Days360RequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Days360/Days360RequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action days360 * @param Days360PostRequestBody $body The request body * @param Days360RequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Days360PostRequestBody $body, ?Days360RequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Days360PostRequestBody $body, ?Days360R $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Db/DbRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Db/DbRequestBuilder.php index 11d7c634a20..8095c717c73 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Db/DbRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Db/DbRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action db * @param DbPostRequestBody $body The request body * @param DbRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DbPostRequestBody $body, ?DbRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DbPostRequestBody $body, ?DbRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dbcs/DbcsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dbcs/DbcsRequestBuilder.php index a6fc64aae6b..0c7af4bb392 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dbcs/DbcsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dbcs/DbcsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dbcs * @param DbcsPostRequestBody $body The request body * @param DbcsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DbcsPostRequestBody $body, ?DbcsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DbcsPostRequestBody $body, ?DbcsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dcount/DcountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dcount/DcountRequestBuilder.php index f6c85ff4188..a84c8e04730 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dcount/DcountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dcount/DcountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dcount * @param DcountPostRequestBody $body The request body * @param DcountRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DcountPostRequestBody $body, ?DcountRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DcountPostRequestBody $body, ?DcountReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DcountA/DcountARequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DcountA/DcountARequestBuilder.php index 25daacd4d89..a882ecdd717 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DcountA/DcountARequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DcountA/DcountARequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dcountA * @param DcountAPostRequestBody $body The request body * @param DcountARequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DcountAPostRequestBody $body, ?DcountARequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DcountAPostRequestBody $body, ?DcountAR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ddb/DdbRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ddb/DdbRequestBuilder.php index d6495b6dd5f..700d7e224e9 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ddb/DdbRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ddb/DdbRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action ddb * @param DdbPostRequestBody $body The request body * @param DdbRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DdbPostRequestBody $body, ?DdbRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DdbPostRequestBody $body, ?DdbRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dec2Bin/Dec2BinRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dec2Bin/Dec2BinRequestBuilder.php index 7b9de1524ab..0caf5de9ad4 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dec2Bin/Dec2BinRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dec2Bin/Dec2BinRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dec2Bin * @param Dec2BinPostRequestBody $body The request body * @param Dec2BinRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Dec2BinPostRequestBody $body, ?Dec2BinRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Dec2BinPostRequestBody $body, ?Dec2BinR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dec2Hex/Dec2HexRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dec2Hex/Dec2HexRequestBuilder.php index cafe6efe37a..3bc5fdf3739 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dec2Hex/Dec2HexRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dec2Hex/Dec2HexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dec2Hex * @param Dec2HexPostRequestBody $body The request body * @param Dec2HexRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Dec2HexPostRequestBody $body, ?Dec2HexRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Dec2HexPostRequestBody $body, ?Dec2HexR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dec2Oct/Dec2OctRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dec2Oct/Dec2OctRequestBuilder.php index c52702cb252..aa49774eb37 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dec2Oct/Dec2OctRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dec2Oct/Dec2OctRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dec2Oct * @param Dec2OctPostRequestBody $body The request body * @param Dec2OctRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Dec2OctPostRequestBody $body, ?Dec2OctRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Dec2OctPostRequestBody $body, ?Dec2OctR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Decimal/DecimalRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Decimal/DecimalRequestBuilder.php index f380dee8665..17f6c7aa568 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Decimal/DecimalRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Decimal/DecimalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action decimal * @param DecimalPostRequestBody $body The request body * @param DecimalRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DecimalPostRequestBody $body, ?DecimalRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DecimalPostRequestBody $body, ?DecimalR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Degrees/DegreesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Degrees/DegreesRequestBuilder.php index 28d58297cd1..7b42b2d512b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Degrees/DegreesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Degrees/DegreesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action degrees * @param DegreesPostRequestBody $body The request body * @param DegreesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DegreesPostRequestBody $body, ?DegreesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DegreesPostRequestBody $body, ?DegreesR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Delta/DeltaRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Delta/DeltaRequestBuilder.php index 12ccc5d71bb..4d9da771bd8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action delta * @param DeltaPostRequestBody $body The request body * @param DeltaRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DeltaPostRequestBody $body, ?DeltaRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DeltaPostRequestBody $body, ?DeltaReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DevSq/DevSqRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DevSq/DevSqRequestBuilder.php index f01ccaebd89..435bee5676a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DevSq/DevSqRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DevSq/DevSqRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action devSq * @param DevSqPostRequestBody $body The request body * @param DevSqRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DevSqPostRequestBody $body, ?DevSqRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DevSqPostRequestBody $body, ?DevSqReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dget/DgetRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dget/DgetRequestBuilder.php index 12877d04e9f..60dbaaf1759 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dget/DgetRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dget/DgetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dget * @param DgetPostRequestBody $body The request body * @param DgetRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DgetPostRequestBody $body, ?DgetRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DgetPostRequestBody $body, ?DgetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Disc/DiscRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Disc/DiscRequestBuilder.php index a419dff9540..62555d55dec 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Disc/DiscRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Disc/DiscRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action disc * @param DiscPostRequestBody $body The request body * @param DiscRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DiscPostRequestBody $body, ?DiscRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DiscPostRequestBody $body, ?DiscRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dmax/DmaxRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dmax/DmaxRequestBuilder.php index b1d462bcac0..3104721c697 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dmax/DmaxRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dmax/DmaxRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dmax * @param DmaxPostRequestBody $body The request body * @param DmaxRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DmaxPostRequestBody $body, ?DmaxRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DmaxPostRequestBody $body, ?DmaxRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dmin/DminRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dmin/DminRequestBuilder.php index be96bc08765..c2c5b5d8db8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dmin/DminRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dmin/DminRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dmin * @param DminPostRequestBody $body The request body * @param DminRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DminPostRequestBody $body, ?DminRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DminPostRequestBody $body, ?DminRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dollar/DollarRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dollar/DollarRequestBuilder.php index 2232793ba86..9bf0bf8a46c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dollar/DollarRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dollar/DollarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dollar * @param DollarPostRequestBody $body The request body * @param DollarRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DollarPostRequestBody $body, ?DollarRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DollarPostRequestBody $body, ?DollarReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DollarDe/DollarDeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DollarDe/DollarDeRequestBuilder.php index a0d1cec5b52..719f1c780c3 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DollarDe/DollarDeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DollarDe/DollarDeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dollarDe * @param DollarDePostRequestBody $body The request body * @param DollarDeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DollarDePostRequestBody $body, ?DollarDeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DollarDePostRequestBody $body, ?DollarD $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DollarFr/DollarFrRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DollarFr/DollarFrRequestBuilder.php index c35adbf14d7..b05889ed7fd 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DollarFr/DollarFrRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DollarFr/DollarFrRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dollarFr * @param DollarFrPostRequestBody $body The request body * @param DollarFrRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DollarFrPostRequestBody $body, ?DollarFrRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DollarFrPostRequestBody $body, ?DollarF $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dproduct/DproductRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dproduct/DproductRequestBuilder.php index d9fff91192b..35acf51d600 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dproduct/DproductRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dproduct/DproductRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dproduct * @param DproductPostRequestBody $body The request body * @param DproductRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DproductPostRequestBody $body, ?DproductRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DproductPostRequestBody $body, ?Dproduc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DstDev/DstDevRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DstDev/DstDevRequestBuilder.php index 549ee212b2b..e94e9f7ac0a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DstDev/DstDevRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DstDev/DstDevRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dstDev * @param DstDevPostRequestBody $body The request body * @param DstDevRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DstDevPostRequestBody $body, ?DstDevRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DstDevPostRequestBody $body, ?DstDevReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DstDevP/DstDevPRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DstDevP/DstDevPRequestBuilder.php index 6852f04e28f..bbc35665fed 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DstDevP/DstDevPRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DstDevP/DstDevPRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dstDevP * @param DstDevPPostRequestBody $body The request body * @param DstDevPRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DstDevPPostRequestBody $body, ?DstDevPRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DstDevPPostRequestBody $body, ?DstDevPR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dsum/DsumRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dsum/DsumRequestBuilder.php index 9b4552144f3..9ed58681624 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dsum/DsumRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dsum/DsumRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dsum * @param DsumPostRequestBody $body The request body * @param DsumRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DsumPostRequestBody $body, ?DsumRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DsumPostRequestBody $body, ?DsumRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Duration/DurationRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Duration/DurationRequestBuilder.php index 831bd427c4a..742ca260f9b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Duration/DurationRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Duration/DurationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action duration * @param DurationPostRequestBody $body The request body * @param DurationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DurationPostRequestBody $body, ?DurationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DurationPostRequestBody $body, ?Duratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dvar/DvarRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dvar/DvarRequestBuilder.php index 9302227da02..51deff87e2a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dvar/DvarRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Dvar/DvarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dvar * @param DvarPostRequestBody $body The request body * @param DvarRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DvarPostRequestBody $body, ?DvarRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DvarPostRequestBody $body, ?DvarRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DvarP/DvarPRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DvarP/DvarPRequestBuilder.php index f3afa0ed862..14dd120d1f3 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DvarP/DvarPRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/DvarP/DvarPRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action dvarP * @param DvarPPostRequestBody $body The request body * @param DvarPRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DvarPPostRequestBody $body, ?DvarPRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(DvarPPostRequestBody $body, ?DvarPReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ecma_Ceiling/Ecma_CeilingRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ecma_Ceiling/Ecma_CeilingRequestBuilder.php index 30caf3f2c51..b39a5f96b60 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ecma_Ceiling/Ecma_CeilingRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ecma_Ceiling/Ecma_CeilingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action ecma_Ceiling * @param Ecma_CeilingPostRequestBody $body The request body * @param Ecma_CeilingRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Ecma_CeilingPostRequestBody $body, ?Ecma_CeilingRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Ecma_CeilingPostRequestBody $body, ?Ecm $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Edate/EdateRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Edate/EdateRequestBuilder.php index d48229407be..591597d612e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Edate/EdateRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Edate/EdateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action edate * @param EdatePostRequestBody $body The request body * @param EdateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EdatePostRequestBody $body, ?EdateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(EdatePostRequestBody $body, ?EdateReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Effect/EffectRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Effect/EffectRequestBuilder.php index 952b56b2b60..8bce888a1ca 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Effect/EffectRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Effect/EffectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action effect * @param EffectPostRequestBody $body The request body * @param EffectRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EffectPostRequestBody $body, ?EffectRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(EffectPostRequestBody $body, ?EffectReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EoMonth/EoMonthRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EoMonth/EoMonthRequestBuilder.php index 6f0b9c0731a..188b9535c1d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EoMonth/EoMonthRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EoMonth/EoMonthRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action eoMonth * @param EoMonthPostRequestBody $body The request body * @param EoMonthRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EoMonthPostRequestBody $body, ?EoMonthRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(EoMonthPostRequestBody $body, ?EoMonthR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Erf/ErfRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Erf/ErfRequestBuilder.php index b51f29db0ba..fbb08588f75 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Erf/ErfRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Erf/ErfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action erf * @param ErfPostRequestBody $body The request body * @param ErfRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ErfPostRequestBody $body, ?ErfRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ErfPostRequestBody $body, ?ErfRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ErfC/ErfCRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ErfC/ErfCRequestBuilder.php index 801cb05d4de..2926ecd8c10 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ErfC/ErfCRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ErfC/ErfCRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action erfC * @param ErfCPostRequestBody $body The request body * @param ErfCRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ErfCPostRequestBody $body, ?ErfCRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ErfCPostRequestBody $body, ?ErfCRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ErfC_Precise/ErfC_PreciseRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ErfC_Precise/ErfC_PreciseRequestBuilder.php index d936df9f4e1..1017217eb76 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ErfC_Precise/ErfC_PreciseRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ErfC_Precise/ErfC_PreciseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action erfC_Precise * @param ErfC_PrecisePostRequestBody $body The request body * @param ErfC_PreciseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ErfC_PrecisePostRequestBody $body, ?ErfC_PreciseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ErfC_PrecisePostRequestBody $body, ?Erf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Erf_Precise/Erf_PreciseRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Erf_Precise/Erf_PreciseRequestBuilder.php index 29b782bad0f..8a2e829ccbe 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Erf_Precise/Erf_PreciseRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Erf_Precise/Erf_PreciseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action erf_Precise * @param Erf_PrecisePostRequestBody $body The request body * @param Erf_PreciseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Erf_PrecisePostRequestBody $body, ?Erf_PreciseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Erf_PrecisePostRequestBody $body, ?Erf_ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Error_Type/Error_TypeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Error_Type/Error_TypeRequestBuilder.php index 2f36ef5a4be..51b86e1322c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Error_Type/Error_TypeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Error_Type/Error_TypeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action error_Type * @param Error_TypePostRequestBody $body The request body * @param Error_TypeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Error_TypePostRequestBody $body, ?Error_TypeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Error_TypePostRequestBody $body, ?Error $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedAnd/AndRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedAnd/AndRequestBuilder.php index d0416255be5..fbadfd74f68 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedAnd/AndRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedAnd/AndRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action and * @param AndPostRequestBody $body The request body * @param AndRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AndPostRequestBody $body, ?AndRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AndPostRequestBody $body, ?AndRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedIf/IfRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedIf/IfRequestBuilder.php index f3e9950ec4b..53989a6438d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedIf/IfRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedIf/IfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action if * @param IfPostRequestBody $body The request body * @param IfRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IfPostRequestBody $body, ?IfRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IfPostRequestBody $body, ?IfRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedOr/OrRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedOr/OrRequestBuilder.php index a7bde3e688d..9df28e2d387 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedOr/OrRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedOr/OrRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action or * @param OrPostRequestBody $body The request body * @param OrRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OrPostRequestBody $body, ?OrRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(OrPostRequestBody $body, ?OrRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedXor/XorRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedXor/XorRequestBuilder.php index f3df1aa654a..ab2d571f0a1 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedXor/XorRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedXor/XorRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action xor * @param XorPostRequestBody $body The request body * @param XorRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(XorPostRequestBody $body, ?XorRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(XorPostRequestBody $body, ?XorRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedYield/YieldRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedYield/YieldRequestBuilder.php index d3d5fad8ac7..50ae579be77 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedYield/YieldRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/EscapedYield/YieldRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action yield * @param YieldPostRequestBody $body The request body * @param YieldRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(YieldPostRequestBody $body, ?YieldRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(YieldPostRequestBody $body, ?YieldReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Even/EvenRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Even/EvenRequestBuilder.php index b06148294de..0f245c277fe 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Even/EvenRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Even/EvenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action even * @param EvenPostRequestBody $body The request body * @param EvenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EvenPostRequestBody $body, ?EvenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(EvenPostRequestBody $body, ?EvenRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Exact/ExactRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Exact/ExactRequestBuilder.php index 6170bfc026c..3e25c233f50 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Exact/ExactRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Exact/ExactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action exact * @param ExactPostRequestBody $body The request body * @param ExactRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ExactPostRequestBody $body, ?ExactRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ExactPostRequestBody $body, ?ExactReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Exp/ExpRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Exp/ExpRequestBuilder.php index 6c967ef3209..6947a79b2ba 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Exp/ExpRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Exp/ExpRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action exp * @param ExpPostRequestBody $body The request body * @param ExpRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ExpPostRequestBody $body, ?ExpRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ExpPostRequestBody $body, ?ExpRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Expon_Dist/Expon_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Expon_Dist/Expon_DistRequestBuilder.php index 1c7a19dc2da..225bf06ffd2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Expon_Dist/Expon_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Expon_Dist/Expon_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action expon_Dist * @param Expon_DistPostRequestBody $body The request body * @param Expon_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Expon_DistPostRequestBody $body, ?Expon_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Expon_DistPostRequestBody $body, ?Expon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Dist/F_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Dist/F_DistRequestBuilder.php index 0ed1a17ccd8..c40e1ca2bcc 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Dist/F_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Dist/F_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action f_Dist * @param F_DistPostRequestBody $body The request body * @param F_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(F_DistPostRequestBody $body, ?F_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(F_DistPostRequestBody $body, ?F_DistReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Dist_RT/F_Dist_RTRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Dist_RT/F_Dist_RTRequestBuilder.php index b462675a227..fc4a22db86e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Dist_RT/F_Dist_RTRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Dist_RT/F_Dist_RTRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action f_Dist_RT * @param F_Dist_RTPostRequestBody $body The request body * @param F_Dist_RTRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(F_Dist_RTPostRequestBody $body, ?F_Dist_RTRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(F_Dist_RTPostRequestBody $body, ?F_Dist $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Inv/F_InvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Inv/F_InvRequestBuilder.php index 940487cf3da..22f360818db 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Inv/F_InvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Inv/F_InvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action f_Inv * @param F_InvPostRequestBody $body The request body * @param F_InvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(F_InvPostRequestBody $body, ?F_InvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(F_InvPostRequestBody $body, ?F_InvReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Inv_RT/F_Inv_RTRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Inv_RT/F_Inv_RTRequestBuilder.php index 5f315c29419..ef3a4882039 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Inv_RT/F_Inv_RTRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/F_Inv_RT/F_Inv_RTRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action f_Inv_RT * @param F_Inv_RTPostRequestBody $body The request body * @param F_Inv_RTRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(F_Inv_RTPostRequestBody $body, ?F_Inv_RTRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(F_Inv_RTPostRequestBody $body, ?F_Inv_R $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fact/FactRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fact/FactRequestBuilder.php index e7428c26b63..1225fac3fd0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fact/FactRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fact/FactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action fact * @param FactPostRequestBody $body The request body * @param FactRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(FactPostRequestBody $body, ?FactRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(FactPostRequestBody $body, ?FactRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FactDouble/FactDoubleRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FactDouble/FactDoubleRequestBuilder.php index 80956df6575..7934f1fe318 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FactDouble/FactDoubleRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FactDouble/FactDoubleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action factDouble * @param FactDoublePostRequestBody $body The request body * @param FactDoubleRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(FactDoublePostRequestBody $body, ?FactDoubleRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(FactDoublePostRequestBody $body, ?FactD $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/False/FalseRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/False/FalseRequestBuilder.php index 075f797ae31..69a42b1d245 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/False/FalseRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/False/FalseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action false * @param FalseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?FalseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toPostRequestInformation(?FalseRequestBuilderPostRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Find/FindRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Find/FindRequestBuilder.php index 8df17502c70..ab844f703e4 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Find/FindRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Find/FindRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action find * @param FindPostRequestBody $body The request body * @param FindRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(FindPostRequestBody $body, ?FindRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(FindPostRequestBody $body, ?FindRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FindB/FindBRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FindB/FindBRequestBuilder.php index 5f4a3751770..d0091514149 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FindB/FindBRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FindB/FindBRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action findB * @param FindBPostRequestBody $body The request body * @param FindBRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(FindBPostRequestBody $body, ?FindBRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(FindBPostRequestBody $body, ?FindBReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fisher/FisherRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fisher/FisherRequestBuilder.php index c0de38d68cd..70cc107b9c9 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fisher/FisherRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fisher/FisherRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action fisher * @param FisherPostRequestBody $body The request body * @param FisherRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(FisherPostRequestBody $body, ?FisherRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(FisherPostRequestBody $body, ?FisherReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FisherInv/FisherInvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FisherInv/FisherInvRequestBuilder.php index 9608c905463..494ed51a5b9 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FisherInv/FisherInvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FisherInv/FisherInvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action fisherInv * @param FisherInvPostRequestBody $body The request body * @param FisherInvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(FisherInvPostRequestBody $body, ?FisherInvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(FisherInvPostRequestBody $body, ?Fisher $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fixed/FixedRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fixed/FixedRequestBuilder.php index df012d3767c..95ec586189c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fixed/FixedRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fixed/FixedRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action fixed * @param FixedPostRequestBody $body The request body * @param FixedRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(FixedPostRequestBody $body, ?FixedRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(FixedPostRequestBody $body, ?FixedReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Floor_Math/Floor_MathRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Floor_Math/Floor_MathRequestBuilder.php index 807d42fa7cf..74960e8c8ff 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Floor_Math/Floor_MathRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Floor_Math/Floor_MathRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action floor_Math * @param Floor_MathPostRequestBody $body The request body * @param Floor_MathRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Floor_MathPostRequestBody $body, ?Floor_MathRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Floor_MathPostRequestBody $body, ?Floor $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Floor_Precise/Floor_PreciseRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Floor_Precise/Floor_PreciseRequestBuilder.php index f17eec76aa7..30fbcbcde39 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Floor_Precise/Floor_PreciseRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Floor_Precise/Floor_PreciseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action floor_Precise * @param Floor_PrecisePostRequestBody $body The request body * @param Floor_PreciseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Floor_PrecisePostRequestBody $body, ?Floor_PreciseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Floor_PrecisePostRequestBody $body, ?Fl $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FunctionsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FunctionsRequestBuilder.php index e443bc46242..5103162c4a7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FunctionsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/FunctionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Functions\Abs\AbsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Functions\AccrInt\AccrIntRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Functions\AccrIntM\AccrIntMRequestBuilder; @@ -2962,56 +2961,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property functions for drives * @param FunctionsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FunctionsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get functions from drives * @param FunctionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FunctionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctions::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctions::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property functions in drives * @param WorkbookFunctions $body The request body * @param FunctionsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookFunctions $body, ?FunctionsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctions::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctions::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -3028,6 +3018,7 @@ public function toDeleteRequestInformation(?FunctionsRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -3041,7 +3032,6 @@ public function toGetRequestInformation(?FunctionsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -3049,6 +3039,7 @@ public function toGetRequestInformation(?FunctionsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -3063,11 +3054,11 @@ public function toPatchRequestInformation(WorkbookFunctions $body, ?FunctionsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fv/FvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fv/FvRequestBuilder.php index 1d658ebb74d..7a11b46deef 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fv/FvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fv/FvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action fv * @param FvPostRequestBody $body The request body * @param FvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(FvPostRequestBody $body, ?FvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(FvPostRequestBody $body, ?FvRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fvschedule/FvscheduleRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fvschedule/FvscheduleRequestBuilder.php index bd218f1b342..0a802f4901f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fvschedule/FvscheduleRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Fvschedule/FvscheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action fvschedule * @param FvschedulePostRequestBody $body The request body * @param FvscheduleRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(FvschedulePostRequestBody $body, ?FvscheduleRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(FvschedulePostRequestBody $body, ?Fvsch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gamma/GammaRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gamma/GammaRequestBuilder.php index ef33c080787..a75bd6c34f1 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gamma/GammaRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gamma/GammaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action gamma * @param GammaPostRequestBody $body The request body * @param GammaRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(GammaPostRequestBody $body, ?GammaRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GammaPostRequestBody $body, ?GammaReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GammaLn/GammaLnRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GammaLn/GammaLnRequestBuilder.php index 8d71e575611..5b46da01a5d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GammaLn/GammaLnRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GammaLn/GammaLnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action gammaLn * @param GammaLnPostRequestBody $body The request body * @param GammaLnRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(GammaLnPostRequestBody $body, ?GammaLnRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GammaLnPostRequestBody $body, ?GammaLnR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GammaLn_Precise/GammaLn_PreciseRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GammaLn_Precise/GammaLn_PreciseRequestBuilder.php index 20833af8fa4..450cac6142c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GammaLn_Precise/GammaLn_PreciseRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GammaLn_Precise/GammaLn_PreciseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action gammaLn_Precise * @param GammaLn_PrecisePostRequestBody $body The request body * @param GammaLn_PreciseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(GammaLn_PrecisePostRequestBody $body, ?GammaLn_PreciseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GammaLn_PrecisePostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gamma_Dist/Gamma_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gamma_Dist/Gamma_DistRequestBuilder.php index 5a6c1c1bb11..e74e2e93d5f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gamma_Dist/Gamma_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gamma_Dist/Gamma_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action gamma_Dist * @param Gamma_DistPostRequestBody $body The request body * @param Gamma_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Gamma_DistPostRequestBody $body, ?Gamma_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Gamma_DistPostRequestBody $body, ?Gamma $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gamma_Inv/Gamma_InvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gamma_Inv/Gamma_InvRequestBuilder.php index e7f1558473e..862cea1624b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gamma_Inv/Gamma_InvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gamma_Inv/Gamma_InvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action gamma_Inv * @param Gamma_InvPostRequestBody $body The request body * @param Gamma_InvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Gamma_InvPostRequestBody $body, ?Gamma_InvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Gamma_InvPostRequestBody $body, ?Gamma_ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gauss/GaussRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gauss/GaussRequestBuilder.php index b337a4d5635..42e0ad55295 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gauss/GaussRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gauss/GaussRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action gauss * @param GaussPostRequestBody $body The request body * @param GaussRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(GaussPostRequestBody $body, ?GaussRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GaussPostRequestBody $body, ?GaussReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gcd/GcdRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gcd/GcdRequestBuilder.php index 2d03b0a99b4..8d412ba3f98 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gcd/GcdRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Gcd/GcdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action gcd * @param GcdPostRequestBody $body The request body * @param GcdRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(GcdPostRequestBody $body, ?GcdRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GcdPostRequestBody $body, ?GcdRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GeStep/GeStepRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GeStep/GeStepRequestBuilder.php index f885c6eca7d..2368cac0b5c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GeStep/GeStepRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GeStep/GeStepRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action geStep * @param GeStepPostRequestBody $body The request body * @param GeStepRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(GeStepPostRequestBody $body, ?GeStepRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GeStepPostRequestBody $body, ?GeStepReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GeoMean/GeoMeanRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GeoMean/GeoMeanRequestBuilder.php index 77661b92b01..f624dcc30b2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GeoMean/GeoMeanRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/GeoMean/GeoMeanRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action geoMean * @param GeoMeanPostRequestBody $body The request body * @param GeoMeanRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(GeoMeanPostRequestBody $body, ?GeoMeanRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GeoMeanPostRequestBody $body, ?GeoMeanR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/HarMean/HarMeanRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/HarMean/HarMeanRequestBuilder.php index 9d0b56e4de1..da346aa266d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/HarMean/HarMeanRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/HarMean/HarMeanRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action harMean * @param HarMeanPostRequestBody $body The request body * @param HarMeanRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(HarMeanPostRequestBody $body, ?HarMeanRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(HarMeanPostRequestBody $body, ?HarMeanR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hex2Bin/Hex2BinRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hex2Bin/Hex2BinRequestBuilder.php index 9bd701da42e..66cec25cb12 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hex2Bin/Hex2BinRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hex2Bin/Hex2BinRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action hex2Bin * @param Hex2BinPostRequestBody $body The request body * @param Hex2BinRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Hex2BinPostRequestBody $body, ?Hex2BinRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Hex2BinPostRequestBody $body, ?Hex2BinR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hex2Dec/Hex2DecRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hex2Dec/Hex2DecRequestBuilder.php index 110859768c5..db9e0261844 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hex2Dec/Hex2DecRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hex2Dec/Hex2DecRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action hex2Dec * @param Hex2DecPostRequestBody $body The request body * @param Hex2DecRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Hex2DecPostRequestBody $body, ?Hex2DecRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Hex2DecPostRequestBody $body, ?Hex2DecR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hex2Oct/Hex2OctRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hex2Oct/Hex2OctRequestBuilder.php index 4711a760410..ec40a858a09 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hex2Oct/Hex2OctRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hex2Oct/Hex2OctRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action hex2Oct * @param Hex2OctPostRequestBody $body The request body * @param Hex2OctRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Hex2OctPostRequestBody $body, ?Hex2OctRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Hex2OctPostRequestBody $body, ?Hex2OctR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hlookup/HlookupRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hlookup/HlookupRequestBuilder.php index a4eecabd7f4..b9e5bd10a96 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hlookup/HlookupRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hlookup/HlookupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action hlookup * @param HlookupPostRequestBody $body The request body * @param HlookupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(HlookupPostRequestBody $body, ?HlookupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(HlookupPostRequestBody $body, ?HlookupR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hour/HourRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hour/HourRequestBuilder.php index 85b622b26c9..a9ba799473f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hour/HourRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hour/HourRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action hour * @param HourPostRequestBody $body The request body * @param HourRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(HourPostRequestBody $body, ?HourRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(HourPostRequestBody $body, ?HourRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/HypGeom_Dist/HypGeom_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/HypGeom_Dist/HypGeom_DistRequestBuilder.php index 823fb2cad28..fee6353d711 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/HypGeom_Dist/HypGeom_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/HypGeom_Dist/HypGeom_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action hypGeom_Dist * @param HypGeom_DistPostRequestBody $body The request body * @param HypGeom_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(HypGeom_DistPostRequestBody $body, ?HypGeom_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(HypGeom_DistPostRequestBody $body, ?Hyp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hyperlink/HyperlinkRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hyperlink/HyperlinkRequestBuilder.php index f3c52fc80ed..ad96cb642e5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hyperlink/HyperlinkRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Hyperlink/HyperlinkRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action hyperlink * @param HyperlinkPostRequestBody $body The request body * @param HyperlinkRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(HyperlinkPostRequestBody $body, ?HyperlinkRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(HyperlinkPostRequestBody $body, ?Hyperl $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImAbs/ImAbsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImAbs/ImAbsRequestBuilder.php index 272df2df514..d163a55d4cd 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImAbs/ImAbsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImAbs/ImAbsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imAbs * @param ImAbsPostRequestBody $body The request body * @param ImAbsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImAbsPostRequestBody $body, ?ImAbsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImAbsPostRequestBody $body, ?ImAbsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImArgument/ImArgumentRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImArgument/ImArgumentRequestBuilder.php index bed6e8df165..b8ab9c5be23 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImArgument/ImArgumentRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImArgument/ImArgumentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imArgument * @param ImArgumentPostRequestBody $body The request body * @param ImArgumentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImArgumentPostRequestBody $body, ?ImArgumentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImArgumentPostRequestBody $body, ?ImArg $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImConjugate/ImConjugateRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImConjugate/ImConjugateRequestBuilder.php index 2e5578a00e6..a35da0bdee1 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImConjugate/ImConjugateRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImConjugate/ImConjugateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imConjugate * @param ImConjugatePostRequestBody $body The request body * @param ImConjugateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImConjugatePostRequestBody $body, ?ImConjugateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImConjugatePostRequestBody $body, ?ImCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCos/ImCosRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCos/ImCosRequestBuilder.php index 89861964f7e..9bc39346a59 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCos/ImCosRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCos/ImCosRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imCos * @param ImCosPostRequestBody $body The request body * @param ImCosRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImCosPostRequestBody $body, ?ImCosRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImCosPostRequestBody $body, ?ImCosReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCosh/ImCoshRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCosh/ImCoshRequestBuilder.php index 9bc499efe99..380d6a0d8d4 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCosh/ImCoshRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCosh/ImCoshRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imCosh * @param ImCoshPostRequestBody $body The request body * @param ImCoshRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImCoshPostRequestBody $body, ?ImCoshRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImCoshPostRequestBody $body, ?ImCoshReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCot/ImCotRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCot/ImCotRequestBuilder.php index 821117ff432..53f63f4c7fd 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCot/ImCotRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCot/ImCotRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imCot * @param ImCotPostRequestBody $body The request body * @param ImCotRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImCotPostRequestBody $body, ?ImCotRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImCotPostRequestBody $body, ?ImCotReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCsc/ImCscRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCsc/ImCscRequestBuilder.php index af0815c27c8..b3ad9a3352a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCsc/ImCscRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCsc/ImCscRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imCsc * @param ImCscPostRequestBody $body The request body * @param ImCscRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImCscPostRequestBody $body, ?ImCscRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImCscPostRequestBody $body, ?ImCscReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCsch/ImCschRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCsch/ImCschRequestBuilder.php index b0b6b95e7bf..d8bb0db46a6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCsch/ImCschRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImCsch/ImCschRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imCsch * @param ImCschPostRequestBody $body The request body * @param ImCschRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImCschPostRequestBody $body, ?ImCschRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImCschPostRequestBody $body, ?ImCschReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImDiv/ImDivRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImDiv/ImDivRequestBuilder.php index 20f7b04d18f..c23726d5534 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImDiv/ImDivRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImDiv/ImDivRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imDiv * @param ImDivPostRequestBody $body The request body * @param ImDivRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImDivPostRequestBody $body, ?ImDivRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImDivPostRequestBody $body, ?ImDivReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImExp/ImExpRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImExp/ImExpRequestBuilder.php index 6644252bf1e..3436ceb97fa 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImExp/ImExpRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImExp/ImExpRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imExp * @param ImExpPostRequestBody $body The request body * @param ImExpRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImExpPostRequestBody $body, ?ImExpRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImExpPostRequestBody $body, ?ImExpReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImLn/ImLnRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImLn/ImLnRequestBuilder.php index f077fb49461..9c2e4dc6e31 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImLn/ImLnRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImLn/ImLnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imLn * @param ImLnPostRequestBody $body The request body * @param ImLnRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImLnPostRequestBody $body, ?ImLnRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImLnPostRequestBody $body, ?ImLnRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImLog10/ImLog10RequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImLog10/ImLog10RequestBuilder.php index 7cd378f7902..4bdc8ee24ab 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImLog10/ImLog10RequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImLog10/ImLog10RequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imLog10 * @param ImLog10PostRequestBody $body The request body * @param ImLog10RequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImLog10PostRequestBody $body, ?ImLog10RequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImLog10PostRequestBody $body, ?ImLog10R $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImLog2/ImLog2RequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImLog2/ImLog2RequestBuilder.php index d409c6104f0..1e5515d2891 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImLog2/ImLog2RequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImLog2/ImLog2RequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imLog2 * @param ImLog2PostRequestBody $body The request body * @param ImLog2RequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImLog2PostRequestBody $body, ?ImLog2RequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImLog2PostRequestBody $body, ?ImLog2Req $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImPower/ImPowerRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImPower/ImPowerRequestBuilder.php index 180a62def1e..041d6a0b2c2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImPower/ImPowerRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImPower/ImPowerRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imPower * @param ImPowerPostRequestBody $body The request body * @param ImPowerRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImPowerPostRequestBody $body, ?ImPowerRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImPowerPostRequestBody $body, ?ImPowerR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImProduct/ImProductRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImProduct/ImProductRequestBuilder.php index 7dc2f4ea9b8..c05c305b818 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImProduct/ImProductRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImProduct/ImProductRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imProduct * @param ImProductPostRequestBody $body The request body * @param ImProductRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImProductPostRequestBody $body, ?ImProductRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImProductPostRequestBody $body, ?ImProd $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImReal/ImRealRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImReal/ImRealRequestBuilder.php index fbfcf80b22d..a5241f7baca 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImReal/ImRealRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImReal/ImRealRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imReal * @param ImRealPostRequestBody $body The request body * @param ImRealRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImRealPostRequestBody $body, ?ImRealRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImRealPostRequestBody $body, ?ImRealReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSec/ImSecRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSec/ImSecRequestBuilder.php index 6ca24c333c1..19bd96f2a70 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSec/ImSecRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSec/ImSecRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imSec * @param ImSecPostRequestBody $body The request body * @param ImSecRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImSecPostRequestBody $body, ?ImSecRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImSecPostRequestBody $body, ?ImSecReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSech/ImSechRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSech/ImSechRequestBuilder.php index 59fb0553878..61d5cca59b1 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSech/ImSechRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSech/ImSechRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imSech * @param ImSechPostRequestBody $body The request body * @param ImSechRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImSechPostRequestBody $body, ?ImSechRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImSechPostRequestBody $body, ?ImSechReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSin/ImSinRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSin/ImSinRequestBuilder.php index c9cf1f61dd3..92f257a90f0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSin/ImSinRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSin/ImSinRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imSin * @param ImSinPostRequestBody $body The request body * @param ImSinRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImSinPostRequestBody $body, ?ImSinRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImSinPostRequestBody $body, ?ImSinReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSinh/ImSinhRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSinh/ImSinhRequestBuilder.php index 28176af97ad..7b87d752bcf 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSinh/ImSinhRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSinh/ImSinhRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imSinh * @param ImSinhPostRequestBody $body The request body * @param ImSinhRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImSinhPostRequestBody $body, ?ImSinhRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImSinhPostRequestBody $body, ?ImSinhReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSqrt/ImSqrtRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSqrt/ImSqrtRequestBuilder.php index 8cec906c0c8..9ea8e6ffaf0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSqrt/ImSqrtRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSqrt/ImSqrtRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imSqrt * @param ImSqrtPostRequestBody $body The request body * @param ImSqrtRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImSqrtPostRequestBody $body, ?ImSqrtRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImSqrtPostRequestBody $body, ?ImSqrtReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSub/ImSubRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSub/ImSubRequestBuilder.php index f729116c8ba..6f8d30715d5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSub/ImSubRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSub/ImSubRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imSub * @param ImSubPostRequestBody $body The request body * @param ImSubRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImSubPostRequestBody $body, ?ImSubRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImSubPostRequestBody $body, ?ImSubReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSum/ImSumRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSum/ImSumRequestBuilder.php index 0977428a400..1eac714a824 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSum/ImSumRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImSum/ImSumRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imSum * @param ImSumPostRequestBody $body The request body * @param ImSumRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImSumPostRequestBody $body, ?ImSumRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImSumPostRequestBody $body, ?ImSumReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImTan/ImTanRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImTan/ImTanRequestBuilder.php index a0f11b32b1d..b3d62ffe293 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImTan/ImTanRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ImTan/ImTanRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imTan * @param ImTanPostRequestBody $body The request body * @param ImTanRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImTanPostRequestBody $body, ?ImTanRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImTanPostRequestBody $body, ?ImTanReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Imaginary/ImaginaryRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Imaginary/ImaginaryRequestBuilder.php index 2bb1e86e5ec..1d851df13eb 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Imaginary/ImaginaryRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Imaginary/ImaginaryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action imaginary * @param ImaginaryPostRequestBody $body The request body * @param ImaginaryRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ImaginaryPostRequestBody $body, ?ImaginaryRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ImaginaryPostRequestBody $body, ?Imagin $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Int/IntRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Int/IntRequestBuilder.php index dc5aacfcb79..8c6988e10f2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Int/IntRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Int/IntRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action int * @param IntPostRequestBody $body The request body * @param IntRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IntPostRequestBody $body, ?IntRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IntPostRequestBody $body, ?IntRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IntRate/IntRateRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IntRate/IntRateRequestBuilder.php index 9ea2eec7ed4..8226114ecf7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IntRate/IntRateRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IntRate/IntRateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action intRate * @param IntRatePostRequestBody $body The request body * @param IntRateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IntRatePostRequestBody $body, ?IntRateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IntRatePostRequestBody $body, ?IntRateR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ipmt/IpmtRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ipmt/IpmtRequestBuilder.php index 93bfe86000c..6df2fe23cb5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ipmt/IpmtRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ipmt/IpmtRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action ipmt * @param IpmtPostRequestBody $body The request body * @param IpmtRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IpmtPostRequestBody $body, ?IpmtRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IpmtPostRequestBody $body, ?IpmtRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Irr/IrrRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Irr/IrrRequestBuilder.php index 20d1c03dd7d..755975e29bd 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Irr/IrrRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Irr/IrrRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action irr * @param IrrPostRequestBody $body The request body * @param IrrRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IrrPostRequestBody $body, ?IrrRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IrrPostRequestBody $body, ?IrrRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsErr/IsErrRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsErr/IsErrRequestBuilder.php index 589b1cb9120..99efb36ecd2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsErr/IsErrRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsErr/IsErrRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action isErr * @param IsErrPostRequestBody $body The request body * @param IsErrRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IsErrPostRequestBody $body, ?IsErrRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IsErrPostRequestBody $body, ?IsErrReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsError/IsErrorRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsError/IsErrorRequestBuilder.php index 26f3ce0f196..03a66249785 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsError/IsErrorRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsError/IsErrorRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action isError * @param IsErrorPostRequestBody $body The request body * @param IsErrorRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IsErrorPostRequestBody $body, ?IsErrorRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IsErrorPostRequestBody $body, ?IsErrorR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsEven/IsEvenRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsEven/IsEvenRequestBuilder.php index 2db7743f109..a2ba6a5614d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsEven/IsEvenRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsEven/IsEvenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action isEven * @param IsEvenPostRequestBody $body The request body * @param IsEvenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IsEvenPostRequestBody $body, ?IsEvenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IsEvenPostRequestBody $body, ?IsEvenReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsFormula/IsFormulaRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsFormula/IsFormulaRequestBuilder.php index a129036f803..8c03be7a0af 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsFormula/IsFormulaRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsFormula/IsFormulaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action isFormula * @param IsFormulaPostRequestBody $body The request body * @param IsFormulaRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IsFormulaPostRequestBody $body, ?IsFormulaRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IsFormulaPostRequestBody $body, ?IsForm $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsLogical/IsLogicalRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsLogical/IsLogicalRequestBuilder.php index eec66d50bfa..6bd91e198e4 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsLogical/IsLogicalRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsLogical/IsLogicalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action isLogical * @param IsLogicalPostRequestBody $body The request body * @param IsLogicalRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IsLogicalPostRequestBody $body, ?IsLogicalRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IsLogicalPostRequestBody $body, ?IsLogi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsNA/IsNARequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsNA/IsNARequestBuilder.php index 1617ef8b2bd..20972cb96d2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsNA/IsNARequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsNA/IsNARequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action isNA * @param IsNAPostRequestBody $body The request body * @param IsNARequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IsNAPostRequestBody $body, ?IsNARequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IsNAPostRequestBody $body, ?IsNARequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsNonText/IsNonTextRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsNonText/IsNonTextRequestBuilder.php index 0884955d079..890e2eea997 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsNonText/IsNonTextRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsNonText/IsNonTextRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action isNonText * @param IsNonTextPostRequestBody $body The request body * @param IsNonTextRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IsNonTextPostRequestBody $body, ?IsNonTextRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IsNonTextPostRequestBody $body, ?IsNonT $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsNumber/IsNumberRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsNumber/IsNumberRequestBuilder.php index 1b1af064670..be023a9be56 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsNumber/IsNumberRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsNumber/IsNumberRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action isNumber * @param IsNumberPostRequestBody $body The request body * @param IsNumberRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IsNumberPostRequestBody $body, ?IsNumberRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IsNumberPostRequestBody $body, ?IsNumbe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsOdd/IsOddRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsOdd/IsOddRequestBuilder.php index 2cbedb4ff7a..4426c49fc49 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsOdd/IsOddRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsOdd/IsOddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action isOdd * @param IsOddPostRequestBody $body The request body * @param IsOddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IsOddPostRequestBody $body, ?IsOddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IsOddPostRequestBody $body, ?IsOddReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsText/IsTextRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsText/IsTextRequestBuilder.php index b8f43639b61..89d0fcbb53f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsText/IsTextRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsText/IsTextRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action isText * @param IsTextPostRequestBody $body The request body * @param IsTextRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IsTextPostRequestBody $body, ?IsTextRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IsTextPostRequestBody $body, ?IsTextReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsoWeekNum/IsoWeekNumRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsoWeekNum/IsoWeekNumRequestBuilder.php index c9748400e85..78d5bd62811 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsoWeekNum/IsoWeekNumRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/IsoWeekNum/IsoWeekNumRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action isoWeekNum * @param IsoWeekNumPostRequestBody $body The request body * @param IsoWeekNumRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IsoWeekNumPostRequestBody $body, ?IsoWeekNumRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IsoWeekNumPostRequestBody $body, ?IsoWe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Iso_Ceiling/Iso_CeilingRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Iso_Ceiling/Iso_CeilingRequestBuilder.php index f3a985def2e..6ad5f715538 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Iso_Ceiling/Iso_CeilingRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Iso_Ceiling/Iso_CeilingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action iso_Ceiling * @param Iso_CeilingPostRequestBody $body The request body * @param Iso_CeilingRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Iso_CeilingPostRequestBody $body, ?Iso_CeilingRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Iso_CeilingPostRequestBody $body, ?Iso_ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ispmt/IspmtRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ispmt/IspmtRequestBuilder.php index 973f820948b..76602332299 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ispmt/IspmtRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ispmt/IspmtRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action ispmt * @param IspmtPostRequestBody $body The request body * @param IspmtRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IspmtPostRequestBody $body, ?IspmtRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IspmtPostRequestBody $body, ?IspmtReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Isref/IsrefRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Isref/IsrefRequestBuilder.php index 32c6e3c67a8..cad9cdfaa4b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Isref/IsrefRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Isref/IsrefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action isref * @param IsrefPostRequestBody $body The request body * @param IsrefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IsrefPostRequestBody $body, ?IsrefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(IsrefPostRequestBody $body, ?IsrefReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Kurt/KurtRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Kurt/KurtRequestBuilder.php index 97e412e8f55..173169d4745 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Kurt/KurtRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Kurt/KurtRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action kurt * @param KurtPostRequestBody $body The request body * @param KurtRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(KurtPostRequestBody $body, ?KurtRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(KurtPostRequestBody $body, ?KurtRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Large/LargeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Large/LargeRequestBuilder.php index bf924d111f5..15675aa0282 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Large/LargeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Large/LargeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action large * @param LargePostRequestBody $body The request body * @param LargeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LargePostRequestBody $body, ?LargeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(LargePostRequestBody $body, ?LargeReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lcm/LcmRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lcm/LcmRequestBuilder.php index ce6f2d504fa..ad0391d1c86 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lcm/LcmRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lcm/LcmRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action lcm * @param LcmPostRequestBody $body The request body * @param LcmRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LcmPostRequestBody $body, ?LcmRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(LcmPostRequestBody $body, ?LcmRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Left/LeftRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Left/LeftRequestBuilder.php index 27bfefd231e..7bba1d9baed 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Left/LeftRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Left/LeftRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action left * @param LeftPostRequestBody $body The request body * @param LeftRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LeftPostRequestBody $body, ?LeftRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(LeftPostRequestBody $body, ?LeftRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Leftb/LeftbRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Leftb/LeftbRequestBuilder.php index d5ab87cc232..8a4c4381c2b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Leftb/LeftbRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Leftb/LeftbRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action leftb * @param LeftbPostRequestBody $body The request body * @param LeftbRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LeftbPostRequestBody $body, ?LeftbRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(LeftbPostRequestBody $body, ?LeftbReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Len/LenRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Len/LenRequestBuilder.php index f3faf080405..381f01e0ffe 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Len/LenRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Len/LenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action len * @param LenPostRequestBody $body The request body * @param LenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LenPostRequestBody $body, ?LenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(LenPostRequestBody $body, ?LenRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lenb/LenbRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lenb/LenbRequestBuilder.php index 61b10866900..0a88cdeab41 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lenb/LenbRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lenb/LenbRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action lenb * @param LenbPostRequestBody $body The request body * @param LenbRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LenbPostRequestBody $body, ?LenbRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(LenbPostRequestBody $body, ?LenbRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ln/LnRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ln/LnRequestBuilder.php index 595d8412096..c85136bf257 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ln/LnRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ln/LnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action ln * @param LnPostRequestBody $body The request body * @param LnRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LnPostRequestBody $body, ?LnRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(LnPostRequestBody $body, ?LnRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Log/LogRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Log/LogRequestBuilder.php index 86e6ab02071..fcf0441d168 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Log/LogRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Log/LogRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action log * @param LogPostRequestBody $body The request body * @param LogRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LogPostRequestBody $body, ?LogRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(LogPostRequestBody $body, ?LogRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Log10/Log10RequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Log10/Log10RequestBuilder.php index 108a7789933..0531d87ee2a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Log10/Log10RequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Log10/Log10RequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action log10 * @param Log10PostRequestBody $body The request body * @param Log10RequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Log10PostRequestBody $body, ?Log10RequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Log10PostRequestBody $body, ?Log10Reque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/LogNorm_Dist/LogNorm_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/LogNorm_Dist/LogNorm_DistRequestBuilder.php index f275eb2216e..cf7e53d9675 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/LogNorm_Dist/LogNorm_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/LogNorm_Dist/LogNorm_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action logNorm_Dist * @param LogNorm_DistPostRequestBody $body The request body * @param LogNorm_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LogNorm_DistPostRequestBody $body, ?LogNorm_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(LogNorm_DistPostRequestBody $body, ?Log $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/LogNorm_Inv/LogNorm_InvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/LogNorm_Inv/LogNorm_InvRequestBuilder.php index 1788a9885b3..3183b0669f0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/LogNorm_Inv/LogNorm_InvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/LogNorm_Inv/LogNorm_InvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action logNorm_Inv * @param LogNorm_InvPostRequestBody $body The request body * @param LogNorm_InvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LogNorm_InvPostRequestBody $body, ?LogNorm_InvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(LogNorm_InvPostRequestBody $body, ?LogN $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lookup/LookupRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lookup/LookupRequestBuilder.php index 4d372474e8b..9294d4c422f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lookup/LookupRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lookup/LookupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action lookup * @param LookupPostRequestBody $body The request body * @param LookupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LookupPostRequestBody $body, ?LookupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(LookupPostRequestBody $body, ?LookupReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lower/LowerRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lower/LowerRequestBuilder.php index eff0e606939..7ae9e5cfc88 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lower/LowerRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Lower/LowerRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action lower * @param LowerPostRequestBody $body The request body * @param LowerRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LowerPostRequestBody $body, ?LowerRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(LowerPostRequestBody $body, ?LowerReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Match/MatchRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Match/MatchRequestBuilder.php index ca43028d9d7..dba23dc089e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Match/MatchRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Match/MatchRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action match * @param MatchPostRequestBody $body The request body * @param MatchRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MatchPostRequestBody $body, ?MatchRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MatchPostRequestBody $body, ?MatchReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Max/MaxRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Max/MaxRequestBuilder.php index fd04ab0a87b..96951df254d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Max/MaxRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Max/MaxRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action max * @param MaxPostRequestBody $body The request body * @param MaxRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MaxPostRequestBody $body, ?MaxRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MaxPostRequestBody $body, ?MaxRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/MaxA/MaxARequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/MaxA/MaxARequestBuilder.php index fca59187f0c..746cb182350 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/MaxA/MaxARequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/MaxA/MaxARequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action maxA * @param MaxAPostRequestBody $body The request body * @param MaxARequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MaxAPostRequestBody $body, ?MaxARequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MaxAPostRequestBody $body, ?MaxARequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mduration/MdurationRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mduration/MdurationRequestBuilder.php index f37fd417f4e..aa54b52304c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mduration/MdurationRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mduration/MdurationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action mduration * @param MdurationPostRequestBody $body The request body * @param MdurationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MdurationPostRequestBody $body, ?MdurationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MdurationPostRequestBody $body, ?Mdurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Median/MedianRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Median/MedianRequestBuilder.php index 1d205f18c78..1049096eb73 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Median/MedianRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Median/MedianRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action median * @param MedianPostRequestBody $body The request body * @param MedianRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MedianPostRequestBody $body, ?MedianRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MedianPostRequestBody $body, ?MedianReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mid/MidRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mid/MidRequestBuilder.php index b3cb5703e57..35e0829a8f5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mid/MidRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mid/MidRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action mid * @param MidPostRequestBody $body The request body * @param MidRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MidPostRequestBody $body, ?MidRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MidPostRequestBody $body, ?MidRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Midb/MidbRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Midb/MidbRequestBuilder.php index d94d1f37cf6..4621eb7bb2d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Midb/MidbRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Midb/MidbRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action midb * @param MidbPostRequestBody $body The request body * @param MidbRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MidbPostRequestBody $body, ?MidbRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MidbPostRequestBody $body, ?MidbRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Min/MinRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Min/MinRequestBuilder.php index 0f4e07d02d5..334a69186b5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Min/MinRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Min/MinRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action min * @param MinPostRequestBody $body The request body * @param MinRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MinPostRequestBody $body, ?MinRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MinPostRequestBody $body, ?MinRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/MinA/MinARequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/MinA/MinARequestBuilder.php index e6b45fc293e..2e03e45a4e0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/MinA/MinARequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/MinA/MinARequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action minA * @param MinAPostRequestBody $body The request body * @param MinARequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MinAPostRequestBody $body, ?MinARequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MinAPostRequestBody $body, ?MinARequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Minute/MinuteRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Minute/MinuteRequestBuilder.php index af043a09627..83b526bb9bc 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Minute/MinuteRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Minute/MinuteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action minute * @param MinutePostRequestBody $body The request body * @param MinuteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MinutePostRequestBody $body, ?MinuteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MinutePostRequestBody $body, ?MinuteReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mirr/MirrRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mirr/MirrRequestBuilder.php index c817918fb92..8b564ebd30d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mirr/MirrRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mirr/MirrRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action mirr * @param MirrPostRequestBody $body The request body * @param MirrRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MirrPostRequestBody $body, ?MirrRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MirrPostRequestBody $body, ?MirrRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mod/ModRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mod/ModRequestBuilder.php index a9c833b8f36..420b0a12df0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mod/ModRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mod/ModRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action mod * @param ModPostRequestBody $body The request body * @param ModRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ModPostRequestBody $body, ?ModRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ModPostRequestBody $body, ?ModRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Month/MonthRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Month/MonthRequestBuilder.php index f03f86ddc36..9fc1e75c577 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Month/MonthRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Month/MonthRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action month * @param MonthPostRequestBody $body The request body * @param MonthRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MonthPostRequestBody $body, ?MonthRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MonthPostRequestBody $body, ?MonthReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mround/MroundRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mround/MroundRequestBuilder.php index 61971822487..a5471a3b1f6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mround/MroundRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Mround/MroundRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action mround * @param MroundPostRequestBody $body The request body * @param MroundRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MroundPostRequestBody $body, ?MroundRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MroundPostRequestBody $body, ?MroundReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/MultiNomial/MultiNomialRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/MultiNomial/MultiNomialRequestBuilder.php index 499c6687bb8..6889ed0e3e2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/MultiNomial/MultiNomialRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/MultiNomial/MultiNomialRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action multiNomial * @param MultiNomialPostRequestBody $body The request body * @param MultiNomialRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MultiNomialPostRequestBody $body, ?MultiNomialRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(MultiNomialPostRequestBody $body, ?Mult $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/N/NRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/N/NRequestBuilder.php index 522eb8ef246..f716be03980 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/N/NRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/N/NRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action n * @param NPostRequestBody $body The request body * @param NRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(NPostRequestBody $body, ?NRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(NPostRequestBody $body, ?NRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Na/NaRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Na/NaRequestBuilder.php index 1f534ba04de..008ac977041 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Na/NaRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Na/NaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action na * @param NaRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?NaRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toPostRequestInformation(?NaRequestBuilderPostRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NegBinom_Dist/NegBinom_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NegBinom_Dist/NegBinom_DistRequestBuilder.php index 705e346350c..db3e92073ce 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NegBinom_Dist/NegBinom_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NegBinom_Dist/NegBinom_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action negBinom_Dist * @param NegBinom_DistPostRequestBody $body The request body * @param NegBinom_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(NegBinom_DistPostRequestBody $body, ?NegBinom_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(NegBinom_DistPostRequestBody $body, ?Ne $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NetworkDays/NetworkDaysRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NetworkDays/NetworkDaysRequestBuilder.php index aab4f09cd61..9cd4784b3fe 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NetworkDays/NetworkDaysRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NetworkDays/NetworkDaysRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action networkDays * @param NetworkDaysPostRequestBody $body The request body * @param NetworkDaysRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(NetworkDaysPostRequestBody $body, ?NetworkDaysRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(NetworkDaysPostRequestBody $body, ?Netw $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NetworkDays_Intl/NetworkDays_IntlRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NetworkDays_Intl/NetworkDays_IntlRequestBuilder.php index 85d5ead4948..f9e4601618e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NetworkDays_Intl/NetworkDays_IntlRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NetworkDays_Intl/NetworkDays_IntlRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action networkDays_Intl * @param NetworkDays_IntlPostRequestBody $body The request body * @param NetworkDays_IntlRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(NetworkDays_IntlPostRequestBody $body, ?NetworkDays_IntlRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(NetworkDays_IntlPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Nominal/NominalRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Nominal/NominalRequestBuilder.php index 7861fbe34d3..1e4e49cea50 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Nominal/NominalRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Nominal/NominalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action nominal * @param NominalPostRequestBody $body The request body * @param NominalRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(NominalPostRequestBody $body, ?NominalRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(NominalPostRequestBody $body, ?NominalR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_Dist/Norm_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_Dist/Norm_DistRequestBuilder.php index a946f237023..2727439833c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_Dist/Norm_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_Dist/Norm_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action norm_Dist * @param Norm_DistPostRequestBody $body The request body * @param Norm_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Norm_DistPostRequestBody $body, ?Norm_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Norm_DistPostRequestBody $body, ?Norm_D $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_Inv/Norm_InvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_Inv/Norm_InvRequestBuilder.php index cf114106605..ad4882cd251 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_Inv/Norm_InvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_Inv/Norm_InvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action norm_Inv * @param Norm_InvPostRequestBody $body The request body * @param Norm_InvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Norm_InvPostRequestBody $body, ?Norm_InvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Norm_InvPostRequestBody $body, ?Norm_In $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_S_Dist/Norm_S_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_S_Dist/Norm_S_DistRequestBuilder.php index 52d079598a9..2b7d6dd3a37 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_S_Dist/Norm_S_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_S_Dist/Norm_S_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action norm_S_Dist * @param Norm_S_DistPostRequestBody $body The request body * @param Norm_S_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Norm_S_DistPostRequestBody $body, ?Norm_S_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Norm_S_DistPostRequestBody $body, ?Norm $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_S_Inv/Norm_S_InvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_S_Inv/Norm_S_InvRequestBuilder.php index acd5ccb44b7..1b873d0cebf 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_S_Inv/Norm_S_InvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Norm_S_Inv/Norm_S_InvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action norm_S_Inv * @param Norm_S_InvPostRequestBody $body The request body * @param Norm_S_InvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Norm_S_InvPostRequestBody $body, ?Norm_S_InvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Norm_S_InvPostRequestBody $body, ?Norm_ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Not/NotRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Not/NotRequestBuilder.php index 3276e14485e..8d7dc5c877e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Not/NotRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Not/NotRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action not * @param NotPostRequestBody $body The request body * @param NotRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(NotPostRequestBody $body, ?NotRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(NotPostRequestBody $body, ?NotRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Now/NowRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Now/NowRequestBuilder.php index f659b99ef47..97f9dd2c640 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Now/NowRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Now/NowRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action now * @param NowRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?NowRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toPostRequestInformation(?NowRequestBuilderPostRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Nper/NperRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Nper/NperRequestBuilder.php index 317c4c5c56d..549c39a1f8d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Nper/NperRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Nper/NperRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action nper * @param NperPostRequestBody $body The request body * @param NperRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(NperPostRequestBody $body, ?NperRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(NperPostRequestBody $body, ?NperRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Npv/NpvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Npv/NpvRequestBuilder.php index 4d5bddac58c..84304cdd34a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Npv/NpvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Npv/NpvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action npv * @param NpvPostRequestBody $body The request body * @param NpvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(NpvPostRequestBody $body, ?NpvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(NpvPostRequestBody $body, ?NpvRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NumberValue/NumberValueRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NumberValue/NumberValueRequestBuilder.php index 44e8a55615c..56803d46fd2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NumberValue/NumberValueRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/NumberValue/NumberValueRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action numberValue * @param NumberValuePostRequestBody $body The request body * @param NumberValueRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(NumberValuePostRequestBody $body, ?NumberValueRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(NumberValuePostRequestBody $body, ?Numb $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Oct2Bin/Oct2BinRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Oct2Bin/Oct2BinRequestBuilder.php index 1001c6f2f1a..8a299de3281 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Oct2Bin/Oct2BinRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Oct2Bin/Oct2BinRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action oct2Bin * @param Oct2BinPostRequestBody $body The request body * @param Oct2BinRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Oct2BinPostRequestBody $body, ?Oct2BinRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Oct2BinPostRequestBody $body, ?Oct2BinR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Oct2Dec/Oct2DecRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Oct2Dec/Oct2DecRequestBuilder.php index 6855103237b..f4063d77834 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Oct2Dec/Oct2DecRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Oct2Dec/Oct2DecRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action oct2Dec * @param Oct2DecPostRequestBody $body The request body * @param Oct2DecRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Oct2DecPostRequestBody $body, ?Oct2DecRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Oct2DecPostRequestBody $body, ?Oct2DecR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Oct2Hex/Oct2HexRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Oct2Hex/Oct2HexRequestBuilder.php index caa20412604..05ab10863d7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Oct2Hex/Oct2HexRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Oct2Hex/Oct2HexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action oct2Hex * @param Oct2HexPostRequestBody $body The request body * @param Oct2HexRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Oct2HexPostRequestBody $body, ?Oct2HexRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Oct2HexPostRequestBody $body, ?Oct2HexR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Odd/OddRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Odd/OddRequestBuilder.php index e1762f0397d..4e1926f3993 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Odd/OddRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Odd/OddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action odd * @param OddPostRequestBody $body The request body * @param OddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OddPostRequestBody $body, ?OddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(OddPostRequestBody $body, ?OddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddFPrice/OddFPriceRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddFPrice/OddFPriceRequestBuilder.php index bff54dea9fc..6069e852c4f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddFPrice/OddFPriceRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddFPrice/OddFPriceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action oddFPrice * @param OddFPricePostRequestBody $body The request body * @param OddFPriceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OddFPricePostRequestBody $body, ?OddFPriceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(OddFPricePostRequestBody $body, ?OddFPr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddFYield/OddFYieldRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddFYield/OddFYieldRequestBuilder.php index 8c333f79d0e..ddbd20b1808 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddFYield/OddFYieldRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddFYield/OddFYieldRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action oddFYield * @param OddFYieldPostRequestBody $body The request body * @param OddFYieldRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OddFYieldPostRequestBody $body, ?OddFYieldRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(OddFYieldPostRequestBody $body, ?OddFYi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddLPrice/OddLPriceRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddLPrice/OddLPriceRequestBuilder.php index 7e2daed6458..01ac51035b0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddLPrice/OddLPriceRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddLPrice/OddLPriceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action oddLPrice * @param OddLPricePostRequestBody $body The request body * @param OddLPriceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OddLPricePostRequestBody $body, ?OddLPriceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(OddLPricePostRequestBody $body, ?OddLPr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddLYield/OddLYieldRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddLYield/OddLYieldRequestBuilder.php index de63718c023..7a67f07a5e4 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddLYield/OddLYieldRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/OddLYield/OddLYieldRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action oddLYield * @param OddLYieldPostRequestBody $body The request body * @param OddLYieldRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OddLYieldPostRequestBody $body, ?OddLYieldRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(OddLYieldPostRequestBody $body, ?OddLYi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pduration/PdurationRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pduration/PdurationRequestBuilder.php index bfbbb2f2b66..474a3a08e81 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pduration/PdurationRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pduration/PdurationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action pduration * @param PdurationPostRequestBody $body The request body * @param PdurationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PdurationPostRequestBody $body, ?PdurationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PdurationPostRequestBody $body, ?Pdurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PercentRank_Exc/PercentRank_ExcRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PercentRank_Exc/PercentRank_ExcRequestBuilder.php index d407ab77152..d579370936a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PercentRank_Exc/PercentRank_ExcRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PercentRank_Exc/PercentRank_ExcRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action percentRank_Exc * @param PercentRank_ExcPostRequestBody $body The request body * @param PercentRank_ExcRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PercentRank_ExcPostRequestBody $body, ?PercentRank_ExcRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PercentRank_ExcPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PercentRank_Inc/PercentRank_IncRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PercentRank_Inc/PercentRank_IncRequestBuilder.php index 0e5f24a2636..7041ee6a503 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PercentRank_Inc/PercentRank_IncRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PercentRank_Inc/PercentRank_IncRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action percentRank_Inc * @param PercentRank_IncPostRequestBody $body The request body * @param PercentRank_IncRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PercentRank_IncPostRequestBody $body, ?PercentRank_IncRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PercentRank_IncPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Percentile_Exc/Percentile_ExcRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Percentile_Exc/Percentile_ExcRequestBuilder.php index 7003b5b657b..1de891fedc2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Percentile_Exc/Percentile_ExcRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Percentile_Exc/Percentile_ExcRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action percentile_Exc * @param Percentile_ExcPostRequestBody $body The request body * @param Percentile_ExcRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Percentile_ExcPostRequestBody $body, ?Percentile_ExcRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Percentile_ExcPostRequestBody $body, ?P $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Percentile_Inc/Percentile_IncRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Percentile_Inc/Percentile_IncRequestBuilder.php index aa87168910d..7319506ab0f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Percentile_Inc/Percentile_IncRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Percentile_Inc/Percentile_IncRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action percentile_Inc * @param Percentile_IncPostRequestBody $body The request body * @param Percentile_IncRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Percentile_IncPostRequestBody $body, ?Percentile_IncRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Percentile_IncPostRequestBody $body, ?P $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Permut/PermutRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Permut/PermutRequestBuilder.php index 1644f68a595..ed5dc331c1e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Permut/PermutRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Permut/PermutRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action permut * @param PermutPostRequestBody $body The request body * @param PermutRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PermutPostRequestBody $body, ?PermutRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PermutPostRequestBody $body, ?PermutReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Permutationa/PermutationaRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Permutationa/PermutationaRequestBuilder.php index 6a77bb293bb..8f8832498cb 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Permutationa/PermutationaRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Permutationa/PermutationaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action permutationa * @param PermutationaPostRequestBody $body The request body * @param PermutationaRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PermutationaPostRequestBody $body, ?PermutationaRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PermutationaPostRequestBody $body, ?Per $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Phi/PhiRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Phi/PhiRequestBuilder.php index 7303ec1d567..fef90285ca9 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Phi/PhiRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Phi/PhiRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action phi * @param PhiPostRequestBody $body The request body * @param PhiRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PhiPostRequestBody $body, ?PhiRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PhiPostRequestBody $body, ?PhiRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pi/PiRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pi/PiRequestBuilder.php index 974693c421a..0f84efb2e00 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pi/PiRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pi/PiRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action pi * @param PiRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?PiRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toPostRequestInformation(?PiRequestBuilderPostRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pmt/PmtRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pmt/PmtRequestBuilder.php index 3907d342db8..03d2653235a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pmt/PmtRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pmt/PmtRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action pmt * @param PmtPostRequestBody $body The request body * @param PmtRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PmtPostRequestBody $body, ?PmtRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PmtPostRequestBody $body, ?PmtRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Poisson_Dist/Poisson_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Poisson_Dist/Poisson_DistRequestBuilder.php index 8be44b876e8..07cb1f21479 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Poisson_Dist/Poisson_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Poisson_Dist/Poisson_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action poisson_Dist * @param Poisson_DistPostRequestBody $body The request body * @param Poisson_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Poisson_DistPostRequestBody $body, ?Poisson_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Poisson_DistPostRequestBody $body, ?Poi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Power/PowerRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Power/PowerRequestBuilder.php index e1b520bdb41..c73c8c830c9 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Power/PowerRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Power/PowerRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action power * @param PowerPostRequestBody $body The request body * @param PowerRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PowerPostRequestBody $body, ?PowerRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PowerPostRequestBody $body, ?PowerReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ppmt/PpmtRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ppmt/PpmtRequestBuilder.php index 802b3d73b17..fc7a77a911b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ppmt/PpmtRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Ppmt/PpmtRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action ppmt * @param PpmtPostRequestBody $body The request body * @param PpmtRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PpmtPostRequestBody $body, ?PpmtRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PpmtPostRequestBody $body, ?PpmtRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Price/PriceRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Price/PriceRequestBuilder.php index 37ec121c9fc..2a360081d84 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Price/PriceRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Price/PriceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action price * @param PricePostRequestBody $body The request body * @param PriceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PricePostRequestBody $body, ?PriceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PricePostRequestBody $body, ?PriceReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PriceDisc/PriceDiscRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PriceDisc/PriceDiscRequestBuilder.php index d6ea412e661..4a6afc20691 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PriceDisc/PriceDiscRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PriceDisc/PriceDiscRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action priceDisc * @param PriceDiscPostRequestBody $body The request body * @param PriceDiscRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PriceDiscPostRequestBody $body, ?PriceDiscRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PriceDiscPostRequestBody $body, ?PriceD $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PriceMat/PriceMatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PriceMat/PriceMatRequestBuilder.php index fbc3705b455..b12174a46e6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PriceMat/PriceMatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/PriceMat/PriceMatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action priceMat * @param PriceMatPostRequestBody $body The request body * @param PriceMatRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PriceMatPostRequestBody $body, ?PriceMatRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PriceMatPostRequestBody $body, ?PriceMa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Product/ProductRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Product/ProductRequestBuilder.php index aedc1181c92..8fed3d28660 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Product/ProductRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Product/ProductRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action product * @param ProductPostRequestBody $body The request body * @param ProductRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ProductPostRequestBody $body, ?ProductRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ProductPostRequestBody $body, ?ProductR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Proper/ProperRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Proper/ProperRequestBuilder.php index 60dd65946c0..ea3ea4eedd5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Proper/ProperRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Proper/ProperRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action proper * @param ProperPostRequestBody $body The request body * @param ProperRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ProperPostRequestBody $body, ?ProperRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ProperPostRequestBody $body, ?ProperReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pv/PvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pv/PvRequestBuilder.php index 6ffdc0ce18f..56d74fdd779 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pv/PvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Pv/PvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action pv * @param PvPostRequestBody $body The request body * @param PvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PvPostRequestBody $body, ?PvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(PvPostRequestBody $body, ?PvRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Quartile_Exc/Quartile_ExcRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Quartile_Exc/Quartile_ExcRequestBuilder.php index e2f3e59132d..a1c8b358134 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Quartile_Exc/Quartile_ExcRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Quartile_Exc/Quartile_ExcRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action quartile_Exc * @param Quartile_ExcPostRequestBody $body The request body * @param Quartile_ExcRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Quartile_ExcPostRequestBody $body, ?Quartile_ExcRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Quartile_ExcPostRequestBody $body, ?Qua $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Quartile_Inc/Quartile_IncRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Quartile_Inc/Quartile_IncRequestBuilder.php index f3fb622dc4e..3ad91ea18e0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Quartile_Inc/Quartile_IncRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Quartile_Inc/Quartile_IncRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action quartile_Inc * @param Quartile_IncPostRequestBody $body The request body * @param Quartile_IncRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Quartile_IncPostRequestBody $body, ?Quartile_IncRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Quartile_IncPostRequestBody $body, ?Qua $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Quotient/QuotientRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Quotient/QuotientRequestBuilder.php index ba5f1c8f26c..77f1d20c5e7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Quotient/QuotientRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Quotient/QuotientRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action quotient * @param QuotientPostRequestBody $body The request body * @param QuotientRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(QuotientPostRequestBody $body, ?QuotientRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(QuotientPostRequestBody $body, ?Quotien $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Radians/RadiansRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Radians/RadiansRequestBuilder.php index 3d1b46cdad3..e52d36ce7b7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Radians/RadiansRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Radians/RadiansRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action radians * @param RadiansPostRequestBody $body The request body * @param RadiansRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RadiansPostRequestBody $body, ?RadiansRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RadiansPostRequestBody $body, ?RadiansR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rand/RandRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rand/RandRequestBuilder.php index c12111cb42b..4c09c595689 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rand/RandRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rand/RandRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action rand * @param RandRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RandRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toPostRequestInformation(?RandRequestBuilderPostRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/RandBetween/RandBetweenRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/RandBetween/RandBetweenRequestBuilder.php index 9c39c68a767..4ed9d91e43a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/RandBetween/RandBetweenRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/RandBetween/RandBetweenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action randBetween * @param RandBetweenPostRequestBody $body The request body * @param RandBetweenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RandBetweenPostRequestBody $body, ?RandBetweenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RandBetweenPostRequestBody $body, ?Rand $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rank_Avg/Rank_AvgRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rank_Avg/Rank_AvgRequestBuilder.php index a6727cd7373..7aa4312545d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rank_Avg/Rank_AvgRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rank_Avg/Rank_AvgRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action rank_Avg * @param Rank_AvgPostRequestBody $body The request body * @param Rank_AvgRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Rank_AvgPostRequestBody $body, ?Rank_AvgRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Rank_AvgPostRequestBody $body, ?Rank_Av $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rank_Eq/Rank_EqRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rank_Eq/Rank_EqRequestBuilder.php index 559e8074c1c..31ca9e45da1 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rank_Eq/Rank_EqRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rank_Eq/Rank_EqRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action rank_Eq * @param Rank_EqPostRequestBody $body The request body * @param Rank_EqRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Rank_EqPostRequestBody $body, ?Rank_EqRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Rank_EqPostRequestBody $body, ?Rank_EqR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rate/RateRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rate/RateRequestBuilder.php index 9d8082fa858..2238ef0b3ae 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rate/RateRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rate/RateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action rate * @param RatePostRequestBody $body The request body * @param RateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RatePostRequestBody $body, ?RateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RatePostRequestBody $body, ?RateRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Received/ReceivedRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Received/ReceivedRequestBuilder.php index a6d6f1747dd..baa848c280c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Received/ReceivedRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Received/ReceivedRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action received * @param ReceivedPostRequestBody $body The request body * @param ReceivedRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ReceivedPostRequestBody $body, ?ReceivedRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ReceivedPostRequestBody $body, ?Receive $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Replace/ReplaceRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Replace/ReplaceRequestBuilder.php index c36b5e79364..0f33fbbd54f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Replace/ReplaceRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Replace/ReplaceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action replace * @param ReplacePostRequestBody $body The request body * @param ReplaceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ReplacePostRequestBody $body, ?ReplaceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ReplacePostRequestBody $body, ?ReplaceR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ReplaceB/ReplaceBRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ReplaceB/ReplaceBRequestBuilder.php index 004c1fb2584..096d6be9a99 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ReplaceB/ReplaceBRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/ReplaceB/ReplaceBRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action replaceB * @param ReplaceBPostRequestBody $body The request body * @param ReplaceBRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ReplaceBPostRequestBody $body, ?ReplaceBRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ReplaceBPostRequestBody $body, ?Replace $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rept/ReptRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rept/ReptRequestBuilder.php index 600bed51549..f269fac6d12 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rept/ReptRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rept/ReptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action rept * @param ReptPostRequestBody $body The request body * @param ReptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ReptPostRequestBody $body, ?ReptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ReptPostRequestBody $body, ?ReptRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Right/RightRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Right/RightRequestBuilder.php index ed983510186..177c4be1d74 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Right/RightRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Right/RightRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action right * @param RightPostRequestBody $body The request body * @param RightRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RightPostRequestBody $body, ?RightRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RightPostRequestBody $body, ?RightReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rightb/RightbRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rightb/RightbRequestBuilder.php index 589908dcea1..112e7bc4c3e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rightb/RightbRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rightb/RightbRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action rightb * @param RightbPostRequestBody $body The request body * @param RightbRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RightbPostRequestBody $body, ?RightbRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RightbPostRequestBody $body, ?RightbReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Roman/RomanRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Roman/RomanRequestBuilder.php index d12d62fb4ea..040d6695840 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Roman/RomanRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Roman/RomanRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action roman * @param RomanPostRequestBody $body The request body * @param RomanRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RomanPostRequestBody $body, ?RomanRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RomanPostRequestBody $body, ?RomanReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Round/RoundRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Round/RoundRequestBuilder.php index a345d254aee..33be99e7d4b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Round/RoundRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Round/RoundRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action round * @param RoundPostRequestBody $body The request body * @param RoundRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RoundPostRequestBody $body, ?RoundRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RoundPostRequestBody $body, ?RoundReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/RoundDown/RoundDownRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/RoundDown/RoundDownRequestBuilder.php index d2def1d8d08..4dd52d2da2f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/RoundDown/RoundDownRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/RoundDown/RoundDownRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action roundDown * @param RoundDownPostRequestBody $body The request body * @param RoundDownRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RoundDownPostRequestBody $body, ?RoundDownRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RoundDownPostRequestBody $body, ?RoundD $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/RoundUp/RoundUpRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/RoundUp/RoundUpRequestBuilder.php index c328311234e..ae22c2228e6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/RoundUp/RoundUpRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/RoundUp/RoundUpRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action roundUp * @param RoundUpPostRequestBody $body The request body * @param RoundUpRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RoundUpPostRequestBody $body, ?RoundUpRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RoundUpPostRequestBody $body, ?RoundUpR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rows/RowsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rows/RowsRequestBuilder.php index 19c9b0201b0..7ce6f4ded83 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rows/RowsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rows/RowsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action rows * @param RowsPostRequestBody $body The request body * @param RowsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RowsPostRequestBody $body, ?RowsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RowsPostRequestBody $body, ?RowsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rri/RriRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rri/RriRequestBuilder.php index b3d8b48c9a0..23c6d8438b7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rri/RriRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Rri/RriRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action rri * @param RriPostRequestBody $body The request body * @param RriRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RriPostRequestBody $body, ?RriRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RriPostRequestBody $body, ?RriRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sec/SecRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sec/SecRequestBuilder.php index 8bb8fbd210d..fb28db58ff0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sec/SecRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sec/SecRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sec * @param SecPostRequestBody $body The request body * @param SecRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SecPostRequestBody $body, ?SecRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SecPostRequestBody $body, ?SecRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sech/SechRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sech/SechRequestBuilder.php index 5a6d5556815..40bd53597fe 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sech/SechRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sech/SechRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sech * @param SechPostRequestBody $body The request body * @param SechRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SechPostRequestBody $body, ?SechRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SechPostRequestBody $body, ?SechRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Second/SecondRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Second/SecondRequestBuilder.php index 4e333cd6335..045380a710e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Second/SecondRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Second/SecondRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action second * @param SecondPostRequestBody $body The request body * @param SecondRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SecondPostRequestBody $body, ?SecondRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SecondPostRequestBody $body, ?SecondReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SeriesSum/SeriesSumRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SeriesSum/SeriesSumRequestBuilder.php index b7a17257667..41fc8b8d11f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SeriesSum/SeriesSumRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SeriesSum/SeriesSumRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action seriesSum * @param SeriesSumPostRequestBody $body The request body * @param SeriesSumRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SeriesSumPostRequestBody $body, ?SeriesSumRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SeriesSumPostRequestBody $body, ?Series $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sheet/SheetRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sheet/SheetRequestBuilder.php index 038e419ca56..bd6edaaca12 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sheet/SheetRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sheet/SheetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sheet * @param SheetPostRequestBody $body The request body * @param SheetRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SheetPostRequestBody $body, ?SheetRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SheetPostRequestBody $body, ?SheetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sheets/SheetsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sheets/SheetsRequestBuilder.php index dfafc6b5137..e5dec3e8627 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sheets/SheetsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sheets/SheetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sheets * @param SheetsPostRequestBody $body The request body * @param SheetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SheetsPostRequestBody $body, ?SheetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SheetsPostRequestBody $body, ?SheetsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sign/SignRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sign/SignRequestBuilder.php index cb8a75eacdd..e9874906c7b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sign/SignRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sign/SignRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sign * @param SignPostRequestBody $body The request body * @param SignRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SignPostRequestBody $body, ?SignRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SignPostRequestBody $body, ?SignRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sin/SinRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sin/SinRequestBuilder.php index a2f650b8cff..7c2bd66ccf6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sin/SinRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sin/SinRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sin * @param SinPostRequestBody $body The request body * @param SinRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SinPostRequestBody $body, ?SinRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SinPostRequestBody $body, ?SinRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sinh/SinhRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sinh/SinhRequestBuilder.php index 49fb442ba8d..e6ff8824945 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sinh/SinhRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sinh/SinhRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sinh * @param SinhPostRequestBody $body The request body * @param SinhRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SinhPostRequestBody $body, ?SinhRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SinhPostRequestBody $body, ?SinhRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Skew/SkewRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Skew/SkewRequestBuilder.php index 49b9d21ef1b..33ad208d24a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Skew/SkewRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Skew/SkewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action skew * @param SkewPostRequestBody $body The request body * @param SkewRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SkewPostRequestBody $body, ?SkewRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SkewPostRequestBody $body, ?SkewRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Skew_p/Skew_pRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Skew_p/Skew_pRequestBuilder.php index f785b9f33aa..21b0611826e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Skew_p/Skew_pRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Skew_p/Skew_pRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action skew_p * @param Skew_pPostRequestBody $body The request body * @param Skew_pRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Skew_pPostRequestBody $body, ?Skew_pRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Skew_pPostRequestBody $body, ?Skew_pReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sln/SlnRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sln/SlnRequestBuilder.php index 88623867d70..fa455f65f47 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sln/SlnRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sln/SlnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sln * @param SlnPostRequestBody $body The request body * @param SlnRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SlnPostRequestBody $body, ?SlnRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SlnPostRequestBody $body, ?SlnRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Small/SmallRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Small/SmallRequestBuilder.php index c717f562e0d..5261d12132e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Small/SmallRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Small/SmallRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action small * @param SmallPostRequestBody $body The request body * @param SmallRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SmallPostRequestBody $body, ?SmallRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SmallPostRequestBody $body, ?SmallReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sqrt/SqrtRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sqrt/SqrtRequestBuilder.php index b75f43e583a..01210e32a5e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sqrt/SqrtRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sqrt/SqrtRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sqrt * @param SqrtPostRequestBody $body The request body * @param SqrtRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SqrtPostRequestBody $body, ?SqrtRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SqrtPostRequestBody $body, ?SqrtRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SqrtPi/SqrtPiRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SqrtPi/SqrtPiRequestBuilder.php index 08d484ea169..6086cbc7145 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SqrtPi/SqrtPiRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SqrtPi/SqrtPiRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sqrtPi * @param SqrtPiPostRequestBody $body The request body * @param SqrtPiRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SqrtPiPostRequestBody $body, ?SqrtPiRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SqrtPiPostRequestBody $body, ?SqrtPiReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDevA/StDevARequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDevA/StDevARequestBuilder.php index 9dc455b7ed0..49e6e624859 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDevA/StDevARequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDevA/StDevARequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action stDevA * @param StDevAPostRequestBody $body The request body * @param StDevARequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(StDevAPostRequestBody $body, ?StDevARequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(StDevAPostRequestBody $body, ?StDevAReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDevPA/StDevPARequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDevPA/StDevPARequestBuilder.php index f0cc656646f..282e0660b53 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDevPA/StDevPARequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDevPA/StDevPARequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action stDevPA * @param StDevPAPostRequestBody $body The request body * @param StDevPARequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(StDevPAPostRequestBody $body, ?StDevPARequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(StDevPAPostRequestBody $body, ?StDevPAR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDev_P/StDev_PRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDev_P/StDev_PRequestBuilder.php index d110ec3945c..bb8e6c23f0b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDev_P/StDev_PRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDev_P/StDev_PRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action stDev_P * @param StDev_PPostRequestBody $body The request body * @param StDev_PRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(StDev_PPostRequestBody $body, ?StDev_PRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(StDev_PPostRequestBody $body, ?StDev_PR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDev_S/StDev_SRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDev_S/StDev_SRequestBuilder.php index a982edd2d09..8ce605b91c8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDev_S/StDev_SRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/StDev_S/StDev_SRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action stDev_S * @param StDev_SPostRequestBody $body The request body * @param StDev_SRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(StDev_SPostRequestBody $body, ?StDev_SRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(StDev_SPostRequestBody $body, ?StDev_SR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Standardize/StandardizeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Standardize/StandardizeRequestBuilder.php index 5d504aa2d4e..43643bb9e01 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Standardize/StandardizeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Standardize/StandardizeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action standardize * @param StandardizePostRequestBody $body The request body * @param StandardizeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(StandardizePostRequestBody $body, ?StandardizeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(StandardizePostRequestBody $body, ?Stan $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Substitute/SubstituteRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Substitute/SubstituteRequestBuilder.php index 93f00abd8cf..1305e378d65 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Substitute/SubstituteRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Substitute/SubstituteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action substitute * @param SubstitutePostRequestBody $body The request body * @param SubstituteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SubstitutePostRequestBody $body, ?SubstituteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SubstitutePostRequestBody $body, ?Subst $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Subtotal/SubtotalRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Subtotal/SubtotalRequestBuilder.php index 6637bda9bcb..439b6448ca0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Subtotal/SubtotalRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Subtotal/SubtotalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action subtotal * @param SubtotalPostRequestBody $body The request body * @param SubtotalRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SubtotalPostRequestBody $body, ?SubtotalRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SubtotalPostRequestBody $body, ?Subtota $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sum/SumRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sum/SumRequestBuilder.php index 80b2bf11a68..50e0ac30f37 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sum/SumRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Sum/SumRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sum * @param SumPostRequestBody $body The request body * @param SumRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SumPostRequestBody $body, ?SumRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SumPostRequestBody $body, ?SumRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SumIf/SumIfRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SumIf/SumIfRequestBuilder.php index d0dcea99bff..fc91b0dfa5b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SumIf/SumIfRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SumIf/SumIfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sumIf * @param SumIfPostRequestBody $body The request body * @param SumIfRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SumIfPostRequestBody $body, ?SumIfRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SumIfPostRequestBody $body, ?SumIfReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SumIfs/SumIfsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SumIfs/SumIfsRequestBuilder.php index 0a19ef475a7..29f317bd5bb 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SumIfs/SumIfsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SumIfs/SumIfsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sumIfs * @param SumIfsPostRequestBody $body The request body * @param SumIfsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SumIfsPostRequestBody $body, ?SumIfsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SumIfsPostRequestBody $body, ?SumIfsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SumSq/SumSqRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SumSq/SumSqRequestBuilder.php index b95aafeb7f1..e4542ee4c96 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SumSq/SumSqRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/SumSq/SumSqRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action sumSq * @param SumSqPostRequestBody $body The request body * @param SumSqRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SumSqPostRequestBody $body, ?SumSqRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SumSqPostRequestBody $body, ?SumSqReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Syd/SydRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Syd/SydRequestBuilder.php index ca069b55f7e..af1b0c99297 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Syd/SydRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Syd/SydRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action syd * @param SydPostRequestBody $body The request body * @param SydRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SydPostRequestBody $body, ?SydRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(SydPostRequestBody $body, ?SydRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T/TRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T/TRequestBuilder.php index ae3155597d5..f3faba93da2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T/TRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T/TRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action t * @param TPostRequestBody $body The request body * @param TRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TPostRequestBody $body, ?TRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TPostRequestBody $body, ?TRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Dist/T_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Dist/T_DistRequestBuilder.php index 16afe857199..99bd1a7ae9d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Dist/T_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Dist/T_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action t_Dist * @param T_DistPostRequestBody $body The request body * @param T_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(T_DistPostRequestBody $body, ?T_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(T_DistPostRequestBody $body, ?T_DistReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Dist_2T/T_Dist_2TRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Dist_2T/T_Dist_2TRequestBuilder.php index c5de105a04b..e159db7d57a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Dist_2T/T_Dist_2TRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Dist_2T/T_Dist_2TRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action t_Dist_2T * @param T_Dist_2TPostRequestBody $body The request body * @param T_Dist_2TRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(T_Dist_2TPostRequestBody $body, ?T_Dist_2TRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(T_Dist_2TPostRequestBody $body, ?T_Dist $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Dist_RT/T_Dist_RTRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Dist_RT/T_Dist_RTRequestBuilder.php index 657ed4b87ef..0bb917bbe06 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Dist_RT/T_Dist_RTRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Dist_RT/T_Dist_RTRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action t_Dist_RT * @param T_Dist_RTPostRequestBody $body The request body * @param T_Dist_RTRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(T_Dist_RTPostRequestBody $body, ?T_Dist_RTRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(T_Dist_RTPostRequestBody $body, ?T_Dist $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Inv/T_InvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Inv/T_InvRequestBuilder.php index 78c5e8d7817..0628a5da25e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Inv/T_InvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Inv/T_InvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action t_Inv * @param T_InvPostRequestBody $body The request body * @param T_InvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(T_InvPostRequestBody $body, ?T_InvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(T_InvPostRequestBody $body, ?T_InvReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Inv_2T/T_Inv_2TRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Inv_2T/T_Inv_2TRequestBuilder.php index 43bfbf6cd0c..7e3c976f740 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Inv_2T/T_Inv_2TRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/T_Inv_2T/T_Inv_2TRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action t_Inv_2T * @param T_Inv_2TPostRequestBody $body The request body * @param T_Inv_2TRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(T_Inv_2TPostRequestBody $body, ?T_Inv_2TRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(T_Inv_2TPostRequestBody $body, ?T_Inv_2 $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Tan/TanRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Tan/TanRequestBuilder.php index ea80084e264..8f30356a38f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Tan/TanRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Tan/TanRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action tan * @param TanPostRequestBody $body The request body * @param TanRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TanPostRequestBody $body, ?TanRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TanPostRequestBody $body, ?TanRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Tanh/TanhRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Tanh/TanhRequestBuilder.php index 0b77e8f2860..1aa1cae3453 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Tanh/TanhRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Tanh/TanhRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action tanh * @param TanhPostRequestBody $body The request body * @param TanhRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TanhPostRequestBody $body, ?TanhRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TanhPostRequestBody $body, ?TanhRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TbillEq/TbillEqRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TbillEq/TbillEqRequestBuilder.php index 8b23a75d465..b77ed91cc90 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TbillEq/TbillEqRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TbillEq/TbillEqRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action tbillEq * @param TbillEqPostRequestBody $body The request body * @param TbillEqRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TbillEqPostRequestBody $body, ?TbillEqRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TbillEqPostRequestBody $body, ?TbillEqR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TbillPrice/TbillPriceRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TbillPrice/TbillPriceRequestBuilder.php index 185b1c54a05..71361d2261f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TbillPrice/TbillPriceRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TbillPrice/TbillPriceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action tbillPrice * @param TbillPricePostRequestBody $body The request body * @param TbillPriceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TbillPricePostRequestBody $body, ?TbillPriceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TbillPricePostRequestBody $body, ?Tbill $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TbillYield/TbillYieldRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TbillYield/TbillYieldRequestBuilder.php index c03ed5cc3c0..fc4bf3deb23 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TbillYield/TbillYieldRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TbillYield/TbillYieldRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action tbillYield * @param TbillYieldPostRequestBody $body The request body * @param TbillYieldRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TbillYieldPostRequestBody $body, ?TbillYieldRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TbillYieldPostRequestBody $body, ?Tbill $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Text/TextRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Text/TextRequestBuilder.php index a36e17b6b0a..b4a942ce319 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Text/TextRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Text/TextRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action text * @param TextPostRequestBody $body The request body * @param TextRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TextPostRequestBody $body, ?TextRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TextPostRequestBody $body, ?TextRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Time/TimeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Time/TimeRequestBuilder.php index 4f13555b60f..5afd7332c8d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Time/TimeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Time/TimeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action time * @param TimePostRequestBody $body The request body * @param TimeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TimePostRequestBody $body, ?TimeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TimePostRequestBody $body, ?TimeRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Timevalue/TimevalueRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Timevalue/TimevalueRequestBuilder.php index c67ca7f4c68..eddd0b6486a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Timevalue/TimevalueRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Timevalue/TimevalueRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action timevalue * @param TimevaluePostRequestBody $body The request body * @param TimevalueRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TimevaluePostRequestBody $body, ?TimevalueRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TimevaluePostRequestBody $body, ?Timeva $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Today/TodayRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Today/TodayRequestBuilder.php index d722fe3f7a3..0ddfd4323b8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Today/TodayRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Today/TodayRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action today * @param TodayRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?TodayRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toPostRequestInformation(?TodayRequestBuilderPostRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Trim/TrimRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Trim/TrimRequestBuilder.php index 70d074072bd..23c4b593cec 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Trim/TrimRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Trim/TrimRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action trim * @param TrimPostRequestBody $body The request body * @param TrimRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TrimPostRequestBody $body, ?TrimRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TrimPostRequestBody $body, ?TrimRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TrimMean/TrimMeanRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TrimMean/TrimMeanRequestBuilder.php index a8d40ed35a0..0167ed50586 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TrimMean/TrimMeanRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/TrimMean/TrimMeanRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action trimMean * @param TrimMeanPostRequestBody $body The request body * @param TrimMeanRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TrimMeanPostRequestBody $body, ?TrimMeanRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TrimMeanPostRequestBody $body, ?TrimMea $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/True/TrueRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/True/TrueRequestBuilder.php index 63ac2627244..b2fc75f05b9 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/True/TrueRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/True/TrueRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action true * @param TrueRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?TrueRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toPostRequestInformation(?TrueRequestBuilderPostRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Trunc/TruncRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Trunc/TruncRequestBuilder.php index 50760b79f2c..d588d7e0cd7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Trunc/TruncRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Trunc/TruncRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action trunc * @param TruncPostRequestBody $body The request body * @param TruncRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TruncPostRequestBody $body, ?TruncRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TruncPostRequestBody $body, ?TruncReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Type/TypeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Type/TypeRequestBuilder.php index 1816145d4f9..5a6f22787c3 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Type/TypeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Type/TypeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action type * @param TypePostRequestBody $body The request body * @param TypeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TypePostRequestBody $body, ?TypeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TypePostRequestBody $body, ?TypeRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Unichar/UnicharRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Unichar/UnicharRequestBuilder.php index 818ab3ee35f..b87fc14ad3b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Unichar/UnicharRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Unichar/UnicharRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unichar * @param UnicharPostRequestBody $body The request body * @param UnicharRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnicharPostRequestBody $body, ?UnicharRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(UnicharPostRequestBody $body, ?UnicharR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Unicode/UnicodeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Unicode/UnicodeRequestBuilder.php index e9a2160f212..94ab9e14d1a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Unicode/UnicodeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Unicode/UnicodeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unicode * @param UnicodePostRequestBody $body The request body * @param UnicodeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnicodePostRequestBody $body, ?UnicodeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(UnicodePostRequestBody $body, ?UnicodeR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Upper/UpperRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Upper/UpperRequestBuilder.php index a56a364749e..25e59b12bac 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Upper/UpperRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Upper/UpperRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action upper * @param UpperPostRequestBody $body The request body * @param UpperRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UpperPostRequestBody $body, ?UpperRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(UpperPostRequestBody $body, ?UpperReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Usdollar/UsdollarRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Usdollar/UsdollarRequestBuilder.php index e6aef5037b4..9682cc74e82 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Usdollar/UsdollarRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Usdollar/UsdollarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action usdollar * @param UsdollarPostRequestBody $body The request body * @param UsdollarRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UsdollarPostRequestBody $body, ?UsdollarRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(UsdollarPostRequestBody $body, ?Usdolla $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Value/ValueRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Value/ValueRequestBuilder.php index 420669e33d6..af6e0eaed8c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Value/ValueRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Value/ValueRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action value * @param ValuePostRequestBody $body The request body * @param ValueRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ValuePostRequestBody $body, ?ValueRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(ValuePostRequestBody $body, ?ValueReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/VarA/VarARequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/VarA/VarARequestBuilder.php index f7bd5e0069d..e95de6e57dc 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/VarA/VarARequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/VarA/VarARequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action varA * @param VarAPostRequestBody $body The request body * @param VarARequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(VarAPostRequestBody $body, ?VarARequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(VarAPostRequestBody $body, ?VarARequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/VarPA/VarPARequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/VarPA/VarPARequestBuilder.php index fbb71003db5..258ddb5f747 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/VarPA/VarPARequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/VarPA/VarPARequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action varPA * @param VarPAPostRequestBody $body The request body * @param VarPARequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(VarPAPostRequestBody $body, ?VarPARequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(VarPAPostRequestBody $body, ?VarPAReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Var_P/Var_PRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Var_P/Var_PRequestBuilder.php index 454c55d9024..dedb4edcee5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Var_P/Var_PRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Var_P/Var_PRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action var_P * @param Var_PPostRequestBody $body The request body * @param Var_PRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Var_PPostRequestBody $body, ?Var_PRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Var_PPostRequestBody $body, ?Var_PReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Var_S/Var_SRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Var_S/Var_SRequestBuilder.php index 09c9c0d9843..3a8f4934d65 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Var_S/Var_SRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Var_S/Var_SRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action var_S * @param Var_SPostRequestBody $body The request body * @param Var_SRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Var_SPostRequestBody $body, ?Var_SRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Var_SPostRequestBody $body, ?Var_SReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Vdb/VdbRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Vdb/VdbRequestBuilder.php index 057197ecca2..45d28c6ba78 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Vdb/VdbRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Vdb/VdbRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action vdb * @param VdbPostRequestBody $body The request body * @param VdbRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(VdbPostRequestBody $body, ?VdbRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(VdbPostRequestBody $body, ?VdbRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Vlookup/VlookupRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Vlookup/VlookupRequestBuilder.php index 2dc741da135..e99c49dd314 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Vlookup/VlookupRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Vlookup/VlookupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action vlookup * @param VlookupPostRequestBody $body The request body * @param VlookupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(VlookupPostRequestBody $body, ?VlookupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(VlookupPostRequestBody $body, ?VlookupR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/WeekNum/WeekNumRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/WeekNum/WeekNumRequestBuilder.php index 8e8396f3420..36e13ea8011 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/WeekNum/WeekNumRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/WeekNum/WeekNumRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action weekNum * @param WeekNumPostRequestBody $body The request body * @param WeekNumRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WeekNumPostRequestBody $body, ?WeekNumRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(WeekNumPostRequestBody $body, ?WeekNumR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Weekday/WeekdayRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Weekday/WeekdayRequestBuilder.php index 72b1501b89d..175be9d8363 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Weekday/WeekdayRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Weekday/WeekdayRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action weekday * @param WeekdayPostRequestBody $body The request body * @param WeekdayRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WeekdayPostRequestBody $body, ?WeekdayRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(WeekdayPostRequestBody $body, ?WeekdayR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Weibull_Dist/Weibull_DistRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Weibull_Dist/Weibull_DistRequestBuilder.php index 951a2ed0e0a..d3e07fa8756 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Weibull_Dist/Weibull_DistRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Weibull_Dist/Weibull_DistRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action weibull_Dist * @param Weibull_DistPostRequestBody $body The request body * @param Weibull_DistRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Weibull_DistPostRequestBody $body, ?Weibull_DistRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Weibull_DistPostRequestBody $body, ?Wei $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/WorkDay/WorkDayRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/WorkDay/WorkDayRequestBuilder.php index d829512473d..b0075637ae8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/WorkDay/WorkDayRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/WorkDay/WorkDayRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action workDay * @param WorkDayPostRequestBody $body The request body * @param WorkDayRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WorkDayPostRequestBody $body, ?WorkDayRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(WorkDayPostRequestBody $body, ?WorkDayR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/WorkDay_Intl/WorkDay_IntlRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/WorkDay_Intl/WorkDay_IntlRequestBuilder.php index 8edbd06545c..e5a0eefa90d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/WorkDay_Intl/WorkDay_IntlRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/WorkDay_Intl/WorkDay_IntlRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action workDay_Intl * @param WorkDay_IntlPostRequestBody $body The request body * @param WorkDay_IntlRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WorkDay_IntlPostRequestBody $body, ?WorkDay_IntlRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(WorkDay_IntlPostRequestBody $body, ?Wor $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Xirr/XirrRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Xirr/XirrRequestBuilder.php index d226553eeca..3afce60b421 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Xirr/XirrRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Xirr/XirrRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action xirr * @param XirrPostRequestBody $body The request body * @param XirrRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(XirrPostRequestBody $body, ?XirrRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(XirrPostRequestBody $body, ?XirrRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Xnpv/XnpvRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Xnpv/XnpvRequestBuilder.php index 2226f72545a..f99ff90264f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Xnpv/XnpvRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Xnpv/XnpvRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action xnpv * @param XnpvPostRequestBody $body The request body * @param XnpvRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(XnpvPostRequestBody $body, ?XnpvRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(XnpvPostRequestBody $body, ?XnpvRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Year/YearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Year/YearRequestBuilder.php index 3edd0f71235..276f248a3e0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Year/YearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Year/YearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action year * @param YearPostRequestBody $body The request body * @param YearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(YearPostRequestBody $body, ?YearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(YearPostRequestBody $body, ?YearRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/YearFrac/YearFracRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/YearFrac/YearFracRequestBuilder.php index df9283a3e2a..fc255ff6d38 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/YearFrac/YearFracRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/YearFrac/YearFracRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action yearFrac * @param YearFracPostRequestBody $body The request body * @param YearFracRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(YearFracPostRequestBody $body, ?YearFracRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(YearFracPostRequestBody $body, ?YearFra $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/YieldDisc/YieldDiscRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/YieldDisc/YieldDiscRequestBuilder.php index 32107a6af34..292a65104b7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/YieldDisc/YieldDiscRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/YieldDisc/YieldDiscRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action yieldDisc * @param YieldDiscPostRequestBody $body The request body * @param YieldDiscRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(YieldDiscPostRequestBody $body, ?YieldDiscRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(YieldDiscPostRequestBody $body, ?YieldD $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/YieldMat/YieldMatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/YieldMat/YieldMatRequestBuilder.php index 29ecf76ce1b..937d7ee0993 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/YieldMat/YieldMatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/YieldMat/YieldMatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action yieldMat * @param YieldMatPostRequestBody $body The request body * @param YieldMatRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(YieldMatPostRequestBody $body, ?YieldMatRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(YieldMatPostRequestBody $body, ?YieldMa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Z_Test/Z_TestRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Z_Test/Z_TestRequestBuilder.php index 594e3c24892..4ea921370b1 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Z_Test/Z_TestRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Functions/Z_Test/Z_TestRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookFunctionResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action z_Test * @param Z_TestPostRequestBody $body The request body * @param Z_TestRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Z_TestPostRequestBody $body, ?Z_TestRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFunctionResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(Z_TestPostRequestBody $body, ?Z_TestReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Names/Add/AddRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Names/Add/AddRequestBuilder.php index e57f4131ac5..99fc4925b26 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Names/Add/AddRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Names/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookNamedItem; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Adds a new name to the collection of the given scope using the user's locale for the formula. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/nameditem-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Names/AddFormulaLocal/AddFormulaLocalRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Names/AddFormulaLocal/AddFormulaLocalRequestBuilder.php index e10820d7f43..7496ca6c8e7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Names/AddFormulaLocal/AddFormulaLocalRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Names/AddFormulaLocal/AddFormulaLocalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookNamedItem; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Adds a new name to the collection of the given scope using the user's locale for the formula. This API is available in the following national cloud deployments. * @param AddFormulaLocalPostRequestBody $body The request body * @param AddFormulaLocalRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/nameditem-addformulalocal?view=graph-rest-1.0 Find more info here */ public function post(AddFormulaLocalPostRequestBody $body, ?AddFormulaLocalRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddFormulaLocalPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Names/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Names/Count/CountRequestBuilder.php index 5b2328ff854..6fa16270da8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Names/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Names/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Names/Item/Range/RangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Names/Item/Range/RangeRequestBuilder.php index 12931908910..f24b634a753 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Names/Item/Range/RangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Names/Item/Range/RangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,26 +31,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the properties and relationships of range object. This API is available in the following national cloud deployments. + * Returns the range object that is associated with the name. Throws an exception if the named item's type is not a range. This API is available in the following national cloud deployments. * @param RangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/range-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/nameditem-range?view=graph-rest-1.0 Find more info here */ public function get(?RangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the properties and relationships of range object. This API is available in the following national cloud deployments. + * Returns the range object that is associated with the name. Throws an exception if the named item's type is not a range. This API is available in the following national cloud deployments. * @param RangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -60,11 +56,11 @@ public function toGetRequestInformation(?RangeRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Names/Item/WorkbookNamedItemItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Names/Item/WorkbookNamedItemItemRequestBuilder.php index 50671ca45db..885b1781667 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Names/Item/WorkbookNamedItemItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Names/Item/WorkbookNamedItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Names\Item\Range\RangeRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Names\Item\Worksheet\WorksheetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property names for drives * @param WorkbookNamedItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WorkbookNamedItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of nameditem object. This API is available in the following national cloud deployments. * @param WorkbookNamedItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/nameditem-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkbookNamedItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of nameditem object. This API is available in the following national cloud deployments. * @param WorkbookNamedItem $body The request body * @param WorkbookNamedItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/nameditem-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookNamedItem $body, ?WorkbookNamedItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?WorkbookNamedItemItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?WorkbookNamedItemItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?WorkbookNamedItemItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(WorkbookNamedItem $body, ?WorkbookName $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Names/Item/Worksheet/WorksheetRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Names/Item/Worksheet/WorksheetRequestBuilder.php index 07d474efc4c..39260c24f18 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Names/Item/Worksheet/WorksheetRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Names/Item/Worksheet/WorksheetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookWorksheet; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Returns the worksheet on which the named item is scoped to. Available only if the item is scoped to the worksheet. Read-only. * @param WorksheetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WorksheetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?WorksheetRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?WorksheetRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Names/NamesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Names/NamesRequestBuilder.php index 5aebc31fbfd..a1d3ad1d9e8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Names/NamesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Names/NamesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Names\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Names\AddFormulaLocal\AddFormulaLocalRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Names\Count\CountRequestBuilder; @@ -71,39 +70,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of nameditem objects. This API is available in the following national cloud deployments. * @param NamesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workbook-list-names?view=graph-rest-1.0 Find more info here */ public function get(?NamesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to names for drives * @param WorkbookNamedItem $body The request body * @param NamesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WorkbookNamedItem $body, ?NamesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,7 +109,6 @@ public function toGetRequestInformation(?NamesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +116,7 @@ public function toGetRequestInformation(?NamesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +131,11 @@ public function toPostRequestInformation(WorkbookNamedItem $body, ?NamesRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Operations/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Operations/Count/CountRequestBuilder.php index 27aa710ca72..360f7849e46 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Operations/Item/WorkbookOperationItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Operations/Item/WorkbookOperationItemRequestBuilder.php index f80506e583e..ab2b1da4faf 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Operations/Item/WorkbookOperationItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Operations/Item/WorkbookOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for drives * @param WorkbookOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WorkbookOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Meaningless if this url is called independently. This request is part of all async requests for excel. This is used to retrieve the status of a workbookOperation object. Currently not all requests support async. Take Create session request as an example. Issue an async Create session request, follow the documentation and you may get status code 202 Accepted, async operation starts from here and you can find the url this document required from the response header, from the location part. This API is available in the following national cloud deployments. * @param WorkbookOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workbookoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkbookOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in drives * @param WorkbookOperation $body The request body * @param WorkbookOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookOperation $body, ?WorkbookOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?WorkbookOperationItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?WorkbookOperationItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?WorkbookOperationItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(WorkbookOperation $body, ?WorkbookOper $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Operations/OperationsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Operations/OperationsRequestBuilder.php index 54f22526c9a..e15a2a3e811 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Operations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Operations\Item\WorkbookOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Meaningless if this url is called independently. This request is part of all async requests for excel. This is used to retrieve the status of a workbookOperation object. Currently not all requests support async. Take Create session request as an example. Issue an async Create session request, follow the documentation and you may get status code 202 Accepted, async operation starts from here and you can find the url this document required from the response header, from the location part. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for drives * @param WorkbookOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WorkbookOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(WorkbookOperation $body, ?OperationsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/RefreshSession/RefreshSessionRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/RefreshSession/RefreshSessionRequestBuilder.php index 8632fd77598..10d671787f7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/RefreshSession/RefreshSessionRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/RefreshSession/RefreshSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Use this API to refresh an existing workbook session. This API is available in the following national cloud deployments. * @param RefreshSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workbook-refreshsession?view=graph-rest-1.0 Find more info here */ public function post(?RefreshSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RefreshSessionRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/SessionInfoResourceWithKey/SessionInfoResourceWithKeyRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/SessionInfoResourceWithKey/SessionInfoResourceWithKeyRequestBuilder.php index 973fe7bec9d..763056d58c7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/SessionInfoResourceWithKey/SessionInfoResourceWithKeyRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/SessionInfoResourceWithKey/SessionInfoResourceWithKeyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookSessionInfo; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function sessionInfoResource * @param SessionInfoResourceWithKeyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SessionInfoResourceWithKeyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookSessionInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookSessionInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?SessionInfoResourceWithKeyRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/TableRowOperationResultWithKey/TableRowOperationResultWithKeyRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/TableRowOperationResultWithKey/TableRowOperationResultWithKeyRequestBuilder.php index e0a3cbe860a..10a7a4bb06b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/TableRowOperationResultWithKey/TableRowOperationResultWithKeyRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/TableRowOperationResultWithKey/TableRowOperationResultWithKeyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTableRow; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function tableRowOperationResult * @param TableRowOperationResultWithKeyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TableRowOperationResultWithKeyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?TableRowOperationResultWithKeyRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Add/AddRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Add/AddRequestBuilder.php index 79bafd7f1a1..1fab45598bb 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Add/AddRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTable; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a new table. The range source address determines the worksheet under which the table will be added. If the table can't be added (for example, because the address is invalid, or the table would overlap with another table), an error is generated. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecollection-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Count/CountRequestBuilder.php index 529db886669..c72dd68c9f0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function count * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/ClearFilters/ClearFiltersRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/ClearFilters/ClearFiltersRequestBuilder.php index 8268a679e0e..17fa83b0b57 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/ClearFilters/ClearFiltersRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/ClearFilters/ClearFiltersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clears all the filters currently applied on the table. This API is available in the following national cloud deployments. * @param ClearFiltersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-clearfilters?view=graph-rest-1.0 Find more info here */ public function post(?ClearFiltersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearFiltersRequestBuilderPostRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Add/AddRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Add/AddRequestBuilder.php index e5119c1e9ed..7ccbc99f1ae 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Add/AddRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTableColumn; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Adds a new column to the table. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumncollection-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/ColumnsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/ColumnsRequestBuilder.php index 04830f90a77..a0ea263b54f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Columns\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Columns\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Columns\Item\WorkbookTableColumnItemRequestBuilder; @@ -64,20 +63,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of tablecolumn objects. This API is available in the following national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/tablecolumn-list?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/table-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumnCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumnCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,20 +89,17 @@ public function itemAtWithIndex(int $index): ItemAtWithIndexRequestBuilder { * Use this API to create a new TableColumn. This API is available in the following national cloud deployments. * @param WorkbookTableColumn $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-post-columns?view=graph-rest-1.0 Find more info here */ public function post(WorkbookTableColumn $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,7 +112,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -127,6 +119,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -141,11 +134,11 @@ public function toPostRequestInformation(WorkbookTableColumn $body, ?ColumnsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Count/CountRequestBuilder.php index 48cfea76e02..7c39bf38a43 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function count * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/DataBodyRange/DataBodyRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/DataBodyRange/DataBodyRangeRequestBuilder.php index a4cf0619a51..fe7185dc051 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/DataBodyRange/DataBodyRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/DataBodyRange/DataBodyRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with the data body of the column. This API is available in the following national cloud deployments. * @param DataBodyRangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-databodyrange?view=graph-rest-1.0 Find more info here */ public function get(?DataBodyRangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?DataBodyRangeRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/Apply/ApplyRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/Apply/ApplyRequestBuilder.php index 5ecb2e4c9e4..005dc5a75f8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/Apply/ApplyRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/Apply/ApplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Apply the given filter criteria on the given column. This API is available in the following national cloud deployments. * @param ApplyPostRequestBody $body The request body * @param ApplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/filter-apply?view=graph-rest-1.0 Find more info here */ public function post(ApplyPostRequestBody $body, ?ApplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ApplyPostRequestBody $body, ?ApplyReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyBottomItemsFilter/ApplyBottomItemsFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyBottomItemsFilter/ApplyBottomItemsFilterRequestBuilder.php index 02df12d2fd6..723a78e928d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyBottomItemsFilter/ApplyBottomItemsFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyBottomItemsFilter/ApplyBottomItemsFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyBottomItemsFilter * @param ApplyBottomItemsFilterPostRequestBody $body The request body * @param ApplyBottomItemsFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyBottomItemsFilterPostRequestBody $body, ?ApplyBottomItemsFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyBottomItemsFilterPostRequestBody $ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyBottomPercentFilter/ApplyBottomPercentFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyBottomPercentFilter/ApplyBottomPercentFilterRequestBuilder.php index f8124d1a56e..b973b7a4a6b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyBottomPercentFilter/ApplyBottomPercentFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyBottomPercentFilter/ApplyBottomPercentFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyBottomPercentFilter * @param ApplyBottomPercentFilterPostRequestBody $body The request body * @param ApplyBottomPercentFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyBottomPercentFilterPostRequestBody $body, ?ApplyBottomPercentFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyBottomPercentFilterPostRequestBody $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyCellColorFilter/ApplyCellColorFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyCellColorFilter/ApplyCellColorFilterRequestBuilder.php index 3bbed6fe582..b9ba6396d20 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyCellColorFilter/ApplyCellColorFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyCellColorFilter/ApplyCellColorFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyCellColorFilter * @param ApplyCellColorFilterPostRequestBody $body The request body * @param ApplyCellColorFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyCellColorFilterPostRequestBody $body, ?ApplyCellColorFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyCellColorFilterPostRequestBody $bo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyCustomFilter/ApplyCustomFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyCustomFilter/ApplyCustomFilterRequestBuilder.php index 0bddcf45494..6f98ffc9ac6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyCustomFilter/ApplyCustomFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyCustomFilter/ApplyCustomFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyCustomFilter * @param ApplyCustomFilterPostRequestBody $body The request body * @param ApplyCustomFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyCustomFilterPostRequestBody $body, ?ApplyCustomFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyCustomFilterPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyDynamicFilter/ApplyDynamicFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyDynamicFilter/ApplyDynamicFilterRequestBuilder.php index 3eb536e4e30..ba37ec225b8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyDynamicFilter/ApplyDynamicFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyDynamicFilter/ApplyDynamicFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyDynamicFilter * @param ApplyDynamicFilterPostRequestBody $body The request body * @param ApplyDynamicFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyDynamicFilterPostRequestBody $body, ?ApplyDynamicFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyDynamicFilterPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyFontColorFilter/ApplyFontColorFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyFontColorFilter/ApplyFontColorFilterRequestBuilder.php index 96c22d47e58..bbd243912ee 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyFontColorFilter/ApplyFontColorFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyFontColorFilter/ApplyFontColorFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyFontColorFilter * @param ApplyFontColorFilterPostRequestBody $body The request body * @param ApplyFontColorFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyFontColorFilterPostRequestBody $body, ?ApplyFontColorFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyFontColorFilterPostRequestBody $bo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyIconFilter/ApplyIconFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyIconFilter/ApplyIconFilterRequestBuilder.php index c80d975ccc1..4f5052db10a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyIconFilter/ApplyIconFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyIconFilter/ApplyIconFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyIconFilter * @param ApplyIconFilterPostRequestBody $body The request body * @param ApplyIconFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyIconFilterPostRequestBody $body, ?ApplyIconFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyIconFilterPostRequestBody $body, ? $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyTopItemsFilter/ApplyTopItemsFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyTopItemsFilter/ApplyTopItemsFilterRequestBuilder.php index 9e677ec5e7b..fad1b6aff26 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyTopItemsFilter/ApplyTopItemsFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyTopItemsFilter/ApplyTopItemsFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyTopItemsFilter * @param ApplyTopItemsFilterPostRequestBody $body The request body * @param ApplyTopItemsFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyTopItemsFilterPostRequestBody $body, ?ApplyTopItemsFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyTopItemsFilterPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyTopPercentFilter/ApplyTopPercentFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyTopPercentFilter/ApplyTopPercentFilterRequestBuilder.php index 196d929ec7a..2e3f838acd6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyTopPercentFilter/ApplyTopPercentFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyTopPercentFilter/ApplyTopPercentFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyTopPercentFilter * @param ApplyTopPercentFilterPostRequestBody $body The request body * @param ApplyTopPercentFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyTopPercentFilterPostRequestBody $body, ?ApplyTopPercentFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyTopPercentFilterPostRequestBody $b $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyValuesFilter/ApplyValuesFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyValuesFilter/ApplyValuesFilterRequestBuilder.php index 2fe4e08dca1..dc98f1a54e3 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyValuesFilter/ApplyValuesFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/ApplyValuesFilter/ApplyValuesFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyValuesFilter * @param ApplyValuesFilterPostRequestBody $body The request body * @param ApplyValuesFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyValuesFilterPostRequestBody $body, ?ApplyValuesFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyValuesFilterPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/Clear/ClearRequestBuilder.php index d0f92f35ed4..a3ce943736e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the filter on the given column. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/filter-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/FilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/FilterRequestBuilder.php index 72173507ddf..a8917b3ea44 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/FilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Filter/FilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Columns\Item\Filter\Apply\ApplyRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Columns\Item\Filter\ApplyBottomItemsFilter\ApplyBottomItemsFilterRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Columns\Item\Filter\ApplyBottomPercentFilter\ApplyBottomPercentFilterRequestBuilder; @@ -130,56 +129,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property filter for drives * @param FilterRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FilterRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the filter applied to the column. Read-only. * @param FilterRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFilter::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFilter::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property filter in drives * @param WorkbookFilter $body The request body * @param FilterRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookFilter $body, ?FilterRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFilter::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFilter::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -196,6 +186,7 @@ public function toDeleteRequestInformation(?FilterRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -209,7 +200,6 @@ public function toGetRequestInformation(?FilterRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -217,6 +207,7 @@ public function toGetRequestInformation(?FilterRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -231,11 +222,11 @@ public function toPatchRequestInformation(WorkbookFilter $body, ?FilterRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php index f68baf02803..f86ae22052a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with the header row of the column. This API is available in the following national cloud deployments. * @param HeaderRowRangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-headerrowrange?view=graph-rest-1.0 Find more info here */ public function get(?HeaderRowRangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?HeaderRowRangeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Range/RangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Range/RangeRequestBuilder.php index 792a5c8c911..5b1d070cfb0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Range/RangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/Range/RangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with the entire column. This API is available in the following national cloud deployments. * @param RangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-range?view=graph-rest-1.0 Find more info here */ public function get(?RangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?RangeRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/TotalRowRange/TotalRowRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/TotalRowRange/TotalRowRangeRequestBuilder.php index 972112b850a..34fa9f9f96a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/TotalRowRange/TotalRowRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/TotalRowRange/TotalRowRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with the totals row of the column. This API is available in the following national cloud deployments. * @param TotalRowRangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-totalrowrange?view=graph-rest-1.0 Find more info here */ public function get(?TotalRowRangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?TotalRowRangeRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/WorkbookTableColumnItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/WorkbookTableColumnItemRequestBuilder.php index 665a7ccee0a..624c3db6b6a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/WorkbookTableColumnItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/Item/WorkbookTableColumnItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Columns\Item\DataBodyRange\DataBodyRangeRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Columns\Item\Filter\FilterRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Columns\Item\HeaderRowRange\HeaderRowRangeRequestBuilder; @@ -74,59 +73,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes the column from the table. This API is available in the following national cloud deployments. * @param WorkbookTableColumnItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WorkbookTableColumnItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of tablecolumn object. This API is available in the following national cloud deployments. * @param WorkbookTableColumnItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkbookTableColumnItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of tablecolumn object. This API is available in the following national cloud deployments. * @param WorkbookTableColumn $body The request body * @param WorkbookTableColumnItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookTableColumn $body, ?WorkbookTableColumnItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -143,6 +133,7 @@ public function toDeleteRequestInformation(?WorkbookTableColumnItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -156,7 +147,6 @@ public function toGetRequestInformation(?WorkbookTableColumnItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -164,6 +154,7 @@ public function toGetRequestInformation(?WorkbookTableColumnItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -178,11 +169,11 @@ public function toPatchRequestInformation(WorkbookTableColumn $body, ?WorkbookTa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php index 3ce9434abcb..7d35315d333 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Columns/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTableColumn; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function itemAt * @param ItemAtWithIndexRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemAtWithIndexRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?ItemAtWithIndexRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/ConvertToRange/ConvertToRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/ConvertToRange/ConvertToRangeRequestBuilder.php index ddc5c41a2f6..5114c56a903 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/ConvertToRange/ConvertToRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/ConvertToRange/ConvertToRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Converts the table into a normal range of cells. All data is preserved. This API is available in the following national cloud deployments. * @param ConvertToRangeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-converttorange?view=graph-rest-1.0 Find more info here */ public function post(?ConvertToRangeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ConvertToRangeRequestBuilderPostReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/DataBodyRange/DataBodyRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/DataBodyRange/DataBodyRangeRequestBuilder.php index 22f7715f9c9..b12e4a9eb22 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/DataBodyRange/DataBodyRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/DataBodyRange/DataBodyRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with the data body of the table. This API is available in the following national cloud deployments. * @param DataBodyRangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-databodyrange?view=graph-rest-1.0 Find more info here */ public function get(?DataBodyRangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?DataBodyRangeRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php index dfa41b15544..e555d625bf9 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with header row of the table. This API is available in the following national cloud deployments. * @param HeaderRowRangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-headerrowrange?view=graph-rest-1.0 Find more info here */ public function get(?HeaderRowRangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?HeaderRowRangeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Range/RangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Range/RangeRequestBuilder.php index 20f35888369..e1611ebb7bd 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Range/RangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Range/RangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the range object associated with the entire table. This API is available in the following national cloud deployments. * @param RangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-range?view=graph-rest-1.0 Find more info here */ public function get(?RangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?RangeRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/ReapplyFilters/ReapplyFiltersRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/ReapplyFilters/ReapplyFiltersRequestBuilder.php index 14f860d76fc..dc7d58903f6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/ReapplyFilters/ReapplyFiltersRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/ReapplyFilters/ReapplyFiltersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reapplies all the filters currently on the table. This API is available in the following national cloud deployments. * @param ReapplyFiltersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-reapplyfilters?view=graph-rest-1.0 Find more info here */ public function post(?ReapplyFiltersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ReapplyFiltersRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Add/AddRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Add/AddRequestBuilder.php index 7cd37766a08..9f0b64f5fe1 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Add/AddRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTableRow; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Adds rows to the end of the table. Note that the API can accept multiple rows data using this API. Adding one row at a time could lead to performance degradation. The recommended approach would be to batch the rows together in a single call rather than doing single row insertion. For best results, collect the rows to be inserted on the application side and perform single rows add operation. Experiment with the number of rows to determine the ideal number of rows to use in single API call. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablerowcollection-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Count/CountRequestBuilder.php index e7fe479c611..cb4d5db025e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function count * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Item/Range/RangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Item/Range/RangeRequestBuilder.php index d4e2ad4a8b4..9678223dd5d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Item/Range/RangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Item/Range/RangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function range * @param RangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?RangeRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Item/WorkbookTableRowItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Item/WorkbookTableRowItemRequestBuilder.php index 85fc21a5770..28e0f4178b5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Item/WorkbookTableRowItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/Item/WorkbookTableRowItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Rows\Item\Range\RangeRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTableRow; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes the row from the table. This API is available in the following national cloud deployments. * @param WorkbookTableRowItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablerow-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WorkbookTableRowItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of tablerow object. This API is available in the following national cloud deployments. * @param WorkbookTableRowItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablerow-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkbookTableRowItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of tablerow object. This API is available in the following national cloud deployments. * @param WorkbookTableRow $body The request body * @param WorkbookTableRowItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablerow-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookTableRow $body, ?WorkbookTableRowItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?WorkbookTableRowItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?WorkbookTableRowItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?WorkbookTableRowItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(WorkbookTableRow $body, ?WorkbookTable $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php index 4bdc03ffe60..499ce320ba5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTableRow; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function itemAt * @param ItemAtWithIndexRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemAtWithIndexRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?ItemAtWithIndexRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/RowsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/RowsRequestBuilder.php index 3349544a439..ad68133c50b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/RowsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Rows/RowsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Rows\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Rows\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Rows\Item\WorkbookTableRowItemRequestBuilder; @@ -64,20 +63,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of tablerow objects. This API is available in the following national cloud deployments. * @param RowsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/table-list-rows?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/tablerow-list?view=graph-rest-1.0 Find more info here */ public function get(?RowsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRowCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRowCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,20 +89,17 @@ public function itemAtWithIndex(int $index): ItemAtWithIndexRequestBuilder { * Adds rows to the end of a table. Note that this API can accept multiple rows of data. Adding one row at a time can affect performance. The recommended approach is to batch the rows together in a single call rather than inserting single rows. For best results, collect the rows to be inserted on the application side and perform a single row add operation. Experiment with the number of rows to determine the ideal number of rows to use in a single API call. This request might occasionally result in a 504 HTTP error. The appropriate response to this error is to repeat the request. This API is available in the following national cloud deployments. * @param WorkbookTableRow $body The request body * @param RowsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-post-rows?view=graph-rest-1.0 Find more info here */ public function post(WorkbookTableRow $body, ?RowsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,7 +112,6 @@ public function toGetRequestInformation(?RowsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -127,6 +119,7 @@ public function toGetRequestInformation(?RowsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -141,11 +134,11 @@ public function toPostRequestInformation(WorkbookTableRow $body, ?RowsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/Apply/ApplyRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/Apply/ApplyRequestBuilder.php index 0db3f0e8f6f..2564414cd8f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/Apply/ApplyRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/Apply/ApplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Perform a sort operation. This API is available in the following national cloud deployments. * @param ApplyPostRequestBody $body The request body * @param ApplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablesort-apply?view=graph-rest-1.0 Find more info here */ public function post(ApplyPostRequestBody $body, ?ApplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ApplyPostRequestBody $body, ?ApplyReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/Clear/ClearRequestBuilder.php index d5d7b4c49b1..bd3bd8a98e0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clears the sorting that is currently on the table. While this doesn't modify the table's ordering, it clears the state of the header buttons. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablesort-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/Reapply/ReapplyRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/Reapply/ReapplyRequestBuilder.php index 71cdda0a1bb..f5ac3df99ba 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/Reapply/ReapplyRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/Reapply/ReapplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reapplies the current sorting parameters to the table. This API is available in the following national cloud deployments. * @param ReapplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablesort-reapply?view=graph-rest-1.0 Find more info here */ public function post(?ReapplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ReapplyRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/SortRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/SortRequestBuilder.php index 6310363b091..8bf52004173 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/SortRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Sort/SortRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Sort\Apply\ApplyRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Sort\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Sort\Reapply\ReapplyRequestBuilder; @@ -58,57 +57,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sort for drives * @param SortRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SortRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of tablesort object. This API is available in the following national cloud deployments. * @param SortRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablesort-get?view=graph-rest-1.0 Find more info here */ public function get(?SortRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableSort::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableSort::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sort in drives * @param WorkbookTableSort $body The request body * @param SortRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookTableSort $body, ?SortRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableSort::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableSort::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -125,6 +115,7 @@ public function toDeleteRequestInformation(?SortRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -138,7 +129,6 @@ public function toGetRequestInformation(?SortRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -146,6 +136,7 @@ public function toGetRequestInformation(?SortRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -160,11 +151,11 @@ public function toPatchRequestInformation(WorkbookTableSort $body, ?SortRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/TotalRowRange/TotalRowRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/TotalRowRange/TotalRowRangeRequestBuilder.php index 2304f02cfd8..61e45de3f4e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/TotalRowRange/TotalRowRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/TotalRowRange/TotalRowRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with totals row of the table. This API is available in the following national cloud deployments. * @param TotalRowRangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-totalrowrange?view=graph-rest-1.0 Find more info here */ public function get(?TotalRowRangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?TotalRowRangeRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/WorkbookTableItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/WorkbookTableItemRequestBuilder.php index 3153b14f789..321ddb75af6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/WorkbookTableItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/WorkbookTableItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\ClearFilters\ClearFiltersRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\Columns\ColumnsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\ConvertToRange\ConvertToRangeRequestBuilder; @@ -122,59 +121,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes the table. This API is available in the following national cloud deployments. * @param WorkbookTableItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WorkbookTableItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of table object. This API is available in the following national cloud deployments. * @param WorkbookTableItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkbookTableItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of table object. This API is available in the following national cloud deployments. * @param WorkbookTable $body The request body * @param WorkbookTableItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookTable $body, ?WorkbookTableItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -191,6 +181,7 @@ public function toDeleteRequestInformation(?WorkbookTableItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -204,7 +195,6 @@ public function toGetRequestInformation(?WorkbookTableItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -212,6 +202,7 @@ public function toGetRequestInformation(?WorkbookTableItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -226,11 +217,11 @@ public function toPatchRequestInformation(WorkbookTable $body, ?WorkbookTableIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Worksheet/WorksheetRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Worksheet/WorksheetRequestBuilder.php index f2557bfe7d8..4ebd6e97c34 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Worksheet/WorksheetRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/Item/Worksheet/WorksheetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookWorksheet; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The worksheet containing the current table. Read-only. * @param WorksheetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WorksheetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?WorksheetRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?WorksheetRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php index 080578c4e1c..84ce01abf0b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTable; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function itemAt * @param ItemAtWithIndexRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemAtWithIndexRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?ItemAtWithIndexRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/TablesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/TablesRequestBuilder.php index 5011a672067..f4ea0f62296 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Tables/TablesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Tables/TablesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Tables\Item\WorkbookTableItemRequestBuilder; @@ -64,20 +63,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of table objects. This API is available in the following national cloud deployments. * @param TablesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workbook-list-tables?view=graph-rest-1.0 Find more info here */ public function get(?TablesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,19 +89,16 @@ public function itemAtWithIndex(int $index): ItemAtWithIndexRequestBuilder { * Create new navigation property to tables for drives * @param WorkbookTable $body The request body * @param TablesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WorkbookTable $body, ?TablesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,7 +111,6 @@ public function toGetRequestInformation(?TablesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -126,6 +118,7 @@ public function toGetRequestInformation(?TablesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -140,11 +133,11 @@ public function toPostRequestInformation(WorkbookTable $body, ?TablesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/WorkbookRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/WorkbookRequestBuilder.php index b0cd681a31b..40d02595250 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/WorkbookRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/WorkbookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Application\ApplicationRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\CloseSession\CloseSessionRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Comments\CommentsRequestBuilder; @@ -116,56 +115,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property workbook for drives * @param WorkbookRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WorkbookRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * For files that are Excel spreadsheets, accesses the workbook API to work with the spreadsheet's contents. Nullable. * @param WorkbookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WorkbookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Workbook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Workbook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property workbook in drives * @param Workbook $body The request body * @param WorkbookRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Workbook $body, ?WorkbookRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Workbook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Workbook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -200,6 +190,7 @@ public function toDeleteRequestInformation(?WorkbookRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -213,7 +204,6 @@ public function toGetRequestInformation(?WorkbookRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -221,6 +211,7 @@ public function toGetRequestInformation(?WorkbookRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -235,11 +226,11 @@ public function toPatchRequestInformation(Workbook $body, ?WorkbookRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Add/AddRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Add/AddRequestBuilder.php index 1edc76ff182..2f6867c0a3f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Add/AddRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookWorksheet; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Adds a new worksheet to the workbook. The worksheet is added at the end of existing worksheets. If you wish to activate the newly added worksheet, call .activate() on it. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/worksheetcollection-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Count/CountRequestBuilder.php index 11eaa00a3ce..15876897063 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/CellWithRowWithColumn/CellWithRowWithColumnRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/CellWithRowWithColumn/CellWithRowWithColumnRequestBuilder.php index fae6359f4f8..dd57c8c21ee 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/CellWithRowWithColumn/CellWithRowWithColumnRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/CellWithRowWithColumn/CellWithRowWithColumnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -39,19 +38,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function cell * @param CellWithRowWithColumnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CellWithRowWithColumnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -64,11 +60,11 @@ public function toGetRequestInformation(?CellWithRowWithColumnRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Add/AddRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Add/AddRequestBuilder.php index a630607e2ae..ab6e9686758 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Add/AddRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChart; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Creates a new chart. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartcollection-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChart::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChart::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/ChartsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/ChartsRequestBuilder.php index 3b48f825661..67ac7ffb6f3 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/ChartsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/ChartsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\WorkbookChartItemRequestBuilder; @@ -65,20 +64,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of chart objects. This API is available in the following national cloud deployments. * @param ChartsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/chart-list?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/worksheet-list-charts?view=graph-rest-1.0 Find more info here */ public function get(?ChartsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,20 +99,17 @@ public function itemWithName(string $name): ItemWithNameRequestBuilder { * Use this API to create a new Chart. This API is available in the following national cloud deployments. * @param WorkbookChart $body The request body * @param ChartsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/worksheet-post-charts?view=graph-rest-1.0 Find more info here */ public function post(WorkbookChart $body, ?ChartsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChart::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChart::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -129,7 +122,6 @@ public function toGetRequestInformation(?ChartsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +129,7 @@ public function toGetRequestInformation(?ChartsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +144,11 @@ public function toPostRequestInformation(WorkbookChart $body, ?ChartsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Count/CountRequestBuilder.php index 51640f882dc..a2b864ba2dd 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function count * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/AxesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/AxesRequestBuilder.php index eabfa14bb71..e874085c2a5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/AxesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/AxesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\CategoryAxisRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\SeriesAxisRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\ValueAxisRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property axes for drives * @param AxesRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AxesRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents chart axes. Read-only. * @param AxesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AxesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxes::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxes::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property axes in drives * @param WorkbookChartAxes $body The request body * @param AxesRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartAxes $body, ?AxesRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxes::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxes::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?AxesRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?AxesRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?AxesRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(WorkbookChartAxes $body, ?AxesRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/CategoryAxisRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/CategoryAxisRequestBuilder.php index 677de821883..20fc30b1869 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/CategoryAxisRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/CategoryAxisRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\MajorGridlines\MajorGridlinesRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\MinorGridlines\MinorGridlinesRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property categoryAxis for drives * @param CategoryAxisRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CategoryAxisRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the category axis in a chart. Read-only. * @param CategoryAxisRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CategoryAxisRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxis::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxis::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property categoryAxis in drives * @param WorkbookChartAxis $body The request body * @param CategoryAxisRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartAxis $body, ?CategoryAxisRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxis::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxis::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?CategoryAxisRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?CategoryAxisRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?CategoryAxisRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(WorkbookChartAxis $body, ?CategoryAxis $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/Font/FontRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/Font/FontRequestBuilder.php index a96f45d8911..f6fac8fe2a7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/Font/FontRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/Font/FontRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartFont; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property font for drives * @param FontRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FontRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartfont object. This API is available in the following national cloud deployments. * @param FontRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfont-get?view=graph-rest-1.0 Find more info here */ public function get(?FontRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartfont object. This API is available in the following national cloud deployments. * @param WorkbookChartFont $body The request body * @param FontRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfont-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartFont $body, ?FontRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?FontRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(WorkbookChartFont $body, ?FontRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/FormatRequestBuilder.php index 6afafcd031d..5b220bd58ae 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\Format\Font\FontRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\Format\Line\LineRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of a chart object, which includes line and font formatting. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartAxisFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartAxisFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartAxisFormat $body, ?Format $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/Line/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/Line/Clear/ClearRequestBuilder.php index f77d1aaca92..784f4cc3ce2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/Line/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/Line/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the line format of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/Line/LineRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/Line/LineRequestBuilder.php index 965f8fe7897..0423d865438 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/Line/LineRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Format/Line/LineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\Format\Line\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartLineFormat; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property line for drives * @param LineRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LineRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartlineformat object. This API is available in the following national cloud deployments. * @param LineRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-get?view=graph-rest-1.0 Find more info here */ public function get(?LineRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartlineformat object. This API is available in the following national cloud deployments. * @param WorkbookChartLineFormat $body The request body * @param LineRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartLineFormat $body, ?LineRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?LineRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WorkbookChartLineFormat $body, ?LineRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/Format/FormatRequestBuilder.php index cebf59943d3..4e0c83c7bdd 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\MajorGridlines\Format\Line\LineRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartGridlinesFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of chart gridlines. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartGridlinesFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartGridlinesFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartGridlinesFormat $body, ?F $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/Format/Line/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/Format/Line/Clear/ClearRequestBuilder.php index 9b5b9147d7f..ae1a6bb7054 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/Format/Line/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/Format/Line/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the line format of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/Format/Line/LineRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/Format/Line/LineRequestBuilder.php index 9438494ce02..e03dc3b9527 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/Format/Line/LineRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/Format/Line/LineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\MajorGridlines\Format\Line\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartLineFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property line for drives * @param LineRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LineRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents chart line formatting. Read-only. * @param LineRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LineRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property line in drives * @param WorkbookChartLineFormat $body The request body * @param LineRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartLineFormat $body, ?LineRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?LineRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartLineFormat $body, ?LineRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/MajorGridlinesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/MajorGridlinesRequestBuilder.php index 18b4a5824ef..fb03181d809 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/MajorGridlinesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MajorGridlines/MajorGridlinesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\MajorGridlines\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartGridlines; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property majorGridlines for drives * @param MajorGridlinesRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MajorGridlinesRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns a gridlines object that represents the major gridlines for the specified axis. Read-only. * @param MajorGridlinesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MajorGridlinesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property majorGridlines in drives * @param WorkbookChartGridlines $body The request body * @param MajorGridlinesRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartGridlines $body, ?MajorGridlinesRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?MajorGridlinesRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?MajorGridlinesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?MajorGridlinesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartGridlines $body, ?MajorGr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/Format/FormatRequestBuilder.php index 0b2c5edb43c..6839124a89e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\MinorGridlines\Format\Line\LineRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartGridlinesFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of chart gridlines. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartGridlinesFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartGridlinesFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartGridlinesFormat $body, ?F $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/Format/Line/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/Format/Line/Clear/ClearRequestBuilder.php index 3a89d013960..9cb5a50d80a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/Format/Line/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/Format/Line/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the line format of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/Format/Line/LineRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/Format/Line/LineRequestBuilder.php index 3d3d66da073..9e8d35dd4e5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/Format/Line/LineRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/Format/Line/LineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\MinorGridlines\Format\Line\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartLineFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property line for drives * @param LineRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LineRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents chart line formatting. Read-only. * @param LineRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LineRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property line in drives * @param WorkbookChartLineFormat $body The request body * @param LineRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartLineFormat $body, ?LineRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?LineRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartLineFormat $body, ?LineRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/MinorGridlinesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/MinorGridlinesRequestBuilder.php index 4873c396cef..62d95186fb2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/MinorGridlinesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/MinorGridlines/MinorGridlinesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\MinorGridlines\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartGridlines; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property minorGridlines for drives * @param MinorGridlinesRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MinorGridlinesRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartgridlines object. This API is available in the following national cloud deployments. * @param MinorGridlinesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartgridlines-get?view=graph-rest-1.0 Find more info here */ public function get(?MinorGridlinesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartgridlines object. This API is available in the following national cloud deployments. * @param WorkbookChartGridlines $body The request body * @param MinorGridlinesRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartgridlines-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartGridlines $body, ?MinorGridlinesRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?MinorGridlinesRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?MinorGridlinesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?MinorGridlinesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WorkbookChartGridlines $body, ?MinorGr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Title/Format/Font/FontRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Title/Format/Font/FontRequestBuilder.php index f10cba98ae8..7f9ddfc3d38 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Title/Format/Font/FontRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Title/Format/Font/FontRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartFont; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property font for drives * @param FontRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FontRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the font attributes, such as font name, font size, color, etc. of chart axis title object. Read-only. * @param FontRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FontRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property font in drives * @param WorkbookChartFont $body The request body * @param FontRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartFont $body, ?FontRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FontRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(WorkbookChartFont $body, ?FontRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Title/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Title/Format/FormatRequestBuilder.php index 080dcc0ab93..3f9fc965b54 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Title/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Title/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\Title\Format\Font\FontRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartAxisTitleFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of chart axis title. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartAxisTitleFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartAxisTitleFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartAxisTitleFormat $body, ?F $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Title/TitleRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Title/TitleRequestBuilder.php index 37b92b316e5..eb0edb284dd 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Title/TitleRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/CategoryAxis/Title/TitleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\CategoryAxis\Title\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartAxisTitle; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property title for drives * @param TitleRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TitleRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartaxistitle object. This API is available in the following national cloud deployments. * @param TitleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartaxistitle-get?view=graph-rest-1.0 Find more info here */ public function get(?TitleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitle::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitle::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartaxistitle object. This API is available in the following national cloud deployments. * @param WorkbookChartAxisTitle $body The request body * @param TitleRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartaxistitle-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartAxisTitle $body, ?TitleRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitle::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitle::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?TitleRequestBuilderDeleteRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?TitleRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?TitleRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WorkbookChartAxisTitle $body, ?TitleRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/Font/FontRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/Font/FontRequestBuilder.php index 2e5a45a2dd8..1644511cc6a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/Font/FontRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/Font/FontRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartFont; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property font for drives * @param FontRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FontRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartfont object. This API is available in the following national cloud deployments. * @param FontRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfont-get?view=graph-rest-1.0 Find more info here */ public function get(?FontRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartfont object. This API is available in the following national cloud deployments. * @param WorkbookChartFont $body The request body * @param FontRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfont-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartFont $body, ?FontRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?FontRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(WorkbookChartFont $body, ?FontRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/FormatRequestBuilder.php index 448deefe4ab..8d1256546c2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\Format\Font\FontRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\Format\Line\LineRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of a chart object, which includes line and font formatting. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartAxisFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartAxisFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartAxisFormat $body, ?Format $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/Line/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/Line/Clear/ClearRequestBuilder.php index 26fb8012d77..dede634d4e6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/Line/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/Line/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the line format of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/Line/LineRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/Line/LineRequestBuilder.php index 7d948daa83d..a5049f504f8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/Line/LineRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Format/Line/LineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\Format\Line\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartLineFormat; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property line for drives * @param LineRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LineRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartlineformat object. This API is available in the following national cloud deployments. * @param LineRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-get?view=graph-rest-1.0 Find more info here */ public function get(?LineRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartlineformat object. This API is available in the following national cloud deployments. * @param WorkbookChartLineFormat $body The request body * @param LineRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartLineFormat $body, ?LineRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?LineRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WorkbookChartLineFormat $body, ?LineRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/Format/FormatRequestBuilder.php index 20656658b1b..f0866d3db3b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\MajorGridlines\Format\Line\LineRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartGridlinesFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of chart gridlines. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartGridlinesFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartGridlinesFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartGridlinesFormat $body, ?F $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/Format/Line/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/Format/Line/Clear/ClearRequestBuilder.php index 2ec11c388dd..ccfc9817193 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/Format/Line/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/Format/Line/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the line format of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/Format/Line/LineRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/Format/Line/LineRequestBuilder.php index 3b0d3280411..270c0f280a8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/Format/Line/LineRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/Format/Line/LineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\MajorGridlines\Format\Line\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartLineFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property line for drives * @param LineRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LineRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents chart line formatting. Read-only. * @param LineRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LineRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property line in drives * @param WorkbookChartLineFormat $body The request body * @param LineRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartLineFormat $body, ?LineRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?LineRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartLineFormat $body, ?LineRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/MajorGridlinesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/MajorGridlinesRequestBuilder.php index 3ec86a714f1..ecd8cd63092 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/MajorGridlinesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MajorGridlines/MajorGridlinesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\MajorGridlines\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartGridlines; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property majorGridlines for drives * @param MajorGridlinesRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MajorGridlinesRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns a gridlines object that represents the major gridlines for the specified axis. Read-only. * @param MajorGridlinesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MajorGridlinesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property majorGridlines in drives * @param WorkbookChartGridlines $body The request body * @param MajorGridlinesRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartGridlines $body, ?MajorGridlinesRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?MajorGridlinesRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?MajorGridlinesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?MajorGridlinesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartGridlines $body, ?MajorGr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/Format/FormatRequestBuilder.php index 2a974ab61bf..49728cd4d3e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\MinorGridlines\Format\Line\LineRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartGridlinesFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of chart gridlines. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartGridlinesFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartGridlinesFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartGridlinesFormat $body, ?F $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/Format/Line/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/Format/Line/Clear/ClearRequestBuilder.php index 1c9debbe823..26d276dbefc 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/Format/Line/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/Format/Line/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the line format of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/Format/Line/LineRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/Format/Line/LineRequestBuilder.php index 7aacad4722f..9900a757a86 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/Format/Line/LineRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/Format/Line/LineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\MinorGridlines\Format\Line\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartLineFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property line for drives * @param LineRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LineRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents chart line formatting. Read-only. * @param LineRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LineRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property line in drives * @param WorkbookChartLineFormat $body The request body * @param LineRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartLineFormat $body, ?LineRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?LineRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartLineFormat $body, ?LineRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/MinorGridlinesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/MinorGridlinesRequestBuilder.php index 266e6ad39ef..5d77a1e3459 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/MinorGridlinesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/MinorGridlines/MinorGridlinesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\MinorGridlines\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartGridlines; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property minorGridlines for drives * @param MinorGridlinesRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MinorGridlinesRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartgridlines object. This API is available in the following national cloud deployments. * @param MinorGridlinesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartgridlines-get?view=graph-rest-1.0 Find more info here */ public function get(?MinorGridlinesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartgridlines object. This API is available in the following national cloud deployments. * @param WorkbookChartGridlines $body The request body * @param MinorGridlinesRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartgridlines-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartGridlines $body, ?MinorGridlinesRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?MinorGridlinesRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?MinorGridlinesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?MinorGridlinesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WorkbookChartGridlines $body, ?MinorGr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/SeriesAxisRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/SeriesAxisRequestBuilder.php index c9ab0e6f9c6..e4f218a37f2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/SeriesAxisRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/SeriesAxisRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\MajorGridlines\MajorGridlinesRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\MinorGridlines\MinorGridlinesRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property seriesAxis for drives * @param SeriesAxisRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SeriesAxisRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the series axis of a 3-dimensional chart. Read-only. * @param SeriesAxisRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SeriesAxisRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxis::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxis::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property seriesAxis in drives * @param WorkbookChartAxis $body The request body * @param SeriesAxisRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartAxis $body, ?SeriesAxisRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxis::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxis::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?SeriesAxisRequestBuilderDeleteReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?SeriesAxisRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?SeriesAxisRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(WorkbookChartAxis $body, ?SeriesAxisRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Title/Format/Font/FontRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Title/Format/Font/FontRequestBuilder.php index e1aa1b59cac..90114582f58 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Title/Format/Font/FontRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Title/Format/Font/FontRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartFont; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property font for drives * @param FontRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FontRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the font attributes, such as font name, font size, color, etc. of chart axis title object. Read-only. * @param FontRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FontRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property font in drives * @param WorkbookChartFont $body The request body * @param FontRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartFont $body, ?FontRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FontRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(WorkbookChartFont $body, ?FontRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Title/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Title/Format/FormatRequestBuilder.php index e7e049b2c94..4dcd8c75e0a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Title/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Title/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\Title\Format\Font\FontRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartAxisTitleFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of chart axis title. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartAxisTitleFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartAxisTitleFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartAxisTitleFormat $body, ?F $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Title/TitleRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Title/TitleRequestBuilder.php index 927c8d1d74c..c43434f2b20 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Title/TitleRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/SeriesAxis/Title/TitleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\SeriesAxis\Title\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartAxisTitle; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property title for drives * @param TitleRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TitleRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartaxistitle object. This API is available in the following national cloud deployments. * @param TitleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartaxistitle-get?view=graph-rest-1.0 Find more info here */ public function get(?TitleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitle::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitle::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartaxistitle object. This API is available in the following national cloud deployments. * @param WorkbookChartAxisTitle $body The request body * @param TitleRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartaxistitle-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartAxisTitle $body, ?TitleRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitle::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitle::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?TitleRequestBuilderDeleteRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?TitleRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?TitleRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WorkbookChartAxisTitle $body, ?TitleRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/Font/FontRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/Font/FontRequestBuilder.php index 3ee3d85f6ff..a29f208b695 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/Font/FontRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/Font/FontRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartFont; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property font for drives * @param FontRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FontRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartfont object. This API is available in the following national cloud deployments. * @param FontRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfont-get?view=graph-rest-1.0 Find more info here */ public function get(?FontRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartfont object. This API is available in the following national cloud deployments. * @param WorkbookChartFont $body The request body * @param FontRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfont-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartFont $body, ?FontRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?FontRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(WorkbookChartFont $body, ?FontRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/FormatRequestBuilder.php index ebb910a83ec..cab0c32baec 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\Format\Font\FontRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\Format\Line\LineRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of a chart object, which includes line and font formatting. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartAxisFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartAxisFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartAxisFormat $body, ?Format $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/Line/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/Line/Clear/ClearRequestBuilder.php index d3b10db511f..15e7ce604d7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/Line/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/Line/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the line format of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/Line/LineRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/Line/LineRequestBuilder.php index 52e26dd68ca..b002c59ccc7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/Line/LineRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Format/Line/LineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\Format\Line\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartLineFormat; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property line for drives * @param LineRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LineRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartlineformat object. This API is available in the following national cloud deployments. * @param LineRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-get?view=graph-rest-1.0 Find more info here */ public function get(?LineRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartlineformat object. This API is available in the following national cloud deployments. * @param WorkbookChartLineFormat $body The request body * @param LineRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartLineFormat $body, ?LineRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?LineRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WorkbookChartLineFormat $body, ?LineRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/Format/FormatRequestBuilder.php index d51017e8012..8938e962d83 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\MajorGridlines\Format\Line\LineRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartGridlinesFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of chart gridlines. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartGridlinesFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartGridlinesFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartGridlinesFormat $body, ?F $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/Format/Line/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/Format/Line/Clear/ClearRequestBuilder.php index fadf3bf7123..9ce4f9b8a99 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/Format/Line/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/Format/Line/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the line format of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/Format/Line/LineRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/Format/Line/LineRequestBuilder.php index 0c7d1783116..37aed16c693 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/Format/Line/LineRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/Format/Line/LineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\MajorGridlines\Format\Line\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartLineFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property line for drives * @param LineRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LineRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents chart line formatting. Read-only. * @param LineRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LineRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property line in drives * @param WorkbookChartLineFormat $body The request body * @param LineRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartLineFormat $body, ?LineRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?LineRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartLineFormat $body, ?LineRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/MajorGridlinesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/MajorGridlinesRequestBuilder.php index 350404cd055..fb7affd7258 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/MajorGridlinesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MajorGridlines/MajorGridlinesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\MajorGridlines\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartGridlines; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property majorGridlines for drives * @param MajorGridlinesRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MajorGridlinesRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns a gridlines object that represents the major gridlines for the specified axis. Read-only. * @param MajorGridlinesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MajorGridlinesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property majorGridlines in drives * @param WorkbookChartGridlines $body The request body * @param MajorGridlinesRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartGridlines $body, ?MajorGridlinesRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?MajorGridlinesRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?MajorGridlinesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?MajorGridlinesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartGridlines $body, ?MajorGr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/Format/FormatRequestBuilder.php index 778e080ec59..0e585985099 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\MinorGridlines\Format\Line\LineRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartGridlinesFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of chart gridlines. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartGridlinesFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartGridlinesFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlinesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartGridlinesFormat $body, ?F $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/Format/Line/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/Format/Line/Clear/ClearRequestBuilder.php index 60e63e2e623..ff7594b9ea7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/Format/Line/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/Format/Line/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the line format of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/Format/Line/LineRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/Format/Line/LineRequestBuilder.php index b020c8b2e0d..2831fff6e0c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/Format/Line/LineRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/Format/Line/LineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\MinorGridlines\Format\Line\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartLineFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property line for drives * @param LineRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LineRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents chart line formatting. Read-only. * @param LineRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LineRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property line in drives * @param WorkbookChartLineFormat $body The request body * @param LineRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartLineFormat $body, ?LineRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?LineRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartLineFormat $body, ?LineRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/MinorGridlinesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/MinorGridlinesRequestBuilder.php index 28819bd61ea..acd371dd0ae 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/MinorGridlinesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/MinorGridlines/MinorGridlinesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\MinorGridlines\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartGridlines; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property minorGridlines for drives * @param MinorGridlinesRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MinorGridlinesRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartgridlines object. This API is available in the following national cloud deployments. * @param MinorGridlinesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartgridlines-get?view=graph-rest-1.0 Find more info here */ public function get(?MinorGridlinesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartgridlines object. This API is available in the following national cloud deployments. * @param WorkbookChartGridlines $body The request body * @param MinorGridlinesRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartgridlines-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartGridlines $body, ?MinorGridlinesRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartGridlines::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?MinorGridlinesRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?MinorGridlinesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?MinorGridlinesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WorkbookChartGridlines $body, ?MinorGr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Title/Format/Font/FontRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Title/Format/Font/FontRequestBuilder.php index e66ba82092b..e1fbc6cb230 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Title/Format/Font/FontRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Title/Format/Font/FontRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartFont; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property font for drives * @param FontRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FontRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the font attributes, such as font name, font size, color, etc. of chart axis title object. Read-only. * @param FontRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FontRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property font in drives * @param WorkbookChartFont $body The request body * @param FontRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartFont $body, ?FontRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FontRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(WorkbookChartFont $body, ?FontRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Title/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Title/Format/FormatRequestBuilder.php index 52999ccd897..e86f885a05e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Title/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Title/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\Title\Format\Font\FontRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartAxisTitleFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of chart axis title. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartAxisTitleFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartAxisTitleFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartAxisTitleFormat $body, ?F $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Title/TitleRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Title/TitleRequestBuilder.php index 8b41387ac26..2a4a4e39c77 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Title/TitleRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/Title/TitleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\Title\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartAxisTitle; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property title for drives * @param TitleRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TitleRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartaxistitle object. This API is available in the following national cloud deployments. * @param TitleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartaxistitle-get?view=graph-rest-1.0 Find more info here */ public function get(?TitleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitle::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitle::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartaxistitle object. This API is available in the following national cloud deployments. * @param WorkbookChartAxisTitle $body The request body * @param TitleRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartaxistitle-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartAxisTitle $body, ?TitleRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitle::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxisTitle::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?TitleRequestBuilderDeleteRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?TitleRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?TitleRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WorkbookChartAxisTitle $body, ?TitleRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/ValueAxisRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/ValueAxisRequestBuilder.php index 79561782851..9370570fc50 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/ValueAxisRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Axes/ValueAxis/ValueAxisRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\MajorGridlines\MajorGridlinesRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\ValueAxis\MinorGridlines\MinorGridlinesRequestBuilder; @@ -66,58 +65,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property valueAxis for drives * @param ValueAxisRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ValueAxisRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartaxis object. This API is available in the following national cloud deployments. * @param ValueAxisRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartaxis-get?view=graph-rest-1.0 Find more info here */ public function get(?ValueAxisRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxis::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxis::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartaxis object. This API is available in the following national cloud deployments. * @param WorkbookChartAxis $body The request body * @param ValueAxisRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartaxis-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartAxis $body, ?ValueAxisRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxis::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAxis::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -134,6 +124,7 @@ public function toDeleteRequestInformation(?ValueAxisRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -147,7 +138,6 @@ public function toGetRequestInformation(?ValueAxisRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -155,6 +145,7 @@ public function toGetRequestInformation(?ValueAxisRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -169,11 +160,11 @@ public function toPatchRequestInformation(WorkbookChartAxis $body, ?ValueAxisReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/DataLabelsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/DataLabelsRequestBuilder.php index 7b7fdcfd29e..6d99a254e2e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/DataLabelsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/DataLabelsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\DataLabels\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartDataLabels; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property dataLabels for drives * @param DataLabelsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DataLabelsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartdatalabels object. This API is available in the following national cloud deployments. * @param DataLabelsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartdatalabels-get?view=graph-rest-1.0 Find more info here */ public function get(?DataLabelsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartDataLabels::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartDataLabels::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartdatalabels object. This API is available in the following national cloud deployments. * @param WorkbookChartDataLabels $body The request body * @param DataLabelsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartdatalabels-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartDataLabels $body, ?DataLabelsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartDataLabels::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartDataLabels::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?DataLabelsRequestBuilderDeleteReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?DataLabelsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?DataLabelsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WorkbookChartDataLabels $body, ?DataLa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Fill/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Fill/Clear/ClearRequestBuilder.php index cb6ea776208..96365c0fd3c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Fill/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Fill/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the fill color of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfill-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Fill/FillRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Fill/FillRequestBuilder.php index 02bbd758430..bfbbf125972 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Fill/FillRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Fill/FillRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\DataLabels\Format\Fill\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\DataLabels\Format\Fill\SetSolidColor\SetSolidColorRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fill for drives * @param FillRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FillRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the fill format of the current chart data label. Read-only. * @param FillRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FillRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fill in drives * @param WorkbookChartFill $body The request body * @param FillRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartFill $body, ?FillRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FillRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FillRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FillRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartFill $body, ?FillRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php index 3a2eac77e43..23214062b19 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Sets the fill formatting of a chart element to a uniform color. This API is available in the following national cloud deployments. * @param SetSolidColorPostRequestBody $body The request body * @param SetSolidColorRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfill-setsolidcolor?view=graph-rest-1.0 Find more info here */ public function post(SetSolidColorPostRequestBody $body, ?SetSolidColorRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetSolidColorPostRequestBody $body, ?Se $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Font/FontRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Font/FontRequestBuilder.php index 62e77a79dad..8bbecbba411 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Font/FontRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/Font/FontRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartFont; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property font for drives * @param FontRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FontRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the font attributes (font name, font size, color, etc.) for a chart data label. Read-only. * @param FontRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FontRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property font in drives * @param WorkbookChartFont $body The request body * @param FontRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartFont $body, ?FontRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FontRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(WorkbookChartFont $body, ?FontRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/FormatRequestBuilder.php index 3c2ce3d55d1..fa1b35b3b64 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/DataLabels/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\DataLabels\Format\Fill\FillRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\DataLabels\Format\Font\FontRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the format of chart data labels, which includes fill and font formatting. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartDataLabelFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartDataLabelFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartDataLabelFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartDataLabelFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartDataLabelFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartDataLabelFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartDataLabelFormat $body, ?F $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Fill/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Fill/Clear/ClearRequestBuilder.php index 7d82bf5f1be..7e23346f1be 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Fill/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Fill/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the fill color of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfill-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Fill/FillRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Fill/FillRequestBuilder.php index d88ded1495e..8e8651f8ca7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Fill/FillRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Fill/FillRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Format\Fill\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Format\Fill\SetSolidColor\SetSolidColorRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fill for drives * @param FillRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FillRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the fill format of an object, which includes background formatting information. Read-only. * @param FillRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FillRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fill in drives * @param WorkbookChartFill $body The request body * @param FillRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartFill $body, ?FillRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FillRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FillRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FillRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartFill $body, ?FillRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php index 85b61982fcb..1e4c1f4062b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Sets the fill formatting of a chart element to a uniform color. This API is available in the following national cloud deployments. * @param SetSolidColorPostRequestBody $body The request body * @param SetSolidColorRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfill-setsolidcolor?view=graph-rest-1.0 Find more info here */ public function post(SetSolidColorPostRequestBody $body, ?SetSolidColorRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetSolidColorPostRequestBody $body, ?Se $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Font/FontRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Font/FontRequestBuilder.php index 5579d018f20..d5d6d93cf59 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Font/FontRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/Font/FontRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartFont; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property font for drives * @param FontRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FontRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the font attributes (font name, font size, color, etc.) for the current object. Read-only. * @param FontRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FontRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property font in drives * @param WorkbookChartFont $body The request body * @param FontRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartFont $body, ?FontRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FontRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(WorkbookChartFont $body, ?FontRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/FormatRequestBuilder.php index bdc2b088bee..fb266abe1f4 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Format\Fill\FillRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Format\Font\FontRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Encapsulates the format properties for the chart area. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAreaFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAreaFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartAreaFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartAreaFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAreaFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartAreaFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartAreaFormat $body, ?Format $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Image/ImageRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Image/ImageRequestBuilder.php index d4fa585b6bb..410d01cae91 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Image/ImageRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Image/ImageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function image * @param ImageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ImageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ImageGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ImageGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?ImageRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/ImageWithWidth/ImageWithWidthRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/ImageWithWidth/ImageWithWidthRequestBuilder.php index c878442b438..19260545798 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/ImageWithWidth/ImageWithWidthRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/ImageWithWidth/ImageWithWidthRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function image * @param ImageWithWidthRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ImageWithWidthRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ImageWithWidthGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ImageWithWidthGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toGetRequestInformation(?ImageWithWidthRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/ImageWithWidthWithHeight/ImageWithWidthWithHeightRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/ImageWithWidthWithHeight/ImageWithWidthWithHeightRequestBuilder.php index 2fa71e2c655..381e62f357b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/ImageWithWidthWithHeight/ImageWithWidthWithHeightRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/ImageWithWidthWithHeight/ImageWithWidthWithHeightRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function image * @param ImageWithWidthWithHeightRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ImageWithWidthWithHeightRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ImageWithWidthWithHeightGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ImageWithWidthWithHeightGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -63,11 +59,11 @@ public function toGetRequestInformation(?ImageWithWidthWithHeightRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/ImageWithWidthWithHeightWithFittingMode/ImageWithWidthWithHeightWithFittingModeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/ImageWithWidthWithHeightWithFittingMode/ImageWithWidthWithHeightWithFittingModeRequestBuilder.php index a2cfd5be058..3da7224a7d4 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/ImageWithWidthWithHeightWithFittingMode/ImageWithWidthWithHeightWithFittingModeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/ImageWithWidthWithHeightWithFittingMode/ImageWithWidthWithHeightWithFittingModeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function image * @param ImageWithWidthWithHeightWithFittingModeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ImageWithWidthWithHeightWithFittingModeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ImageWithWidthWithHeightWithFittingModeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ImageWithWidthWithHeightWithFittingModeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,11 +61,11 @@ public function toGetRequestInformation(?ImageWithWidthWithHeightWithFittingMode $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Fill/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Fill/Clear/ClearRequestBuilder.php index 3c0ba7e72a4..dfb8e0a5776 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Fill/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Fill/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the fill color of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfill-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Fill/FillRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Fill/FillRequestBuilder.php index 1dff58efe11..3b5c5b65ee5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Fill/FillRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Fill/FillRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Legend\Format\Fill\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Legend\Format\Fill\SetSolidColor\SetSolidColorRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fill for drives * @param FillRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FillRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the fill format of an object, which includes background formating information. Read-only. * @param FillRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FillRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fill in drives * @param WorkbookChartFill $body The request body * @param FillRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartFill $body, ?FillRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FillRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FillRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FillRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartFill $body, ?FillRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php index e23bd7948b5..dbb95bb8fc8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Sets the fill formatting of a chart element to a uniform color. This API is available in the following national cloud deployments. * @param SetSolidColorPostRequestBody $body The request body * @param SetSolidColorRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfill-setsolidcolor?view=graph-rest-1.0 Find more info here */ public function post(SetSolidColorPostRequestBody $body, ?SetSolidColorRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetSolidColorPostRequestBody $body, ?Se $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Font/FontRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Font/FontRequestBuilder.php index b3a8bf87233..b5d06ce3789 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Font/FontRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/Font/FontRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartFont; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property font for drives * @param FontRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FontRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the font attributes such as font name, font size, color, etc. of a chart legend. Read-only. * @param FontRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FontRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property font in drives * @param WorkbookChartFont $body The request body * @param FontRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartFont $body, ?FontRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FontRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(WorkbookChartFont $body, ?FontRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/FormatRequestBuilder.php index 80de7b21303..f381f7bd4c6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Legend\Format\Fill\FillRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Legend\Format\Font\FontRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of a chart legend, which includes fill and font formatting. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLegendFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLegendFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartLegendFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartLegendFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLegendFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLegendFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartLegendFormat $body, ?Form $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/LegendRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/LegendRequestBuilder.php index 2b58597e832..d2ec2fcb8e1 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/LegendRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Legend/LegendRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Legend\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartLegend; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property legend for drives * @param LegendRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LegendRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartlegend object. This API is available in the following national cloud deployments. * @param LegendRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlegend-get?view=graph-rest-1.0 Find more info here */ public function get(?LegendRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLegend::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLegend::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartlegend object. This API is available in the following national cloud deployments. * @param WorkbookChartLegend $body The request body * @param LegendRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlegend-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartLegend $body, ?LegendRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLegend::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLegend::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?LegendRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?LegendRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?LegendRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WorkbookChartLegend $body, ?LegendRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Count/CountRequestBuilder.php index 13eb7aca0b8..f3212565362 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function count * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Fill/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Fill/Clear/ClearRequestBuilder.php index 996c37c8dc6..914bc8510db 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Fill/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Fill/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the fill color of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfill-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Fill/FillRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Fill/FillRequestBuilder.php index 366c43db2cc..882e56bd0a5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Fill/FillRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Fill/FillRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Format\Fill\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Format\Fill\SetSolidColor\SetSolidColorRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fill for drives * @param FillRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FillRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the fill format of a chart series, which includes background formatting information. Read-only. * @param FillRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FillRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fill in drives * @param WorkbookChartFill $body The request body * @param FillRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartFill $body, ?FillRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FillRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FillRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FillRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartFill $body, ?FillRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php index 6019aa6537f..2a3ebbe32a9 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Sets the fill formatting of a chart element to a uniform color. This API is available in the following national cloud deployments. * @param SetSolidColorPostRequestBody $body The request body * @param SetSolidColorRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfill-setsolidcolor?view=graph-rest-1.0 Find more info here */ public function post(SetSolidColorPostRequestBody $body, ?SetSolidColorRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetSolidColorPostRequestBody $body, ?Se $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/FormatRequestBuilder.php index be690ebcc32..b7b12b4e60a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Format\Fill\FillRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Format\Line\LineRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of a chart series, which includes fill and line formatting. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeriesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeriesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartSeriesFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartSeriesFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeriesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeriesFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartSeriesFormat $body, ?Form $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Line/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Line/Clear/ClearRequestBuilder.php index 7c8318b3a29..9863e6e15c7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Line/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Line/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the line format of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartlineformat-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Line/LineRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Line/LineRequestBuilder.php index e92d486cd49..4c6940a85ae 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Line/LineRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Format/Line/LineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Format\Line\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartLineFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property line for drives * @param LineRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LineRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents line formatting. Read-only. * @param LineRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LineRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property line in drives * @param WorkbookChartLineFormat $body The request body * @param LineRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartLineFormat $body, ?LineRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartLineFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?LineRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?LineRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartLineFormat $body, ?LineRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Count/CountRequestBuilder.php index 0b741441767..207bad563a2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function count * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/Fill/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/Fill/Clear/ClearRequestBuilder.php index 8f3745d8b17..fbb33927383 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/Fill/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/Fill/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the fill color of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfill-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/Fill/FillRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/Fill/FillRequestBuilder.php index 40dd7088690..98e18d049ad 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/Fill/FillRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/Fill/FillRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Points\Item\Format\Fill\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Points\Item\Format\Fill\SetSolidColor\SetSolidColorRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fill for drives * @param FillRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FillRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the fill format of a chart, which includes background formatting information. Read-only. * @param FillRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FillRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fill in drives * @param WorkbookChartFill $body The request body * @param FillRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartFill $body, ?FillRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FillRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FillRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FillRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartFill $body, ?FillRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php index cdbadf3a347..53d349766d1 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Sets the fill formatting of a chart element to a uniform color. This API is available in the following national cloud deployments. * @param SetSolidColorPostRequestBody $body The request body * @param SetSolidColorRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfill-setsolidcolor?view=graph-rest-1.0 Find more info here */ public function post(SetSolidColorPostRequestBody $body, ?SetSolidColorRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetSolidColorPostRequestBody $body, ?Se $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/FormatRequestBuilder.php index 65c3dcdb58e..f321d694918 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Points\Item\Format\Fill\FillRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartPointFormat; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Encapsulates the format properties chart point. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPointFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPointFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartPointFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartPointFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPointFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPointFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WorkbookChartPointFormat $body, ?Forma $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/WorkbookChartPointItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/WorkbookChartPointItemRequestBuilder.php index d8dc3335d88..bb158512aee 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/WorkbookChartPointItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/Item/WorkbookChartPointItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Points\Item\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartPoint; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property points for drives * @param WorkbookChartPointItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WorkbookChartPointItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartpoint object. This API is available in the following national cloud deployments. * @param WorkbookChartPointItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartpoint-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkbookChartPointItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property points in drives * @param WorkbookChartPoint $body The request body * @param WorkbookChartPointItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartPoint $body, ?WorkbookChartPointItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?WorkbookChartPointItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?WorkbookChartPointItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?WorkbookChartPointItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(WorkbookChartPoint $body, ?WorkbookCha $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php index feb84b695bc..ca1ccf73a68 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartPoint; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function itemAt * @param ItemAtWithIndexRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemAtWithIndexRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?ItemAtWithIndexRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/PointsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/PointsRequestBuilder.php index 355ec989cdf..d57f5f3c023 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/PointsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/PointsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Points\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Points\Item\WorkbookChartPointItemRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Points\ItemAtWithIndex\ItemAtWithIndexRequestBuilder; @@ -54,22 +53,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve a list of chartpoints objects. This API is available in the following national cloud deployments. + * Retrieve a list of chartpoint objects. This API is available in the following national cloud deployments. * @param PointsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/chartseries-list-points?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/chartpoint-list?view=graph-rest-1.0 Find more info here */ public function get(?PointsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -85,24 +81,21 @@ public function itemAtWithIndex(int $index): ItemAtWithIndexRequestBuilder { * Use this API to create a new ChartPoints. This API is available in the following national cloud deployments. * @param WorkbookChartPoint $body The request body * @param PointsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartseries-post-points?view=graph-rest-1.0 Find more info here */ public function post(WorkbookChartPoint $body, ?PointsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartPoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve a list of chartpoints objects. This API is available in the following national cloud deployments. + * Retrieve a list of chartpoint objects. This API is available in the following national cloud deployments. * @param PointsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -111,7 +104,6 @@ public function toGetRequestInformation(?PointsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -119,6 +111,7 @@ public function toGetRequestInformation(?PointsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -133,11 +126,11 @@ public function toPostRequestInformation(WorkbookChartPoint $body, ?PointsReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/PointsRequestBuilderGetQueryParameters.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/PointsRequestBuilderGetQueryParameters.php index 08c32e3f96f..d804faa78f6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/PointsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/Points/PointsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve a list of chartpoints objects. This API is available in the following national cloud deployments. + * Retrieve a list of chartpoint objects. This API is available in the following national cloud deployments. */ class PointsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/WorkbookChartSeriesItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/WorkbookChartSeriesItemRequestBuilder.php index 388375a0400..3777a63fe45 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/WorkbookChartSeriesItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/Item/WorkbookChartSeriesItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\Points\PointsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property series for drives * @param WorkbookChartSeriesItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WorkbookChartSeriesItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chartseries object. This API is available in the following national cloud deployments. * @param WorkbookChartSeriesItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartseries-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkbookChartSeriesItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeries::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeries::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of chartseries object. This API is available in the following national cloud deployments. * @param WorkbookChartSeries $body The request body * @param WorkbookChartSeriesItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartseries-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartSeries $body, ?WorkbookChartSeriesItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeries::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeries::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?WorkbookChartSeriesItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?WorkbookChartSeriesItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?WorkbookChartSeriesItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(WorkbookChartSeries $body, ?WorkbookCh $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php index 770210ef079..5d2afc89899 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartSeries; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function itemAt * @param ItemAtWithIndexRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemAtWithIndexRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeries::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeries::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?ItemAtWithIndexRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/SeriesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/SeriesRequestBuilder.php index 8aaeb632cef..71e443f9070 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/SeriesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Series/SeriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\Item\WorkbookChartSeriesItemRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Series\ItemAtWithIndex\ItemAtWithIndexRequestBuilder; @@ -56,20 +55,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of chartseries objects. This API is available in the following national cloud deployments. * @param SeriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/chartseries-list?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/chart-list-series?view=graph-rest-1.0 Find more info here */ public function get(?SeriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeriesCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeriesCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -85,20 +81,17 @@ public function itemAtWithIndex(int $index): ItemAtWithIndexRequestBuilder { * Use this API to create a new ChartSeries. This API is available in the following national cloud deployments. * @param WorkbookChartSeries $body The request body * @param SeriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chart-post-series?view=graph-rest-1.0 Find more info here */ public function post(WorkbookChartSeries $body, ?SeriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeries::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartSeries::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,7 +104,6 @@ public function toGetRequestInformation(?SeriesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -119,6 +111,7 @@ public function toGetRequestInformation(?SeriesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -133,11 +126,11 @@ public function toPostRequestInformation(WorkbookChartSeries $body, ?SeriesReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/SetData/SetDataRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/SetData/SetDataRequestBuilder.php index 2c4896759d8..adeafdbdf88 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/SetData/SetDataRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/SetData/SetDataRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resets the source data for the chart. This API is available in the following national cloud deployments. * @param SetDataPostRequestBody $body The request body * @param SetDataRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chart-setdata?view=graph-rest-1.0 Find more info here */ public function post(SetDataPostRequestBody $body, ?SetDataRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetDataPostRequestBody $body, ?SetDataR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/SetPosition/SetPositionRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/SetPosition/SetPositionRequestBuilder.php index 63e5b14cbef..01de0a6f598 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/SetPosition/SetPositionRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/SetPosition/SetPositionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Positions the chart relative to cells on the worksheet. This API is available in the following national cloud deployments. * @param SetPositionPostRequestBody $body The request body * @param SetPositionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chart-setposition?view=graph-rest-1.0 Find more info here */ public function post(SetPositionPostRequestBody $body, ?SetPositionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetPositionPostRequestBody $body, ?SetP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Fill/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Fill/Clear/ClearRequestBuilder.php index 046f8b8abf9..a62fe62e433 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Fill/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Fill/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the fill color of a chart element. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfill-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Fill/FillRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Fill/FillRequestBuilder.php index ea2b4df69d8..942bd56538f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Fill/FillRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Fill/FillRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Title\Format\Fill\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Title\Format\Fill\SetSolidColor\SetSolidColorRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fill for drives * @param FillRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FillRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the fill format of an object, which includes background formatting information. Read-only. * @param FillRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FillRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fill in drives * @param WorkbookChartFill $body The request body * @param FillRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartFill $body, ?FillRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFill::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FillRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FillRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FillRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartFill $body, ?FillRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php index 58b29c508cc..2efea898107 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Fill/SetSolidColor/SetSolidColorRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Sets the fill formatting of a chart element to a uniform color. This API is available in the following national cloud deployments. * @param SetSolidColorPostRequestBody $body The request body * @param SetSolidColorRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chartfill-setsolidcolor?view=graph-rest-1.0 Find more info here */ public function post(SetSolidColorPostRequestBody $body, ?SetSolidColorRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetSolidColorPostRequestBody $body, ?Se $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Font/FontRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Font/FontRequestBuilder.php index 7dc2e652861..554eb75a4d6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Font/FontRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/Font/FontRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartFont; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property font for drives * @param FontRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FontRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the font attributes (font name, font size, color, etc.) for the current object. Read-only. * @param FontRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FontRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property font in drives * @param WorkbookChartFont $body The request body * @param FontRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartFont $body, ?FontRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartFont::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FontRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FontRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(WorkbookChartFont $body, ?FontRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/FormatRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/FormatRequestBuilder.php index 84eebb49d92..103481f29b4 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/FormatRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/Format/FormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Title\Format\Fill\FillRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Title\Format\Font\FontRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property format for drives * @param FormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the formatting of a chart title, which includes fill and font formatting. Read-only. * @param FormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property format in drives * @param WorkbookChartTitleFormat $body The request body * @param FormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookChartTitleFormat $body, ?FormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartTitleFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?FormatRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?FormatRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookChartTitleFormat $body, ?Forma $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/TitleRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/TitleRequestBuilder.php index 5a5964f597b..8a867cdcab6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/TitleRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Title/TitleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Title\Format\FormatRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChartTitle; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property title for drives * @param TitleRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TitleRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of charttitle object. This API is available in the following national cloud deployments. * @param TitleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/charttitle-get?view=graph-rest-1.0 Find more info here */ public function get(?TitleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartTitle::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartTitle::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of charttitle object. This API is available in the following national cloud deployments. * @param WorkbookChartTitle $body The request body * @param TitleRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/charttitle-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChartTitle $body, ?TitleRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartTitle::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChartTitle::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?TitleRequestBuilderDeleteRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?TitleRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?TitleRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WorkbookChartTitle $body, ?TitleReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/WorkbookChartItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/WorkbookChartItemRequestBuilder.php index 08cc3eb2eb7..cefbfdac9f2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/WorkbookChartItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/WorkbookChartItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Axes\AxesRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\DataLabels\DataLabelsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\Item\Format\FormatRequestBuilder; @@ -117,39 +116,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes the chart object. This API is available in the following national cloud deployments. * @param WorkbookChartItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chart-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WorkbookChartItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chart object. This API is available in the following national cloud deployments. * @param WorkbookChartItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chart-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkbookChartItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChart::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChart::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -186,20 +179,17 @@ public function imageWithWidthWithHeightWithFittingMode(string $fittingMode, int * Update the properties of chart object. This API is available in the following national cloud deployments. * @param WorkbookChart $body The request body * @param WorkbookChartItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chart-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookChart $body, ?WorkbookChartItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChart::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChart::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -216,6 +206,7 @@ public function toDeleteRequestInformation(?WorkbookChartItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -229,7 +220,6 @@ public function toGetRequestInformation(?WorkbookChartItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -237,6 +227,7 @@ public function toGetRequestInformation(?WorkbookChartItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -251,11 +242,11 @@ public function toPatchRequestInformation(WorkbookChart $body, ?WorkbookChartIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Worksheet/WorksheetRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Worksheet/WorksheetRequestBuilder.php index 180f240485f..0c8ce1d5127 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Worksheet/WorksheetRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/Item/Worksheet/WorksheetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookWorksheet; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The worksheet containing the current chart. Read-only. * @param WorksheetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WorksheetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?WorksheetRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?WorksheetRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php index 180002f066e..b1bba65bdc6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChart; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function itemAt * @param ItemAtWithIndexRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemAtWithIndexRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChart::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChart::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?ItemAtWithIndexRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/ItemWithName/ItemWithNameRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/ItemWithName/ItemWithNameRequestBuilder.php index c6adc85b807..7eb88d43bb9 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/ItemWithName/ItemWithNameRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Charts/ItemWithName/ItemWithNameRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookChart; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function item * @param ItemWithNameRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemWithNameRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChart::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookChart::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?ItemWithNameRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Add/AddRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Add/AddRequestBuilder.php index 15cd5652d07..11c3775040b 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Add/AddRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookNamedItem; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Adds a new name to the collection of the given scope using the user's locale for the formula. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/nameditem-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/AddFormulaLocal/AddFormulaLocalRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/AddFormulaLocal/AddFormulaLocalRequestBuilder.php index f866f5873b0..5bd99cd4766 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/AddFormulaLocal/AddFormulaLocalRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/AddFormulaLocal/AddFormulaLocalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookNamedItem; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Adds a new name to the collection of the given scope using the user's locale for the formula. This API is available in the following national cloud deployments. * @param AddFormulaLocalPostRequestBody $body The request body * @param AddFormulaLocalRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/nameditem-addformulalocal?view=graph-rest-1.0 Find more info here */ public function post(AddFormulaLocalPostRequestBody $body, ?AddFormulaLocalRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddFormulaLocalPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Count/CountRequestBuilder.php index 4af6092df06..c9cbc30e5a9 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Item/Range/RangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Item/Range/RangeRequestBuilder.php index d0f153145e7..04d8f5834ed 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Item/Range/RangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Item/Range/RangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,26 +31,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the properties and relationships of range object. This API is available in the following national cloud deployments. + * Returns the range object that is associated with the name. Throws an exception if the named item's type is not a range. This API is available in the following national cloud deployments. * @param RangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/range-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/nameditem-range?view=graph-rest-1.0 Find more info here */ public function get(?RangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the properties and relationships of range object. This API is available in the following national cloud deployments. + * Returns the range object that is associated with the name. Throws an exception if the named item's type is not a range. This API is available in the following national cloud deployments. * @param RangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -60,11 +56,11 @@ public function toGetRequestInformation(?RangeRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Item/WorkbookNamedItemItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Item/WorkbookNamedItemItemRequestBuilder.php index d8db1aa6687..8fd97fd3905 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Item/WorkbookNamedItemItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Item/WorkbookNamedItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Names\Item\Range\RangeRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Names\Item\Worksheet\WorksheetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property names for drives * @param WorkbookNamedItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WorkbookNamedItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns collection of names that are associated with the worksheet. Read-only. * @param WorkbookNamedItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WorkbookNamedItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property names in drives * @param WorkbookNamedItem $body The request body * @param WorkbookNamedItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookNamedItem $body, ?WorkbookNamedItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?WorkbookNamedItemItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?WorkbookNamedItemItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?WorkbookNamedItemItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(WorkbookNamedItem $body, ?WorkbookName $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Item/Worksheet/WorksheetRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Item/Worksheet/WorksheetRequestBuilder.php index a52c6b8b4fe..6577ed77bb9 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Item/Worksheet/WorksheetRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/Item/Worksheet/WorksheetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookWorksheet; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Returns the worksheet on which the named item is scoped to. Available only if the item is scoped to the worksheet. Read-only. * @param WorksheetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WorksheetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?WorksheetRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?WorksheetRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/NamesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/NamesRequestBuilder.php index c7b10615401..ecbddb5f14a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/NamesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Names/NamesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Names\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Names\AddFormulaLocal\AddFormulaLocalRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Names\Count\CountRequestBuilder; @@ -71,39 +70,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of named item associated with the worksheet. This API is available in the following national cloud deployments. * @param NamesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/worksheet-list-names?view=graph-rest-1.0 Find more info here */ public function get(?NamesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to names for drives * @param WorkbookNamedItem $body The request body * @param NamesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WorkbookNamedItem $body, ?NamesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookNamedItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,7 +109,6 @@ public function toGetRequestInformation(?NamesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +116,7 @@ public function toGetRequestInformation(?NamesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +131,11 @@ public function toPostRequestInformation(WorkbookNamedItem $body, ?NamesRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Count/CountRequestBuilder.php index 039a820d8e5..0977aa570e6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Item/Refresh/RefreshRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Item/Refresh/RefreshRequestBuilder.php index b7bb578b0ac..384eeed646a 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Item/Refresh/RefreshRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Item/Refresh/RefreshRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Refreshes the PivotTable. This API is available in the following national cloud deployments. * @param RefreshRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workbookpivottable-refresh?view=graph-rest-1.0 Find more info here */ public function post(?RefreshRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RefreshRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Item/WorkbookPivotTableItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Item/WorkbookPivotTableItemRequestBuilder.php index e3f248a262c..d2498eb01d1 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Item/WorkbookPivotTableItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Item/WorkbookPivotTableItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\PivotTables\Item\Refresh\RefreshRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\PivotTables\Item\Worksheet\WorksheetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pivotTables for drives * @param WorkbookPivotTableItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WorkbookPivotTableItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of workbookPivotTable object. This API is available in the following national cloud deployments. * @param WorkbookPivotTableItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workbookpivottable-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkbookPivotTableItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookPivotTable::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookPivotTable::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pivotTables in drives * @param WorkbookPivotTable $body The request body * @param WorkbookPivotTableItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookPivotTable $body, ?WorkbookPivotTableItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookPivotTable::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookPivotTable::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?WorkbookPivotTableItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?WorkbookPivotTableItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?WorkbookPivotTableItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(WorkbookPivotTable $body, ?WorkbookPiv $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Item/Worksheet/WorksheetRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Item/Worksheet/WorksheetRequestBuilder.php index 7e355e08942..2accc822a3e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Item/Worksheet/WorksheetRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/Item/Worksheet/WorksheetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookWorksheet; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The worksheet containing the current PivotTable. Read-only. * @param WorksheetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WorksheetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?WorksheetRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?WorksheetRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/PivotTablesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/PivotTablesRequestBuilder.php index 7ecc3bd2070..d9779cf7241 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/PivotTablesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/PivotTablesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\PivotTables\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\PivotTables\Item\WorkbookPivotTableItemRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\PivotTables\RefreshAll\RefreshAllRequestBuilder; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of workbookpivottable objects. This API is available in the following national cloud deployments. * @param PivotTablesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workbookworksheet-list-pivottables?view=graph-rest-1.0 Find more info here */ public function get(?PivotTablesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookPivotTableCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookPivotTableCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to pivotTables for drives * @param WorkbookPivotTable $body The request body * @param PivotTablesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WorkbookPivotTable $body, ?PivotTablesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookPivotTable::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookPivotTable::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?PivotTablesRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?PivotTablesRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(WorkbookPivotTable $body, ?PivotTablesR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/RefreshAll/RefreshAllRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/RefreshAll/RefreshAllRequestBuilder.php index 7ec0a1b1b17..39f96231ed5 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/RefreshAll/RefreshAllRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/PivotTables/RefreshAll/RefreshAllRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Refreshes the PivotTable within a given worksheet. This API is available in the following national cloud deployments. * @param RefreshAllRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workbookpivottable-refreshall?view=graph-rest-1.0 Find more info here */ public function post(?RefreshAllRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RefreshAllRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Protection/Protect/ProtectRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Protection/Protect/ProtectRequestBuilder.php index 3a0e3a80301..11c76dd5381 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Protection/Protect/ProtectRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Protection/Protect/ProtectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Protect a worksheet. It throws if the worksheet has been protected. This API is available in the following national cloud deployments. * @param ProtectPostRequestBody $body The request body * @param ProtectRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/worksheetprotection-protect?view=graph-rest-1.0 Find more info here */ public function post(ProtectPostRequestBody $body, ?ProtectRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ProtectPostRequestBody $body, ?ProtectR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Protection/ProtectionRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Protection/ProtectionRequestBuilder.php index 29deb6336dc..17d502a1fcf 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Protection/ProtectionRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Protection/ProtectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Protection\Protect\ProtectRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Protection\Unprotect\UnprotectRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property protection for drives * @param ProtectionRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ProtectionRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of worksheetprotection object. This API is available in the following national cloud deployments. * @param ProtectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/worksheetprotection-get?view=graph-rest-1.0 Find more info here */ public function get(?ProtectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheetProtection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheetProtection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property protection in drives * @param WorkbookWorksheetProtection $body The request body * @param ProtectionRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookWorksheetProtection $body, ?ProtectionRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheetProtection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheetProtection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?ProtectionRequestBuilderDeleteReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?ProtectionRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?ProtectionRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(WorkbookWorksheetProtection $body, ?Pr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Protection/Unprotect/UnprotectRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Protection/Unprotect/UnprotectRequestBuilder.php index fcc6987fc03..77010f7056c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Protection/Unprotect/UnprotectRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Protection/Unprotect/UnprotectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unprotect a worksheet This API is available in the following national cloud deployments. * @param UnprotectRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/worksheetprotection-unprotect?view=graph-rest-1.0 Find more info here */ public function post(?UnprotectRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnprotectRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Range/RangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Range/RangeRequestBuilder.php index c00dc1de608..876b2eb3973 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Range/RangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Range/RangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function range * @param RangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?RangeRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/RangeWithAddress/RangeWithAddressRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/RangeWithAddress/RangeWithAddressRequestBuilder.php index 12cf6b76c8f..7ae88220c65 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/RangeWithAddress/RangeWithAddressRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/RangeWithAddress/RangeWithAddressRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function range * @param RangeWithAddressRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RangeWithAddressRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?RangeWithAddressRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Add/AddRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Add/AddRequestBuilder.php index c7c67d76dad..3b29c29eebf 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Add/AddRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTable; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a new table. The range source address determines the worksheet under which the table will be added. If the table can't be added (for example, because the address is invalid, or the table would overlap with another table), an error is generated. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecollection-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Count/CountRequestBuilder.php index 822b2fdd9f3..aa2db14b8fb 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function count * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/ClearFilters/ClearFiltersRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/ClearFilters/ClearFiltersRequestBuilder.php index 2eb6c8bb549..a23da2bfec2 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/ClearFilters/ClearFiltersRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/ClearFilters/ClearFiltersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clears all the filters currently applied on the table. This API is available in the following national cloud deployments. * @param ClearFiltersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-clearfilters?view=graph-rest-1.0 Find more info here */ public function post(?ClearFiltersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearFiltersRequestBuilderPostRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Add/AddRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Add/AddRequestBuilder.php index 2c754c5c113..c3db2c75d4e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Add/AddRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTableColumn; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Adds a new column to the table. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumncollection-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/ColumnsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/ColumnsRequestBuilder.php index 272b960dc6f..c274ec4564d 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Columns\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Columns\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Columns\Item\WorkbookTableColumnItemRequestBuilder; @@ -64,20 +63,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of tablecolumn objects. This API is available in the following national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/tablecolumn-list?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/table-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumnCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumnCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,20 +89,17 @@ public function itemAtWithIndex(int $index): ItemAtWithIndexRequestBuilder { * Use this API to create a new TableColumn. This API is available in the following national cloud deployments. * @param WorkbookTableColumn $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-post-columns?view=graph-rest-1.0 Find more info here */ public function post(WorkbookTableColumn $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,7 +112,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -127,6 +119,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -141,11 +134,11 @@ public function toPostRequestInformation(WorkbookTableColumn $body, ?ColumnsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Count/CountRequestBuilder.php index 5f57ba7247b..b9e3c853066 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function count * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/DataBodyRange/DataBodyRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/DataBodyRange/DataBodyRangeRequestBuilder.php index 0b790bdfca6..2698dfa6a5f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/DataBodyRange/DataBodyRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/DataBodyRange/DataBodyRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with the data body of the column. This API is available in the following national cloud deployments. * @param DataBodyRangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-databodyrange?view=graph-rest-1.0 Find more info here */ public function get(?DataBodyRangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?DataBodyRangeRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/Apply/ApplyRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/Apply/ApplyRequestBuilder.php index a13545ace80..e0ee2ac6d45 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/Apply/ApplyRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/Apply/ApplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Apply the given filter criteria on the given column. This API is available in the following national cloud deployments. * @param ApplyPostRequestBody $body The request body * @param ApplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/filter-apply?view=graph-rest-1.0 Find more info here */ public function post(ApplyPostRequestBody $body, ?ApplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ApplyPostRequestBody $body, ?ApplyReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyBottomItemsFilter/ApplyBottomItemsFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyBottomItemsFilter/ApplyBottomItemsFilterRequestBuilder.php index 8cf9f99ab59..8b17b2172c1 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyBottomItemsFilter/ApplyBottomItemsFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyBottomItemsFilter/ApplyBottomItemsFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyBottomItemsFilter * @param ApplyBottomItemsFilterPostRequestBody $body The request body * @param ApplyBottomItemsFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyBottomItemsFilterPostRequestBody $body, ?ApplyBottomItemsFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyBottomItemsFilterPostRequestBody $ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyBottomPercentFilter/ApplyBottomPercentFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyBottomPercentFilter/ApplyBottomPercentFilterRequestBuilder.php index 3b1d05af9cd..661695587df 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyBottomPercentFilter/ApplyBottomPercentFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyBottomPercentFilter/ApplyBottomPercentFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyBottomPercentFilter * @param ApplyBottomPercentFilterPostRequestBody $body The request body * @param ApplyBottomPercentFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyBottomPercentFilterPostRequestBody $body, ?ApplyBottomPercentFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyBottomPercentFilterPostRequestBody $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyCellColorFilter/ApplyCellColorFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyCellColorFilter/ApplyCellColorFilterRequestBuilder.php index d0962b4cb69..89f98153484 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyCellColorFilter/ApplyCellColorFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyCellColorFilter/ApplyCellColorFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyCellColorFilter * @param ApplyCellColorFilterPostRequestBody $body The request body * @param ApplyCellColorFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyCellColorFilterPostRequestBody $body, ?ApplyCellColorFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyCellColorFilterPostRequestBody $bo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyCustomFilter/ApplyCustomFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyCustomFilter/ApplyCustomFilterRequestBuilder.php index d3a97022951..7e93b546b39 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyCustomFilter/ApplyCustomFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyCustomFilter/ApplyCustomFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyCustomFilter * @param ApplyCustomFilterPostRequestBody $body The request body * @param ApplyCustomFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyCustomFilterPostRequestBody $body, ?ApplyCustomFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyCustomFilterPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyDynamicFilter/ApplyDynamicFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyDynamicFilter/ApplyDynamicFilterRequestBuilder.php index 4b24b61bd13..31eb25ebb3f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyDynamicFilter/ApplyDynamicFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyDynamicFilter/ApplyDynamicFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyDynamicFilter * @param ApplyDynamicFilterPostRequestBody $body The request body * @param ApplyDynamicFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyDynamicFilterPostRequestBody $body, ?ApplyDynamicFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyDynamicFilterPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyFontColorFilter/ApplyFontColorFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyFontColorFilter/ApplyFontColorFilterRequestBuilder.php index b384f7c6eb9..40f609012ed 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyFontColorFilter/ApplyFontColorFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyFontColorFilter/ApplyFontColorFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyFontColorFilter * @param ApplyFontColorFilterPostRequestBody $body The request body * @param ApplyFontColorFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyFontColorFilterPostRequestBody $body, ?ApplyFontColorFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyFontColorFilterPostRequestBody $bo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyIconFilter/ApplyIconFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyIconFilter/ApplyIconFilterRequestBuilder.php index 1b55042e071..1f5e5bd8054 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyIconFilter/ApplyIconFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyIconFilter/ApplyIconFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyIconFilter * @param ApplyIconFilterPostRequestBody $body The request body * @param ApplyIconFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyIconFilterPostRequestBody $body, ?ApplyIconFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyIconFilterPostRequestBody $body, ? $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyTopItemsFilter/ApplyTopItemsFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyTopItemsFilter/ApplyTopItemsFilterRequestBuilder.php index 6df87688d06..9ab7c51aabb 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyTopItemsFilter/ApplyTopItemsFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyTopItemsFilter/ApplyTopItemsFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyTopItemsFilter * @param ApplyTopItemsFilterPostRequestBody $body The request body * @param ApplyTopItemsFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyTopItemsFilterPostRequestBody $body, ?ApplyTopItemsFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyTopItemsFilterPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyTopPercentFilter/ApplyTopPercentFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyTopPercentFilter/ApplyTopPercentFilterRequestBuilder.php index 6cbf80ee560..4a5a5eaf0bb 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyTopPercentFilter/ApplyTopPercentFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyTopPercentFilter/ApplyTopPercentFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyTopPercentFilter * @param ApplyTopPercentFilterPostRequestBody $body The request body * @param ApplyTopPercentFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyTopPercentFilterPostRequestBody $body, ?ApplyTopPercentFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyTopPercentFilterPostRequestBody $b $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyValuesFilter/ApplyValuesFilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyValuesFilter/ApplyValuesFilterRequestBuilder.php index b7d972785ab..4b61e69a573 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyValuesFilter/ApplyValuesFilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/ApplyValuesFilter/ApplyValuesFilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyValuesFilter * @param ApplyValuesFilterPostRequestBody $body The request body * @param ApplyValuesFilterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyValuesFilterPostRequestBody $body, ?ApplyValuesFilterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyValuesFilterPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/Clear/ClearRequestBuilder.php index 7410874b41c..23055f77b63 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the filter on the given column. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/filter-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/FilterRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/FilterRequestBuilder.php index b64b426b320..f281c11cfa0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/FilterRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Filter/FilterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Columns\Item\Filter\Apply\ApplyRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Columns\Item\Filter\ApplyBottomItemsFilter\ApplyBottomItemsFilterRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Columns\Item\Filter\ApplyBottomPercentFilter\ApplyBottomPercentFilterRequestBuilder; @@ -130,56 +129,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property filter for drives * @param FilterRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FilterRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the filter applied to the column. Read-only. * @param FilterRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFilter::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFilter::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property filter in drives * @param WorkbookFilter $body The request body * @param FilterRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookFilter $body, ?FilterRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFilter::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookFilter::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -196,6 +186,7 @@ public function toDeleteRequestInformation(?FilterRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -209,7 +200,6 @@ public function toGetRequestInformation(?FilterRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -217,6 +207,7 @@ public function toGetRequestInformation(?FilterRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -231,11 +222,11 @@ public function toPatchRequestInformation(WorkbookFilter $body, ?FilterRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php index 4920ff320c0..6f18307ac03 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with the header row of the column. This API is available in the following national cloud deployments. * @param HeaderRowRangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-headerrowrange?view=graph-rest-1.0 Find more info here */ public function get(?HeaderRowRangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?HeaderRowRangeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Range/RangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Range/RangeRequestBuilder.php index c77865ba873..ec718fc22b8 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Range/RangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/Range/RangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with the entire column. This API is available in the following national cloud deployments. * @param RangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-range?view=graph-rest-1.0 Find more info here */ public function get(?RangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?RangeRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/TotalRowRange/TotalRowRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/TotalRowRange/TotalRowRangeRequestBuilder.php index c0b84d48ab6..bd27b5db1d6 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/TotalRowRange/TotalRowRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/TotalRowRange/TotalRowRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with the totals row of the column. This API is available in the following national cloud deployments. * @param TotalRowRangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-totalrowrange?view=graph-rest-1.0 Find more info here */ public function get(?TotalRowRangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?TotalRowRangeRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/WorkbookTableColumnItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/WorkbookTableColumnItemRequestBuilder.php index f5e3cd405dc..3a58b3b6219 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/WorkbookTableColumnItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/Item/WorkbookTableColumnItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Columns\Item\DataBodyRange\DataBodyRangeRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Columns\Item\Filter\FilterRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Columns\Item\HeaderRowRange\HeaderRowRangeRequestBuilder; @@ -74,59 +73,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes the column from the table. This API is available in the following national cloud deployments. * @param WorkbookTableColumnItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WorkbookTableColumnItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of tablecolumn object. This API is available in the following national cloud deployments. * @param WorkbookTableColumnItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkbookTableColumnItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of tablecolumn object. This API is available in the following national cloud deployments. * @param WorkbookTableColumn $body The request body * @param WorkbookTableColumnItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablecolumn-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookTableColumn $body, ?WorkbookTableColumnItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -143,6 +133,7 @@ public function toDeleteRequestInformation(?WorkbookTableColumnItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -156,7 +147,6 @@ public function toGetRequestInformation(?WorkbookTableColumnItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -164,6 +154,7 @@ public function toGetRequestInformation(?WorkbookTableColumnItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -178,11 +169,11 @@ public function toPatchRequestInformation(WorkbookTableColumn $body, ?WorkbookTa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php index a759fa01c8d..cc4a813d2f0 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Columns/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTableColumn; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function itemAt * @param ItemAtWithIndexRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemAtWithIndexRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableColumn::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?ItemAtWithIndexRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/ConvertToRange/ConvertToRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/ConvertToRange/ConvertToRangeRequestBuilder.php index 54dd8ddbe7f..2ac3010fb7f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/ConvertToRange/ConvertToRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/ConvertToRange/ConvertToRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Converts the table into a normal range of cells. All data is preserved. This API is available in the following national cloud deployments. * @param ConvertToRangeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-converttorange?view=graph-rest-1.0 Find more info here */ public function post(?ConvertToRangeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ConvertToRangeRequestBuilderPostReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/DataBodyRange/DataBodyRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/DataBodyRange/DataBodyRangeRequestBuilder.php index f68f1aebe0a..ebc2c512d76 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/DataBodyRange/DataBodyRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/DataBodyRange/DataBodyRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with the data body of the table. This API is available in the following national cloud deployments. * @param DataBodyRangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-databodyrange?view=graph-rest-1.0 Find more info here */ public function get(?DataBodyRangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?DataBodyRangeRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php index 2f44290e766..8eddea39f88 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/HeaderRowRange/HeaderRowRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with header row of the table. This API is available in the following national cloud deployments. * @param HeaderRowRangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-headerrowrange?view=graph-rest-1.0 Find more info here */ public function get(?HeaderRowRangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?HeaderRowRangeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Range/RangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Range/RangeRequestBuilder.php index aab09bd8af1..5c884a43a7e 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Range/RangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Range/RangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the range object associated with the entire table. This API is available in the following national cloud deployments. * @param RangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-range?view=graph-rest-1.0 Find more info here */ public function get(?RangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?RangeRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/ReapplyFilters/ReapplyFiltersRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/ReapplyFilters/ReapplyFiltersRequestBuilder.php index ca884aae334..ad256dcf723 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/ReapplyFilters/ReapplyFiltersRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/ReapplyFilters/ReapplyFiltersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reapplies all the filters currently on the table. This API is available in the following national cloud deployments. * @param ReapplyFiltersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-reapplyfilters?view=graph-rest-1.0 Find more info here */ public function post(?ReapplyFiltersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ReapplyFiltersRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Add/AddRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Add/AddRequestBuilder.php index 39ac916e1b0..e246ed5ab5c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Add/AddRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTableRow; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Adds rows to the end of the table. Note that the API can accept multiple rows data using this API. Adding one row at a time could lead to performance degradation. The recommended approach would be to batch the rows together in a single call rather than doing single row insertion. For best results, collect the rows to be inserted on the application side and perform single rows add operation. Experiment with the number of rows to determine the ideal number of rows to use in single API call. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablerowcollection-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Count/CountRequestBuilder.php index 3096fa56437..92e1285cf37 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function count * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CountGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Item/Range/RangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Item/Range/RangeRequestBuilder.php index 002ee758b60..a2af871602f 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Item/Range/RangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Item/Range/RangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function range * @param RangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?RangeRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Item/WorkbookTableRowItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Item/WorkbookTableRowItemRequestBuilder.php index 0bef5c931a0..05ec6874004 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Item/WorkbookTableRowItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/Item/WorkbookTableRowItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Rows\Item\Range\RangeRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTableRow; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes the row from the table. This API is available in the following national cloud deployments. * @param WorkbookTableRowItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablerow-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WorkbookTableRowItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of tablerow object. This API is available in the following national cloud deployments. * @param WorkbookTableRowItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablerow-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkbookTableRowItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of tablerow object. This API is available in the following national cloud deployments. * @param WorkbookTableRow $body The request body * @param WorkbookTableRowItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablerow-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookTableRow $body, ?WorkbookTableRowItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?WorkbookTableRowItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?WorkbookTableRowItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?WorkbookTableRowItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(WorkbookTableRow $body, ?WorkbookTable $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php index beb4a607b8e..432b78abe15 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTableRow; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function itemAt * @param ItemAtWithIndexRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemAtWithIndexRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?ItemAtWithIndexRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/RowsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/RowsRequestBuilder.php index f0e11a45aac..52c5aa054c4 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/RowsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Rows/RowsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Rows\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Rows\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Rows\Item\WorkbookTableRowItemRequestBuilder; @@ -64,20 +63,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of tablerow objects. This API is available in the following national cloud deployments. * @param RowsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/table-list-rows?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/tablerow-list?view=graph-rest-1.0 Find more info here */ public function get(?RowsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRowCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRowCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,20 +89,17 @@ public function itemAtWithIndex(int $index): ItemAtWithIndexRequestBuilder { * Adds rows to the end of a table. Note that this API can accept multiple rows of data. Adding one row at a time can affect performance. The recommended approach is to batch the rows together in a single call rather than inserting single rows. For best results, collect the rows to be inserted on the application side and perform a single row add operation. Experiment with the number of rows to determine the ideal number of rows to use in a single API call. This request might occasionally result in a 504 HTTP error. The appropriate response to this error is to repeat the request. This API is available in the following national cloud deployments. * @param WorkbookTableRow $body The request body * @param RowsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-post-rows?view=graph-rest-1.0 Find more info here */ public function post(WorkbookTableRow $body, ?RowsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableRow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,7 +112,6 @@ public function toGetRequestInformation(?RowsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -127,6 +119,7 @@ public function toGetRequestInformation(?RowsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -141,11 +134,11 @@ public function toPostRequestInformation(WorkbookTableRow $body, ?RowsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/Apply/ApplyRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/Apply/ApplyRequestBuilder.php index f7cf1812569..f4752fe3782 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/Apply/ApplyRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/Apply/ApplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Perform a sort operation. This API is available in the following national cloud deployments. * @param ApplyPostRequestBody $body The request body * @param ApplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablesort-apply?view=graph-rest-1.0 Find more info here */ public function post(ApplyPostRequestBody $body, ?ApplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ApplyPostRequestBody $body, ?ApplyReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/Clear/ClearRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/Clear/ClearRequestBuilder.php index 488183e9f71..b476885d9bb 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/Clear/ClearRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/Clear/ClearRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clears the sorting that is currently on the table. While this doesn't modify the table's ordering, it clears the state of the header buttons. This API is available in the following national cloud deployments. * @param ClearRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablesort-clear?view=graph-rest-1.0 Find more info here */ public function post(?ClearRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/Reapply/ReapplyRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/Reapply/ReapplyRequestBuilder.php index 5b8fcf54269..acab8322dd7 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/Reapply/ReapplyRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/Reapply/ReapplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reapplies the current sorting parameters to the table. This API is available in the following national cloud deployments. * @param ReapplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablesort-reapply?view=graph-rest-1.0 Find more info here */ public function post(?ReapplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ReapplyRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/SortRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/SortRequestBuilder.php index a465100dc28..6813d00a7ba 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/SortRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Sort/SortRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Sort\Apply\ApplyRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Sort\Clear\ClearRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Sort\Reapply\ReapplyRequestBuilder; @@ -58,57 +57,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sort for drives * @param SortRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SortRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of tablesort object. This API is available in the following national cloud deployments. * @param SortRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tablesort-get?view=graph-rest-1.0 Find more info here */ public function get(?SortRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableSort::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableSort::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sort in drives * @param WorkbookTableSort $body The request body * @param SortRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookTableSort $body, ?SortRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableSort::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableSort::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -125,6 +115,7 @@ public function toDeleteRequestInformation(?SortRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -138,7 +129,6 @@ public function toGetRequestInformation(?SortRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -146,6 +136,7 @@ public function toGetRequestInformation(?SortRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -160,11 +151,11 @@ public function toPatchRequestInformation(WorkbookTableSort $body, ?SortRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/TotalRowRange/TotalRowRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/TotalRowRange/TotalRowRangeRequestBuilder.php index f0a328d16fa..6ce419d623c 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/TotalRowRange/TotalRowRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/TotalRowRange/TotalRowRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets the range object associated with totals row of the table. This API is available in the following national cloud deployments. * @param TotalRowRangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/table-totalrowrange?view=graph-rest-1.0 Find more info here */ public function get(?TotalRowRangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toGetRequestInformation(?TotalRowRangeRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/WorkbookTableItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/WorkbookTableItemRequestBuilder.php index fa1a8c6ce30..39c433eb3bd 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/WorkbookTableItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/WorkbookTableItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\ClearFilters\ClearFiltersRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\Columns\ColumnsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\ConvertToRange\ConvertToRangeRequestBuilder; @@ -122,56 +121,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tables for drives * @param WorkbookTableItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WorkbookTableItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Collection of tables that are part of the worksheet. Read-only. * @param WorkbookTableItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WorkbookTableItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tables in drives * @param WorkbookTable $body The request body * @param WorkbookTableItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WorkbookTable $body, ?WorkbookTableItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -188,6 +178,7 @@ public function toDeleteRequestInformation(?WorkbookTableItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -201,7 +192,6 @@ public function toGetRequestInformation(?WorkbookTableItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -209,6 +199,7 @@ public function toGetRequestInformation(?WorkbookTableItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -223,11 +214,11 @@ public function toPatchRequestInformation(WorkbookTable $body, ?WorkbookTableIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Worksheet/WorksheetRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Worksheet/WorksheetRequestBuilder.php index dc1682291f4..c7d4786c913 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Worksheet/WorksheetRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/Item/Worksheet/WorksheetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookWorksheet; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The worksheet containing the current table. Read-only. * @param WorksheetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WorksheetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?WorksheetRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?WorksheetRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php index a44f2411f34..b9863841497 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/ItemAtWithIndex/ItemAtWithIndexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookTable; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function itemAt * @param ItemAtWithIndexRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemAtWithIndexRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?ItemAtWithIndexRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/TablesRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/TablesRequestBuilder.php index fbc15d76341..1873fd75721 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/TablesRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/Tables/TablesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Tables\Item\WorkbookTableItemRequestBuilder; @@ -64,20 +63,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of table objects. This API is available in the following national cloud deployments. * @param TablesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/worksheet-list-tables?view=graph-rest-1.0 Find more info here */ public function get(?TablesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTableCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,19 +89,16 @@ public function itemAtWithIndex(int $index): ItemAtWithIndexRequestBuilder { * Create new navigation property to tables for drives * @param WorkbookTable $body The request body * @param TablesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WorkbookTable $body, ?TablesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookTable::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,7 +111,6 @@ public function toGetRequestInformation(?TablesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -126,6 +118,7 @@ public function toGetRequestInformation(?TablesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -140,11 +133,11 @@ public function toPostRequestInformation(WorkbookTable $body, ?TablesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/UsedRange/UsedRangeRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/UsedRange/UsedRangeRequestBuilder.php index d6f6b81adaf..c967ed425f4 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/UsedRange/UsedRangeRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/UsedRange/UsedRangeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function usedRange * @param UsedRangeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UsedRangeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?UsedRangeRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/UsedRangeWithValuesOnly/UsedRangeWithValuesOnlyRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/UsedRangeWithValuesOnly/UsedRangeWithValuesOnlyRequestBuilder.php index 314b1f9b86e..6d7364af123 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/UsedRangeWithValuesOnly/UsedRangeWithValuesOnlyRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/UsedRangeWithValuesOnly/UsedRangeWithValuesOnlyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkbookRange; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function usedRange * @param UsedRangeWithValuesOnlyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UsedRangeWithValuesOnlyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookRange::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?UsedRangeWithValuesOnlyRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/WorkbookWorksheetItemRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/WorkbookWorksheetItemRequestBuilder.php index 30d7f6c8150..427b9a05333 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/WorkbookWorksheetItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/Item/WorkbookWorksheetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\CellWithRowWithColumn\CellWithRowWithColumnRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Charts\ChartsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\Names\NamesRequestBuilder; @@ -103,59 +102,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes the worksheet from the workbook. This API is available in the following national cloud deployments. * @param WorkbookWorksheetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/worksheet-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WorkbookWorksheetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of worksheet object. This API is available in the following national cloud deployments. * @param WorkbookWorksheetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/worksheet-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkbookWorksheetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of worksheet object. This API is available in the following national cloud deployments. * @param WorkbookWorksheet $body The request body * @param WorkbookWorksheetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/worksheet-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkbookWorksheet $body, ?WorkbookWorksheetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -181,6 +171,7 @@ public function toDeleteRequestInformation(?WorkbookWorksheetItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -194,7 +185,6 @@ public function toGetRequestInformation(?WorkbookWorksheetItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -202,6 +192,7 @@ public function toGetRequestInformation(?WorkbookWorksheetItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -216,11 +207,11 @@ public function toPatchRequestInformation(WorkbookWorksheet $body, ?WorkbookWork $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/WorksheetsRequestBuilder.php b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/WorksheetsRequestBuilder.php index effb739245c..fe0d8e05166 100644 --- a/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/WorksheetsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/Item/Workbook/Worksheets/WorksheetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\Workbook\Worksheets\Item\WorkbookWorksheetItemRequestBuilder; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of worksheet objects. This API is available in the following national cloud deployments. * @param WorksheetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/worksheet-list?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/workbook-list-worksheets?view=graph-rest-1.0 Find more info here */ public function get(?WorksheetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to worksheets for drives * @param WorkbookWorksheet $body The request body * @param WorksheetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WorkbookWorksheet $body, ?WorksheetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkbookWorksheet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?WorksheetsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?WorksheetsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(WorkbookWorksheet $body, ?WorksheetsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Items/ItemsRequestBuilder.php b/src/Generated/Drives/Item/Items/ItemsRequestBuilder.php index d8c30cdd100..4064e9559e4 100644 --- a/src/Generated/Drives/Item/Items/ItemsRequestBuilder.php +++ b/src/Generated/Drives/Item/Items/ItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Items\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Items\Item\DriveItemItemRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * All items contained in the drive. Read-only. Nullable. * @param ItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to items for drives * @param DriveItem $body The request body * @param ItemsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DriveItem $body, ?ItemsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DriveItem $body, ?ItemsRequestBuilderPo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php b/src/Generated/Drives/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php index cd4a01417c2..ca8941568be 100644 --- a/src/Generated/Drives/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php +++ b/src/Generated/Drives/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\LastModifiedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\LastModifiedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who last modified the item. Read-only. * @param LastModifiedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Drives/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 8bc78fc4ba5..250ae4c8283 100644 --- a/src/Generated/Drives/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Drives/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Drives/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 34903d96fdf..f2919e8f2b7 100644 --- a/src/Generated/Drives/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Drives/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 6c4bb3d8a8b..252e1538a1f 100644 --- a/src/Generated/Drives/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Drives/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\LastModifiedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Recent/RecentRequestBuilder.php b/src/Generated/Drives/Item/Recent/RecentRequestBuilder.php index 65843df3d15..4e67bc03ab7 100644 --- a/src/Generated/Drives/Item/Recent/RecentRequestBuilder.php +++ b/src/Generated/Drives/Item/Recent/RecentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function recent * @param RecentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RecentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RecentGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RecentGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?RecentRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?RecentRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Root/Content/ContentRequestBuilder.php b/src/Generated/Drives/Item/Root/Content/ContentRequestBuilder.php index 5b961618111..5a56a4dcb9b 100644 --- a/src/Generated/Drives/Item/Root/Content/ContentRequestBuilder.php +++ b/src/Generated/Drives/Item/Root/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-get?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Root/RootRequestBuilder.php b/src/Generated/Drives/Item/Root/RootRequestBuilder.php index c0ad9b21eba..6dd96d9dc73 100644 --- a/src/Generated/Drives/Item/Root/RootRequestBuilder.php +++ b/src/Generated/Drives/Item/Root/RootRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Root\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,20 +41,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the metadata for a driveItem in a drive by file system path or ID.item-id is the ID of a driveItem. It may also be the unique ID of a SharePoint list item. This API is available in the following national cloud deployments. * @param RootRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/driveitem-get?view=graph-rest-1.0 Find more info here */ public function get(?RootRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -68,7 +64,6 @@ public function toGetRequestInformation(?RootRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -76,6 +71,7 @@ public function toGetRequestInformation(?RootRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/SearchWithQ/SearchWithQRequestBuilder.php b/src/Generated/Drives/Item/SearchWithQ/SearchWithQRequestBuilder.php index 14d9936d289..c5a1b763198 100644 --- a/src/Generated/Drives/Item/SearchWithQ/SearchWithQRequestBuilder.php +++ b/src/Generated/Drives/Item/SearchWithQ/SearchWithQRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function search * @param SearchWithQRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SearchWithQRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SearchWithQGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SearchWithQGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?SearchWithQRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?SearchWithQRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/SharedWithMe/SharedWithMeRequestBuilder.php b/src/Generated/Drives/Item/SharedWithMe/SharedWithMeRequestBuilder.php index 3c02eab6940..b39ce83d2e9 100644 --- a/src/Generated/Drives/Item/SharedWithMe/SharedWithMeRequestBuilder.php +++ b/src/Generated/Drives/Item/SharedWithMe/SharedWithMeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function sharedWithMe * @param SharedWithMeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SharedWithMeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithMeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithMeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?SharedWithMeRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?SharedWithMeRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Special/Count/CountRequestBuilder.php b/src/Generated/Drives/Item/Special/Count/CountRequestBuilder.php index 35a87700396..15ecd93d83a 100644 --- a/src/Generated/Drives/Item/Special/Count/CountRequestBuilder.php +++ b/src/Generated/Drives/Item/Special/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Special/Item/Content/ContentRequestBuilder.php b/src/Generated/Drives/Item/Special/Item/Content/ContentRequestBuilder.php index 959044492b8..bb4050e67bd 100644 --- a/src/Generated/Drives/Item/Special/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Drives/Item/Special/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Special/Item/DriveItemItemRequestBuilder.php b/src/Generated/Drives/Item/Special/Item/DriveItemItemRequestBuilder.php index f3323720399..3a3e1485707 100644 --- a/src/Generated/Drives/Item/Special/Item/DriveItemItemRequestBuilder.php +++ b/src/Generated/Drives/Item/Special/Item/DriveItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Special\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,20 +41,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Use the special collection to access a special folder by name. Special folders provide simple aliases to access well-known folders in OneDrive without the need to look up the folder by path (which would require localization), or reference the folder with an ID. If a special folder is renamed or moved to another location within the drive, this syntax will continue to find that folder. Special folders are automatically created the first time an application attempts to write to one, if it doesn't already exist. If a user deletes one, it is recreated when written to again. This API is available in the following national cloud deployments. * @param DriveItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/drive-get-specialfolder?view=graph-rest-1.0 Find more info here */ public function get(?DriveItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -68,7 +64,6 @@ public function toGetRequestInformation(?DriveItemItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -76,6 +71,7 @@ public function toGetRequestInformation(?DriveItemItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Drives/Item/Special/SpecialRequestBuilder.php b/src/Generated/Drives/Item/Special/SpecialRequestBuilder.php index 7c78739fcc9..1c78ef552d7 100644 --- a/src/Generated/Drives/Item/Special/SpecialRequestBuilder.php +++ b/src/Generated/Drives/Item/Special/SpecialRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Drives\Item\Special\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Drives\Item\Special\Item\DriveItemItemRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItemCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Use the special collection to access a special folder by name. Special folders provide simple aliases to access well-known folders in OneDrive without the need to look up the folder by path (which would require localization), or reference the folder with an ID. If a special folder is renamed or moved to another location within the drive, this syntax will continue to find that folder. Special folders are automatically created the first time an application attempts to write to one, if it doesn't already exist. If a user deletes one, it is recreated when written to again. This API is available in the following national cloud deployments. * @param SpecialRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SpecialRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?SpecialRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?SpecialRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/ClassesRequestBuilder.php b/src/Generated/Education/Classes/ClassesRequestBuilder.php index 91f6f83796b..affeaf3a4d9 100644 --- a/src/Generated/Education/Classes/ClassesRequestBuilder.php +++ b/src/Generated/Education/Classes/ClassesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\EducationClassItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the educationClass objects and their properties. This API is available in the following national cloud deployments. * @param ClassesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-list?view=graph-rest-1.0 Find more info here */ public function get(?ClassesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationClassCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationClassCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new educationClass object. This API is available in the following national cloud deployments. * @param EducationClass $body The request body * @param ClassesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-post?view=graph-rest-1.0 Find more info here */ public function post(EducationClass $body, ?ClassesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ClassesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ClassesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(EducationClass $body, ?ClassesRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Count/CountRequestBuilder.php b/src/Generated/Education/Classes/Count/CountRequestBuilder.php index 6995373357c..cde05b629a1 100644 --- a/src/Generated/Education/Classes/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Classes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Delta/DeltaRequestBuilder.php b/src/Generated/Education/Classes/Delta/DeltaRequestBuilder.php index 3b499779a6d..67afd130d7a 100644 --- a/src/Generated/Education/Classes/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Education/Classes/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/AssignmentCategories/AssignmentCategoriesRequestBuilder.php b/src/Generated/Education/Classes/Item/AssignmentCategories/AssignmentCategoriesRequestBuilder.php index 47a3e1d23a1..78bf5ed2ee7 100644 --- a/src/Generated/Education/Classes/Item/AssignmentCategories/AssignmentCategoriesRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/AssignmentCategories/AssignmentCategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\AssignmentCategories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\AssignmentCategories\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\AssignmentCategories\Item\EducationCategoryItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of educationCategory objects. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param AssignmentCategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-list-categories?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentCategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new educationCategory on an educationClass. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param EducationCategory $body The request body * @param AssignmentCategoriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-post-category?view=graph-rest-1.0 Find more info here */ public function post(EducationCategory $body, ?AssignmentCategoriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AssignmentCategoriesRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AssignmentCategoriesRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(EducationCategory $body, ?AssignmentCat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/AssignmentCategories/Count/CountRequestBuilder.php b/src/Generated/Education/Classes/Item/AssignmentCategories/Count/CountRequestBuilder.php index cde2596d201..7a3fc2ad663 100644 --- a/src/Generated/Education/Classes/Item/AssignmentCategories/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/AssignmentCategories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/AssignmentCategories/Delta/DeltaRequestBuilder.php b/src/Generated/Education/Classes/Item/AssignmentCategories/Delta/DeltaRequestBuilder.php index 160be278749..99e7818e83e 100644 --- a/src/Generated/Education/Classes/Item/AssignmentCategories/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/AssignmentCategories/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/AssignmentCategories/Item/EducationCategoryItemRequestBuilder.php b/src/Generated/Education/Classes/Item/AssignmentCategories/Item/EducationCategoryItemRequestBuilder.php index 3aeaddc9968..41ab6c0fb4a 100644 --- a/src/Generated/Education/Classes/Item/AssignmentCategories/Item/EducationCategoryItemRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/AssignmentCategories/Item/EducationCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an existing category. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param EducationCategoryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationcategory-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationCategoryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve an educationCategory object. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param EducationCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationcategory-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignmentCategories in education * @param EducationCategory $body The request body * @param EducationCategoryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationCategory $body, ?EducationCategoryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?EducationCategoryItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?EducationCategoryItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?EducationCategoryItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(EducationCategory $body, ?EducationCat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/AssignmentDefaults/AssignmentDefaultsRequestBuilder.php b/src/Generated/Education/Classes/Item/AssignmentDefaults/AssignmentDefaultsRequestBuilder.php index 4664613c701..833e4eb980b 100644 --- a/src/Generated/Education/Classes/Item/AssignmentDefaults/AssignmentDefaultsRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/AssignmentDefaults/AssignmentDefaultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignmentDefaults; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignmentDefaults for education * @param AssignmentDefaultsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AssignmentDefaultsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an educationAssignmentDefaults object. These are the class-level assignment defaults respected by new assignments created in the class. Callers can continue to specify custom values on each assignment creation if they don't want the default behaviors. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param AssignmentDefaultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignmentdefaults-get?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentDefaultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentDefaults::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentDefaults::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an educationAssignmentDefaults object. Only teachers can update these settings. This API is available in the following national cloud deployments. * @param EducationAssignmentDefaults $body The request body * @param AssignmentDefaultsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignmentdefaults-update?view=graph-rest-1.0 Find more info here */ public function patch(EducationAssignmentDefaults $body, ?AssignmentDefaultsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentDefaults::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentDefaults::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AssignmentDefaultsRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AssignmentDefaultsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AssignmentDefaultsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(EducationAssignmentDefaults $body, ?As $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/AssignmentSettings/AssignmentSettingsRequestBuilder.php b/src/Generated/Education/Classes/Item/AssignmentSettings/AssignmentSettingsRequestBuilder.php index 0cc57398e1d..1b1ed81b61b 100644 --- a/src/Generated/Education/Classes/Item/AssignmentSettings/AssignmentSettingsRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/AssignmentSettings/AssignmentSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignmentSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignmentSettings for education * @param AssignmentSettingsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AssignmentSettingsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Specifies class-level assignments settings. * @param AssignmentSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AssignmentSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an educationAssignmentSettings object. Only teachers can update these settings. This API is available in the following national cloud deployments. * @param EducationAssignmentSettings $body The request body * @param AssignmentSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignmentsettings-update?view=graph-rest-1.0 Find more info here */ public function patch(EducationAssignmentSettings $body, ?AssignmentSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?AssignmentSettingsRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?AssignmentSettingsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?AssignmentSettingsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(EducationAssignmentSettings $body, ?As $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/AssignmentsRequestBuilder.php index 2f680f6e114..fb0b4bf523d 100644 --- a/src/Generated/Education/Classes/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\EducationAssignmentItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of assignment objects. Only teachers, students, and applications with application permissions can perform this operation. A teacher or an application executing with application permissions can see all assignment objects for the class. Students can only see assignments that are assigned to them. This API is available in the following national cloud deployments. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-list-assignments?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new assignment. Only teachers in a class can create an assignment. Assignments start in the Draft state, which means that students will not see the assignment until publication. This API is available in the following national cloud deployments. * @param EducationAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-post-assignment?view=graph-rest-1.0 Find more info here */ public function post(EducationAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(EducationAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Count/CountRequestBuilder.php index ac8795ad742..47354f11599 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Delta/DeltaRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Delta/DeltaRequestBuilder.php index 0c3d8d8fc1c..c23bc6b722c 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Categories/CategoriesRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Categories/CategoriesRequestBuilder.php index 5c48b747506..e5d177632c1 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Categories\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Categories\Item\EducationCategoryItemRequestBuilder; @@ -71,40 +70,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the categories associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-list-categories?view=graph-rest-1.0 Find more info here */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add one or more existing educationCategory objects to the specified educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param EducationCategory $body The request body * @param CategoriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-post-categories?view=graph-rest-1.0 Find more info here */ public function post(EducationCategory $body, ?CategoriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,7 +110,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -125,6 +117,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -139,11 +132,11 @@ public function toPostRequestInformation(EducationCategory $body, ?CategoriesReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Count/CountRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Count/CountRequestBuilder.php index 1bd173f06a0..6e23c1f79a8 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Delta/DeltaRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Delta/DeltaRequestBuilder.php index 810d4d2d555..a0ebbee6b81 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Item/Ref/RefRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Item/Ref/RefRequestBuilder.php index a39cb626000..6a5dc441cb2 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an educationCategory from an educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-remove-category?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Ref/RefRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Ref/RefRequestBuilder.php index 2f634dd6c2a..84452492ca9 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Categories/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the categories associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-list-categories?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add one or more existing educationCategory objects to the specified educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-post-categories?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/EducationAssignmentItemRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/EducationAssignmentItemRequestBuilder.php index 8c0aa9b27ea..a8892f65d95 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/EducationAssignmentItemRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/EducationAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Publish\PublishRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Resources\ResourcesRequestBuilder; @@ -90,59 +89,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an existing assignment. Only teachers within a class can delete assignments. This API is available in the following national cloud deployments. * @param EducationAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of an assignment. Only teachers, students, and applications with application permissions can perform this operation. Students can only see assignments assigned to them; teachers and applications with application permissions can see all assignments in a class. This API is available in the following national cloud deployments. * @param EducationAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an educationAssignment object. Only teachers can perform this action. Alternatively, request to change the status of an assignment with publish action. Don't use a PATCH operation for this purpose. This API is available in the following national cloud deployments. * @param EducationAssignment $body The request body * @param EducationAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(EducationAssignment $body, ?EducationAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -159,6 +149,7 @@ public function toDeleteRequestInformation(?EducationAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -172,7 +163,6 @@ public function toGetRequestInformation(?EducationAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -180,6 +170,7 @@ public function toGetRequestInformation(?EducationAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -194,11 +185,11 @@ public function toPatchRequestInformation(EducationAssignment $body, ?EducationA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Publish/PublishRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Publish/PublishRequestBuilder.php index 64031630cf8..cb3ea8f801c 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Publish/PublishRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Publish/PublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Publish an education assignment. Change the state of an educationAssignment from its original draft status to the published status. You can change the state from draft to scheduled if the assignment is scheduled for a future date. Only a teacher in the class can make this call. When an assignment is in draft status, students will not see the assignment, nor will there be any submission objects. Calling this API creates educationSubmission objects and displays the assignment in each student's list. The state of the assignment goes back to draft if there is any backend failure during publish process. To update the properties of a published assignment, see update an assignment. This API is available in the following national cloud deployments. * @param PublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-publish?view=graph-rest-1.0 Find more info here */ public function post(?PublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?PublishRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Resources/Count/CountRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Resources/Count/CountRequestBuilder.php index 2eca845b481..5d9c58859c3 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Resources/Item/EducationAssignmentResourceItemRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Resources/Item/EducationAssignmentResourceItemRequestBuilder.php index 6ff492745d8..f60da8ba56b 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Resources/Item/EducationAssignmentResourceItemRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Resources/Item/EducationAssignmentResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignmentResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a specific educationAssignmentResource attached to an assignment. In general, only teachers in the class can remove a resource. However, teachers can't remove resources marked as 'distributeToStudents', after the assignment has been published to students. This API is available in the following national cloud deployments. * @param EducationAssignmentResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignmentresource-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationAssignmentResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties of an education assignment resource associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param EducationAssignmentResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignmentresource-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationAssignmentResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in education * @param EducationAssignmentResource $body The request body * @param EducationAssignmentResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationAssignmentResource $body, ?EducationAssignmentResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?EducationAssignmentResourceItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?EducationAssignmentResourceItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?EducationAssignmentResourceItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(EducationAssignmentResource $body, ?Ed $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Resources/ResourcesRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Resources/ResourcesRequestBuilder.php index 5fd0a9e0e4f..25cdea28ba0 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Resources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Resources\Item\EducationAssignmentResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationAssignmentResource; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get all the educationAssignmentResource objects associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-list-resources?view=graph-rest-1.0 Find more info here */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an assignment resource. Only teachers can perform this operation. You can create the following types of assignment resources: Every resource has an @odata.type property to indicate which type of resource is being created. This API is available in the following national cloud deployments. * @param EducationAssignmentResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-post-resource?view=graph-rest-1.0 Find more info here */ public function post(EducationAssignmentResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EducationAssignmentResource $body, ?Res $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Rubric/Ref/RefRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Rubric/Ref/RefRequestBuilder.php index bf76cd9b8ab..a45c7e61073 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Rubric/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Rubric/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceUpdate; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,52 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an educationRubric from an educationAssignment. This method doesn't delete the rubric itself and can only be performed by teachers. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-delete-rubric?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the educationRubric object attached to an educationAssignment, if one exists. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-get-rubric?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'string', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'string', $errorMappings); + return $result; } /** * Attach an existing educationRubric object to an educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param ReferenceUpdate $body The request body * @param RefRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-put-rubric?view=graph-rest-1.0 Find more info here */ public function put(ReferenceUpdate $body, ?RefRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -103,6 +95,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,11 +109,11 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -139,6 +132,7 @@ public function toPutRequestInformation(ReferenceUpdate $body, ?RefRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Rubric/RubricRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Rubric/RubricRequestBuilder.php index d22ff89e04a..dd062c5b300 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Rubric/RubricRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Rubric/RubricRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Rubric\Ref\RefRequestBuilder; use Microsoft\Graph\Generated\Models\EducationRubric; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an educationRubric from an educationAssignment. This method doesn't delete the rubric itself and can only be performed by teachers. This API is available in the following national cloud deployments. * @param RubricRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-delete-rubric?view=graph-rest-1.0 Find more info here */ public function delete(?RubricRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the educationRubric object attached to an educationAssignment, if one exists. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param RubricRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-get-rubric?view=graph-rest-1.0 Find more info here */ public function get(?RubricRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Attach an existing educationRubric object to an educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param EducationRubric $body The request body * @param RubricRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-put-rubric?view=graph-rest-1.0 Find more info here */ public function patch(EducationRubric $body, ?RubricRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?RubricRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?RubricRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?RubricRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(EducationRubric $body, ?RubricRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/SetUpFeedbackResourcesFolder/SetUpFeedbackResourcesFolderRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/SetUpFeedbackResourcesFolder/SetUpFeedbackResourcesFolderRequestBuilder.php index 905ca4c005c..7543fbeb187 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/SetUpFeedbackResourcesFolder/SetUpFeedbackResourcesFolderRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/SetUpFeedbackResourcesFolder/SetUpFeedbackResourcesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Create a SharePoint folder to upload feedback files for a given educationSubmission. Only teachers can perform this operation. The teacher determines the resources to upload in the feedback resources folder of a submission. This API is available in the following national cloud deployments. * @param SetUpFeedbackResourcesFolderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-setupfeedbackresourcesfolder?view=graph-rest-1.0 Find more info here */ public function post(?SetUpFeedbackResourcesFolderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?SetUpFeedbackResourcesFolderRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php index a5d9aaaf5d8..17b5a871fb9 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Create a SharePoint folder to upload files for a given educationAssignment. Only teachers can perform this operation. The teacher determines the resources to upload in the assignment's folder. This API is available in the following national cloud deployments. * @param SetUpResourcesFolderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-setupresourcesfolder?view=graph-rest-1.0 Find more info here */ public function post(?SetUpResourcesFolderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?SetUpResourcesFolderRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Count/CountRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Count/CountRequestBuilder.php index d3fce3f0ae0..9ab3ead49f7 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/EducationSubmissionItemRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/EducationSubmissionItemRequestBuilder.php index 133b1fd8e1f..0358a1a8716 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/EducationSubmissionItemRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/EducationSubmissionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Submissions\Item\EscapedReturn\ReturnRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Submissions\Item\Outcomes\OutcomesRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Submissions\Item\Reassign\ReassignRequestBuilder; @@ -98,57 +97,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property submissions for education * @param EducationSubmissionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EducationSubmissionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a particular submission. Only teachers, students, and applications with application permissions can perform this operation. A submission object represents a student's work for an assignment. Resources associated with the submission represent this work. Only the assignedTo student can see and modify the submission. A teacher or application with application permissions has full access to all submissions. The grade and feedback from a teacher are part of the educationOutcome associated with this object. Only teachers or applications with application permissions can add or change grades and feedback. Students will not see the grade or feedback until the assignment has been released. This API is available in the following national cloud deployments. * @param EducationSubmissionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationSubmissionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property submissions in education * @param EducationSubmission $body The request body * @param EducationSubmissionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationSubmission $body, ?EducationSubmissionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -165,6 +155,7 @@ public function toDeleteRequestInformation(?EducationSubmissionItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -178,7 +169,6 @@ public function toGetRequestInformation(?EducationSubmissionItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -186,6 +176,7 @@ public function toGetRequestInformation(?EducationSubmissionItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -200,11 +191,11 @@ public function toPatchRequestInformation(EducationSubmission $body, ?EducationS $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/EscapedReturn/ReturnRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/EscapedReturn/ReturnRequestBuilder.php index b32ed16d23d..7c91f0e3309 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/EscapedReturn/ReturnRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/EscapedReturn/ReturnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Make the grade and feedback associated with this submission available to the student. This action changes the status of the submission from 'submitted' to 'returned' and indicates that feedback is provided or grading is done. This action can only be done by the teacher. This API is available in the following national cloud deployments. * @param ReturnRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-return?view=graph-rest-1.0 Find more info here */ public function post(?ReturnRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ReturnRequestBuilderPostRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Outcomes/Count/CountRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Outcomes/Count/CountRequestBuilder.php index cc8300d46ff..c5727f26138 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Outcomes/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Outcomes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Outcomes/Item/EducationOutcomeItemRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Outcomes/Item/EducationOutcomeItemRequestBuilder.php index 4d51cd6fc4a..5ae8710691c 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Outcomes/Item/EducationOutcomeItemRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Outcomes/Item/EducationOutcomeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationOutcome; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a feedback resource from a submission. This can only be done by a teacher. This API is available in the following national cloud deployments. * @param EducationOutcomeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationfeedbackresourceoutcome-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationOutcomeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get outcomes from education * @param EducationOutcomeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EducationOutcomeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an educationOutcome object. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param EducationOutcome $body The request body * @param EducationOutcomeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationoutcome-update?view=graph-rest-1.0 Find more info here */ public function patch(EducationOutcome $body, ?EducationOutcomeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?EducationOutcomeItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?EducationOutcomeItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?EducationOutcomeItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(EducationOutcome $body, ?EducationOutc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Outcomes/OutcomesRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Outcomes/OutcomesRequestBuilder.php index c9687927ba1..c8379d40373 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Outcomes/OutcomesRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Outcomes/OutcomesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Submissions\Item\Outcomes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Submissions\Item\Outcomes\Item\EducationOutcomeItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationOutcome; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of educationOutcome objects. There are four types of outcomes: educationPointsOutcome, educationFeedbackOutcome, educationRubricOutcome, and educationFeedbackResourceOutcome. Only teachers, students, and applications with application permissions can perform this operation. A submission for a credit assignment (one that has no point value and no rubric) will have an educationFeedbackOutcome. (It might also return an educationPointsOutcome, but that outcome is ignored.) A submission for a points assignment (one that has a point value assigned) will have both an educationFeedbackOutcome and an educationPointsOutcome. A submission for an assignment with an attached rubric, if the rubric is a credit rubric (no points), will have an educationFeedbackOutcome and an educationRubricOutcome. (It might also return an educationPointsOutcome, but that outcome is ignored.) A submission for an assignment with an attached rubric, if the rubric is a points rubric, will have an educationFeedbackOutcome, an educationPointsOutcome, and an educationRubricOutcome. A submission for a feedback resource will have an educationFeedbackResourceOutcome. All outcome types have a regular and a published property appropriate to that type of outcome; for example, points and publishedPoints, feedback and publishedFeedback. The regular property is the most recent value updated by the teacher; the published property is the most recent value returned to the student. This API is available in the following national cloud deployments. * @param OutcomesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-list-outcomes?view=graph-rest-1.0 Find more info here */ public function get(?OutcomesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcomeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcomeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new feedback resource for a submission. Only a teacher can perform this operation. To create a new file-based resource, upload the file to the feedback resources folder associated with the assignment. If the file doesn't exist or isn't in that folder, the POST request will fail. This API is available in the following national cloud deployments. * @param EducationOutcome $body The request body * @param OutcomesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationfeedbackresourceoutcome-post-outcomes?view=graph-rest-1.0 Find more info here */ public function post(EducationOutcome $body, ?OutcomesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OutcomesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OutcomesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EducationOutcome $body, ?OutcomesReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Reassign/ReassignRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Reassign/ReassignRequestBuilder.php index c779b9b8295..503353f0dff 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Reassign/ReassignRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Reassign/ReassignRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reassign the submission to the student with feedback for review. Only teachers can perform this action. Include the Prefer: include-unknown-enum-members header when you call this method; otherwise, a reassigned submission will be treated as a returned submission. This means that the reassigned status will be mapped to the returned status, and reassignedDateTime and reassignedBy properties will be mapped to returnedDateTime and returnedBy respectively. If the header Prefer: include-unknown-enum-members is provided, a reassigned submission retains the reassigned status. For details, see the examples section. This API is available in the following national cloud deployments. * @param ReassignRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-reassign?view=graph-rest-1.0 Find more info here */ public function post(?ReassignRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ReassignRequestBuilderPostRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Resources/Count/CountRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Resources/Count/CountRequestBuilder.php index c24f358565f..bdc16c72c26 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Resources/Item/EducationSubmissionResourceItemRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Resources/Item/EducationSubmissionResourceItemRequestBuilder.php index 2f3dc1382e9..c30c2be125e 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Resources/Item/EducationSubmissionResourceItemRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Resources/Item/EducationSubmissionResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmissionResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an educationSubmissionResource from the submission. Only teachers and students can perform this operation. If the resource was copied from the assignment, a new copy of the resource will be created after the current copy is deleted. This allows you to 'reset' the resource to its original state. If the resource wasn't copied from the assignment but was added from the student, the resource is deleted. This API is available in the following national cloud deployments. * @param EducationSubmissionResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmissionresource-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationSubmissionResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of a specific resource associated with a submission. Only teachers, students, and applications with application permissions can perform this operation. This resource is in the 'working' resource list and should be considered work in process by a student. This resource is wrapped with a possible pointer back to the assignment resource if it was copied from the assignment. This API is available in the following national cloud deployments. * @param EducationSubmissionResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmissionresource-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationSubmissionResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in education * @param EducationSubmissionResource $body The request body * @param EducationSubmissionResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationSubmissionResource $body, ?EducationSubmissionResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?EducationSubmissionResourceItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?EducationSubmissionResourceItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?EducationSubmissionResourceItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(EducationSubmissionResource $body, ?Ed $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Resources/ResourcesRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Resources/ResourcesRequestBuilder.php index 279fea1c1ff..c68ca0e0c71 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Submissions\Item\Resources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Submissions\Item\Resources\Item\EducationSubmissionResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationSubmissionResource; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the resources associated with a submission. Only teachers, students, and applications with application permissions can perform this operation. The educationSubmissionResource object is a wrapper around the actual resource object the student is working on. The wrapper also includes a pointer to the resources on the assignment if this was copied from the assignment during the assign process. These resources are the working copy of the assignment. The submittedResources are the resources that have officially been submitted to be graded. This API is available in the following national cloud deployments. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-list-resources?view=graph-rest-1.0 Find more info here */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add an educationSubmissionResource to a submission resource list. Only teachers and students can perform this operation. The operation will not succeed if the allowStudentsToAddResources flag is not set to true. To create a new file-based resource, upload the file to the resources folder associated with the submission. If the file doesn't exist or is not in that folder, the POST request will fail. This API is available in the following national cloud deployments. * @param EducationSubmissionResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-post-resources?view=graph-rest-1.0 Find more info here */ public function post(EducationSubmissionResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EducationSubmissionResource $body, ?Res $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php index e0f1f8a5738..7a4e31a3a50 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Trigger the creation of the SharePoint resource folder where all file-based resources (Word, Excel, and so on) should be uploaded for a given submission. Only teachers and students can perform this operation. Note that files must be located in this folder in order to be added as resources. Only a student in the class can determine what files to upload in a given submission-level resource folder. This API is available in the following national cloud deployments. * @param SetUpResourcesFolderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-setupresourcesfolder?view=graph-rest-1.0 Find more info here */ public function post(?SetUpResourcesFolderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?SetUpResourcesFolderRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Submit/SubmitRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Submit/SubmitRequestBuilder.php index 9fb3cf6e674..c544ce7120c 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Submit/SubmitRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Submit/SubmitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Indicate that a student is done with the work and is ready to hand in the assignment. Only teachers, students, and applications with application permissions can perform this operation. This method changes the status of the submission from working to submitted. During the submit process, all the resources are copied to the submittedResources bucket. The teacher will be looking at the submitted resources list for grading. A teacher can also submit a student's assignment on their behalf. This API is available in the following national cloud deployments. * @param SubmitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-submit?view=graph-rest-1.0 Find more info here */ public function post(?SubmitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?SubmitRequestBuilderPostRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SubmittedResources/Count/CountRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SubmittedResources/Count/CountRequestBuilder.php index c68ee374ed6..2c4f51de620 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SubmittedResources/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SubmittedResources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SubmittedResources/Item/EducationSubmissionResourceItemRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SubmittedResources/Item/EducationSubmissionResourceItemRequestBuilder.php index 1689da2f1f9..ba665453dfe 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SubmittedResources/Item/EducationSubmissionResourceItemRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SubmittedResources/Item/EducationSubmissionResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmissionResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property submittedResources for education * @param EducationSubmissionResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EducationSubmissionResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a submitted resource. Only teachers, students, and applications with application permissions can perform this operation. Resources are available to a teacher or an application with application permissions after a student submits it, and are available to the student after the teacher returns the submission. Teachers can leave notes in some resources. This API is available in the following national cloud deployments. * @param EducationSubmissionResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmittedsubmissionresource-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationSubmissionResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property submittedResources in education * @param EducationSubmissionResource $body The request body * @param EducationSubmissionResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationSubmissionResource $body, ?EducationSubmissionResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?EducationSubmissionResourceItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?EducationSubmissionResourceItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?EducationSubmissionResourceItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(EducationSubmissionResource $body, ?Ed $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SubmittedResources/SubmittedResourcesRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SubmittedResources/SubmittedResourcesRequestBuilder.php index 7d3cda41afd..83f36c25e1b 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SubmittedResources/SubmittedResourcesRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/SubmittedResources/SubmittedResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Submissions\Item\SubmittedResources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Submissions\Item\SubmittedResources\Item\EducationSubmissionResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationSubmissionResource; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the educationSubmissionResource objects that have officially been submitted for grading. Only teachers, students, and applications with application permissions can perform this operation. The student who owns the submission cannot change the submitted list without resubmitting the assignment. This is a wrapper around the real resource and can contain a pointer back to the actual assignment resource if this resource was copied from the assignment. This API is available in the following national cloud deployments. * @param SubmittedResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-list-submittedresources?view=graph-rest-1.0 Find more info here */ public function get(?SubmittedResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to submittedResources for education * @param EducationSubmissionResource $body The request body * @param SubmittedResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EducationSubmissionResource $body, ?SubmittedResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SubmittedResourcesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SubmittedResourcesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(EducationSubmissionResource $body, ?Sub $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Unsubmit/UnsubmitRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Unsubmit/UnsubmitRequestBuilder.php index 06a2d032d27..ed6f81ef4c4 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Unsubmit/UnsubmitRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/Item/Unsubmit/UnsubmitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Indicate that a student wants to work on the submission of the assignment after it was turned in. Only teachers, students, and applications with application permissions can perform this operation. This method changes the status of the submission from submitted to working. During the submit process, all the resources are copied from submittedResources to workingResources. The teacher will be looking at the working resources list for grading. A teacher can also unsubmit a student's assignment on their behalf. This API is available in the following national cloud deployments. * @param UnsubmitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-unsubmit?view=graph-rest-1.0 Find more info here */ public function post(?UnsubmitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?UnsubmitRequestBuilderPostRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/SubmissionsRequestBuilder.php b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/SubmissionsRequestBuilder.php index 943832d9ab6..0bedfb37397 100644 --- a/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/SubmissionsRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Assignments/Item/Submissions/SubmissionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Submissions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\Item\Submissions\Item\EducationSubmissionItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationSubmission; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the submissions associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. A teacher or an application with application permissions can get all the submissions while a student can only get submissions that they are associated with. This API is available in the following national cloud deployments. * @param SubmissionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-list-submissions?view=graph-rest-1.0 Find more info here */ public function get(?SubmissionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to submissions for education * @param EducationSubmission $body The request body * @param SubmissionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EducationSubmission $body, ?SubmissionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SubmissionsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SubmissionsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(EducationSubmission $body, ?Submissions $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/EducationClassItemRequestBuilder.php b/src/Generated/Education/Classes/Item/EducationClassItemRequestBuilder.php index 38a19cc11df..433995a6e93 100644 --- a/src/Generated/Education/Classes/Item/EducationClassItemRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/EducationClassItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\AssignmentCategories\AssignmentCategoriesRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\AssignmentDefaults\AssignmentDefaultsRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Assignments\AssignmentsRequestBuilder; @@ -98,59 +97,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an educationClass. Because a class is also a universal group, deleting a class deletes the group. This API is available in the following national cloud deployments. * @param EducationClassItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationClassItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a class from the system. A class is a universal group with a special property that indicates to the system that the group is a class. Group members represent the students; group admins represent the teachers in the class. If you're using the delegated token, the user will only see classes in which they are members. This API is available in the following national cloud deployments. * @param EducationClassItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationClassItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an educationClass object. This API is available in the following national cloud deployments. * @param EducationClass $body The request body * @param EducationClassItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-update?view=graph-rest-1.0 Find more info here */ public function patch(EducationClass $body, ?EducationClassItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -167,6 +157,7 @@ public function toDeleteRequestInformation(?EducationClassItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -180,7 +171,6 @@ public function toGetRequestInformation(?EducationClassItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -188,6 +178,7 @@ public function toGetRequestInformation(?EducationClassItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -202,11 +193,11 @@ public function toPatchRequestInformation(EducationClass $body, ?EducationClassI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Group/GroupRequestBuilder.php b/src/Generated/Education/Classes/Item/Group/GroupRequestBuilder.php index e5f580c68b6..57e3fc16a92 100644 --- a/src/Generated/Education/Classes/Item/Group/GroupRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Group/GroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Group\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The underlying Microsoft 365 group object. * @param GroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Education/Classes/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 8f90e105c67..5135625ecb4 100644 --- a/src/Generated/Education/Classes/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Education/Classes/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 748df37cf90..269e41fb5dc 100644 --- a/src/Generated/Education/Classes/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Group\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Education/Classes/Item/Members/Count/CountRequestBuilder.php index b1d9ef2a0cb..55728955bd8 100644 --- a/src/Generated/Education/Classes/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Members/Item/Ref/RefRequestBuilder.php b/src/Generated/Education/Classes/Item/Members/Item/Ref/RefRequestBuilder.php index 67d3772af26..5e9b346df42 100644 --- a/src/Generated/Education/Classes/Item/Members/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Members/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an educationUser from an educationClass. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-delete-members?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Members/MembersRequestBuilder.php b/src/Generated/Education/Classes/Item/Members/MembersRequestBuilder.php index bb194be3465..4cb72f32142 100644 --- a/src/Generated/Education/Classes/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Members\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Members\Item\EducationUserItemRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Members\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieves the educationUser members of an educationClass. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Members/Ref/RefRequestBuilder.php b/src/Generated/Education/Classes/Item/Members/Ref/RefRequestBuilder.php index 9ae5297f06e..5a24cbf804d 100644 --- a/src/Generated/Education/Classes/Item/Members/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Members/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieves the educationUser members of an educationClass. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-list-members?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add an educationUser member to an educationClass. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-post-members?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Schools/Count/CountRequestBuilder.php b/src/Generated/Education/Classes/Item/Schools/Count/CountRequestBuilder.php index ea2d334561d..87c16f0cd73 100644 --- a/src/Generated/Education/Classes/Item/Schools/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Schools/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Schools/Item/EducationSchoolItemRequestBuilder.php b/src/Generated/Education/Classes/Item/Schools/Item/EducationSchoolItemRequestBuilder.php index 6941ada2cc0..e8485a1076f 100644 --- a/src/Generated/Education/Classes/Item/Schools/Item/EducationSchoolItemRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Schools/Item/EducationSchoolItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSchool; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * All schools that this class is associated with. Nullable. * @param EducationSchoolItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EducationSchoolItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSchool::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSchool::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EducationSchoolItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EducationSchoolItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Schools/SchoolsRequestBuilder.php b/src/Generated/Education/Classes/Item/Schools/SchoolsRequestBuilder.php index 5ce956bd76a..6a64e1f3616 100644 --- a/src/Generated/Education/Classes/Item/Schools/SchoolsRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Schools/SchoolsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Schools\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Schools\Item\EducationSchoolItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationSchoolCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of schools in which the class is taught. This API is available in the following national cloud deployments. * @param SchoolsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-list-schools?view=graph-rest-1.0 Find more info here */ public function get(?SchoolsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSchoolCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSchoolCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SchoolsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SchoolsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Teachers/Count/CountRequestBuilder.php b/src/Generated/Education/Classes/Item/Teachers/Count/CountRequestBuilder.php index 852c7c9453a..37885a4f5ea 100644 --- a/src/Generated/Education/Classes/Item/Teachers/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Teachers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Teachers/Item/Ref/RefRequestBuilder.php b/src/Generated/Education/Classes/Item/Teachers/Item/Ref/RefRequestBuilder.php index 6152e33adcb..9c484f768a3 100644 --- a/src/Generated/Education/Classes/Item/Teachers/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Teachers/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a teacher from an educationClass. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-delete-teachers?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Teachers/Ref/RefRequestBuilder.php b/src/Generated/Education/Classes/Item/Teachers/Ref/RefRequestBuilder.php index d36ef60e129..6c8fac86f79 100644 --- a/src/Generated/Education/Classes/Item/Teachers/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Teachers/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of teachers for a class. Delegated tokens must be members of the class to get the teacher list. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-list-teachers?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a teacher to a class. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-post-teachers?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Classes/Item/Teachers/TeachersRequestBuilder.php b/src/Generated/Education/Classes/Item/Teachers/TeachersRequestBuilder.php index 44ef1ff914a..cfdce5c396c 100644 --- a/src/Generated/Education/Classes/Item/Teachers/TeachersRequestBuilder.php +++ b/src/Generated/Education/Classes/Item/Teachers/TeachersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\Item\Teachers\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Teachers\Item\EducationUserItemRequestBuilder; use Microsoft\Graph\Generated\Education\Classes\Item\Teachers\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of teachers for a class. Delegated tokens must be members of the class to get the teacher list. This API is available in the following national cloud deployments. * @param TeachersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationclass-list-teachers?view=graph-rest-1.0 Find more info here */ public function get(?TeachersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?TeachersRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?TeachersRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/EducationRequestBuilder.php b/src/Generated/Education/EducationRequestBuilder.php index 7678b1d59ec..bf3683b405e 100644 --- a/src/Generated/Education/EducationRequestBuilder.php +++ b/src/Generated/Education/EducationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Classes\ClassesRequestBuilder; use Microsoft\Graph\Generated\Education\Me\MeRequestBuilder; use Microsoft\Graph\Generated\Education\Schools\SchoolsRequestBuilder; @@ -66,38 +65,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get education * @param EducationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EducationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update education * @param EducationRoot $body The request body * @param EducationRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationRoot $body, ?EducationRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?EducationRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?EducationRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPatchRequestInformation(EducationRoot $body, ?EducationRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/AssignmentsRequestBuilder.php b/src/Generated/Education/Me/Assignments/AssignmentsRequestBuilder.php index a244b1bdb02..5dc9124cd1f 100644 --- a/src/Generated/Education/Me/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Assignments\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\EducationAssignmentItemRequestBuilder; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Returns a list of educationAssignment assigned to a educationUser for all classes. Only teachers, students, and applications with application permissions can perform this operation. This method allows a caller to find all the assignments belonging to a student or a teacher in a single call rather than having to request assignments from each class. The assignment list contains what is needed to get the detailed information for the assignment from within the class namespace. Use the methods defined for the assignment for all other operations. This API is available in the following national cloud deployments. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-list-assignments?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to assignments for education * @param EducationAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EducationAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(EducationAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Count/CountRequestBuilder.php b/src/Generated/Education/Me/Assignments/Count/CountRequestBuilder.php index f29a4dfe39f..fac4bd94bf6 100644 --- a/src/Generated/Education/Me/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Delta/DeltaRequestBuilder.php b/src/Generated/Education/Me/Assignments/Delta/DeltaRequestBuilder.php index a8fadb6668e..c7bd9886a36 100644 --- a/src/Generated/Education/Me/Assignments/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Categories/CategoriesRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Categories/CategoriesRequestBuilder.php index 81ff2834f1d..43a5dfb4692 100644 --- a/src/Generated/Education/Me/Assignments/Item/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Categories\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Categories\Item\EducationCategoryItemRequestBuilder; @@ -71,40 +70,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the categories associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-list-categories?view=graph-rest-1.0 Find more info here */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add one or more existing educationCategory objects to the specified educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param EducationCategory $body The request body * @param CategoriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-post-categories?view=graph-rest-1.0 Find more info here */ public function post(EducationCategory $body, ?CategoriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,7 +110,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -125,6 +117,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -139,11 +132,11 @@ public function toPostRequestInformation(EducationCategory $body, ?CategoriesReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Categories/Count/CountRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Categories/Count/CountRequestBuilder.php index 0a3b0cf479e..35ef29ce1a2 100644 --- a/src/Generated/Education/Me/Assignments/Item/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Categories/Delta/DeltaRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Categories/Delta/DeltaRequestBuilder.php index f8ab9af21d2..65e064623a7 100644 --- a/src/Generated/Education/Me/Assignments/Item/Categories/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Categories/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Categories/Item/Ref/RefRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Categories/Item/Ref/RefRequestBuilder.php index 455834cab3d..a73b388a584 100644 --- a/src/Generated/Education/Me/Assignments/Item/Categories/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Categories/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an educationCategory from an educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-remove-category?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Categories/Ref/RefRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Categories/Ref/RefRequestBuilder.php index dfbc8883d99..00a16186e45 100644 --- a/src/Generated/Education/Me/Assignments/Item/Categories/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Categories/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the categories associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-list-categories?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add one or more existing educationCategory objects to the specified educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-post-categories?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/EducationAssignmentItemRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/EducationAssignmentItemRequestBuilder.php index 58888030469..17efd4b7baf 100644 --- a/src/Generated/Education/Me/Assignments/Item/EducationAssignmentItemRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/EducationAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Publish\PublishRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Resources\ResourcesRequestBuilder; @@ -90,56 +89,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignments for education * @param EducationAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EducationAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Assignments belonging to the user. * @param EducationAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EducationAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignments in education * @param EducationAssignment $body The request body * @param EducationAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationAssignment $body, ?EducationAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -156,6 +146,7 @@ public function toDeleteRequestInformation(?EducationAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -169,7 +160,6 @@ public function toGetRequestInformation(?EducationAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -177,6 +167,7 @@ public function toGetRequestInformation(?EducationAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -191,11 +182,11 @@ public function toPatchRequestInformation(EducationAssignment $body, ?EducationA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Publish/PublishRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Publish/PublishRequestBuilder.php index 7400a175875..02f7aeaa6c9 100644 --- a/src/Generated/Education/Me/Assignments/Item/Publish/PublishRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Publish/PublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Publish an education assignment. Change the state of an educationAssignment from its original draft status to the published status. You can change the state from draft to scheduled if the assignment is scheduled for a future date. Only a teacher in the class can make this call. When an assignment is in draft status, students will not see the assignment, nor will there be any submission objects. Calling this API creates educationSubmission objects and displays the assignment in each student's list. The state of the assignment goes back to draft if there is any backend failure during publish process. To update the properties of a published assignment, see update an assignment. This API is available in the following national cloud deployments. * @param PublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-publish?view=graph-rest-1.0 Find more info here */ public function post(?PublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?PublishRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Resources/Count/CountRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Resources/Count/CountRequestBuilder.php index 622d6708a74..4af14a84e91 100644 --- a/src/Generated/Education/Me/Assignments/Item/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Resources/Item/EducationAssignmentResourceItemRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Resources/Item/EducationAssignmentResourceItemRequestBuilder.php index 651679e5d97..6e24adfda50 100644 --- a/src/Generated/Education/Me/Assignments/Item/Resources/Item/EducationAssignmentResourceItemRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Resources/Item/EducationAssignmentResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignmentResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a specific educationAssignmentResource attached to an assignment. In general, only teachers in the class can remove a resource. However, teachers can't remove resources marked as 'distributeToStudents', after the assignment has been published to students. This API is available in the following national cloud deployments. * @param EducationAssignmentResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignmentresource-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationAssignmentResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties of an education assignment resource associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param EducationAssignmentResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignmentresource-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationAssignmentResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in education * @param EducationAssignmentResource $body The request body * @param EducationAssignmentResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationAssignmentResource $body, ?EducationAssignmentResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?EducationAssignmentResourceItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?EducationAssignmentResourceItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?EducationAssignmentResourceItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(EducationAssignmentResource $body, ?Ed $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Resources/ResourcesRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Resources/ResourcesRequestBuilder.php index 6d6c7982c09..f02fd30fe7f 100644 --- a/src/Generated/Education/Me/Assignments/Item/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Resources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Resources\Item\EducationAssignmentResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationAssignmentResource; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get all the educationAssignmentResource objects associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-list-resources?view=graph-rest-1.0 Find more info here */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an assignment resource. Only teachers can perform this operation. You can create the following types of assignment resources: Every resource has an @odata.type property to indicate which type of resource is being created. This API is available in the following national cloud deployments. * @param EducationAssignmentResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-post-resource?view=graph-rest-1.0 Find more info here */ public function post(EducationAssignmentResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EducationAssignmentResource $body, ?Res $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Rubric/Ref/RefRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Rubric/Ref/RefRequestBuilder.php index 3cb5473c638..df6136d0991 100644 --- a/src/Generated/Education/Me/Assignments/Item/Rubric/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Rubric/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceUpdate; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,52 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an educationRubric from an educationAssignment. This method doesn't delete the rubric itself and can only be performed by teachers. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-delete-rubric?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the educationRubric object attached to an educationAssignment, if one exists. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-get-rubric?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'string', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'string', $errorMappings); + return $result; } /** * Attach an existing educationRubric object to an educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param ReferenceUpdate $body The request body * @param RefRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-put-rubric?view=graph-rest-1.0 Find more info here */ public function put(ReferenceUpdate $body, ?RefRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -103,6 +95,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,11 +109,11 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -139,6 +132,7 @@ public function toPutRequestInformation(ReferenceUpdate $body, ?RefRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Rubric/RubricRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Rubric/RubricRequestBuilder.php index a66c75829e1..131d618684d 100644 --- a/src/Generated/Education/Me/Assignments/Item/Rubric/RubricRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Rubric/RubricRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Rubric\Ref\RefRequestBuilder; use Microsoft\Graph\Generated\Models\EducationRubric; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an educationRubric from an educationAssignment. This method doesn't delete the rubric itself and can only be performed by teachers. This API is available in the following national cloud deployments. * @param RubricRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-delete-rubric?view=graph-rest-1.0 Find more info here */ public function delete(?RubricRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the educationRubric object attached to an educationAssignment, if one exists. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param RubricRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-get-rubric?view=graph-rest-1.0 Find more info here */ public function get(?RubricRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Attach an existing educationRubric object to an educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param EducationRubric $body The request body * @param RubricRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-put-rubric?view=graph-rest-1.0 Find more info here */ public function patch(EducationRubric $body, ?RubricRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?RubricRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?RubricRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?RubricRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(EducationRubric $body, ?RubricRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/SetUpFeedbackResourcesFolder/SetUpFeedbackResourcesFolderRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/SetUpFeedbackResourcesFolder/SetUpFeedbackResourcesFolderRequestBuilder.php index 9e8c50fb8bf..10aad9d05f5 100644 --- a/src/Generated/Education/Me/Assignments/Item/SetUpFeedbackResourcesFolder/SetUpFeedbackResourcesFolderRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/SetUpFeedbackResourcesFolder/SetUpFeedbackResourcesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Create a SharePoint folder to upload feedback files for a given educationSubmission. Only teachers can perform this operation. The teacher determines the resources to upload in the feedback resources folder of a submission. This API is available in the following national cloud deployments. * @param SetUpFeedbackResourcesFolderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-setupfeedbackresourcesfolder?view=graph-rest-1.0 Find more info here */ public function post(?SetUpFeedbackResourcesFolderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?SetUpFeedbackResourcesFolderRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php index 1c4a78138af..d1960b4ecef 100644 --- a/src/Generated/Education/Me/Assignments/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Create a SharePoint folder to upload files for a given educationAssignment. Only teachers can perform this operation. The teacher determines the resources to upload in the assignment's folder. This API is available in the following national cloud deployments. * @param SetUpResourcesFolderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-setupresourcesfolder?view=graph-rest-1.0 Find more info here */ public function post(?SetUpResourcesFolderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?SetUpResourcesFolderRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Count/CountRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Count/CountRequestBuilder.php index c79f76a2115..c9e3090c01a 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/EducationSubmissionItemRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/EducationSubmissionItemRequestBuilder.php index bddbd99a79a..95d142fb5df 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/EducationSubmissionItemRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/EducationSubmissionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Submissions\Item\EscapedReturn\ReturnRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Submissions\Item\Outcomes\OutcomesRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Submissions\Item\Reassign\ReassignRequestBuilder; @@ -98,57 +97,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property submissions for education * @param EducationSubmissionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EducationSubmissionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a particular submission. Only teachers, students, and applications with application permissions can perform this operation. A submission object represents a student's work for an assignment. Resources associated with the submission represent this work. Only the assignedTo student can see and modify the submission. A teacher or application with application permissions has full access to all submissions. The grade and feedback from a teacher are part of the educationOutcome associated with this object. Only teachers or applications with application permissions can add or change grades and feedback. Students will not see the grade or feedback until the assignment has been released. This API is available in the following national cloud deployments. * @param EducationSubmissionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationSubmissionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property submissions in education * @param EducationSubmission $body The request body * @param EducationSubmissionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationSubmission $body, ?EducationSubmissionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -165,6 +155,7 @@ public function toDeleteRequestInformation(?EducationSubmissionItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -178,7 +169,6 @@ public function toGetRequestInformation(?EducationSubmissionItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -186,6 +176,7 @@ public function toGetRequestInformation(?EducationSubmissionItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -200,11 +191,11 @@ public function toPatchRequestInformation(EducationSubmission $body, ?EducationS $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/EscapedReturn/ReturnRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/EscapedReturn/ReturnRequestBuilder.php index 0e21d2fab4a..3ef3a90893d 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/EscapedReturn/ReturnRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/EscapedReturn/ReturnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Make the grade and feedback associated with this submission available to the student. This action changes the status of the submission from 'submitted' to 'returned' and indicates that feedback is provided or grading is done. This action can only be done by the teacher. This API is available in the following national cloud deployments. * @param ReturnRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-return?view=graph-rest-1.0 Find more info here */ public function post(?ReturnRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ReturnRequestBuilderPostRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Outcomes/Count/CountRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Outcomes/Count/CountRequestBuilder.php index 7045b4efb16..2ea2a6c08e2 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Outcomes/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Outcomes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Outcomes/Item/EducationOutcomeItemRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Outcomes/Item/EducationOutcomeItemRequestBuilder.php index 3d02d6511b9..6ce43a92cd0 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Outcomes/Item/EducationOutcomeItemRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Outcomes/Item/EducationOutcomeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationOutcome; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a feedback resource from a submission. This can only be done by a teacher. This API is available in the following national cloud deployments. * @param EducationOutcomeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationfeedbackresourceoutcome-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationOutcomeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get outcomes from education * @param EducationOutcomeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EducationOutcomeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an educationOutcome object. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param EducationOutcome $body The request body * @param EducationOutcomeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationoutcome-update?view=graph-rest-1.0 Find more info here */ public function patch(EducationOutcome $body, ?EducationOutcomeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?EducationOutcomeItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?EducationOutcomeItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?EducationOutcomeItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(EducationOutcome $body, ?EducationOutc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Outcomes/OutcomesRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Outcomes/OutcomesRequestBuilder.php index 5a3b012afff..51334fdec5d 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Outcomes/OutcomesRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Outcomes/OutcomesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Submissions\Item\Outcomes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Submissions\Item\Outcomes\Item\EducationOutcomeItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationOutcome; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of educationOutcome objects. There are four types of outcomes: educationPointsOutcome, educationFeedbackOutcome, educationRubricOutcome, and educationFeedbackResourceOutcome. Only teachers, students, and applications with application permissions can perform this operation. A submission for a credit assignment (one that has no point value and no rubric) will have an educationFeedbackOutcome. (It might also return an educationPointsOutcome, but that outcome is ignored.) A submission for a points assignment (one that has a point value assigned) will have both an educationFeedbackOutcome and an educationPointsOutcome. A submission for an assignment with an attached rubric, if the rubric is a credit rubric (no points), will have an educationFeedbackOutcome and an educationRubricOutcome. (It might also return an educationPointsOutcome, but that outcome is ignored.) A submission for an assignment with an attached rubric, if the rubric is a points rubric, will have an educationFeedbackOutcome, an educationPointsOutcome, and an educationRubricOutcome. A submission for a feedback resource will have an educationFeedbackResourceOutcome. All outcome types have a regular and a published property appropriate to that type of outcome; for example, points and publishedPoints, feedback and publishedFeedback. The regular property is the most recent value updated by the teacher; the published property is the most recent value returned to the student. This API is available in the following national cloud deployments. * @param OutcomesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-list-outcomes?view=graph-rest-1.0 Find more info here */ public function get(?OutcomesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcomeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcomeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new feedback resource for a submission. Only a teacher can perform this operation. To create a new file-based resource, upload the file to the feedback resources folder associated with the assignment. If the file doesn't exist or isn't in that folder, the POST request will fail. This API is available in the following national cloud deployments. * @param EducationOutcome $body The request body * @param OutcomesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationfeedbackresourceoutcome-post-outcomes?view=graph-rest-1.0 Find more info here */ public function post(EducationOutcome $body, ?OutcomesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OutcomesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OutcomesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EducationOutcome $body, ?OutcomesReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Reassign/ReassignRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Reassign/ReassignRequestBuilder.php index 9658c96010f..34f2b1923a7 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Reassign/ReassignRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Reassign/ReassignRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reassign the submission to the student with feedback for review. Only teachers can perform this action. Include the Prefer: include-unknown-enum-members header when you call this method; otherwise, a reassigned submission will be treated as a returned submission. This means that the reassigned status will be mapped to the returned status, and reassignedDateTime and reassignedBy properties will be mapped to returnedDateTime and returnedBy respectively. If the header Prefer: include-unknown-enum-members is provided, a reassigned submission retains the reassigned status. For details, see the examples section. This API is available in the following national cloud deployments. * @param ReassignRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-reassign?view=graph-rest-1.0 Find more info here */ public function post(?ReassignRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ReassignRequestBuilderPostRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Resources/Count/CountRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Resources/Count/CountRequestBuilder.php index 056104dab4c..391110f104b 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Resources/Item/EducationSubmissionResourceItemRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Resources/Item/EducationSubmissionResourceItemRequestBuilder.php index 7fd288b2e65..d9b3b46b678 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Resources/Item/EducationSubmissionResourceItemRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Resources/Item/EducationSubmissionResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmissionResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an educationSubmissionResource from the submission. Only teachers and students can perform this operation. If the resource was copied from the assignment, a new copy of the resource will be created after the current copy is deleted. This allows you to 'reset' the resource to its original state. If the resource wasn't copied from the assignment but was added from the student, the resource is deleted. This API is available in the following national cloud deployments. * @param EducationSubmissionResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmissionresource-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationSubmissionResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of a specific resource associated with a submission. Only teachers, students, and applications with application permissions can perform this operation. This resource is in the 'working' resource list and should be considered work in process by a student. This resource is wrapped with a possible pointer back to the assignment resource if it was copied from the assignment. This API is available in the following national cloud deployments. * @param EducationSubmissionResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmissionresource-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationSubmissionResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in education * @param EducationSubmissionResource $body The request body * @param EducationSubmissionResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationSubmissionResource $body, ?EducationSubmissionResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?EducationSubmissionResourceItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?EducationSubmissionResourceItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?EducationSubmissionResourceItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(EducationSubmissionResource $body, ?Ed $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Resources/ResourcesRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Resources/ResourcesRequestBuilder.php index 05d5f632a57..748fe9043fb 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Submissions\Item\Resources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Submissions\Item\Resources\Item\EducationSubmissionResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationSubmissionResource; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the resources associated with a submission. Only teachers, students, and applications with application permissions can perform this operation. The educationSubmissionResource object is a wrapper around the actual resource object the student is working on. The wrapper also includes a pointer to the resources on the assignment if this was copied from the assignment during the assign process. These resources are the working copy of the assignment. The submittedResources are the resources that have officially been submitted to be graded. This API is available in the following national cloud deployments. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-list-resources?view=graph-rest-1.0 Find more info here */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add an educationSubmissionResource to a submission resource list. Only teachers and students can perform this operation. The operation will not succeed if the allowStudentsToAddResources flag is not set to true. To create a new file-based resource, upload the file to the resources folder associated with the submission. If the file doesn't exist or is not in that folder, the POST request will fail. This API is available in the following national cloud deployments. * @param EducationSubmissionResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-post-resources?view=graph-rest-1.0 Find more info here */ public function post(EducationSubmissionResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EducationSubmissionResource $body, ?Res $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php index 368816b5ca1..8245913974b 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Trigger the creation of the SharePoint resource folder where all file-based resources (Word, Excel, and so on) should be uploaded for a given submission. Only teachers and students can perform this operation. Note that files must be located in this folder in order to be added as resources. Only a student in the class can determine what files to upload in a given submission-level resource folder. This API is available in the following national cloud deployments. * @param SetUpResourcesFolderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-setupresourcesfolder?view=graph-rest-1.0 Find more info here */ public function post(?SetUpResourcesFolderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?SetUpResourcesFolderRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Submit/SubmitRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Submit/SubmitRequestBuilder.php index a9cc48d0aff..3c32aff3906 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Submit/SubmitRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Submit/SubmitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Indicate that a student is done with the work and is ready to hand in the assignment. Only teachers, students, and applications with application permissions can perform this operation. This method changes the status of the submission from working to submitted. During the submit process, all the resources are copied to the submittedResources bucket. The teacher will be looking at the submitted resources list for grading. A teacher can also submit a student's assignment on their behalf. This API is available in the following national cloud deployments. * @param SubmitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-submit?view=graph-rest-1.0 Find more info here */ public function post(?SubmitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?SubmitRequestBuilderPostRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SubmittedResources/Count/CountRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SubmittedResources/Count/CountRequestBuilder.php index ee1b61d632f..211d8fd940b 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SubmittedResources/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SubmittedResources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SubmittedResources/Item/EducationSubmissionResourceItemRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SubmittedResources/Item/EducationSubmissionResourceItemRequestBuilder.php index 75d049d7739..4a5cb783cae 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SubmittedResources/Item/EducationSubmissionResourceItemRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SubmittedResources/Item/EducationSubmissionResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmissionResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property submittedResources for education * @param EducationSubmissionResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EducationSubmissionResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a submitted resource. Only teachers, students, and applications with application permissions can perform this operation. Resources are available to a teacher or an application with application permissions after a student submits it, and are available to the student after the teacher returns the submission. Teachers can leave notes in some resources. This API is available in the following national cloud deployments. * @param EducationSubmissionResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmittedsubmissionresource-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationSubmissionResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property submittedResources in education * @param EducationSubmissionResource $body The request body * @param EducationSubmissionResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationSubmissionResource $body, ?EducationSubmissionResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?EducationSubmissionResourceItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?EducationSubmissionResourceItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?EducationSubmissionResourceItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(EducationSubmissionResource $body, ?Ed $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SubmittedResources/SubmittedResourcesRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SubmittedResources/SubmittedResourcesRequestBuilder.php index 33917539b75..39b365edeb3 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SubmittedResources/SubmittedResourcesRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/SubmittedResources/SubmittedResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Submissions\Item\SubmittedResources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Submissions\Item\SubmittedResources\Item\EducationSubmissionResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationSubmissionResource; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the educationSubmissionResource objects that have officially been submitted for grading. Only teachers, students, and applications with application permissions can perform this operation. The student who owns the submission cannot change the submitted list without resubmitting the assignment. This is a wrapper around the real resource and can contain a pointer back to the actual assignment resource if this resource was copied from the assignment. This API is available in the following national cloud deployments. * @param SubmittedResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-list-submittedresources?view=graph-rest-1.0 Find more info here */ public function get(?SubmittedResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to submittedResources for education * @param EducationSubmissionResource $body The request body * @param SubmittedResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EducationSubmissionResource $body, ?SubmittedResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SubmittedResourcesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SubmittedResourcesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(EducationSubmissionResource $body, ?Sub $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Unsubmit/UnsubmitRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Unsubmit/UnsubmitRequestBuilder.php index ecbe3b83334..555542016f4 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Unsubmit/UnsubmitRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/Item/Unsubmit/UnsubmitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Indicate that a student wants to work on the submission of the assignment after it was turned in. Only teachers, students, and applications with application permissions can perform this operation. This method changes the status of the submission from submitted to working. During the submit process, all the resources are copied from submittedResources to workingResources. The teacher will be looking at the working resources list for grading. A teacher can also unsubmit a student's assignment on their behalf. This API is available in the following national cloud deployments. * @param UnsubmitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-unsubmit?view=graph-rest-1.0 Find more info here */ public function post(?UnsubmitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?UnsubmitRequestBuilderPostRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Assignments/Item/Submissions/SubmissionsRequestBuilder.php b/src/Generated/Education/Me/Assignments/Item/Submissions/SubmissionsRequestBuilder.php index 80c578268f5..71050cb70d9 100644 --- a/src/Generated/Education/Me/Assignments/Item/Submissions/SubmissionsRequestBuilder.php +++ b/src/Generated/Education/Me/Assignments/Item/Submissions/SubmissionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Submissions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Assignments\Item\Submissions\Item\EducationSubmissionItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationSubmission; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the submissions associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. A teacher or an application with application permissions can get all the submissions while a student can only get submissions that they are associated with. This API is available in the following national cloud deployments. * @param SubmissionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-list-submissions?view=graph-rest-1.0 Find more info here */ public function get(?SubmissionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to submissions for education * @param EducationSubmission $body The request body * @param SubmissionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EducationSubmission $body, ?SubmissionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SubmissionsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SubmissionsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(EducationSubmission $body, ?Submissions $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Classes/ClassesRequestBuilder.php b/src/Generated/Education/Me/Classes/ClassesRequestBuilder.php index 7e031dbbaa5..5f4a3599353 100644 --- a/src/Generated/Education/Me/Classes/ClassesRequestBuilder.php +++ b/src/Generated/Education/Me/Classes/ClassesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Classes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Classes\Item\EducationClassItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationClassCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the educationClass resources an educationUser is a member of. This API is available in the following national cloud deployments. * @param ClassesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-list-classes?view=graph-rest-1.0 Find more info here */ public function get(?ClassesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationClassCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationClassCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?ClassesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?ClassesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Classes/Count/CountRequestBuilder.php b/src/Generated/Education/Me/Classes/Count/CountRequestBuilder.php index 32da7d3b4d8..8fe02b98723 100644 --- a/src/Generated/Education/Me/Classes/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Me/Classes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Classes/Item/EducationClassItemRequestBuilder.php b/src/Generated/Education/Me/Classes/Item/EducationClassItemRequestBuilder.php index b9278402bbd..8de30b71b45 100644 --- a/src/Generated/Education/Me/Classes/Item/EducationClassItemRequestBuilder.php +++ b/src/Generated/Education/Me/Classes/Item/EducationClassItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationClass; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Classes to which the user belongs. Nullable. * @param EducationClassItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EducationClassItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EducationClassItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EducationClassItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/MeRequestBuilder.php b/src/Generated/Education/Me/MeRequestBuilder.php index 8796fac11b7..1fecabae6c7 100644 --- a/src/Generated/Education/Me/MeRequestBuilder.php +++ b/src/Generated/Education/Me/MeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Classes\ClassesRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Rubrics\RubricsRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property me for education * @param MeRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MeRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get me from education * @param MeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property me in education * @param EducationUser $body The request body * @param MeRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationUser $body, ?MeRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?MeRequestBuilderDeleteRequestConfigu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?MeRequestBuilderGetRequestConfiguration $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?MeRequestBuilderGetRequestConfiguration } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(EducationUser $body, ?MeRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Rubrics/Count/CountRequestBuilder.php b/src/Generated/Education/Me/Rubrics/Count/CountRequestBuilder.php index f786fe95729..84954d73c5c 100644 --- a/src/Generated/Education/Me/Rubrics/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Me/Rubrics/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Rubrics/Item/EducationRubricItemRequestBuilder.php b/src/Generated/Education/Me/Rubrics/Item/EducationRubricItemRequestBuilder.php index b8a36f4d755..f3ccbf2d0cc 100644 --- a/src/Generated/Education/Me/Rubrics/Item/EducationRubricItemRequestBuilder.php +++ b/src/Generated/Education/Me/Rubrics/Item/EducationRubricItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationRubric; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an educationRubric object. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param EducationRubricItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationrubric-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationRubricItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an educationRubric object. Only teachers and students can perform this operation. This API is available in the following national cloud deployments. * @param EducationRubricItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationrubric-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationRubricItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an educationRubric object. Only teachers can perform this operation. Updating a rubric attached to an assignment (PATCH /education/classes/{class-id}/assignments/{assignment-id}/rubric) is only possible before the assignment is published, and what is updated is actually the original rubric that exists under /education/users/{id}/rubrics. After the assignment is published, an immutable copy of the rubric is made that is attached to that specific assignment. That rubric can be retrieved using GET /education/classes/{class-id}/assignments/{assignment-id}/rubric, but it cannot be updated. This API is available in the following national cloud deployments. * @param EducationRubric $body The request body * @param EducationRubricItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationrubric-update?view=graph-rest-1.0 Find more info here */ public function patch(EducationRubric $body, ?EducationRubricItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?EducationRubricItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?EducationRubricItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?EducationRubricItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(EducationRubric $body, ?EducationRubri $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Rubrics/RubricsRequestBuilder.php b/src/Generated/Education/Me/Rubrics/RubricsRequestBuilder.php index 79fd0b018c0..06259d5c96a 100644 --- a/src/Generated/Education/Me/Rubrics/RubricsRequestBuilder.php +++ b/src/Generated/Education/Me/Rubrics/RubricsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Rubrics\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Rubrics\Item\EducationRubricItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationRubric; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of educationRubric objects. This API is available in the following national cloud deployments. * @param RubricsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-list-rubrics?view=graph-rest-1.0 Find more info here */ public function get(?RubricsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubricCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubricCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new educationRubric object. This API is available in the following national cloud deployments. * @param EducationRubric $body The request body * @param RubricsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-post-rubrics?view=graph-rest-1.0 Find more info here */ public function post(EducationRubric $body, ?RubricsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?RubricsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?RubricsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EducationRubric $body, ?RubricsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/Schools/Count/CountRequestBuilder.php b/src/Generated/Education/Me/Schools/Count/CountRequestBuilder.php index ce35d0e12cc..9fac26eb917 100644 --- a/src/Generated/Education/Me/Schools/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Me/Schools/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Schools/Item/EducationSchoolItemRequestBuilder.php b/src/Generated/Education/Me/Schools/Item/EducationSchoolItemRequestBuilder.php index 0ef61123afb..a7b83c7ccfa 100644 --- a/src/Generated/Education/Me/Schools/Item/EducationSchoolItemRequestBuilder.php +++ b/src/Generated/Education/Me/Schools/Item/EducationSchoolItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSchool; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Schools to which the user belongs. Nullable. * @param EducationSchoolItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EducationSchoolItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSchool::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSchool::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EducationSchoolItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EducationSchoolItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/Schools/SchoolsRequestBuilder.php b/src/Generated/Education/Me/Schools/SchoolsRequestBuilder.php index 209db48415e..dc16e992e45 100644 --- a/src/Generated/Education/Me/Schools/SchoolsRequestBuilder.php +++ b/src/Generated/Education/Me/Schools/SchoolsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\Schools\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Me\Schools\Item\EducationSchoolItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationSchoolCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of schools for a user. This API is available in the following national cloud deployments. * @param SchoolsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-list-schools?view=graph-rest-1.0 Find more info here */ public function get(?SchoolsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSchoolCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSchoolCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SchoolsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SchoolsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/TaughtClasses/Count/CountRequestBuilder.php b/src/Generated/Education/Me/TaughtClasses/Count/CountRequestBuilder.php index ebc0d64fcb0..a726ae6ee1e 100644 --- a/src/Generated/Education/Me/TaughtClasses/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Me/TaughtClasses/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Me/TaughtClasses/Item/EducationClassItemRequestBuilder.php b/src/Generated/Education/Me/TaughtClasses/Item/EducationClassItemRequestBuilder.php index 58cd3b9ddc6..99dbfa57c07 100644 --- a/src/Generated/Education/Me/TaughtClasses/Item/EducationClassItemRequestBuilder.php +++ b/src/Generated/Education/Me/TaughtClasses/Item/EducationClassItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationClass; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Classes for which the user is a teacher. * @param EducationClassItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EducationClassItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EducationClassItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EducationClassItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/TaughtClasses/TaughtClassesRequestBuilder.php b/src/Generated/Education/Me/TaughtClasses/TaughtClassesRequestBuilder.php index 586055f2c32..0b102229fe2 100644 --- a/src/Generated/Education/Me/TaughtClasses/TaughtClassesRequestBuilder.php +++ b/src/Generated/Education/Me/TaughtClasses/TaughtClassesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\TaughtClasses\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Me\TaughtClasses\Item\EducationClassItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationClassCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the educationClass resources owned by an educationUser. This API is available in the following national cloud deployments. * @param TaughtClassesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-list-taughtclasses?view=graph-rest-1.0 Find more info here */ public function get(?TaughtClassesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationClassCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationClassCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?TaughtClassesRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?TaughtClassesRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/User/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Education/Me/User/MailboxSettings/MailboxSettingsRequestBuilder.php index 368f1909a92..0c679d1a422 100644 --- a/src/Generated/Education/Me/User/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Education/Me/User/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Me/User/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Education/Me/User/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 9604e25a20a..05e56896731 100644 --- a/src/Generated/Education/Me/User/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Me/User/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Me/User/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Education/Me/User/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index b0054646d15..76c5189e571 100644 --- a/src/Generated/Education/Me/User/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Education/Me/User/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\User\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Me/User/UserRequestBuilder.php b/src/Generated/Education/Me/User/UserRequestBuilder.php index 30948136f0f..92ab5d0f6f2 100644 --- a/src/Generated/Education/Me/User/UserRequestBuilder.php +++ b/src/Generated/Education/Me/User/UserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Me\User\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Education\Me\User\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,20 +49,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the simple directory user that corresponds to this educationUser. This API is available in the following national cloud deployments. * @param UserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-get-user?view=graph-rest-1.0 Find more info here */ public function get(?UserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -76,7 +72,6 @@ public function toGetRequestInformation(?UserRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -84,6 +79,7 @@ public function toGetRequestInformation(?UserRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Schools/Count/CountRequestBuilder.php b/src/Generated/Education/Schools/Count/CountRequestBuilder.php index 35e084dd414..0bfffa34e00 100644 --- a/src/Generated/Education/Schools/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Schools/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Schools/Delta/DeltaRequestBuilder.php b/src/Generated/Education/Schools/Delta/DeltaRequestBuilder.php index 877a0c5829c..e774e555cd0 100644 --- a/src/Generated/Education/Schools/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Education/Schools/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Schools/Item/AdministrativeUnit/AdministrativeUnitRequestBuilder.php b/src/Generated/Education/Schools/Item/AdministrativeUnit/AdministrativeUnitRequestBuilder.php index cbef06ee3e6..0984d311ea2 100644 --- a/src/Generated/Education/Schools/Item/AdministrativeUnit/AdministrativeUnitRequestBuilder.php +++ b/src/Generated/Education/Schools/Item/AdministrativeUnit/AdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnit; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,39 +33,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of administrativeUnits associated with an educationSchool object. This API is available in the following national cloud deployments. * @param AdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-list-administrativeunit?view=graph-rest-1.0 Find more info here */ public function get(?AdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property administrativeUnit in education * @param AdministrativeUnit $body The request body * @param AdministrativeUnitRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AdministrativeUnit $body, ?AdministrativeUnitRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +72,6 @@ public function toGetRequestInformation(?AdministrativeUnitRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +79,7 @@ public function toGetRequestInformation(?AdministrativeUnitRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -101,11 +94,11 @@ public function toPatchRequestInformation(AdministrativeUnit $body, ?Administrat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Schools/Item/Classes/ClassesRequestBuilder.php b/src/Generated/Education/Schools/Item/Classes/ClassesRequestBuilder.php index 6597bce496f..b9796989412 100644 --- a/src/Generated/Education/Schools/Item/Classes/ClassesRequestBuilder.php +++ b/src/Generated/Education/Schools/Item/Classes/ClassesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Schools\Item\Classes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Schools\Item\Classes\Item\EducationClassItemRequestBuilder; use Microsoft\Graph\Generated\Education\Schools\Item\Classes\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the educationClass resources owned by an educationSchool. This API is available in the following national cloud deployments. * @param ClassesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-list-classes?view=graph-rest-1.0 Find more info here */ public function get(?ClassesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationClassCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationClassCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?ClassesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?ClassesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Schools/Item/Classes/Count/CountRequestBuilder.php b/src/Generated/Education/Schools/Item/Classes/Count/CountRequestBuilder.php index e6155b830df..d2753127ca3 100644 --- a/src/Generated/Education/Schools/Item/Classes/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Schools/Item/Classes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Schools/Item/Classes/Item/Ref/RefRequestBuilder.php b/src/Generated/Education/Schools/Item/Classes/Item/Ref/RefRequestBuilder.php index f29fa61bf32..f89c49fc2dc 100644 --- a/src/Generated/Education/Schools/Item/Classes/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Schools/Item/Classes/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a class from a school. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-delete-classes?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Education/Schools/Item/Classes/Ref/RefRequestBuilder.php b/src/Generated/Education/Schools/Item/Classes/Ref/RefRequestBuilder.php index 16f830bf7ac..f6cbdff20db 100644 --- a/src/Generated/Education/Schools/Item/Classes/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Schools/Item/Classes/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the educationClass resources owned by an educationSchool. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-list-classes?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a class to a school. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-post-classes?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Schools/Item/EducationSchoolItemRequestBuilder.php b/src/Generated/Education/Schools/Item/EducationSchoolItemRequestBuilder.php index ad4358b9687..7a7d3dc846d 100644 --- a/src/Generated/Education/Schools/Item/EducationSchoolItemRequestBuilder.php +++ b/src/Generated/Education/Schools/Item/EducationSchoolItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Schools\Item\AdministrativeUnit\AdministrativeUnitRequestBuilder; use Microsoft\Graph\Generated\Education\Schools\Item\Classes\ClassesRequestBuilder; use Microsoft\Graph\Generated\Education\Schools\Item\Users\UsersRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a school. This API is available in the following national cloud deployments. * @param EducationSchoolItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationSchoolItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an educationSchool object. This API is available in the following national cloud deployments. * @param EducationSchoolItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationSchoolItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSchool::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSchool::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an educationSchool object. This API is available in the following national cloud deployments. * @param EducationSchool $body The request body * @param EducationSchoolItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-update?view=graph-rest-1.0 Find more info here */ public function patch(EducationSchool $body, ?EducationSchoolItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSchool::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSchool::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?EducationSchoolItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?EducationSchoolItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?EducationSchoolItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(EducationSchool $body, ?EducationSchoo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Schools/Item/Users/Count/CountRequestBuilder.php b/src/Generated/Education/Schools/Item/Users/Count/CountRequestBuilder.php index b23aa334dcb..c16265f774a 100644 --- a/src/Generated/Education/Schools/Item/Users/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Schools/Item/Users/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Schools/Item/Users/Item/Ref/RefRequestBuilder.php b/src/Generated/Education/Schools/Item/Users/Item/Ref/RefRequestBuilder.php index b306ce701d7..f3d3523e960 100644 --- a/src/Generated/Education/Schools/Item/Users/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Schools/Item/Users/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a user from a school. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-delete-users?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Education/Schools/Item/Users/Ref/RefRequestBuilder.php b/src/Generated/Education/Schools/Item/Users/Ref/RefRequestBuilder.php index 0597bac2260..6b31ab500e1 100644 --- a/src/Generated/Education/Schools/Item/Users/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Schools/Item/Users/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the educationUser resources associated with an educationSchool. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-list-users?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a user to a school. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-post-users?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Schools/Item/Users/UsersRequestBuilder.php b/src/Generated/Education/Schools/Item/Users/UsersRequestBuilder.php index 594db1620fd..168322ab126 100644 --- a/src/Generated/Education/Schools/Item/Users/UsersRequestBuilder.php +++ b/src/Generated/Education/Schools/Item/Users/UsersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Schools\Item\Users\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Schools\Item\Users\Item\EducationUserItemRequestBuilder; use Microsoft\Graph\Generated\Education\Schools\Item\Users\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the educationUser resources associated with an educationSchool. This API is available in the following national cloud deployments. * @param UsersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-list-users?view=graph-rest-1.0 Find more info here */ public function get(?UsersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?UsersRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?UsersRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Schools/SchoolsRequestBuilder.php b/src/Generated/Education/Schools/SchoolsRequestBuilder.php index 9cd40bee9a9..79a782e2841 100644 --- a/src/Generated/Education/Schools/SchoolsRequestBuilder.php +++ b/src/Generated/Education/Schools/SchoolsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Schools\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Schools\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Education\Schools\Item\EducationSchoolItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the educationSchool objects and their properties. This API is available in the following national cloud deployments. * @param SchoolsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-list?view=graph-rest-1.0 Find more info here */ public function get(?SchoolsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSchoolCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSchoolCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new educationSchool object. This API is available in the following national cloud deployments. * @param EducationSchool $body The request body * @param SchoolsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationschool-post?view=graph-rest-1.0 Find more info here */ public function post(EducationSchool $body, ?SchoolsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSchool::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSchool::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?SchoolsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?SchoolsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(EducationSchool $body, ?SchoolsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Count/CountRequestBuilder.php b/src/Generated/Education/Users/Count/CountRequestBuilder.php index e9f5b8d9707..561ca689048 100644 --- a/src/Generated/Education/Users/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Users/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Delta/DeltaRequestBuilder.php b/src/Generated/Education/Users/Delta/DeltaRequestBuilder.php index 244b24b4ff9..72bbdc45097 100644 --- a/src/Generated/Education/Users/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Education/Users/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/AssignmentsRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/AssignmentsRequestBuilder.php index 47812dcc392..d6dad1374d3 100644 --- a/src/Generated/Education/Users/Item/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\EducationAssignmentItemRequestBuilder; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Returns a list of educationAssignment assigned to a educationUser for all classes. Only teachers, students, and applications with application permissions can perform this operation. This method allows a caller to find all the assignments belonging to a student or a teacher in a single call rather than having to request assignments from each class. The assignment list contains what is needed to get the detailed information for the assignment from within the class namespace. Use the methods defined for the assignment for all other operations. This API is available in the following national cloud deployments. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-list-assignments?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to assignments for education * @param EducationAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EducationAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(EducationAssignment $body, ?Assignments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Count/CountRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Count/CountRequestBuilder.php index 7a95ff2bbc3..f4c2139c384 100644 --- a/src/Generated/Education/Users/Item/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Delta/DeltaRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Delta/DeltaRequestBuilder.php index 0d5529a3a5d..7f30f608b77 100644 --- a/src/Generated/Education/Users/Item/Assignments/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Categories/CategoriesRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Categories/CategoriesRequestBuilder.php index 17342d5821b..c335ec3b93f 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Categories/CategoriesRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Categories/CategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Categories\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Categories\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Categories\Item\EducationCategoryItemRequestBuilder; @@ -71,40 +70,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the categories associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param CategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-list-categories?view=graph-rest-1.0 Find more info here */ public function get(?CategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add one or more existing educationCategory objects to the specified educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param EducationCategory $body The request body * @param CategoriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-post-categories?view=graph-rest-1.0 Find more info here */ public function post(EducationCategory $body, ?CategoriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,7 +110,6 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -125,6 +117,7 @@ public function toGetRequestInformation(?CategoriesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -139,11 +132,11 @@ public function toPostRequestInformation(EducationCategory $body, ?CategoriesReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Categories/Count/CountRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Categories/Count/CountRequestBuilder.php index 988d1a9002b..c29684432ea 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Categories/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Categories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Categories/Delta/DeltaRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Categories/Delta/DeltaRequestBuilder.php index e80a38426ad..61f94f7bc0a 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Categories/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Categories/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Categories/Item/Ref/RefRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Categories/Item/Ref/RefRequestBuilder.php index 22f47d8ca04..650ac022fa7 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Categories/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Categories/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an educationCategory from an educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-remove-category?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Categories/Ref/RefRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Categories/Ref/RefRequestBuilder.php index 50536205e53..c0460b4f0d4 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Categories/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Categories/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the categories associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-list-categories?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add one or more existing educationCategory objects to the specified educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-post-categories?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/EducationAssignmentItemRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/EducationAssignmentItemRequestBuilder.php index 60ec2bd40f7..5bc62da8e6a 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/EducationAssignmentItemRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/EducationAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Categories\CategoriesRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Publish\PublishRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Resources\ResourcesRequestBuilder; @@ -90,56 +89,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignments for education * @param EducationAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EducationAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Assignments belonging to the user. * @param EducationAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EducationAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignments in education * @param EducationAssignment $body The request body * @param EducationAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationAssignment $body, ?EducationAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -156,6 +146,7 @@ public function toDeleteRequestInformation(?EducationAssignmentItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -169,7 +160,6 @@ public function toGetRequestInformation(?EducationAssignmentItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -177,6 +167,7 @@ public function toGetRequestInformation(?EducationAssignmentItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -191,11 +182,11 @@ public function toPatchRequestInformation(EducationAssignment $body, ?EducationA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Publish/PublishRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Publish/PublishRequestBuilder.php index d2a1201066e..22a9b532797 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Publish/PublishRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Publish/PublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Publish an education assignment. Change the state of an educationAssignment from its original draft status to the published status. You can change the state from draft to scheduled if the assignment is scheduled for a future date. Only a teacher in the class can make this call. When an assignment is in draft status, students will not see the assignment, nor will there be any submission objects. Calling this API creates educationSubmission objects and displays the assignment in each student's list. The state of the assignment goes back to draft if there is any backend failure during publish process. To update the properties of a published assignment, see update an assignment. This API is available in the following national cloud deployments. * @param PublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-publish?view=graph-rest-1.0 Find more info here */ public function post(?PublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?PublishRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Resources/Count/CountRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Resources/Count/CountRequestBuilder.php index a2f56e0cbfc..4896fa70dfd 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Resources/Item/EducationAssignmentResourceItemRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Resources/Item/EducationAssignmentResourceItemRequestBuilder.php index 0c6d2685e55..1fa151b3896 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Resources/Item/EducationAssignmentResourceItemRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Resources/Item/EducationAssignmentResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignmentResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a specific educationAssignmentResource attached to an assignment. In general, only teachers in the class can remove a resource. However, teachers can't remove resources marked as 'distributeToStudents', after the assignment has been published to students. This API is available in the following national cloud deployments. * @param EducationAssignmentResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignmentresource-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationAssignmentResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties of an education assignment resource associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param EducationAssignmentResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignmentresource-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationAssignmentResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in education * @param EducationAssignmentResource $body The request body * @param EducationAssignmentResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationAssignmentResource $body, ?EducationAssignmentResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?EducationAssignmentResourceItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?EducationAssignmentResourceItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?EducationAssignmentResourceItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(EducationAssignmentResource $body, ?Ed $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Resources/ResourcesRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Resources/ResourcesRequestBuilder.php index a43eca00a4c..6013c843263 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Resources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Resources\Item\EducationAssignmentResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationAssignmentResource; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get all the educationAssignmentResource objects associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-list-resources?view=graph-rest-1.0 Find more info here */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an assignment resource. Only teachers can perform this operation. You can create the following types of assignment resources: Every resource has an @odata.type property to indicate which type of resource is being created. This API is available in the following national cloud deployments. * @param EducationAssignmentResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-post-resource?view=graph-rest-1.0 Find more info here */ public function post(EducationAssignmentResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignmentResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EducationAssignmentResource $body, ?Res $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Rubric/Ref/RefRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Rubric/Ref/RefRequestBuilder.php index 33b16bd09ea..c6a6bdc29b3 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Rubric/Ref/RefRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Rubric/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceUpdate; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,52 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an educationRubric from an educationAssignment. This method doesn't delete the rubric itself and can only be performed by teachers. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-delete-rubric?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the educationRubric object attached to an educationAssignment, if one exists. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-get-rubric?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'string', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'string', $errorMappings); + return $result; } /** * Attach an existing educationRubric object to an educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param ReferenceUpdate $body The request body * @param RefRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-put-rubric?view=graph-rest-1.0 Find more info here */ public function put(ReferenceUpdate $body, ?RefRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -103,6 +95,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,11 +109,11 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -139,6 +132,7 @@ public function toPutRequestInformation(ReferenceUpdate $body, ?RefRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Rubric/RubricRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Rubric/RubricRequestBuilder.php index 5a9ffb7a4ea..afe8148248c 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Rubric/RubricRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Rubric/RubricRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Rubric\Ref\RefRequestBuilder; use Microsoft\Graph\Generated\Models\EducationRubric; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an educationRubric from an educationAssignment. This method doesn't delete the rubric itself and can only be performed by teachers. This API is available in the following national cloud deployments. * @param RubricRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-delete-rubric?view=graph-rest-1.0 Find more info here */ public function delete(?RubricRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the educationRubric object attached to an educationAssignment, if one exists. Only teachers, students, and applications with application permissions can perform this operation. This API is available in the following national cloud deployments. * @param RubricRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-get-rubric?view=graph-rest-1.0 Find more info here */ public function get(?RubricRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Attach an existing educationRubric object to an educationAssignment. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param EducationRubric $body The request body * @param RubricRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-put-rubric?view=graph-rest-1.0 Find more info here */ public function patch(EducationRubric $body, ?RubricRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?RubricRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?RubricRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?RubricRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(EducationRubric $body, ?RubricRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/SetUpFeedbackResourcesFolder/SetUpFeedbackResourcesFolderRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/SetUpFeedbackResourcesFolder/SetUpFeedbackResourcesFolderRequestBuilder.php index b6425ddb048..2fd6ace31c7 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/SetUpFeedbackResourcesFolder/SetUpFeedbackResourcesFolderRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/SetUpFeedbackResourcesFolder/SetUpFeedbackResourcesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Create a SharePoint folder to upload feedback files for a given educationSubmission. Only teachers can perform this operation. The teacher determines the resources to upload in the feedback resources folder of a submission. This API is available in the following national cloud deployments. * @param SetUpFeedbackResourcesFolderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-setupfeedbackresourcesfolder?view=graph-rest-1.0 Find more info here */ public function post(?SetUpFeedbackResourcesFolderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?SetUpFeedbackResourcesFolderRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php index ccabfcc11dd..b0997eec6c5 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Create a SharePoint folder to upload files for a given educationAssignment. Only teachers can perform this operation. The teacher determines the resources to upload in the assignment's folder. This API is available in the following national cloud deployments. * @param SetUpResourcesFolderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-setupresourcesfolder?view=graph-rest-1.0 Find more info here */ public function post(?SetUpResourcesFolderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?SetUpResourcesFolderRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Count/CountRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Count/CountRequestBuilder.php index 3a07cfee69e..7b75dfbc2d3 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/EducationSubmissionItemRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/EducationSubmissionItemRequestBuilder.php index c0ce6dd3b81..d2ee7f7380c 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/EducationSubmissionItemRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/EducationSubmissionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Submissions\Item\EscapedReturn\ReturnRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Submissions\Item\Outcomes\OutcomesRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Submissions\Item\Reassign\ReassignRequestBuilder; @@ -98,57 +97,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property submissions for education * @param EducationSubmissionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EducationSubmissionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a particular submission. Only teachers, students, and applications with application permissions can perform this operation. A submission object represents a student's work for an assignment. Resources associated with the submission represent this work. Only the assignedTo student can see and modify the submission. A teacher or application with application permissions has full access to all submissions. The grade and feedback from a teacher are part of the educationOutcome associated with this object. Only teachers or applications with application permissions can add or change grades and feedback. Students will not see the grade or feedback until the assignment has been released. This API is available in the following national cloud deployments. * @param EducationSubmissionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationSubmissionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property submissions in education * @param EducationSubmission $body The request body * @param EducationSubmissionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationSubmission $body, ?EducationSubmissionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -165,6 +155,7 @@ public function toDeleteRequestInformation(?EducationSubmissionItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -178,7 +169,6 @@ public function toGetRequestInformation(?EducationSubmissionItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -186,6 +176,7 @@ public function toGetRequestInformation(?EducationSubmissionItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -200,11 +191,11 @@ public function toPatchRequestInformation(EducationSubmission $body, ?EducationS $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/EscapedReturn/ReturnRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/EscapedReturn/ReturnRequestBuilder.php index af1c6adc92c..eac060b76e5 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/EscapedReturn/ReturnRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/EscapedReturn/ReturnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Make the grade and feedback associated with this submission available to the student. This action changes the status of the submission from 'submitted' to 'returned' and indicates that feedback is provided or grading is done. This action can only be done by the teacher. This API is available in the following national cloud deployments. * @param ReturnRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-return?view=graph-rest-1.0 Find more info here */ public function post(?ReturnRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ReturnRequestBuilderPostRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Outcomes/Count/CountRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Outcomes/Count/CountRequestBuilder.php index bc2482adcde..301c4be5b9f 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Outcomes/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Outcomes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Outcomes/Item/EducationOutcomeItemRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Outcomes/Item/EducationOutcomeItemRequestBuilder.php index 8e63c0d45db..9a7851eecd1 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Outcomes/Item/EducationOutcomeItemRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Outcomes/Item/EducationOutcomeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationOutcome; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a feedback resource from a submission. This can only be done by a teacher. This API is available in the following national cloud deployments. * @param EducationOutcomeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationfeedbackresourceoutcome-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationOutcomeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get outcomes from education * @param EducationOutcomeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EducationOutcomeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an educationOutcome object. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param EducationOutcome $body The request body * @param EducationOutcomeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationoutcome-update?view=graph-rest-1.0 Find more info here */ public function patch(EducationOutcome $body, ?EducationOutcomeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?EducationOutcomeItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?EducationOutcomeItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?EducationOutcomeItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(EducationOutcome $body, ?EducationOutc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Outcomes/OutcomesRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Outcomes/OutcomesRequestBuilder.php index d890dd34681..c571bf7eeaf 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Outcomes/OutcomesRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Outcomes/OutcomesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Submissions\Item\Outcomes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Submissions\Item\Outcomes\Item\EducationOutcomeItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationOutcome; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of educationOutcome objects. There are four types of outcomes: educationPointsOutcome, educationFeedbackOutcome, educationRubricOutcome, and educationFeedbackResourceOutcome. Only teachers, students, and applications with application permissions can perform this operation. A submission for a credit assignment (one that has no point value and no rubric) will have an educationFeedbackOutcome. (It might also return an educationPointsOutcome, but that outcome is ignored.) A submission for a points assignment (one that has a point value assigned) will have both an educationFeedbackOutcome and an educationPointsOutcome. A submission for an assignment with an attached rubric, if the rubric is a credit rubric (no points), will have an educationFeedbackOutcome and an educationRubricOutcome. (It might also return an educationPointsOutcome, but that outcome is ignored.) A submission for an assignment with an attached rubric, if the rubric is a points rubric, will have an educationFeedbackOutcome, an educationPointsOutcome, and an educationRubricOutcome. A submission for a feedback resource will have an educationFeedbackResourceOutcome. All outcome types have a regular and a published property appropriate to that type of outcome; for example, points and publishedPoints, feedback and publishedFeedback. The regular property is the most recent value updated by the teacher; the published property is the most recent value returned to the student. This API is available in the following national cloud deployments. * @param OutcomesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-list-outcomes?view=graph-rest-1.0 Find more info here */ public function get(?OutcomesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcomeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcomeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new feedback resource for a submission. Only a teacher can perform this operation. To create a new file-based resource, upload the file to the feedback resources folder associated with the assignment. If the file doesn't exist or isn't in that folder, the POST request will fail. This API is available in the following national cloud deployments. * @param EducationOutcome $body The request body * @param OutcomesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationfeedbackresourceoutcome-post-outcomes?view=graph-rest-1.0 Find more info here */ public function post(EducationOutcome $body, ?OutcomesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationOutcome::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OutcomesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OutcomesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EducationOutcome $body, ?OutcomesReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Reassign/ReassignRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Reassign/ReassignRequestBuilder.php index a7fd00f0cdb..129fe3f9423 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Reassign/ReassignRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Reassign/ReassignRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reassign the submission to the student with feedback for review. Only teachers can perform this action. Include the Prefer: include-unknown-enum-members header when you call this method; otherwise, a reassigned submission will be treated as a returned submission. This means that the reassigned status will be mapped to the returned status, and reassignedDateTime and reassignedBy properties will be mapped to returnedDateTime and returnedBy respectively. If the header Prefer: include-unknown-enum-members is provided, a reassigned submission retains the reassigned status. For details, see the examples section. This API is available in the following national cloud deployments. * @param ReassignRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-reassign?view=graph-rest-1.0 Find more info here */ public function post(?ReassignRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ReassignRequestBuilderPostRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Resources/Count/CountRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Resources/Count/CountRequestBuilder.php index 435897df354..7ae0a1a6b49 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Resources/Item/EducationSubmissionResourceItemRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Resources/Item/EducationSubmissionResourceItemRequestBuilder.php index 15fb395c399..f926a52ef1b 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Resources/Item/EducationSubmissionResourceItemRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Resources/Item/EducationSubmissionResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmissionResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an educationSubmissionResource from the submission. Only teachers and students can perform this operation. If the resource was copied from the assignment, a new copy of the resource will be created after the current copy is deleted. This allows you to 'reset' the resource to its original state. If the resource wasn't copied from the assignment but was added from the student, the resource is deleted. This API is available in the following national cloud deployments. * @param EducationSubmissionResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmissionresource-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationSubmissionResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of a specific resource associated with a submission. Only teachers, students, and applications with application permissions can perform this operation. This resource is in the 'working' resource list and should be considered work in process by a student. This resource is wrapped with a possible pointer back to the assignment resource if it was copied from the assignment. This API is available in the following national cloud deployments. * @param EducationSubmissionResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmissionresource-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationSubmissionResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in education * @param EducationSubmissionResource $body The request body * @param EducationSubmissionResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationSubmissionResource $body, ?EducationSubmissionResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?EducationSubmissionResourceItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?EducationSubmissionResourceItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?EducationSubmissionResourceItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(EducationSubmissionResource $body, ?Ed $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Resources/ResourcesRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Resources/ResourcesRequestBuilder.php index 794b4e601c5..d6f495fee8f 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Submissions\Item\Resources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Submissions\Item\Resources\Item\EducationSubmissionResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationSubmissionResource; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the resources associated with a submission. Only teachers, students, and applications with application permissions can perform this operation. The educationSubmissionResource object is a wrapper around the actual resource object the student is working on. The wrapper also includes a pointer to the resources on the assignment if this was copied from the assignment during the assign process. These resources are the working copy of the assignment. The submittedResources are the resources that have officially been submitted to be graded. This API is available in the following national cloud deployments. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-list-resources?view=graph-rest-1.0 Find more info here */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add an educationSubmissionResource to a submission resource list. Only teachers and students can perform this operation. The operation will not succeed if the allowStudentsToAddResources flag is not set to true. To create a new file-based resource, upload the file to the resources folder associated with the submission. If the file doesn't exist or is not in that folder, the POST request will fail. This API is available in the following national cloud deployments. * @param EducationSubmissionResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-post-resources?view=graph-rest-1.0 Find more info here */ public function post(EducationSubmissionResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EducationSubmissionResource $body, ?Res $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php index fe6d34e2a70..c52411875a1 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SetUpResourcesFolder/SetUpResourcesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Trigger the creation of the SharePoint resource folder where all file-based resources (Word, Excel, and so on) should be uploaded for a given submission. Only teachers and students can perform this operation. Note that files must be located in this folder in order to be added as resources. Only a student in the class can determine what files to upload in a given submission-level resource folder. This API is available in the following national cloud deployments. * @param SetUpResourcesFolderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-setupresourcesfolder?view=graph-rest-1.0 Find more info here */ public function post(?SetUpResourcesFolderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?SetUpResourcesFolderRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Submit/SubmitRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Submit/SubmitRequestBuilder.php index 7f09aa62ff2..b562582d65a 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Submit/SubmitRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Submit/SubmitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Indicate that a student is done with the work and is ready to hand in the assignment. Only teachers, students, and applications with application permissions can perform this operation. This method changes the status of the submission from working to submitted. During the submit process, all the resources are copied to the submittedResources bucket. The teacher will be looking at the submitted resources list for grading. A teacher can also submit a student's assignment on their behalf. This API is available in the following national cloud deployments. * @param SubmitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-submit?view=graph-rest-1.0 Find more info here */ public function post(?SubmitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?SubmitRequestBuilderPostRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SubmittedResources/Count/CountRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SubmittedResources/Count/CountRequestBuilder.php index 63a8119b736..fdb3135a72b 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SubmittedResources/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SubmittedResources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SubmittedResources/Item/EducationSubmissionResourceItemRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SubmittedResources/Item/EducationSubmissionResourceItemRequestBuilder.php index e5704c6ffc7..fe528128454 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SubmittedResources/Item/EducationSubmissionResourceItemRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SubmittedResources/Item/EducationSubmissionResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmissionResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property submittedResources for education * @param EducationSubmissionResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EducationSubmissionResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a submitted resource. Only teachers, students, and applications with application permissions can perform this operation. Resources are available to a teacher or an application with application permissions after a student submits it, and are available to the student after the teacher returns the submission. Teachers can leave notes in some resources. This API is available in the following national cloud deployments. * @param EducationSubmissionResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmittedsubmissionresource-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationSubmissionResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property submittedResources in education * @param EducationSubmissionResource $body The request body * @param EducationSubmissionResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EducationSubmissionResource $body, ?EducationSubmissionResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?EducationSubmissionResourceItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?EducationSubmissionResourceItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?EducationSubmissionResourceItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(EducationSubmissionResource $body, ?Ed $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SubmittedResources/SubmittedResourcesRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SubmittedResources/SubmittedResourcesRequestBuilder.php index b5c24d6cdcc..608252072c4 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SubmittedResources/SubmittedResourcesRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/SubmittedResources/SubmittedResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Submissions\Item\SubmittedResources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Submissions\Item\SubmittedResources\Item\EducationSubmissionResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationSubmissionResource; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the educationSubmissionResource objects that have officially been submitted for grading. Only teachers, students, and applications with application permissions can perform this operation. The student who owns the submission cannot change the submitted list without resubmitting the assignment. This is a wrapper around the real resource and can contain a pointer back to the actual assignment resource if this resource was copied from the assignment. This API is available in the following national cloud deployments. * @param SubmittedResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-list-submittedresources?view=graph-rest-1.0 Find more info here */ public function get(?SubmittedResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to submittedResources for education * @param EducationSubmissionResource $body The request body * @param SubmittedResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EducationSubmissionResource $body, ?SubmittedResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SubmittedResourcesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SubmittedResourcesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(EducationSubmissionResource $body, ?Sub $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Unsubmit/UnsubmitRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Unsubmit/UnsubmitRequestBuilder.php index 61d64ff18b2..ff9902ac8fc 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Unsubmit/UnsubmitRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/Item/Unsubmit/UnsubmitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSubmission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Indicate that a student wants to work on the submission of the assignment after it was turned in. Only teachers, students, and applications with application permissions can perform this operation. This method changes the status of the submission from submitted to working. During the submit process, all the resources are copied from submittedResources to workingResources. The teacher will be looking at the working resources list for grading. A teacher can also unsubmit a student's assignment on their behalf. This API is available in the following national cloud deployments. * @param UnsubmitRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationsubmission-unsubmit?view=graph-rest-1.0 Find more info here */ public function post(?UnsubmitRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?UnsubmitRequestBuilderPostRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/SubmissionsRequestBuilder.php b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/SubmissionsRequestBuilder.php index 52422581b13..85b54b111d5 100644 --- a/src/Generated/Education/Users/Item/Assignments/Item/Submissions/SubmissionsRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Assignments/Item/Submissions/SubmissionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Submissions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\Item\Submissions\Item\EducationSubmissionItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationSubmission; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the submissions associated with an assignment. Only teachers, students, and applications with application permissions can perform this operation. A teacher or an application with application permissions can get all the submissions while a student can only get submissions that they are associated with. This API is available in the following national cloud deployments. * @param SubmissionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationassignment-list-submissions?view=graph-rest-1.0 Find more info here */ public function get(?SubmissionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to submissions for education * @param EducationSubmission $body The request body * @param SubmissionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EducationSubmission $body, ?SubmissionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSubmission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SubmissionsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SubmissionsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(EducationSubmission $body, ?Submissions $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Classes/ClassesRequestBuilder.php b/src/Generated/Education/Users/Item/Classes/ClassesRequestBuilder.php index 81a235022a8..7756c4d30a1 100644 --- a/src/Generated/Education/Users/Item/Classes/ClassesRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Classes/ClassesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Classes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Classes\Item\EducationClassItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationClassCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the educationClass resources an educationUser is a member of. This API is available in the following national cloud deployments. * @param ClassesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-list-classes?view=graph-rest-1.0 Find more info here */ public function get(?ClassesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationClassCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationClassCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?ClassesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?ClassesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Classes/Count/CountRequestBuilder.php b/src/Generated/Education/Users/Item/Classes/Count/CountRequestBuilder.php index 10a647eb7cb..c9010dd6d9a 100644 --- a/src/Generated/Education/Users/Item/Classes/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Classes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Classes/Item/EducationClassItemRequestBuilder.php b/src/Generated/Education/Users/Item/Classes/Item/EducationClassItemRequestBuilder.php index 2755805028a..100c77e0328 100644 --- a/src/Generated/Education/Users/Item/Classes/Item/EducationClassItemRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Classes/Item/EducationClassItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationClass; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Classes to which the user belongs. Nullable. * @param EducationClassItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EducationClassItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EducationClassItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EducationClassItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/EducationUserItemRequestBuilder.php b/src/Generated/Education/Users/Item/EducationUserItemRequestBuilder.php index bd4e14b6ade..c52fb1c5896 100644 --- a/src/Generated/Education/Users/Item/EducationUserItemRequestBuilder.php +++ b/src/Generated/Education/Users/Item/EducationUserItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Assignments\AssignmentsRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Classes\ClassesRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Rubrics\RubricsRequestBuilder; @@ -82,59 +81,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a user. This API is available in the following national cloud deployments. * @param EducationUserItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationUserItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an educationUser object. This API is available in the following national cloud deployments. * @param EducationUserItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationUserItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an educationUser object. This API is available in the following national cloud deployments. * @param EducationUser $body The request body * @param EducationUserItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-update?view=graph-rest-1.0 Find more info here */ public function patch(EducationUser $body, ?EducationUserItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -151,6 +141,7 @@ public function toDeleteRequestInformation(?EducationUserItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -164,7 +155,6 @@ public function toGetRequestInformation(?EducationUserItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -172,6 +162,7 @@ public function toGetRequestInformation(?EducationUserItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -186,11 +177,11 @@ public function toPatchRequestInformation(EducationUser $body, ?EducationUserIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Rubrics/Count/CountRequestBuilder.php b/src/Generated/Education/Users/Item/Rubrics/Count/CountRequestBuilder.php index 2f676a5769d..fb0b31f5406 100644 --- a/src/Generated/Education/Users/Item/Rubrics/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Rubrics/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Rubrics/Item/EducationRubricItemRequestBuilder.php b/src/Generated/Education/Users/Item/Rubrics/Item/EducationRubricItemRequestBuilder.php index 456bc1780c5..3d0c90446f5 100644 --- a/src/Generated/Education/Users/Item/Rubrics/Item/EducationRubricItemRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Rubrics/Item/EducationRubricItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationRubric; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an educationRubric object. Only teachers can perform this operation. This API is available in the following national cloud deployments. * @param EducationRubricItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationrubric-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EducationRubricItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an educationRubric object. Only teachers and students can perform this operation. This API is available in the following national cloud deployments. * @param EducationRubricItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationrubric-get?view=graph-rest-1.0 Find more info here */ public function get(?EducationRubricItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an educationRubric object. Only teachers can perform this operation. Updating a rubric attached to an assignment (PATCH /education/classes/{class-id}/assignments/{assignment-id}/rubric) is only possible before the assignment is published, and what is updated is actually the original rubric that exists under /education/users/{id}/rubrics. After the assignment is published, an immutable copy of the rubric is made that is attached to that specific assignment. That rubric can be retrieved using GET /education/classes/{class-id}/assignments/{assignment-id}/rubric, but it cannot be updated. This API is available in the following national cloud deployments. * @param EducationRubric $body The request body * @param EducationRubricItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationrubric-update?view=graph-rest-1.0 Find more info here */ public function patch(EducationRubric $body, ?EducationRubricItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?EducationRubricItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?EducationRubricItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?EducationRubricItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(EducationRubric $body, ?EducationRubri $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Rubrics/RubricsRequestBuilder.php b/src/Generated/Education/Users/Item/Rubrics/RubricsRequestBuilder.php index 513392c8432..39adc518f73 100644 --- a/src/Generated/Education/Users/Item/Rubrics/RubricsRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Rubrics/RubricsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Rubrics\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Rubrics\Item\EducationRubricItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationRubric; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of educationRubric objects. This API is available in the following national cloud deployments. * @param RubricsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-list-rubrics?view=graph-rest-1.0 Find more info here */ public function get(?RubricsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubricCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubricCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new educationRubric object. This API is available in the following national cloud deployments. * @param EducationRubric $body The request body * @param RubricsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-post-rubrics?view=graph-rest-1.0 Find more info here */ public function post(EducationRubric $body, ?RubricsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationRubric::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?RubricsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?RubricsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EducationRubric $body, ?RubricsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Schools/Count/CountRequestBuilder.php b/src/Generated/Education/Users/Item/Schools/Count/CountRequestBuilder.php index 18da006ca8e..a9043a14466 100644 --- a/src/Generated/Education/Users/Item/Schools/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Schools/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Schools/Item/EducationSchoolItemRequestBuilder.php b/src/Generated/Education/Users/Item/Schools/Item/EducationSchoolItemRequestBuilder.php index 9376ce4da13..4013cb58c4f 100644 --- a/src/Generated/Education/Users/Item/Schools/Item/EducationSchoolItemRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Schools/Item/EducationSchoolItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationSchool; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Schools to which the user belongs. Nullable. * @param EducationSchoolItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EducationSchoolItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSchool::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSchool::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EducationSchoolItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EducationSchoolItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/Schools/SchoolsRequestBuilder.php b/src/Generated/Education/Users/Item/Schools/SchoolsRequestBuilder.php index 771813e2163..1166ae2e31e 100644 --- a/src/Generated/Education/Users/Item/Schools/SchoolsRequestBuilder.php +++ b/src/Generated/Education/Users/Item/Schools/SchoolsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\Schools\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\Schools\Item\EducationSchoolItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationSchoolCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of schools for a user. This API is available in the following national cloud deployments. * @param SchoolsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-list-schools?view=graph-rest-1.0 Find more info here */ public function get(?SchoolsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationSchoolCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationSchoolCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SchoolsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SchoolsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/TaughtClasses/Count/CountRequestBuilder.php b/src/Generated/Education/Users/Item/TaughtClasses/Count/CountRequestBuilder.php index e98b5648982..9fea47df437 100644 --- a/src/Generated/Education/Users/Item/TaughtClasses/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Users/Item/TaughtClasses/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/TaughtClasses/Item/EducationClassItemRequestBuilder.php b/src/Generated/Education/Users/Item/TaughtClasses/Item/EducationClassItemRequestBuilder.php index 6898df28e5d..5540095c07a 100644 --- a/src/Generated/Education/Users/Item/TaughtClasses/Item/EducationClassItemRequestBuilder.php +++ b/src/Generated/Education/Users/Item/TaughtClasses/Item/EducationClassItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EducationClass; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Classes for which the user is a teacher. * @param EducationClassItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EducationClassItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationClass::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EducationClassItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EducationClassItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/TaughtClasses/TaughtClassesRequestBuilder.php b/src/Generated/Education/Users/Item/TaughtClasses/TaughtClassesRequestBuilder.php index 5da63e91162..62443271ab5 100644 --- a/src/Generated/Education/Users/Item/TaughtClasses/TaughtClassesRequestBuilder.php +++ b/src/Generated/Education/Users/Item/TaughtClasses/TaughtClassesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\TaughtClasses\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\TaughtClasses\Item\EducationClassItemRequestBuilder; use Microsoft\Graph\Generated\Models\EducationClassCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the educationClass resources owned by an educationUser. This API is available in the following national cloud deployments. * @param TaughtClassesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-list-taughtclasses?view=graph-rest-1.0 Find more info here */ public function get(?TaughtClassesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationClassCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationClassCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?TaughtClassesRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?TaughtClassesRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/User/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Education/Users/Item/User/MailboxSettings/MailboxSettingsRequestBuilder.php index 6b90343a87f..9ce2c8f6528 100644 --- a/src/Generated/Education/Users/Item/User/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Education/Users/Item/User/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/User/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Education/Users/Item/User/ServiceProvisioningErrors/Count/CountRequestBuilder.php index a239b7d4fbc..39dc0484c84 100644 --- a/src/Generated/Education/Users/Item/User/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Education/Users/Item/User/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/User/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Education/Users/Item/User/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 6690128b6ce..7f4bae81ea0 100644 --- a/src/Generated/Education/Users/Item/User/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Education/Users/Item/User/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\User\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/Item/User/UserRequestBuilder.php b/src/Generated/Education/Users/Item/User/UserRequestBuilder.php index 8f8b488b859..96ab1d86ef9 100644 --- a/src/Generated/Education/Users/Item/User/UserRequestBuilder.php +++ b/src/Generated/Education/Users/Item/User/UserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Item\User\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\User\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,20 +49,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the simple directory user that corresponds to this educationUser. This API is available in the following national cloud deployments. * @param UserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-get-user?view=graph-rest-1.0 Find more info here */ public function get(?UserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -76,7 +72,6 @@ public function toGetRequestInformation(?UserRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -84,6 +79,7 @@ public function toGetRequestInformation(?UserRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Education/Users/UsersRequestBuilder.php b/src/Generated/Education/Users/UsersRequestBuilder.php index 029e3136096..f59f7a62eb2 100644 --- a/src/Generated/Education/Users/UsersRequestBuilder.php +++ b/src/Generated/Education/Users/UsersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Education\Users\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Education\Users\Item\EducationUserItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the educationUser objects and their properties. This API is available in the following national cloud deployments. * @param UsersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-list?view=graph-rest-1.0 Find more info here */ public function get(?UsersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new educationUser object. This API is available in the following national cloud deployments. * @param EducationUser $body The request body * @param UsersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/educationuser-post?view=graph-rest-1.0 Find more info here */ public function post(EducationUser $body, ?UsersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EducationUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EducationUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?UsersRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?UsersRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(EducationUser $body, ?UsersRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EmployeeExperience/EmployeeExperienceRequestBuilder.php b/src/Generated/EmployeeExperience/EmployeeExperienceRequestBuilder.php index a8ea22bdf83..16850ca077a 100644 --- a/src/Generated/EmployeeExperience/EmployeeExperienceRequestBuilder.php +++ b/src/Generated/EmployeeExperience/EmployeeExperienceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EmployeeExperience\LearningCourseActivities\LearningCourseActivitiesRequestBuilder; use Microsoft\Graph\Generated\EmployeeExperience\LearningProviders\LearningProvidersRequestBuilder; use Microsoft\Graph\Generated\Models\EmployeeExperience; @@ -50,38 +49,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get employeeExperience * @param EmployeeExperienceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EmployeeExperienceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EmployeeExperience::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EmployeeExperience::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update employeeExperience * @param EmployeeExperience $body The request body * @param EmployeeExperienceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EmployeeExperience $body, ?EmployeeExperienceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EmployeeExperience::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EmployeeExperience::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -94,7 +87,6 @@ public function toGetRequestInformation(?EmployeeExperienceRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -102,6 +94,7 @@ public function toGetRequestInformation(?EmployeeExperienceRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -116,11 +109,11 @@ public function toPatchRequestInformation(EmployeeExperience $body, ?EmployeeExp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EmployeeExperience/LearningCourseActivities/Count/CountRequestBuilder.php b/src/Generated/EmployeeExperience/LearningCourseActivities/Count/CountRequestBuilder.php index 991a2c19e6a..e0c3e502afa 100644 --- a/src/Generated/EmployeeExperience/LearningCourseActivities/Count/CountRequestBuilder.php +++ b/src/Generated/EmployeeExperience/LearningCourseActivities/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EmployeeExperience/LearningCourseActivities/Item/LearningCourseActivityItemRequestBuilder.php b/src/Generated/EmployeeExperience/LearningCourseActivities/Item/LearningCourseActivityItemRequestBuilder.php index 30aded9ca64..a244edabe74 100644 --- a/src/Generated/EmployeeExperience/LearningCourseActivities/Item/LearningCourseActivityItemRequestBuilder.php +++ b/src/Generated/EmployeeExperience/LearningCourseActivities/Item/LearningCourseActivityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LearningCourseActivity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property learningCourseActivities for employeeExperience * @param LearningCourseActivityItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LearningCourseActivityItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the specified learningCourseActivity object using either an ID or an externalCourseActivityId of the learning provider, or a courseActivityId of a user. This API is available in the following national cloud deployments. * @param LearningCourseActivityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/learningcourseactivity-get?view=graph-rest-1.0 Find more info here */ public function get(?LearningCourseActivityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property learningCourseActivities in employeeExperience * @param LearningCourseActivity $body The request body * @param LearningCourseActivityItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(LearningCourseActivity $body, ?LearningCourseActivityItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?LearningCourseActivityItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?LearningCourseActivityItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?LearningCourseActivityItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(LearningCourseActivity $body, ?Learnin $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EmployeeExperience/LearningCourseActivities/LearningCourseActivitiesRequestBuilder.php b/src/Generated/EmployeeExperience/LearningCourseActivities/LearningCourseActivitiesRequestBuilder.php index 6b5f78398d4..d33ae4d86ca 100644 --- a/src/Generated/EmployeeExperience/LearningCourseActivities/LearningCourseActivitiesRequestBuilder.php +++ b/src/Generated/EmployeeExperience/LearningCourseActivities/LearningCourseActivitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EmployeeExperience\LearningCourseActivities\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EmployeeExperience\LearningCourseActivities\Item\LearningCourseActivityItemRequestBuilder; use Microsoft\Graph\Generated\Models\LearningCourseActivity; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the specified learningCourseActivity object using either an ID or an externalCourseActivityId of the learning provider, or a courseActivityId of a user. This API is available in the following national cloud deployments. * @param LearningCourseActivitiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LearningCourseActivitiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to learningCourseActivities for employeeExperience * @param LearningCourseActivity $body The request body * @param LearningCourseActivitiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LearningCourseActivity $body, ?LearningCourseActivitiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?LearningCourseActivitiesRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?LearningCourseActivitiesRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(LearningCourseActivity $body, ?Learning $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EmployeeExperience/LearningProviders/Count/CountRequestBuilder.php b/src/Generated/EmployeeExperience/LearningProviders/Count/CountRequestBuilder.php index 1d3c9673100..3ebecd1dfbe 100644 --- a/src/Generated/EmployeeExperience/LearningProviders/Count/CountRequestBuilder.php +++ b/src/Generated/EmployeeExperience/LearningProviders/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningContents/Count/CountRequestBuilder.php b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningContents/Count/CountRequestBuilder.php index fc7a17e0c14..902b114e4e6 100644 --- a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningContents/Count/CountRequestBuilder.php +++ b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningContents/Item/LearningContentItemRequestBuilder.php b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningContents/Item/LearningContentItemRequestBuilder.php index 4bc889f4022..39afa0a04e0 100644 --- a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningContents/Item/LearningContentItemRequestBuilder.php +++ b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningContents/Item/LearningContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LearningContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the specified learningContent resource that represents the metadata of the specified provider's ingested content. * @param LearningContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/learningprovider-delete-learningcontents?view=graph-rest-1.0 Find more info here */ public function delete(?LearningContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the specified learningContent resource which represents the metadata of the specified provider's ingested content. This API is available in the following national cloud deployments. * @param LearningContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/learningcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?LearningContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property learningContents in employeeExperience * @param LearningContent $body The request body * @param LearningContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(LearningContent $body, ?LearningContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?LearningContentItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?LearningContentItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?LearningContentItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(LearningContent $body, ?LearningConten $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningContents/LearningContentsRequestBuilder.php b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningContents/LearningContentsRequestBuilder.php index a23004152f6..90122a22d14 100644 --- a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningContents/LearningContentsRequestBuilder.php +++ b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningContents/LearningContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EmployeeExperience\LearningProviders\Item\LearningContents\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EmployeeExperience\LearningProviders\Item\LearningContents\Item\LearningContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\LearningContent; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the learningContent resources and their properties. This list represents the metadata of the specified provider's content in Viva Learning. This API is available in the following national cloud deployments. * @param LearningContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/learningprovider-list-learningcontents?view=graph-rest-1.0 Find more info here */ public function get(?LearningContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to learningContents for employeeExperience * @param LearningContent $body The request body * @param LearningContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LearningContent $body, ?LearningContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?LearningContentsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?LearningContentsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(LearningContent $body, ?LearningContent $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningCourseActivities/Count/CountRequestBuilder.php b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningCourseActivities/Count/CountRequestBuilder.php index 5ef09cfcf8f..ea69b396d18 100644 --- a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningCourseActivities/Count/CountRequestBuilder.php +++ b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningCourseActivities/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningCourseActivities/Item/LearningCourseActivityItemRequestBuilder.php b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningCourseActivities/Item/LearningCourseActivityItemRequestBuilder.php index 99149d90827..96e1ef39c48 100644 --- a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningCourseActivities/Item/LearningCourseActivityItemRequestBuilder.php +++ b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningCourseActivities/Item/LearningCourseActivityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LearningCourseActivity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a learningCourseActivity object by using the course activity ID of either an assignment or a self-initiated activity. This API is available in the following national cloud deployments. * @param LearningCourseActivityItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/learningcourseactivity-delete?view=graph-rest-1.0 Find more info here */ public function delete(?LearningCourseActivityItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get learningCourseActivities from employeeExperience * @param LearningCourseActivityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LearningCourseActivityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a learningCourseActivity object. This API is available in the following national cloud deployments. * @param LearningCourseActivity $body The request body * @param LearningCourseActivityItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/learningcourseactivity-update?view=graph-rest-1.0 Find more info here */ public function patch(LearningCourseActivity $body, ?LearningCourseActivityItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?LearningCourseActivityItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?LearningCourseActivityItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?LearningCourseActivityItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(LearningCourseActivity $body, ?Learnin $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningCourseActivities/LearningCourseActivitiesRequestBuilder.php b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningCourseActivities/LearningCourseActivitiesRequestBuilder.php index 61a85c52628..118b5f4e359 100644 --- a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningCourseActivities/LearningCourseActivitiesRequestBuilder.php +++ b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningCourseActivities/LearningCourseActivitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EmployeeExperience\LearningProviders\Item\LearningCourseActivities\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EmployeeExperience\LearningProviders\Item\LearningCourseActivities\Item\LearningCourseActivityItemRequestBuilder; use Microsoft\Graph\Generated\Models\LearningCourseActivity; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get learningCourseActivities from employeeExperience * @param LearningCourseActivitiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LearningCourseActivitiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new learningCourseActivity object. A learning course activity can be one of two types: - Assignment- Self-initiated Use this method to create either type of activity. This API is available in the following national cloud deployments. * @param LearningCourseActivity $body The request body * @param LearningCourseActivitiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/employeeexperienceuser-post-learningcourseactivities?view=graph-rest-1.0 Find more info here */ public function post(LearningCourseActivity $body, ?LearningCourseActivitiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?LearningCourseActivitiesRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?LearningCourseActivitiesRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(LearningCourseActivity $body, ?Learning $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningProviderItemRequestBuilder.php b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningProviderItemRequestBuilder.php index 26c56891ddb..cec295747d2 100644 --- a/src/Generated/EmployeeExperience/LearningProviders/Item/LearningProviderItemRequestBuilder.php +++ b/src/Generated/EmployeeExperience/LearningProviders/Item/LearningProviderItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EmployeeExperience\LearningProviders\Item\LearningContents\LearningContentsRequestBuilder; use Microsoft\Graph\Generated\EmployeeExperience\LearningProviders\Item\LearningCourseActivities\LearningCourseActivitiesRequestBuilder; use Microsoft\Graph\Generated\Models\LearningProvider; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a learningProvider resource and remove its registration in Viva Learning for a tenant. * @param LearningProviderItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/employeeexperience-delete-learningproviders?view=graph-rest-1.0 Find more info here */ public function delete(?LearningProviderItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a learningProvider object. This API is available in the following national cloud deployments. * @param LearningProviderItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/learningprovider-get?view=graph-rest-1.0 Find more info here */ public function get(?LearningProviderItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningProvider::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningProvider::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a learningProvider object. This API is available in the following national cloud deployments. * @param LearningProvider $body The request body * @param LearningProviderItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/learningprovider-update?view=graph-rest-1.0 Find more info here */ public function patch(LearningProvider $body, ?LearningProviderItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningProvider::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningProvider::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?LearningProviderItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?LearningProviderItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?LearningProviderItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(LearningProvider $body, ?LearningProvi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EmployeeExperience/LearningProviders/LearningProvidersRequestBuilder.php b/src/Generated/EmployeeExperience/LearningProviders/LearningProvidersRequestBuilder.php index fd4d8ddd10a..e6015d2eac9 100644 --- a/src/Generated/EmployeeExperience/LearningProviders/LearningProvidersRequestBuilder.php +++ b/src/Generated/EmployeeExperience/LearningProviders/LearningProvidersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EmployeeExperience\LearningProviders\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EmployeeExperience\LearningProviders\Item\LearningProviderItemRequestBuilder; use Microsoft\Graph\Generated\Models\LearningProvider; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the learningProvider resources registered in Viva Learning for a tenant. This API is available in the following national cloud deployments. * @param LearningProvidersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/employeeexperience-list-learningproviders?view=graph-rest-1.0 Find more info here */ public function get(?LearningProvidersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningProviderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningProviderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new learningProvider object and register it with Viva Learning using the specified display name and logos for different themes. This API is available in the following national cloud deployments. * @param LearningProvider $body The request body * @param LearningProvidersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/employeeexperience-post-learningproviders?view=graph-rest-1.0 Find more info here */ public function post(LearningProvider $body, ?LearningProvidersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningProvider::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningProvider::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?LearningProvidersRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?LearningProvidersRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(LearningProvider $body, ?LearningProvid $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Connectors/ConnectorsRequestBuilder.php b/src/Generated/EscapedPrint/Connectors/ConnectorsRequestBuilder.php index ee1244005e4..29e734d861c 100644 --- a/src/Generated/EscapedPrint/Connectors/ConnectorsRequestBuilder.php +++ b/src/Generated/EscapedPrint/Connectors/ConnectorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Connectors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Connectors\Item\PrintConnectorItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of print connectors. This API is available in the following national cloud deployments. * @param ConnectorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/print-list-connectors?view=graph-rest-1.0 Find more info here */ public function get(?ConnectorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintConnectorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintConnectorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to connectors for print * @param PrintConnector $body The request body * @param ConnectorsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintConnector $body, ?ConnectorsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ConnectorsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ConnectorsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PrintConnector $body, ?ConnectorsReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Connectors/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Connectors/Count/CountRequestBuilder.php index 624b281e04b..e153a383d4e 100644 --- a/src/Generated/EscapedPrint/Connectors/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Connectors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Connectors/Item/PrintConnectorItemRequestBuilder.php b/src/Generated/EscapedPrint/Connectors/Item/PrintConnectorItemRequestBuilder.php index c3c18b403d9..afd74f3f28a 100644 --- a/src/Generated/EscapedPrint/Connectors/Item/PrintConnectorItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Connectors/Item/PrintConnectorItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintConnector; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete (unregister) a printConnector. This API is available in the following national cloud deployments. * @param PrintConnectorItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printconnector-delete?view=graph-rest-1.0 Find more info here */ public function delete(?PrintConnectorItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a printConnector object. This API is available in the following national cloud deployments. * @param PrintConnectorItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printconnector-get?view=graph-rest-1.0 Find more info here */ public function get(?PrintConnectorItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a printConnector object. This API is available in the following national cloud deployments. * @param PrintConnector $body The request body * @param PrintConnectorItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printconnector-update?view=graph-rest-1.0 Find more info here */ public function patch(PrintConnector $body, ?PrintConnectorItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?PrintConnectorItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?PrintConnectorItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?PrintConnectorItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(PrintConnector $body, ?PrintConnectorI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Operations/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Operations/Count/CountRequestBuilder.php index 4bfdf3cf52f..718a93a499e 100644 --- a/src/Generated/EscapedPrint/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Operations/Item/PrintOperationItemRequestBuilder.php b/src/Generated/EscapedPrint/Operations/Item/PrintOperationItemRequestBuilder.php index 3b16b942b62..0137656ab1b 100644 --- a/src/Generated/EscapedPrint/Operations/Item/PrintOperationItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Operations/Item/PrintOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for print * @param PrintOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a printOperation object. This API is available in the following national cloud deployments. * @param PrintOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?PrintOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in print * @param PrintOperation $body The request body * @param PrintOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintOperation $body, ?PrintOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?PrintOperationItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?PrintOperationItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?PrintOperationItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(PrintOperation $body, ?PrintOperationI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Operations/OperationsRequestBuilder.php b/src/Generated/EscapedPrint/Operations/OperationsRequestBuilder.php index 6df94e97595..1ba986337d7 100644 --- a/src/Generated/EscapedPrint/Operations/OperationsRequestBuilder.php +++ b/src/Generated/EscapedPrint/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Operations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Operations\Item\PrintOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of a printOperation object. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for print * @param PrintOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(PrintOperation $body, ?OperationsReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/PrintRequestBuilder.php b/src/Generated/EscapedPrint/PrintRequestBuilder.php index 978c3b699d3..787aa0eeb72 100644 --- a/src/Generated/EscapedPrint/PrintRequestBuilder.php +++ b/src/Generated/EscapedPrint/PrintRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Connectors\ConnectorsRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Operations\OperationsRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\PrintersRequestBuilder; @@ -82,38 +81,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get print * @param PrintRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrintRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EscapedPrint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EscapedPrint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update print * @param EscapedPrint $body The request body * @param PrintRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EscapedPrint $body, ?PrintRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EscapedPrint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EscapedPrint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -126,7 +119,6 @@ public function toGetRequestInformation(?PrintRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -134,6 +126,7 @@ public function toGetRequestInformation(?PrintRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -148,11 +141,11 @@ public function toPatchRequestInformation(EscapedPrint $body, ?PrintRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Count/CountRequestBuilder.php index 4ac8189ebb4..d4d38458935 100644 --- a/src/Generated/EscapedPrint/Printers/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Create/CreateRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Create/CreateRequestBuilder.php index 6b772e6155f..2a9aa619dc8 100644 --- a/src/Generated/EscapedPrint/Printers/Create/CreateRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Create/CreateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create (register) a printer with the Universal Print service. This is a long-running operation and as such, it returns a printerCreateOperation that can be used to track and verify the registration of the printer. For help creating the required Certificate Signing Request (CSR) for creating printer, see the CSR generation code sample. This API is available in the following national cloud deployments. * @param CreatePostRequestBody $body The request body * @param CreateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printer-create?view=graph-rest-1.0 Find more info here */ public function post(CreatePostRequestBody $body, ?CreateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CreatePostRequestBody $body, ?CreateReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Connectors/ConnectorsRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Connectors/ConnectorsRequestBuilder.php index 766bde58f60..7e218b8feeb 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Connectors/ConnectorsRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Connectors/ConnectorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Connectors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Connectors\Item\PrintConnectorItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of printConnectors associated with the printer. This API is available in the following national cloud deployments. * @param ConnectorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printer-list-connectors?view=graph-rest-1.0 Find more info here */ public function get(?ConnectorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintConnectorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintConnectorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?ConnectorsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?ConnectorsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Connectors/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Connectors/Count/CountRequestBuilder.php index cc2f59b75fe..d1b7165bc91 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Connectors/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Connectors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Connectors/Item/PrintConnectorItemRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Connectors/Item/PrintConnectorItemRequestBuilder.php index dd705931807..383e8420c33 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Connectors/Item/PrintConnectorItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Connectors/Item/PrintConnectorItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintConnector; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The connectors that are associated with the printer. * @param PrintConnectorItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrintConnectorItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrintConnectorItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrintConnectorItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Count/CountRequestBuilder.php index 63efc66aea7..16b2f2d5a9a 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Abort/AbortRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Abort/AbortRequestBuilder.php index 8a81d6bebdf..e72fdf4be4f 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Abort/AbortRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Abort/AbortRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Abort a print job. Only applications using application permissions can abort a print job. Aborting a print job will only succeed if there is a printTask in a processing state on the associated print job, started by a trigger that the requesting app created. For details about how to register a task trigger, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param AbortPostRequestBody $body The request body * @param AbortRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printjob-abort?view=graph-rest-1.0 Find more info here */ public function post(AbortPostRequestBody $body, ?AbortRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AbortPostRequestBody $body, ?AbortReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Cancel/CancelRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Cancel/CancelRequestBuilder.php index b159c127195..f5be6afc7fa 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Cancel a print job. Print jobs can be canceled only on behalf of a user, using delegated permissions. This API is available in the following national cloud deployments. * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printjob-cancel?view=graph-rest-1.0 Find more info here */ public function post(?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CancelRequestBuilderPostRequestConfigu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Count/CountRequestBuilder.php index fc736a4cfcb..92703073820 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/DocumentsRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/DocumentsRequestBuilder.php index 05886a840d5..49f9bb08c88 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/DocumentsRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/DocumentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\Item\Documents\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\Item\Documents\Item\PrintDocumentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get documents from print * @param DocumentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DocumentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintDocumentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintDocumentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to documents for print * @param PrintDocument $body The request body * @param DocumentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintDocument $body, ?DocumentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintDocument::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintDocument::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DocumentsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DocumentsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(PrintDocument $body, ?DocumentsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Item/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Item/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 95fbe11efdc..0abbab3c7bc 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Item/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Item/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a binary file linked to the print document. As part of the response, this action returns an upload URL that can be used in subsequent sequential PUT queries. Request headers for each PUT operation can be used to specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printdocument-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Item/PrintDocumentItemRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Item/PrintDocumentItemRequestBuilder.php index 5e78272c609..57597587d9d 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Item/PrintDocumentItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Item/PrintDocumentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\Item\Documents\Item\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\Item\Documents\Item\Value\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property documents for print * @param PrintDocumentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintDocumentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get documents from print * @param PrintDocumentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrintDocumentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintDocument::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintDocument::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property documents in print * @param PrintDocument $body The request body * @param PrintDocumentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintDocument $body, ?PrintDocumentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintDocument::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintDocument::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?PrintDocumentItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?PrintDocumentItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?PrintDocumentItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(PrintDocument $body, ?PrintDocumentIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Item/Value/ContentRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Item/Value/ContentRequestBuilder.php index e8c19173329..e6f05a6d954 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Documents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,38 +33,36 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property documents from print * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property documents in print * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -82,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -100,7 +98,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/PrintJobItemRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/PrintJobItemRequestBuilder.php index ac55a94ad53..cdaf260434e 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/PrintJobItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/PrintJobItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\Item\Abort\AbortRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\Item\Cancel\CancelRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\Item\Documents\DocumentsRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property jobs for print * @param PrintJobItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintJobItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of jobs that are queued for printing by the printer/printerShare. * @param PrintJobItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrintJobItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property jobs in print * @param PrintJob $body The request body * @param PrintJobItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintJob $body, ?PrintJobItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?PrintJobItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?PrintJobItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?PrintJobItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(PrintJob $body, ?PrintJobItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Redirect/RedirectRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Redirect/RedirectRequestBuilder.php index 7e0f720dbba..ae691be533f 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Redirect/RedirectRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Redirect/RedirectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintJob; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Redirect a print job to a different printer. Redirecting a print job will only succeed if there is a printTask in a processing state on the associated print job, started by a trigger that the requesting app created. For details about how to use this API to add pull printing support to Universal Print, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param RedirectPostRequestBody $body The request body * @param RedirectRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printjob-redirect?view=graph-rest-1.0 Find more info here */ public function post(RedirectPostRequestBody $body, ?RedirectRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(RedirectPostRequestBody $body, ?Redirec $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Start/StartRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Start/StartRequestBuilder.php index fa338b6709d..437715551d7 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Start/StartRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Start/StartRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintJobStatus; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Submits the print job to the associated printer or printerShare. It will be printed after any existing pending jobs are completed, aborted, or canceled. This API is available in the following national cloud deployments. * @param StartRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printjob-start?view=graph-rest-1.0 Find more info here */ public function post(?StartRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintJobStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintJobStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?StartRequestBuilderPostRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Count/CountRequestBuilder.php index 75ed8c99a3d..c170479fc69 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Item/Definition/DefinitionRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Item/Definition/DefinitionRequestBuilder.php index 0cc32404057..573c5b0cbd3 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Item/Definition/DefinitionRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Item/Definition/DefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintTaskDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The printTaskDefinition that was used to create this task. Read-only. * @param DefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DefinitionRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DefinitionRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Item/PrintTaskItemRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Item/PrintTaskItemRequestBuilder.php index 2dfe0445c55..0e903706aff 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Item/PrintTaskItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Item/PrintTaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\Item\Tasks\Item\Definition\DefinitionRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\Item\Tasks\Item\Trigger\TriggerRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for print * @param PrintTaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintTaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A list of printTasks that were triggered by this print job. * @param PrintTaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrintTaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in print * @param PrintTask $body The request body * @param PrintTaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintTask $body, ?PrintTaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?PrintTaskItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?PrintTaskItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?PrintTaskItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(PrintTask $body, ?PrintTaskItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Item/Trigger/TriggerRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Item/Trigger/TriggerRequestBuilder.php index 144d7d64e5a..69d77621580 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Item/Trigger/TriggerRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/Item/Trigger/TriggerRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintTaskTrigger; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The printTaskTrigger that triggered this task's execution. Read-only. * @param TriggerRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TriggerRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTrigger::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTrigger::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TriggerRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TriggerRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/TasksRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/TasksRequestBuilder.php index 3acb3f7f663..747deca25ab 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\Item\Tasks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\Item\Tasks\Item\PrintTaskItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A list of printTasks that were triggered by this print job. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for print * @param PrintTask $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintTask $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(PrintTask $body, ?TasksRequestBuilderPo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Jobs/JobsRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Jobs/JobsRequestBuilder.php index 9ab184327f4..323c8029555 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Jobs/JobsRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Jobs/JobsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\Item\PrintJobItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of jobs that are queued for printing by the printer/printerShare. * @param JobsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?JobsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintJobCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintJobCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to jobs for print * @param PrintJob $body The request body * @param JobsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintJob $body, ?JobsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?JobsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?JobsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(PrintJob $body, ?JobsRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/PrinterItemRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/PrinterItemRequestBuilder.php index a9d7988d685..af3ed2dbd00 100644 --- a/src/Generated/EscapedPrint/Printers/Item/PrinterItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/PrinterItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Connectors\ConnectorsRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Jobs\JobsRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\RestoreFactoryDefaults\RestoreFactoryDefaultsRequestBuilder; @@ -74,59 +73,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete (unregister) a printer. This API is available in the following national cloud deployments. * @param PrinterItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printer-delete?view=graph-rest-1.0 Find more info here */ public function delete(?PrinterItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a printer object. This API is available in the following national cloud deployments. * @param PrinterItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printer-get?view=graph-rest-1.0 Find more info here */ public function get(?PrinterItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Printer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Printer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a printer object. This API is available in the following national cloud deployments. * @param Printer $body The request body * @param PrinterItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printer-update?view=graph-rest-1.0 Find more info here */ public function patch(Printer $body, ?PrinterItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Printer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Printer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -143,6 +133,7 @@ public function toDeleteRequestInformation(?PrinterItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -156,7 +147,6 @@ public function toGetRequestInformation(?PrinterItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -164,6 +154,7 @@ public function toGetRequestInformation(?PrinterItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -178,11 +169,11 @@ public function toPatchRequestInformation(Printer $body, ?PrinterItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/RestoreFactoryDefaults/RestoreFactoryDefaultsRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/RestoreFactoryDefaults/RestoreFactoryDefaultsRequestBuilder.php index 56c61fce01a..0dcdac2bf82 100644 --- a/src/Generated/EscapedPrint/Printers/Item/RestoreFactoryDefaults/RestoreFactoryDefaultsRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/RestoreFactoryDefaults/RestoreFactoryDefaultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a printer's default settings to the values specified by the manufacturer. This API is available in the following national cloud deployments. * @param RestoreFactoryDefaultsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printer-restorefactorydefaults?view=graph-rest-1.0 Find more info here */ public function post(?RestoreFactoryDefaultsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RestoreFactoryDefaultsRequestBuilderPo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Shares/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Shares/Count/CountRequestBuilder.php index ab758aca5e6..9f2fefefb57 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Shares/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Shares/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Shares/Item/PrinterShareItemRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Shares/Item/PrinterShareItemRequestBuilder.php index 7a2f2f44ccb..a3ff02f8fa9 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Shares/Item/PrinterShareItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Shares/Item/PrinterShareItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrinterShare; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of printerShares that are associated with the printer. Currently, only one printerShare can be associated with the printer. Read-only. Nullable. * @param PrinterShareItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrinterShareItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrinterShare::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrinterShare::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrinterShareItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrinterShareItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/Shares/SharesRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/Shares/SharesRequestBuilder.php index 5d3f0bd9cb9..48e964bdf22 100644 --- a/src/Generated/EscapedPrint/Printers/Item/Shares/SharesRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/Shares/SharesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Shares\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\Shares\Item\PrinterShareItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of printer shares associated with the printer. This API is available in the following national cloud deployments. * @param SharesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printer-list-shares?view=graph-rest-1.0 Find more info here */ public function get(?SharesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrinterShareCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrinterShareCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SharesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SharesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/Count/CountRequestBuilder.php index 97156a579fe..0a8a69c9039 100644 --- a/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/Item/Definition/DefinitionRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/Item/Definition/DefinitionRequestBuilder.php index 9d331b6b248..0d3b482654a 100644 --- a/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/Item/Definition/DefinitionRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/Item/Definition/DefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintTaskDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * An abstract definition that is used to create a printTask when triggered by a print event. Read-only. * @param DefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DefinitionRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DefinitionRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/Item/PrintTaskTriggerItemRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/Item/PrintTaskTriggerItemRequestBuilder.php index ec11340b24f..523d4c490c2 100644 --- a/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/Item/PrintTaskTriggerItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/Item/PrintTaskTriggerItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\TaskTriggers\Item\Definition\DefinitionRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintTaskTrigger; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the task trigger of a printer to prevent related print events from triggering tasks on the specified printer. This API is available in the following national cloud deployments. * @param PrintTaskTriggerItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printer-delete-tasktrigger?view=graph-rest-1.0 Find more info here */ public function delete(?PrintTaskTriggerItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a task trigger from a printer. For details about how to use this API to add pull printing support to Universal Print, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param PrintTaskTriggerItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printtasktrigger-get?view=graph-rest-1.0 Find more info here */ public function get(?PrintTaskTriggerItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTrigger::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTrigger::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property taskTriggers in print * @param PrintTaskTrigger $body The request body * @param PrintTaskTriggerItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintTaskTrigger $body, ?PrintTaskTriggerItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTrigger::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTrigger::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?PrintTaskTriggerItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?PrintTaskTriggerItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?PrintTaskTriggerItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(PrintTaskTrigger $body, ?PrintTaskTrig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/TaskTriggersRequestBuilder.php b/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/TaskTriggersRequestBuilder.php index 9eac3290fde..ccdd5327e98 100644 --- a/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/TaskTriggersRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/Item/TaskTriggers/TaskTriggersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\TaskTriggers\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\TaskTriggers\Item\PrintTaskTriggerItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of task triggers associated with the printer. The list of task triggers defines which tasks will be triggered as a result of events that occur during printing. For details about how to use this API to add pull printing support to Universal Print, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param TaskTriggersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printer-list-tasktriggers?view=graph-rest-1.0 Find more info here */ public function get(?TaskTriggersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTriggerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTriggerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new task trigger on the specified printer. Currently, only one task trigger can be specified per printer, but this limit might be removed in the future. This API is available in the following national cloud deployments. * @param PrintTaskTrigger $body The request body * @param TaskTriggersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printer-post-tasktriggers?view=graph-rest-1.0 Find more info here */ public function post(PrintTaskTrigger $body, ?TaskTriggersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTrigger::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTrigger::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TaskTriggersRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TaskTriggersRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(PrintTaskTrigger $body, ?TaskTriggersRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Printers/PrintersRequestBuilder.php b/src/Generated/EscapedPrint/Printers/PrintersRequestBuilder.php index e1ce7980228..9c6341cd17a 100644 --- a/src/Generated/EscapedPrint/Printers/PrintersRequestBuilder.php +++ b/src/Generated/EscapedPrint/Printers/PrintersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Printers\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Create\CreateRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Printers\Item\PrinterItemRequestBuilder; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of printers that are registered in the tenant. This API is available in the following national cloud deployments. * @param PrintersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/print-list-printers?view=graph-rest-1.0 Find more info here */ public function get(?PrintersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrinterCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrinterCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to printers for print * @param Printer $body The request body * @param PrintersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Printer $body, ?PrintersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Printer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Printer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?PrintersRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?PrintersRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(Printer $body, ?PrintersRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Services/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Services/Count/CountRequestBuilder.php index 5dfa02e5db4..83da4a343c3 100644 --- a/src/Generated/EscapedPrint/Services/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Services/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Services/Item/Endpoints/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Services/Item/Endpoints/Count/CountRequestBuilder.php index 910298f0bb6..5dd56df8901 100644 --- a/src/Generated/EscapedPrint/Services/Item/Endpoints/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Services/Item/Endpoints/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Services/Item/Endpoints/EndpointsRequestBuilder.php b/src/Generated/EscapedPrint/Services/Item/Endpoints/EndpointsRequestBuilder.php index 256d5be9cab..3f8b95707a2 100644 --- a/src/Generated/EscapedPrint/Services/Item/Endpoints/EndpointsRequestBuilder.php +++ b/src/Generated/EscapedPrint/Services/Item/Endpoints/EndpointsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Services\Item\Endpoints\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Services\Item\Endpoints\Item\PrintServiceEndpointItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of endpoints exposed by a print service. This API is available in the following national cloud deployments. * @param EndpointsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printservice-list-endpoints?view=graph-rest-1.0 Find more info here */ public function get(?EndpointsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintServiceEndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintServiceEndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to endpoints for print * @param PrintServiceEndpoint $body The request body * @param EndpointsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintServiceEndpoint $body, ?EndpointsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintServiceEndpoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintServiceEndpoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?EndpointsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?EndpointsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PrintServiceEndpoint $body, ?EndpointsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Services/Item/Endpoints/Item/PrintServiceEndpointItemRequestBuilder.php b/src/Generated/EscapedPrint/Services/Item/Endpoints/Item/PrintServiceEndpointItemRequestBuilder.php index 7454fee1c16..24c82ef28f6 100644 --- a/src/Generated/EscapedPrint/Services/Item/Endpoints/Item/PrintServiceEndpointItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Services/Item/Endpoints/Item/PrintServiceEndpointItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintServiceEndpoint; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property endpoints for print * @param PrintServiceEndpointItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintServiceEndpointItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a print service endpoint. This API is available in the following national cloud deployments. * @param PrintServiceEndpointItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printserviceendpoint-get?view=graph-rest-1.0 Find more info here */ public function get(?PrintServiceEndpointItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintServiceEndpoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintServiceEndpoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property endpoints in print * @param PrintServiceEndpoint $body The request body * @param PrintServiceEndpointItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintServiceEndpoint $body, ?PrintServiceEndpointItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintServiceEndpoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintServiceEndpoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?PrintServiceEndpointItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?PrintServiceEndpointItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?PrintServiceEndpointItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(PrintServiceEndpoint $body, ?PrintServ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Services/Item/PrintServiceItemRequestBuilder.php b/src/Generated/EscapedPrint/Services/Item/PrintServiceItemRequestBuilder.php index e00491b141d..cdf9b2f959c 100644 --- a/src/Generated/EscapedPrint/Services/Item/PrintServiceItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Services/Item/PrintServiceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Services\Item\Endpoints\EndpointsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintService; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property services for print * @param PrintServiceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintServiceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a print service. This API is available in the following national cloud deployments. * @param PrintServiceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printservice-get?view=graph-rest-1.0 Find more info here */ public function get(?PrintServiceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintService::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintService::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property services in print * @param PrintService $body The request body * @param PrintServiceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintService $body, ?PrintServiceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintService::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintService::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?PrintServiceItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?PrintServiceItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?PrintServiceItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(PrintService $body, ?PrintServiceItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Services/ServicesRequestBuilder.php b/src/Generated/EscapedPrint/Services/ServicesRequestBuilder.php index eff1db54ba6..94dd9064d24 100644 --- a/src/Generated/EscapedPrint/Services/ServicesRequestBuilder.php +++ b/src/Generated/EscapedPrint/Services/ServicesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Services\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Services\Item\PrintServiceItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of printService objects that represent the services available to your tenant. This API is available in the following national cloud deployments. * @param ServicesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/print-list-services?view=graph-rest-1.0 Find more info here */ public function get(?ServicesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintServiceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintServiceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to services for print * @param PrintService $body The request body * @param ServicesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintService $body, ?ServicesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintService::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintService::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ServicesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ServicesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PrintService $body, ?ServicesRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Count/CountRequestBuilder.php index a9804ee7ac8..c5abbb74042 100644 --- a/src/Generated/EscapedPrint/Shares/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/AllowedGroupsRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/AllowedGroupsRequestBuilder.php index 8374495f327..cfd845b5946 100644 --- a/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/AllowedGroupsRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/AllowedGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\AllowedGroups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\AllowedGroups\Item\GroupItemRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\AllowedGroups\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of groups that have been granted access to submit print jobs to the associated printerShare. This API is available in the following national cloud deployments. * @param AllowedGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printershare-list-allowedgroups?view=graph-rest-1.0 Find more info here */ public function get(?AllowedGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?AllowedGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?AllowedGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Count/CountRequestBuilder.php index ca86cefca96..a151edc7b6e 100644 --- a/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Item/Ref/RefRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Item/Ref/RefRequestBuilder.php index 8ae9d318228..d9a8a842c50 100644 --- a/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Revoke the specified group's access to submit print jobs to the associated printerShare. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printershare-delete-allowedgroup?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php index c6dfba886a6..09e02db5d23 100644 --- a/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index c3f9674e1a1..26c820be17a 100644 --- a/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\AllowedGroups\Item\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Ref/RefRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Ref/RefRequestBuilder.php index fa2af89da8b..abba1199135 100644 --- a/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Ref/RefRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/AllowedGroups/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of groups that have been granted access to submit print jobs to the associated printerShare. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printershare-list-allowedgroups?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Grant the specified group access to submit print jobs to the associated printerShare. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printershare-post-allowedgroups?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/AllowedUsersRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/AllowedUsersRequestBuilder.php index 2378bde73b4..3e8fe83710e 100644 --- a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/AllowedUsersRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/AllowedUsersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\AllowedUsers\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\AllowedUsers\Item\UserItemRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\AllowedUsers\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of users who have been granted access to submit print jobs to the associated printerShare. This API is available in the following national cloud deployments. * @param AllowedUsersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printershare-list-allowedusers?view=graph-rest-1.0 Find more info here */ public function get(?AllowedUsersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?AllowedUsersRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?AllowedUsersRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Count/CountRequestBuilder.php index 588462d5b19..86991cc057c 100644 --- a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/MailboxSettings/MailboxSettingsRequestBuilder.php index 8a7c33f6c4a..f2aa55b3187 100644 --- a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/Ref/RefRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/Ref/RefRequestBuilder.php index 353f6d39472..a556228c5fa 100644 --- a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Revoke the specified user's access to submit print jobs to the associated printerShare. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printershare-delete-alloweduser?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php index b2cce59dcc0..8ddd459013f 100644 --- a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 2a9b4d15f03..fbaedf7a750 100644 --- a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\AllowedUsers\Item\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Ref/RefRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Ref/RefRequestBuilder.php index 609e6b2bd19..62eaf95d484 100644 --- a/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Ref/RefRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/AllowedUsers/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of users who have been granted access to submit print jobs to the associated printerShare. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printershare-list-allowedusers?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Grant the specified user access to submit print jobs to the associated printerShare. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printershare-post-allowedusers?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Count/CountRequestBuilder.php index 5fabac8f4f3..8f68be24f09 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Abort/AbortRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Abort/AbortRequestBuilder.php index 10f028d18c2..20d19397652 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Abort/AbortRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Abort/AbortRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Abort a print job. Only applications using application permissions can abort a print job. Aborting a print job will only succeed if there is a printTask in a processing state on the associated print job, started by a trigger that the requesting app created. For details about how to register a task trigger, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param AbortPostRequestBody $body The request body * @param AbortRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printjob-abort?view=graph-rest-1.0 Find more info here */ public function post(AbortPostRequestBody $body, ?AbortRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AbortPostRequestBody $body, ?AbortReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Cancel/CancelRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Cancel/CancelRequestBuilder.php index c7bdc2f0e50..bfa99956b6c 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Cancel a print job. Print jobs can be canceled only on behalf of a user, using delegated permissions. This API is available in the following national cloud deployments. * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printjob-cancel?view=graph-rest-1.0 Find more info here */ public function post(?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CancelRequestBuilderPostRequestConfigu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Count/CountRequestBuilder.php index 177f4f24bb9..575fac05025 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/DocumentsRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/DocumentsRequestBuilder.php index 64ba18ed9f7..b99c59e6340 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/DocumentsRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/DocumentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\Item\Documents\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\Item\Documents\Item\PrintDocumentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get documents from print * @param DocumentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DocumentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintDocumentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintDocumentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to documents for print * @param PrintDocument $body The request body * @param DocumentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintDocument $body, ?DocumentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintDocument::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintDocument::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DocumentsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DocumentsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(PrintDocument $body, ?DocumentsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Item/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Item/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 6508c867081..fe08fb44166 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Item/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Item/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a binary file linked to the print document. As part of the response, this action returns an upload URL that can be used in subsequent sequential PUT queries. Request headers for each PUT operation can be used to specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printdocument-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Item/PrintDocumentItemRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Item/PrintDocumentItemRequestBuilder.php index 3f085540f37..ed6c3a9864a 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Item/PrintDocumentItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Item/PrintDocumentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\Item\Documents\Item\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\Item\Documents\Item\Value\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property documents for print * @param PrintDocumentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintDocumentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get documents from print * @param PrintDocumentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrintDocumentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintDocument::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintDocument::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property documents in print * @param PrintDocument $body The request body * @param PrintDocumentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintDocument $body, ?PrintDocumentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintDocument::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintDocument::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?PrintDocumentItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?PrintDocumentItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?PrintDocumentItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(PrintDocument $body, ?PrintDocumentIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Item/Value/ContentRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Item/Value/ContentRequestBuilder.php index c7eada32ad8..c624e236a64 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Documents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,38 +33,36 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property documents from print * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property documents in print * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -82,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -100,7 +98,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/PrintJobItemRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/PrintJobItemRequestBuilder.php index 04bc8db4968..07fc08e2405 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/PrintJobItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/PrintJobItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\Item\Abort\AbortRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\Item\Cancel\CancelRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\Item\Documents\DocumentsRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property jobs for print * @param PrintJobItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintJobItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of jobs that are queued for printing by the printer/printerShare. * @param PrintJobItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrintJobItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property jobs in print * @param PrintJob $body The request body * @param PrintJobItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintJob $body, ?PrintJobItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?PrintJobItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?PrintJobItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?PrintJobItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(PrintJob $body, ?PrintJobItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Redirect/RedirectRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Redirect/RedirectRequestBuilder.php index e2aed96e1ee..778e8203c3b 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Redirect/RedirectRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Redirect/RedirectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintJob; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Redirect a print job to a different printer. Redirecting a print job will only succeed if there is a printTask in a processing state on the associated print job, started by a trigger that the requesting app created. For details about how to use this API to add pull printing support to Universal Print, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param RedirectPostRequestBody $body The request body * @param RedirectRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printjob-redirect?view=graph-rest-1.0 Find more info here */ public function post(RedirectPostRequestBody $body, ?RedirectRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(RedirectPostRequestBody $body, ?Redirec $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Start/StartRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Start/StartRequestBuilder.php index cde27c2f157..8d050724249 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Start/StartRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Start/StartRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintJobStatus; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Submits the print job to the associated printer or printerShare. It will be printed after any existing pending jobs are completed, aborted, or canceled. This API is available in the following national cloud deployments. * @param StartRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printjob-start?view=graph-rest-1.0 Find more info here */ public function post(?StartRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintJobStatus::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintJobStatus::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?StartRequestBuilderPostRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Count/CountRequestBuilder.php index 7add4c6716f..8b5c99ad752 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Item/Definition/DefinitionRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Item/Definition/DefinitionRequestBuilder.php index 88e8c283087..837d034547b 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Item/Definition/DefinitionRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Item/Definition/DefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintTaskDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The printTaskDefinition that was used to create this task. Read-only. * @param DefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DefinitionRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DefinitionRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Item/PrintTaskItemRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Item/PrintTaskItemRequestBuilder.php index f74c39638c5..96ee937f90e 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Item/PrintTaskItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Item/PrintTaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\Item\Tasks\Item\Definition\DefinitionRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\Item\Tasks\Item\Trigger\TriggerRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for print * @param PrintTaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintTaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A list of printTasks that were triggered by this print job. * @param PrintTaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrintTaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in print * @param PrintTask $body The request body * @param PrintTaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintTask $body, ?PrintTaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?PrintTaskItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?PrintTaskItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?PrintTaskItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(PrintTask $body, ?PrintTaskItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Item/Trigger/TriggerRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Item/Trigger/TriggerRequestBuilder.php index e14467d50f2..1728c0e0cad 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Item/Trigger/TriggerRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/Item/Trigger/TriggerRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintTaskTrigger; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The printTaskTrigger that triggered this task's execution. Read-only. * @param TriggerRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TriggerRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTrigger::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTrigger::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TriggerRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TriggerRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/TasksRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/TasksRequestBuilder.php index fc3765fb929..414968f39ac 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\Item\Tasks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\Item\Tasks\Item\PrintTaskItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A list of printTasks that were triggered by this print job. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for print * @param PrintTask $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintTask $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(PrintTask $body, ?TasksRequestBuilderPo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Jobs/JobsRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Jobs/JobsRequestBuilder.php index e5995e25343..f609db6cfe2 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Jobs/JobsRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Jobs/JobsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\Item\PrintJobItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of jobs that are queued for printing by the printer/printerShare. * @param JobsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?JobsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintJobCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintJobCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to jobs for print * @param PrintJob $body The request body * @param JobsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintJob $body, ?JobsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?JobsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?JobsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(PrintJob $body, ?JobsRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/Printer/PrinterRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/Printer/PrinterRequestBuilder.php index 1502b6896f3..c9782c7c33e 100644 --- a/src/Generated/EscapedPrint/Shares/Item/Printer/PrinterRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/Printer/PrinterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Printer; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The printer that this printer share is related to. * @param PrinterRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrinterRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Printer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Printer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrinterRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrinterRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/Item/PrinterShareItemRequestBuilder.php b/src/Generated/EscapedPrint/Shares/Item/PrinterShareItemRequestBuilder.php index b5bd418b65f..5efcb9f16d4 100644 --- a/src/Generated/EscapedPrint/Shares/Item/PrinterShareItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/Item/PrinterShareItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\AllowedGroups\AllowedGroupsRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\AllowedUsers\AllowedUsersRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\Jobs\JobsRequestBuilder; @@ -66,59 +65,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a printer share (unshare the associated printer). This action can't be undone. If the printer is shared again in the future, any Windows users who had previously installed the printer needs to discover and reinstall it. This API is available in the following national cloud deployments. * @param PrinterShareItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printershare-delete?view=graph-rest-1.0 Find more info here */ public function delete(?PrinterShareItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a printer share. This API is available in the following national cloud deployments. * @param PrinterShareItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printershare-get?view=graph-rest-1.0 Find more info here */ public function get(?PrinterShareItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrinterShare::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrinterShare::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a printer share. This method can be used to swap printers. For example, if a physical printer device breaks, an administrator can register a new printer device and update this printerShare to point to the new printer without requiring users to take any action. This API is available in the following national cloud deployments. * @param PrinterShare $body The request body * @param PrinterShareItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printershare-update?view=graph-rest-1.0 Find more info here */ public function patch(PrinterShare $body, ?PrinterShareItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrinterShare::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrinterShare::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -135,6 +125,7 @@ public function toDeleteRequestInformation(?PrinterShareItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -148,7 +139,6 @@ public function toGetRequestInformation(?PrinterShareItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -156,6 +146,7 @@ public function toGetRequestInformation(?PrinterShareItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -170,11 +161,11 @@ public function toPatchRequestInformation(PrinterShare $body, ?PrinterShareItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/Shares/SharesRequestBuilder.php b/src/Generated/EscapedPrint/Shares/SharesRequestBuilder.php index 3c5f36c44ef..43c3892aef3 100644 --- a/src/Generated/EscapedPrint/Shares/SharesRequestBuilder.php +++ b/src/Generated/EscapedPrint/Shares/SharesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\Shares\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\Shares\Item\PrinterShareItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of printerShares. This API is available in the following national cloud deployments. * @param SharesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/print-list-shares?view=graph-rest-1.0 Find more info here */ public function get(?SharesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrinterShareCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrinterShareCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new printerShare for the specified printer. This API is available in the following national cloud deployments. * @param PrinterShare $body The request body * @param SharesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/print-post-shares?view=graph-rest-1.0 Find more info here */ public function post(PrinterShare $body, ?SharesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrinterShare::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrinterShare::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SharesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SharesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(PrinterShare $body, ?SharesRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/TaskDefinitions/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/TaskDefinitions/Count/CountRequestBuilder.php index 395a7604f19..61796b6d7c3 100644 --- a/src/Generated/EscapedPrint/TaskDefinitions/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/TaskDefinitions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/TaskDefinitions/Item/PrintTaskDefinitionItemRequestBuilder.php b/src/Generated/EscapedPrint/TaskDefinitions/Item/PrintTaskDefinitionItemRequestBuilder.php index e0a8a769ef8..754a01f5e6a 100644 --- a/src/Generated/EscapedPrint/TaskDefinitions/Item/PrintTaskDefinitionItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/TaskDefinitions/Item/PrintTaskDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\TaskDefinitions\Item\Tasks\TasksRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintTaskDefinition; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a taskDefinition. For details about how to use this API to add pull printing support to Universal Print, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param PrintTaskDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/print-delete-taskdefinition?view=graph-rest-1.0 Find more info here */ public function delete(?PrintTaskDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get details about a task definition. For details about how to use this API to add pull printing support to Universal Print, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param PrintTaskDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printtaskdefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?PrintTaskDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a task definition. For details about how to use this API to add pull printing support to Universal Print, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param PrintTaskDefinition $body The request body * @param PrintTaskDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/print-update-taskdefinition?view=graph-rest-1.0 Find more info here */ public function patch(PrintTaskDefinition $body, ?PrintTaskDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?PrintTaskDefinitionItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?PrintTaskDefinitionItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?PrintTaskDefinitionItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(PrintTaskDefinition $body, ?PrintTaskD $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Count/CountRequestBuilder.php index 2424ac4799b..aa07f26af40 100644 --- a/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Item/Definition/DefinitionRequestBuilder.php b/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Item/Definition/DefinitionRequestBuilder.php index 111c054aa87..046cdeaca69 100644 --- a/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Item/Definition/DefinitionRequestBuilder.php +++ b/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Item/Definition/DefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintTaskDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The printTaskDefinition that was used to create this task. Read-only. * @param DefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DefinitionRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DefinitionRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Item/PrintTaskItemRequestBuilder.php b/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Item/PrintTaskItemRequestBuilder.php index b2895dc086a..4763ef7add2 100644 --- a/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Item/PrintTaskItemRequestBuilder.php +++ b/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Item/PrintTaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\TaskDefinitions\Item\Tasks\Item\Definition\DefinitionRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\TaskDefinitions\Item\Tasks\Item\Trigger\TriggerRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for print * @param PrintTaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintTaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get details about a print task. For details about how to use this API to add pull printing support to Universal Print, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param PrintTaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printtask-get?view=graph-rest-1.0 Find more info here */ public function get(?PrintTaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a print task. For details about how to use this API to add pull printing support to Universal Print, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param PrintTask $body The request body * @param PrintTaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printtaskdefinition-update-task?view=graph-rest-1.0 Find more info here */ public function patch(PrintTask $body, ?PrintTaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?PrintTaskItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?PrintTaskItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?PrintTaskItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(PrintTask $body, ?PrintTaskItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Item/Trigger/TriggerRequestBuilder.php b/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Item/Trigger/TriggerRequestBuilder.php index a9fc9d139e2..6e99f884de1 100644 --- a/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Item/Trigger/TriggerRequestBuilder.php +++ b/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/Item/Trigger/TriggerRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintTaskTrigger; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The printTaskTrigger that triggered this task's execution. Read-only. * @param TriggerRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TriggerRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTrigger::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskTrigger::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TriggerRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TriggerRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/TasksRequestBuilder.php b/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/TasksRequestBuilder.php index b91f6d4619e..3778799c6c6 100644 --- a/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/EscapedPrint/TaskDefinitions/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\TaskDefinitions\Item\Tasks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\TaskDefinitions\Item\Tasks\Item\PrintTaskItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of tasks associated with a task definition. For details about how to use this API to add pull printing support to Universal Print, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printtaskdefinition-list-tasks?view=graph-rest-1.0 Find more info here */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for print * @param PrintTask $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintTask $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PrintTask $body, ?TasksRequestBuilderPo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/EscapedPrint/TaskDefinitions/TaskDefinitionsRequestBuilder.php b/src/Generated/EscapedPrint/TaskDefinitions/TaskDefinitionsRequestBuilder.php index 8cf1f5575d6..398d05557aa 100644 --- a/src/Generated/EscapedPrint/TaskDefinitions/TaskDefinitionsRequestBuilder.php +++ b/src/Generated/EscapedPrint/TaskDefinitions/TaskDefinitionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\EscapedPrint\TaskDefinitions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\EscapedPrint\TaskDefinitions\Item\PrintTaskDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of task definitions that the requesting app defined in the tenant. For details about how to use this API to add pull printing support to Universal Print, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param TaskDefinitionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/print-list-taskdefinitions?view=graph-rest-1.0 Find more info here */ public function get(?TaskDefinitionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new task definition. For details about how to use this API to add pull printing support to Universal Print, see Extending Universal Print to support pull printing. This API is available in the following national cloud deployments. * @param PrintTaskDefinition $body The request body * @param TaskDefinitionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/print-post-taskdefinitions?view=graph-rest-1.0 Find more info here */ public function post(PrintTaskDefinition $body, ?TaskDefinitionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintTaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TaskDefinitionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TaskDefinitionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(PrintTaskDefinition $body, ?TaskDefinit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/ConnectionsRequestBuilder.php b/src/Generated/External/Connections/ConnectionsRequestBuilder.php index a42c5dfaf92..8c6372fbce0 100644 --- a/src/Generated/External/Connections/ConnectionsRequestBuilder.php +++ b/src/Generated/External/Connections/ConnectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\External\Connections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\External\Connections\Item\ExternalConnectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalConnection; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the externalConnection objects and their properties. This API is available in the following national cloud deployments. * @param ConnectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalconnection-list?view=graph-rest-1.0 Find more info here */ public function get(?ConnectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new externalConnection object. This API is available in the following national cloud deployments. * @param ExternalConnection $body The request body * @param ConnectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-external-post-connections?view=graph-rest-1.0 Find more info here */ public function post(ExternalConnection $body, ?ConnectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ConnectionsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ConnectionsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ExternalConnection $body, ?ConnectionsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/Count/CountRequestBuilder.php b/src/Generated/External/Connections/Count/CountRequestBuilder.php index 5995d0efa78..9032d34ec6a 100644 --- a/src/Generated/External/Connections/Count/CountRequestBuilder.php +++ b/src/Generated/External/Connections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/ExternalConnectionItemRequestBuilder.php b/src/Generated/External/Connections/Item/ExternalConnectionItemRequestBuilder.php index 234dc69b757..01d9d28eef5 100644 --- a/src/Generated/External/Connections/Item/ExternalConnectionItemRequestBuilder.php +++ b/src/Generated/External/Connections/Item/ExternalConnectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\External\Connections\Item\Groups\GroupsRequestBuilder; use Microsoft\Graph\Generated\External\Connections\Item\Items\ItemsRequestBuilder; use Microsoft\Graph\Generated\External\Connections\Item\Operations\OperationsRequestBuilder; @@ -66,59 +65,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes an externalConnection object. This API is available in the following national cloud deployments. * @param ExternalConnectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalconnection-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ExternalConnectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an externalConnection object. This API is available in the following national cloud deployments. * @param ExternalConnectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalconnection-get?view=graph-rest-1.0 Find more info here */ public function get(?ExternalConnectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an externalConnection object. This API is available in the following national cloud deployments. * @param ExternalConnection $body The request body * @param ExternalConnectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalconnection-update?view=graph-rest-1.0 Find more info here */ public function patch(ExternalConnection $body, ?ExternalConnectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalConnection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -135,6 +125,7 @@ public function toDeleteRequestInformation(?ExternalConnectionItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -148,7 +139,6 @@ public function toGetRequestInformation(?ExternalConnectionItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -156,6 +146,7 @@ public function toGetRequestInformation(?ExternalConnectionItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -170,11 +161,11 @@ public function toPatchRequestInformation(ExternalConnection $body, ?ExternalCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Groups/Count/CountRequestBuilder.php b/src/Generated/External/Connections/Item/Groups/Count/CountRequestBuilder.php index b783a9d6305..c0d41928f97 100644 --- a/src/Generated/External/Connections/Item/Groups/Count/CountRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Groups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Groups/GroupsRequestBuilder.php b/src/Generated/External/Connections/Item/Groups/GroupsRequestBuilder.php index 657481f54b5..9dfd3256786 100644 --- a/src/Generated/External/Connections/Item/Groups/GroupsRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Groups/GroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\External\Connections\Item\Groups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\External\Connections\Item\Groups\Item\ExternalGroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalGroup; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an externalGroup object. This API is available in the following national cloud deployments. * @param GroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new externalGroup object. This API is available in the following national cloud deployments. * @param ExternalGroup $body The request body * @param GroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalconnection-post-groups?view=graph-rest-1.0 Find more info here */ public function post(ExternalGroup $body, ?GroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ExternalGroup $body, ?GroupsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Groups/Item/ExternalGroupItemRequestBuilder.php b/src/Generated/External/Connections/Item/Groups/Item/ExternalGroupItemRequestBuilder.php index 0328abde11b..04787b1ff56 100644 --- a/src/Generated/External/Connections/Item/Groups/Item/ExternalGroupItemRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Groups/Item/ExternalGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\External\Connections\Item\Groups\Item\Members\MembersRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalGroup; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an externalGroup object. This API is available in the following national cloud deployments. * @param ExternalGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalgroup-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ExternalGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an externalGroup object. This API is available in the following national cloud deployments. * @param ExternalGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalgroup-get?view=graph-rest-1.0 Find more info here */ public function get(?ExternalGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an externalGroup object. This API is available in the following national cloud deployments. * @param ExternalGroup $body The request body * @param ExternalGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalgroup-update?view=graph-rest-1.0 Find more info here */ public function patch(ExternalGroup $body, ?ExternalGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?ExternalGroupItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?ExternalGroupItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?ExternalGroupItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(ExternalGroup $body, ?ExternalGroupIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Groups/Item/Members/Count/CountRequestBuilder.php b/src/Generated/External/Connections/Item/Groups/Item/Members/Count/CountRequestBuilder.php index 379211aaa88..c108fef18da 100644 --- a/src/Generated/External/Connections/Item/Groups/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Groups/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilder.php b/src/Generated/External/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilder.php index 264844cf95b..e3b9c579b0a 100644 --- a/src/Generated/External/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ExternalConnectors\Identity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an identity resource to remove the corresponding member from an externalGroup. This API is available in the following national cloud deployments. * @param IdentityItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalgroupmember-delete?view=graph-rest-1.0 Find more info here */ public function delete(?IdentityItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. * @param IdentityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IdentityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property members in external * @param Identity $body The request body * @param IdentityItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Identity $body, ?IdentityItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,11 +91,12 @@ public function toDeleteRequestInformation(?IdentityItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. * @param IdentityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -114,7 +105,6 @@ public function toGetRequestInformation(?IdentityItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?IdentityItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Identity $body, ?IdentityItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilderGetQueryParameters.php b/src/Generated/External/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilderGetQueryParameters.php index 16a639a4c7b..4518a2b473d 100644 --- a/src/Generated/External/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/External/Connections/Item/Groups/Item/Members/Item/IdentityItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. */ class IdentityItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/External/Connections/Item/Groups/Item/Members/MembersRequestBuilder.php b/src/Generated/External/Connections/Item/Groups/Item/Members/MembersRequestBuilder.php index b3f150ed192..4a6ae16b5ea 100644 --- a/src/Generated/External/Connections/Item/Groups/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Groups/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\External\Connections\Item\Groups\Item\Members\Count\CountRequestBuilder; use Microsoft\Graph\Generated\External\Connections\Item\Groups\Item\Members\Item\IdentityItemRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\Identity; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an identity resource for a new member in an externalGroup. This API is available in the following national cloud deployments. * @param Identity $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalgroup-post-members?view=graph-rest-1.0 Find more info here */ public function post(Identity $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Identity $body, ?MembersRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Groups/Item/Members/MembersRequestBuilderGetQueryParameters.php b/src/Generated/External/Connections/Item/Groups/Item/Members/MembersRequestBuilderGetQueryParameters.php index ef90e639a7e..4c3b5108c5d 100644 --- a/src/Generated/External/Connections/Item/Groups/Item/Members/MembersRequestBuilderGetQueryParameters.php +++ b/src/Generated/External/Connections/Item/Groups/Item/Members/MembersRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. */ class MembersRequestBuilderGetQueryParameters { diff --git a/src/Generated/External/Connections/Item/Items/Count/CountRequestBuilder.php b/src/Generated/External/Connections/Item/Items/Count/CountRequestBuilder.php index 1abb1376262..821ade985b5 100644 --- a/src/Generated/External/Connections/Item/Items/Count/CountRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Items/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Items/Item/Activities/ActivitiesRequestBuilder.php b/src/Generated/External/Connections/Item/Items/Item/Activities/ActivitiesRequestBuilder.php index 9822365f062..5431f7a10a5 100644 --- a/src/Generated/External/Connections/Item/Items/Item/Activities/ActivitiesRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Items/Item/Activities/ActivitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\External\Connections\Item\Items\Item\Activities\Count\CountRequestBuilder; use Microsoft\Graph\Generated\External\Connections\Item\Items\Item\Activities\Item\ExternalActivityItemRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalActivity; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Returns a list of activities performed on the item. Write-only. * @param ActivitiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivitiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to activities for external * @param ExternalActivity $body The request body * @param ActivitiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ExternalActivity $body, ?ActivitiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ActivitiesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ActivitiesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ExternalActivity $body, ?ActivitiesRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Items/Item/Activities/Count/CountRequestBuilder.php b/src/Generated/External/Connections/Item/Items/Item/Activities/Count/CountRequestBuilder.php index 721905e26a5..748526545fc 100644 --- a/src/Generated/External/Connections/Item/Items/Item/Activities/Count/CountRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Items/Item/Activities/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Items/Item/Activities/Item/ExternalActivityItemRequestBuilder.php b/src/Generated/External/Connections/Item/Items/Item/Activities/Item/ExternalActivityItemRequestBuilder.php index 3b9bb2cbbd3..160feff9863 100644 --- a/src/Generated/External/Connections/Item/Items/Item/Activities/Item/ExternalActivityItemRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Items/Item/Activities/Item/ExternalActivityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\External\Connections\Item\Items\Item\Activities\Item\PerformedBy\PerformedByRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalActivity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property activities for external * @param ExternalActivityItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExternalActivityItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns a list of activities performed on the item. Write-only. * @param ExternalActivityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExternalActivityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property activities in external * @param ExternalActivity $body The request body * @param ExternalActivityItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ExternalActivity $body, ?ExternalActivityItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ExternalActivityItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ExternalActivityItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ExternalActivityItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ExternalActivity $body, ?ExternalActiv $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Items/Item/Activities/Item/PerformedBy/PerformedByRequestBuilder.php b/src/Generated/External/Connections/Item/Items/Item/Activities/Item/PerformedBy/PerformedByRequestBuilder.php index 0ee71bc1d08..9cfe187bd37 100644 --- a/src/Generated/External/Connections/Item/Items/Item/Activities/Item/PerformedBy/PerformedByRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Items/Item/Activities/Item/PerformedBy/PerformedByRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ExternalConnectors\Identity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents an identity used to identify who is responsible for the activity. * @param PerformedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PerformedByRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Identity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PerformedByRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PerformedByRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Items/Item/ExternalItemItemRequestBuilder.php b/src/Generated/External/Connections/Item/Items/Item/ExternalItemItemRequestBuilder.php index a522f64fc24..1c6a9dcd96a 100644 --- a/src/Generated/External/Connections/Item/Items/Item/ExternalItemItemRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Items/Item/ExternalItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\External\Connections\Item\Items\Item\Activities\ActivitiesRequestBuilder; use Microsoft\Graph\Generated\External\Connections\Item\Items\Item\MicrosoftGraphExternalConnectorsAddActivities\MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalItem; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an externalItem object. This API is available in the following national cloud deployments. * @param ExternalItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalitem-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ExternalItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an externalItem object. This API is available in the following national cloud deployments. * @param ExternalItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalitem-get?view=graph-rest-1.0 Find more info here */ public function get(?ExternalItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property items in external * @param ExternalItem $body The request body * @param ExternalItemItemRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(ExternalItem $body, ?ExternalItemItemRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?ExternalItemItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?ExternalItemItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?ExternalItemItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPutRequestInformation(ExternalItem $body, ?ExternalItemItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Items/Item/MicrosoftGraphExternalConnectorsAddActivities/MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilder.php b/src/Generated/External/Connections/Item/Items/Item/MicrosoftGraphExternalConnectorsAddActivities/MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilder.php index 616f399f8a1..f468788bc54 100644 --- a/src/Generated/External/Connections/Item/Items/Item/MicrosoftGraphExternalConnectorsAddActivities/MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Items/Item/MicrosoftGraphExternalConnectorsAddActivities/MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action addActivities * @param AddActivitiesPostRequestBody $body The request body * @param MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AddActivitiesPostRequestBody $body, ?MicrosoftGraphExternalConnectorsAddActivitiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddActivitiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddActivitiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(AddActivitiesPostRequestBody $body, ?Mi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Items/ItemsRequestBuilder.php b/src/Generated/External/Connections/Item/Items/ItemsRequestBuilder.php index 2cdbd807268..9879268f9b1 100644 --- a/src/Generated/External/Connections/Item/Items/ItemsRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Items/ItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\External\Connections\Item\Items\Count\CountRequestBuilder; use Microsoft\Graph\Generated\External\Connections\Item\Items\Item\ExternalItemItemRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ExternalItem; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of an externalItem object. This API is available in the following national cloud deployments. * @param ItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to items for external * @param ExternalItem $body The request body * @param ItemsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ExternalItem $body, ?ItemsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExternalItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExternalItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ExternalItem $body, ?ItemsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Operations/Count/CountRequestBuilder.php b/src/Generated/External/Connections/Item/Operations/Count/CountRequestBuilder.php index e59c657f547..a8509c55def 100644 --- a/src/Generated/External/Connections/Item/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Operations/Item/ConnectionOperationItemRequestBuilder.php b/src/Generated/External/Connections/Item/Operations/Item/ConnectionOperationItemRequestBuilder.php index 44e83bd32f6..cd52b7efdc9 100644 --- a/src/Generated/External/Connections/Item/Operations/Item/ConnectionOperationItemRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Operations/Item/ConnectionOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ExternalConnectors\ConnectionOperation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for external * @param ConnectionOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ConnectionOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a connectionOperation object. This API is available in the following national cloud deployments. * @param ConnectionOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-connectionoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?ConnectionOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in external * @param ConnectionOperation $body The request body * @param ConnectionOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ConnectionOperation $body, ?ConnectionOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ConnectionOperationItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ConnectionOperationItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ConnectionOperationItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(ConnectionOperation $body, ?Connection $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Operations/OperationsRequestBuilder.php b/src/Generated/External/Connections/Item/Operations/OperationsRequestBuilder.php index 2086b91ae5e..e23d02a3a0a 100644 --- a/src/Generated/External/Connections/Item/Operations/OperationsRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\External\Connections\Item\Operations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\External\Connections\Item\Operations\Item\ConnectionOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\ConnectionOperation; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a connectionOperation object. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for external * @param ConnectionOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ConnectionOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConnectionOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ConnectionOperation $body, ?OperationsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/Connections/Item/Schema/SchemaRequestBuilder.php b/src/Generated/External/Connections/Item/Schema/SchemaRequestBuilder.php index 85eeac98810..1f07526c56e 100644 --- a/src/Generated/External/Connections/Item/Schema/SchemaRequestBuilder.php +++ b/src/Generated/External/Connections/Item/Schema/SchemaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ExternalConnectors\Schema; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,40 +33,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a schema object. This API is available in the following national cloud deployments. * @param SchemaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-schema-get?view=graph-rest-1.0 Find more info here */ public function get(?SchemaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Schema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Schema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create a new schema object. + * Create a new schema object. This API is available in the following national cloud deployments. * @param Schema $body The request body * @param SchemaRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/externalconnectors-externalconnection-patch-schema?view=graph-rest-1.0 Find more info here */ public function patch(Schema $body, ?SchemaRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Schema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Schema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +73,6 @@ public function toGetRequestInformation(?SchemaRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,11 +80,12 @@ public function toGetRequestInformation(?SchemaRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create a new schema object. + * Create a new schema object. This API is available in the following national cloud deployments. * @param Schema $body The request body * @param SchemaRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -102,11 +95,11 @@ public function toPatchRequestInformation(Schema $body, ?SchemaRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/External/ExternalRequestBuilder.php b/src/Generated/External/ExternalRequestBuilder.php index 6e324562636..b4f3b21f293 100644 --- a/src/Generated/External/ExternalRequestBuilder.php +++ b/src/Generated/External/ExternalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\External\Connections\ConnectionsRequestBuilder; use Microsoft\Graph\Generated\Models\ExternalConnectors\External; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,38 +41,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get external * @param ExternalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExternalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [External::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [External::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update external * @param External $body The request body * @param ExternalRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(External $body, ?ExternalRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [External::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [External::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -86,7 +79,6 @@ public function toGetRequestInformation(?ExternalRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -94,6 +86,7 @@ public function toGetRequestInformation(?ExternalRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -108,11 +101,11 @@ public function toPatchRequestInformation(External $body, ?ExternalRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/FilterOperators/Count/CountRequestBuilder.php b/src/Generated/FilterOperators/Count/CountRequestBuilder.php index 5730c0742bc..b37e1db460f 100644 --- a/src/Generated/FilterOperators/Count/CountRequestBuilder.php +++ b/src/Generated/FilterOperators/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/FilterOperators/FilterOperatorsRequestBuilder.php b/src/Generated/FilterOperators/FilterOperatorsRequestBuilder.php index 24157555cd2..2474843662e 100644 --- a/src/Generated/FilterOperators/FilterOperatorsRequestBuilder.php +++ b/src/Generated/FilterOperators/FilterOperatorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\FilterOperators\Count\CountRequestBuilder; use Microsoft\Graph\Generated\FilterOperators\Item\FilterOperatorSchemaItemRequestBuilder; use Microsoft\Graph\Generated\Models\FilterOperatorSchema; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from filterOperators * @param FilterOperatorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterOperatorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorSchemaCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorSchemaCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to filterOperators * @param FilterOperatorSchema $body The request body * @param FilterOperatorsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(FilterOperatorSchema $body, ?FilterOperatorsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FilterOperatorsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FilterOperatorsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(FilterOperatorSchema $body, ?FilterOper $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/FilterOperators/Item/FilterOperatorSchemaItemRequestBuilder.php b/src/Generated/FilterOperators/Item/FilterOperatorSchemaItemRequestBuilder.php index af16e81563b..eebf6b28da4 100644 --- a/src/Generated/FilterOperators/Item/FilterOperatorSchemaItemRequestBuilder.php +++ b/src/Generated/FilterOperators/Item/FilterOperatorSchemaItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FilterOperatorSchema; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from filterOperators * @param FilterOperatorSchemaItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FilterOperatorSchemaItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entity from filterOperators by key * @param FilterOperatorSchemaItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterOperatorSchemaItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in filterOperators * @param FilterOperatorSchema $body The request body * @param FilterOperatorSchemaItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(FilterOperatorSchema $body, ?FilterOperatorSchemaItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FilterOperatorSchemaItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FilterOperatorSchemaItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FilterOperatorSchemaItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(FilterOperatorSchema $body, ?FilterOpe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Functions/Count/CountRequestBuilder.php b/src/Generated/Functions/Count/CountRequestBuilder.php index f079082a2e7..6e715751c4e 100644 --- a/src/Generated/Functions/Count/CountRequestBuilder.php +++ b/src/Generated/Functions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Functions/FunctionsRequestBuilder.php b/src/Generated/Functions/FunctionsRequestBuilder.php index 451f9d0fcb6..c2583604041 100644 --- a/src/Generated/Functions/FunctionsRequestBuilder.php +++ b/src/Generated/Functions/FunctionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Functions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Functions\Item\AttributeMappingFunctionSchemaItemRequestBuilder; use Microsoft\Graph\Generated\Models\AttributeMappingFunctionSchema; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from functions * @param FunctionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FunctionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttributeMappingFunctionSchemaCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttributeMappingFunctionSchemaCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to functions * @param AttributeMappingFunctionSchema $body The request body * @param FunctionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AttributeMappingFunctionSchema $body, ?FunctionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttributeMappingFunctionSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttributeMappingFunctionSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FunctionsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FunctionsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AttributeMappingFunctionSchema $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Functions/Item/AttributeMappingFunctionSchemaItemRequestBuilder.php b/src/Generated/Functions/Item/AttributeMappingFunctionSchemaItemRequestBuilder.php index 619d21080ce..36d28f071d9 100644 --- a/src/Generated/Functions/Item/AttributeMappingFunctionSchemaItemRequestBuilder.php +++ b/src/Generated/Functions/Item/AttributeMappingFunctionSchemaItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AttributeMappingFunctionSchema; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from functions * @param AttributeMappingFunctionSchemaItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttributeMappingFunctionSchemaItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entity from functions by key * @param AttributeMappingFunctionSchemaItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttributeMappingFunctionSchemaItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttributeMappingFunctionSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttributeMappingFunctionSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in functions * @param AttributeMappingFunctionSchema $body The request body * @param AttributeMappingFunctionSchemaItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AttributeMappingFunctionSchema $body, ?AttributeMappingFunctionSchemaItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttributeMappingFunctionSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttributeMappingFunctionSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AttributeMappingFunctionSchemaItemRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AttributeMappingFunctionSchemaItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AttributeMappingFunctionSchemaItemReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AttributeMappingFunctionSchema $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupLifecyclePolicies/Count/CountRequestBuilder.php b/src/Generated/GroupLifecyclePolicies/Count/CountRequestBuilder.php index c02faa5996c..dec0675c48d 100644 --- a/src/Generated/GroupLifecyclePolicies/Count/CountRequestBuilder.php +++ b/src/Generated/GroupLifecyclePolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/GroupLifecyclePolicies/GroupLifecyclePoliciesRequestBuilder.php b/src/Generated/GroupLifecyclePolicies/GroupLifecyclePoliciesRequestBuilder.php index 1e6bfa7f7a8..57003901ef9 100644 --- a/src/Generated/GroupLifecyclePolicies/GroupLifecyclePoliciesRequestBuilder.php +++ b/src/Generated/GroupLifecyclePolicies/GroupLifecyclePoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\GroupLifecyclePolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\GroupLifecyclePolicies\Item\GroupLifecyclePolicyItemRequestBuilder; use Microsoft\Graph\Generated\Models\GroupLifecyclePolicy; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the groupLifecyclePolicies. This API is available in the following national cloud deployments. * @param GroupLifecyclePoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/grouplifecyclepolicy-list?view=graph-rest-1.0 Find more info here */ public function get(?GroupLifecyclePoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Creates a new groupLifecyclePolicy. This API is available in the following national cloud deployments. * @param GroupLifecyclePolicy $body The request body * @param GroupLifecyclePoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/grouplifecyclepolicy-post-grouplifecyclepolicies?view=graph-rest-1.0 Find more info here */ public function post(GroupLifecyclePolicy $body, ?GroupLifecyclePoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?GroupLifecyclePoliciesRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?GroupLifecyclePoliciesRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(GroupLifecyclePolicy $body, ?GroupLifec $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupLifecyclePolicies/Item/AddGroup/AddGroupRequestBuilder.php b/src/Generated/GroupLifecyclePolicies/Item/AddGroup/AddGroupRequestBuilder.php index abad0ab80ca..2df2872f54a 100644 --- a/src/Generated/GroupLifecyclePolicies/Item/AddGroup/AddGroupRequestBuilder.php +++ b/src/Generated/GroupLifecyclePolicies/Item/AddGroup/AddGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Adds specific groups to a lifecycle policy. This action limits the group lifecycle policy to a set of groups only if the managedGroupTypes property of groupLifecyclePolicy is set to Selected. This API is available in the following national cloud deployments. * @param AddGroupPostRequestBody $body The request body * @param AddGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/grouplifecyclepolicy-addgroup?view=graph-rest-1.0 Find more info here */ public function post(AddGroupPostRequestBody $body, ?AddGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddGroupPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddGroupPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddGroupPostRequestBody $body, ?AddGrou $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupLifecyclePolicies/Item/GroupLifecyclePolicyItemRequestBuilder.php b/src/Generated/GroupLifecyclePolicies/Item/GroupLifecyclePolicyItemRequestBuilder.php index 6417c79a8c4..52158330fdc 100644 --- a/src/Generated/GroupLifecyclePolicies/Item/GroupLifecyclePolicyItemRequestBuilder.php +++ b/src/Generated/GroupLifecyclePolicies/Item/GroupLifecyclePolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\GroupLifecyclePolicies\Item\AddGroup\AddGroupRequestBuilder; use Microsoft\Graph\Generated\GroupLifecyclePolicies\Item\RemoveGroup\RemoveGroupRequestBuilder; use Microsoft\Graph\Generated\Models\GroupLifecyclePolicy; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a groupLifecyclePolicy. This API is available in the following national cloud deployments. * @param GroupLifecyclePolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/grouplifecyclepolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?GroupLifecyclePolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a groupLifecyclePolicies object. This API is available in the following national cloud deployments. * @param GroupLifecyclePolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/grouplifecyclepolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?GroupLifecyclePolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a groupLifecyclePolicygroupLifecyclePolicy resource type object. This API is available in the following national cloud deployments. * @param GroupLifecyclePolicy $body The request body * @param GroupLifecyclePolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/grouplifecyclepolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(GroupLifecyclePolicy $body, ?GroupLifecyclePolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?GroupLifecyclePolicyItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?GroupLifecyclePolicyItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?GroupLifecyclePolicyItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(GroupLifecyclePolicy $body, ?GroupLife $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupLifecyclePolicies/Item/RemoveGroup/RemoveGroupRequestBuilder.php b/src/Generated/GroupLifecyclePolicies/Item/RemoveGroup/RemoveGroupRequestBuilder.php index 757d958ae5e..535db5136f5 100644 --- a/src/Generated/GroupLifecyclePolicies/Item/RemoveGroup/RemoveGroupRequestBuilder.php +++ b/src/Generated/GroupLifecyclePolicies/Item/RemoveGroup/RemoveGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Removes a group from a lifecycle policy. This API is available in the following national cloud deployments. * @param RemoveGroupPostRequestBody $body The request body * @param RemoveGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/grouplifecyclepolicy-removegroup?view=graph-rest-1.0 Find more info here */ public function post(RemoveGroupPostRequestBody $body, ?RemoveGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RemoveGroupPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RemoveGroupPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RemoveGroupPostRequestBody $body, ?Remo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupSettingTemplates/Count/CountRequestBuilder.php b/src/Generated/GroupSettingTemplates/Count/CountRequestBuilder.php index 09b8fe0045a..b41b8b47385 100644 --- a/src/Generated/GroupSettingTemplates/Count/CountRequestBuilder.php +++ b/src/Generated/GroupSettingTemplates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/GroupSettingTemplates/Delta/DeltaRequestBuilder.php b/src/Generated/GroupSettingTemplates/Delta/DeltaRequestBuilder.php index 2df112ef3bb..7c8f6d7653f 100644 --- a/src/Generated/GroupSettingTemplates/Delta/DeltaRequestBuilder.php +++ b/src/Generated/GroupSettingTemplates/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/GroupSettingTemplates/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/GroupSettingTemplates/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index 2a6d6121593..84ba51947e6 100644 --- a/src/Generated/GroupSettingTemplates/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/GroupSettingTemplates/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupSettingTemplates/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/GroupSettingTemplates/GetByIds/GetByIdsRequestBuilder.php index de664cd1db4..32306f387fb 100644 --- a/src/Generated/GroupSettingTemplates/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/GroupSettingTemplates/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupSettingTemplates/GroupSettingTemplatesRequestBuilder.php b/src/Generated/GroupSettingTemplates/GroupSettingTemplatesRequestBuilder.php index 1dcb5f48abc..3a987164263 100644 --- a/src/Generated/GroupSettingTemplates/GroupSettingTemplatesRequestBuilder.php +++ b/src/Generated/GroupSettingTemplates/GroupSettingTemplatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\GroupSettingTemplates\Count\CountRequestBuilder; use Microsoft\Graph\Generated\GroupSettingTemplates\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\GroupSettingTemplates\GetAvailableExtensionProperties\GetAvailableExtensionPropertiesRequestBuilder; @@ -87,39 +86,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Group setting templates represents a set of templates from which group settings may be created and used within a tenant. This operation retrieves the list of available groupSettingTemplates objects. This API is available in the following national cloud deployments. * @param GroupSettingTemplatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/groupsettingtemplate-list?view=graph-rest-1.0 Find more info here */ public function get(?GroupSettingTemplatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupSettingTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupSettingTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to groupSettingTemplates * @param GroupSettingTemplate $body The request body * @param GroupSettingTemplatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(GroupSettingTemplate $body, ?GroupSettingTemplatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupSettingTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupSettingTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,7 +125,6 @@ public function toGetRequestInformation(?GroupSettingTemplatesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +132,7 @@ public function toGetRequestInformation(?GroupSettingTemplatesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +147,11 @@ public function toPostRequestInformation(GroupSettingTemplate $body, ?GroupSetti $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupSettingTemplates/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/GroupSettingTemplates/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index dbc3809e2b2..d468e054432 100644 --- a/src/Generated/GroupSettingTemplates/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/GroupSettingTemplates/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupSettingTemplates/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/GroupSettingTemplates/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index 112b74f64a3..608b504ab94 100644 --- a/src/Generated/GroupSettingTemplates/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/GroupSettingTemplates/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupSettingTemplates/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/GroupSettingTemplates/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index 593dbe091d1..e2c87926eb5 100644 --- a/src/Generated/GroupSettingTemplates/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/GroupSettingTemplates/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupSettingTemplates/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/GroupSettingTemplates/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index 40de901586f..dd21d195289 100644 --- a/src/Generated/GroupSettingTemplates/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/GroupSettingTemplates/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupSettingTemplates/Item/GroupSettingTemplateItemRequestBuilder.php b/src/Generated/GroupSettingTemplates/Item/GroupSettingTemplateItemRequestBuilder.php index 9cdbc4d44fd..999bdb47c69 100644 --- a/src/Generated/GroupSettingTemplates/Item/GroupSettingTemplateItemRequestBuilder.php +++ b/src/Generated/GroupSettingTemplates/Item/GroupSettingTemplateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\GroupSettingTemplates\Item\CheckMemberGroups\CheckMemberGroupsRequestBuilder; use Microsoft\Graph\Generated\GroupSettingTemplates\Item\CheckMemberObjects\CheckMemberObjectsRequestBuilder; use Microsoft\Graph\Generated\GroupSettingTemplates\Item\GetMemberGroups\GetMemberGroupsRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from groupSettingTemplates * @param GroupSettingTemplateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?GroupSettingTemplateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A group setting template represents a template of settings from which settings may be created within a tenant. This operation allows retrieval of the properties of the groupSettingTemplate object, including the available settings and their defaults. This API is available in the following national cloud deployments. * @param GroupSettingTemplateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/groupsettingtemplate-get?view=graph-rest-1.0 Find more info here */ public function get(?GroupSettingTemplateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupSettingTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupSettingTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in groupSettingTemplates * @param GroupSettingTemplate $body The request body * @param GroupSettingTemplateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(GroupSettingTemplate $body, ?GroupSettingTemplateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupSettingTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupSettingTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?GroupSettingTemplateItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?GroupSettingTemplateItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?GroupSettingTemplateItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(GroupSettingTemplate $body, ?GroupSett $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupSettingTemplates/Item/Restore/RestoreRequestBuilder.php b/src/Generated/GroupSettingTemplates/Item/Restore/RestoreRequestBuilder.php index 29046a6180b..a53e8262cc6 100644 --- a/src/Generated/GroupSettingTemplates/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/GroupSettingTemplates/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/GroupSettingTemplates/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/GroupSettingTemplates/ValidateProperties/ValidatePropertiesRequestBuilder.php index 3ae5fbb9492..82e0a0b9b86 100644 --- a/src/Generated/GroupSettingTemplates/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/GroupSettingTemplates/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupSettings/Count/CountRequestBuilder.php b/src/Generated/GroupSettings/Count/CountRequestBuilder.php index b147448775e..c45bcf6e757 100644 --- a/src/Generated/GroupSettings/Count/CountRequestBuilder.php +++ b/src/Generated/GroupSettings/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/GroupSettings/GroupSettingsRequestBuilder.php b/src/Generated/GroupSettings/GroupSettingsRequestBuilder.php index 8a1584c435a..2f214447da6 100644 --- a/src/Generated/GroupSettings/GroupSettingsRequestBuilder.php +++ b/src/Generated/GroupSettings/GroupSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\GroupSettings\Count\CountRequestBuilder; use Microsoft\Graph\Generated\GroupSettings\Item\GroupSettingItemRequestBuilder; use Microsoft\Graph\Generated\Models\GroupSetting; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of tenant-level or group-specific group settings objects. This API is available in the following national cloud deployments. * @param GroupSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-settings?view=graph-rest-1.0 Find more info here */ public function get(?GroupSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupSettingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupSettingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new setting based on the templates available in groupSettingTemplates. These settings can be at the tenant-level or at the group level. Group settings apply to only Microsoft 365 groups. The template named Group.Unified can be used to configure tenant-wide Microsoft 365 group settings, while the template named Group.Unified.Guest can be used to configure group-specific settings. This API is available in the following national cloud deployments. * @param GroupSetting $body The request body * @param GroupSettingsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-post-settings?view=graph-rest-1.0 Find more info here */ public function post(GroupSetting $body, ?GroupSettingsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupSetting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupSetting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?GroupSettingsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?GroupSettingsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(GroupSetting $body, ?GroupSettingsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/GroupSettings/Item/GroupSettingItemRequestBuilder.php b/src/Generated/GroupSettings/Item/GroupSettingItemRequestBuilder.php index d5d885db5ef..c7660772091 100644 --- a/src/Generated/GroupSettings/Item/GroupSettingItemRequestBuilder.php +++ b/src/Generated/GroupSettings/Item/GroupSettingItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\GroupSetting; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a tenant-level or group-specific groupSetting object. This API is available in the following national cloud deployments. * @param GroupSettingItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/groupsetting-delete?view=graph-rest-1.0 Find more info here */ public function delete(?GroupSettingItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of a specific group setting object. The setting can be a tenant-level or group-specific setting. This API is available in the following national cloud deployments. * @param GroupSettingItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/groupsetting-get?view=graph-rest-1.0 Find more info here */ public function get(?GroupSettingItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupSetting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupSetting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a groupSetting object for tenant-wide group settings or a specific group setting. This API is available in the following national cloud deployments. * @param GroupSetting $body The request body * @param GroupSettingItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/groupsetting-update?view=graph-rest-1.0 Find more info here */ public function patch(GroupSetting $body, ?GroupSettingItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupSetting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupSetting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?GroupSettingItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?GroupSettingItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?GroupSettingItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(GroupSetting $body, ?GroupSettingItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Count/CountRequestBuilder.php b/src/Generated/Groups/Count/CountRequestBuilder.php index a910f8da2f4..9cb88db266f 100644 --- a/src/Generated/Groups/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Delta/DeltaRequestBuilder.php index db36b2a8871..a0e70c97e45 100644 --- a/src/Generated/Groups/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Groups/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/Groups/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index 974306852ec..80229073b31 100644 --- a/src/Generated/Groups/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/Groups/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/Groups/GetByIds/GetByIdsRequestBuilder.php index e3b0bfca3ee..d1f0f38038d 100644 --- a/src/Generated/Groups/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/Groups/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/GroupsRequestBuilder.php b/src/Generated/Groups/GroupsRequestBuilder.php index 8850d2797a1..dea6954c0f0 100644 --- a/src/Generated/Groups/GroupsRequestBuilder.php +++ b/src/Generated/Groups/GroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\GetAvailableExtensionProperties\GetAvailableExtensionPropertiesRequestBuilder; @@ -87,40 +86,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the groups available in an organization, excluding dynamic distribution groups. To retrieve dynamic distribution groups, use the Exchange admin center. This operation returns by default only a subset of the properties for each group. These default properties are noted in the Properties section. To get properties that are not returned by default, do a GET operation for the group and specify the properties in a $select OData query option. The hasMembersWithLicenseErrors and isArchived properties are an exception and are not returned in the $select query. This API is available in the following national cloud deployments. * @param GroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list?view=graph-rest-1.0 Find more info here */ public function get(?GroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new group as specified in the request body. You can create the following types of groups: This operation returns by default only a subset of the properties for each group. These default properties are noted in the Properties section. To get properties that are not returned by default, do a GET operation and specify the properties in a $select OData query option. This API is available in the following national cloud deployments. * @param Group $body The request body * @param GroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-post-groups?view=graph-rest-1.0 Find more info here */ public function post(Group $body, ?GroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,7 +126,6 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -141,6 +133,7 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -155,11 +148,11 @@ public function toPostRequestInformation(Group $body, ?GroupsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/AcceptedSenders/AcceptedSendersRequestBuilder.php b/src/Generated/Groups/Item/AcceptedSenders/AcceptedSendersRequestBuilder.php index 8db2c8fa757..83e5cf1efc9 100644 --- a/src/Generated/Groups/Item/AcceptedSenders/AcceptedSendersRequestBuilder.php +++ b/src/Generated/Groups/Item/AcceptedSenders/AcceptedSendersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\AcceptedSenders\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\AcceptedSenders\Item\DirectoryObjectItemRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\AcceptedSenders\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Users in the accepted senders list can post to conversations of the group (identified in the GET request URL).Make sure you do not specify the same user or group in the accepted senders and rejected senders lists, otherwise you will get an error. This API is available in the following national cloud deployments. * @param AcceptedSendersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-acceptedsenders?view=graph-rest-1.0 Find more info here */ public function get(?AcceptedSendersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?AcceptedSendersRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?AcceptedSendersRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/AcceptedSenders/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/AcceptedSenders/Count/CountRequestBuilder.php index cf580912c68..8c98c68724f 100644 --- a/src/Generated/Groups/Item/AcceptedSenders/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/AcceptedSenders/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/AcceptedSenders/Item/Ref/RefRequestBuilder.php b/src/Generated/Groups/Item/AcceptedSenders/Item/Ref/RefRequestBuilder.php index 5fc0a4aec9f..c02ece9b028 100644 --- a/src/Generated/Groups/Item/AcceptedSenders/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Groups/Item/AcceptedSenders/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove acceptedSender * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-delete-acceptedsenders?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/AcceptedSenders/Ref/RefRequestBuilder.php b/src/Generated/Groups/Item/AcceptedSenders/Ref/RefRequestBuilder.php index c6fcfeaefd6..cf538904d92 100644 --- a/src/Generated/Groups/Item/AcceptedSenders/Ref/RefRequestBuilder.php +++ b/src/Generated/Groups/Item/AcceptedSenders/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Users in the accepted senders list can post to conversations of the group (identified in the GET request URL).Make sure you do not specify the same user or group in the accepted senders and rejected senders lists, otherwise you will get an error. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-acceptedsenders?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Specify the user or group in @odata.id in the request body. Users in the accepted senders list can post to conversations of the group. Make sure you don't specify the same user or group in the accepted senders and rejected senders lists, otherwise you'll get an error. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-post-acceptedsenders?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/AddFavorite/AddFavoriteRequestBuilder.php b/src/Generated/Groups/Item/AddFavorite/AddFavoriteRequestBuilder.php index d27e7d76346..79ad9e36eb4 100644 --- a/src/Generated/Groups/Item/AddFavorite/AddFavoriteRequestBuilder.php +++ b/src/Generated/Groups/Item/AddFavorite/AddFavoriteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Add the group to the list of the current user's favorite groups. Supported for Microsoft 365 groups only. This API is available in the following national cloud deployments. * @param AddFavoriteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-addfavorite?view=graph-rest-1.0 Find more info here */ public function post(?AddFavoriteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?AddFavoriteRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/AppRoleAssignments/AppRoleAssignmentsRequestBuilder.php b/src/Generated/Groups/Item/AppRoleAssignments/AppRoleAssignmentsRequestBuilder.php index 18ff81f26ba..fa5eafbc4f4 100644 --- a/src/Generated/Groups/Item/AppRoleAssignments/AppRoleAssignmentsRequestBuilder.php +++ b/src/Generated/Groups/Item/AppRoleAssignments/AppRoleAssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\AppRoleAssignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\AppRoleAssignments\Item\AppRoleAssignmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\AppRoleAssignment; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents the app roles a group has been granted for an application. Supports $expand. * @param AppRoleAssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-approleassignments?view=graph-rest-1.0 Find more info here */ public function get(?AppRoleAssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to assign an app role to a security group. All direct members of the group will be considered assigned. Security groups with dynamic memberships are supported. To grant an app role assignment to a group, you need three identifiers: Additional licenses might be required to use a group to manage access to applications. This API is available in the following national cloud deployments. * @param AppRoleAssignment $body The request body * @param AppRoleAssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-post-approleassignments?view=graph-rest-1.0 Find more info here */ public function post(AppRoleAssignment $body, ?AppRoleAssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AppRoleAssignmentsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AppRoleAssignmentsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AppRoleAssignment $body, ?AppRoleAssign $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/AppRoleAssignments/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/AppRoleAssignments/Count/CountRequestBuilder.php index ebbf77850e7..b130c7b00a8 100644 --- a/src/Generated/Groups/Item/AppRoleAssignments/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/AppRoleAssignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/AppRoleAssignments/Item/AppRoleAssignmentItemRequestBuilder.php b/src/Generated/Groups/Item/AppRoleAssignments/Item/AppRoleAssignmentItemRequestBuilder.php index 4ab8d5581bf..977ab38e50c 100644 --- a/src/Generated/Groups/Item/AppRoleAssignments/Item/AppRoleAssignmentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/AppRoleAssignments/Item/AppRoleAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes an appRoleAssignment that a group has been granted. This API is available in the following national cloud deployments. * @param AppRoleAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-delete-approleassignments?view=graph-rest-1.0 Find more info here */ public function delete(?AppRoleAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the app roles a group has been granted for an application. Supports $expand. * @param AppRoleAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppRoleAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property appRoleAssignments in groups * @param AppRoleAssignment $body The request body * @param AppRoleAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AppRoleAssignment $body, ?AppRoleAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?AppRoleAssignmentItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?AppRoleAssignmentItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?AppRoleAssignmentItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(AppRoleAssignment $body, ?AppRoleAssig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/AssignLicense/AssignLicenseRequestBuilder.php b/src/Generated/Groups/Item/AssignLicense/AssignLicenseRequestBuilder.php index 4cd0b4d419a..af9014fab34 100644 --- a/src/Generated/Groups/Item/AssignLicense/AssignLicenseRequestBuilder.php +++ b/src/Generated/Groups/Item/AssignLicense/AssignLicenseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,27 +31,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Add or remove licenses on the group. Licenses assigned to the group will be assigned to all users in the group. To learn more about group-based licensing, see What is group-based licensing in Azure Active Directory. To get the subscriptions available in the directory, perform a GET subscribedSkus request. This API is available in the following national cloud deployments. + * Add or remove licenses on the group. Licenses assigned to the group will be assigned to all users in the group. To learn more about group-based licensing, see What is group-based licensing in Microsoft Entra ID. To get the subscriptions available in the directory, perform a GET subscribedSkus request. This API is available in the following national cloud deployments. * @param AssignLicensePostRequestBody $body The request body * @param AssignLicenseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-assignlicense?view=graph-rest-1.0 Find more info here */ public function post(AssignLicensePostRequestBody $body, ?AssignLicenseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Add or remove licenses on the group. Licenses assigned to the group will be assigned to all users in the group. To learn more about group-based licensing, see What is group-based licensing in Azure Active Directory. To get the subscriptions available in the directory, perform a GET subscribedSkus request. This API is available in the following national cloud deployments. + * Add or remove licenses on the group. Licenses assigned to the group will be assigned to all users in the group. To learn more about group-based licensing, see What is group-based licensing in Microsoft Entra ID. To get the subscriptions available in the directory, perform a GET subscribedSkus request. This API is available in the following national cloud deployments. * @param AssignLicensePostRequestBody $body The request body * @param AssignLicenseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -62,11 +58,11 @@ public function toPostRequestInformation(AssignLicensePostRequestBody $body, ?As $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php b/src/Generated/Groups/Item/Calendar/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php index f2f9ab41d6d..1bc0067844d 100644 --- a/src/Generated/Groups/Item/Calendar/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function allowedCalendarSharingRoles * @param AllowedCalendarSharingRolesWithUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AllowedCalendarSharingRolesWithUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AllowedCalendarSharingRolesWithUserGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AllowedCalendarSharingRolesWithUserGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?AllowedCalendarSharingRolesWithUserRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?AllowedCalendarSharingRolesWithUserRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarPermissions/CalendarPermissionsRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarPermissions/CalendarPermissionsRequestBuilder.php index f71d4cffc6d..abd47d8d494 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarPermissions/CalendarPermissionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarPermissions/CalendarPermissionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarPermissions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarPermissions\Item\CalendarPermissionItemRequestBuilder; use Microsoft\Graph\Generated\Models\CalendarPermission; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a collection of calendarPermission resources that describe the identity and roles of users with whom the specified calendar has been shared or delegated. Here, the calendar can be a user calendar or group calendar. This API is available in the following national cloud deployments. * @param CalendarPermissionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-list-calendarpermissions?view=graph-rest-1.0 Find more info here */ public function get(?CalendarPermissionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a calendarPermission resource to specify the identity and role of the user with whom the specified calendar is being shared or delegated. This API is available in the following national cloud deployments. * @param CalendarPermission $body The request body * @param CalendarPermissionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-post-calendarpermissions?view=graph-rest-1.0 Find more info here */ public function post(CalendarPermission $body, ?CalendarPermissionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CalendarPermissionsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CalendarPermissionsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(CalendarPermission $body, ?CalendarPerm $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarPermissions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarPermissions/Count/CountRequestBuilder.php index d25a24c75c2..0dd420f743e 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarPermissions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarPermissions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php index 1388b910915..4be06f644cc 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CalendarPermission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete calendarPermission. This API is available in the following national cloud deployments. * @param CalendarPermissionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendarpermission-delete?view=graph-rest-1.0 Find more info here */ public function delete(?CalendarPermissionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the specified permissions object of a user or group calendar that has been shared. This API is available in the following national cloud deployments. * @param CalendarPermissionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendarpermission-get?view=graph-rest-1.0 Find more info here */ public function get(?CalendarPermissionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the permissions assigned to an existing share recipient or delegate, through the corresponding calendarPermission object for a calendar. This API is available in the following national cloud deployments. * @param CalendarPermission $body The request body * @param CalendarPermissionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendarpermission-update?view=graph-rest-1.0 Find more info here */ public function patch(CalendarPermission $body, ?CalendarPermissionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?CalendarPermissionItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?CalendarPermissionItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?CalendarPermissionItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(CalendarPermission $body, ?CalendarPer $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarRequestBuilder.php index 48f7aa3c5a0..3922859bdf0 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\AllowedCalendarSharingRolesWithUser\AllowedCalendarSharingRolesWithUserRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarPermissions\CalendarPermissionsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\CalendarViewRequestBuilder; @@ -76,19 +75,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The group's calendar. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +97,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +104,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/CalendarViewRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/CalendarViewRequestBuilder.php index 88434a74347..2575e45fbe3 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/CalendarViewRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/CalendarViewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\EventItemRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar view for the calendar. Navigation property. Read-only. * @param CalendarViewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-list-calendarview?view=graph-rest-1.0 Find more info here */ public function get(?CalendarViewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Count/CountRequestBuilder.php index 37e5def26fa..bc924b545a9 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Delta/DeltaRequestBuilder.php index 69a2d0b396c..18012d7c63d 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Accept/AcceptRequestBuilder.php index f6f65dc6fe0..bcf4182fb3c 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php index cb8ba38540f..099478c23e0 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Attachments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Attachments\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Attachments\Item\AttachmentItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/Count/CountRequestBuilder.php index 93fbd30aeeb..f421433f145 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 98a779786c5..a1d3276cc50 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 6f0d3c071d9..d321dc55349 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Calendar/CalendarRequestBuilder.php index cd4d013b628..cbb22ce89e9 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Cancel/CancelRequestBuilder.php index df41bb34622..a3988b21f67 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Decline/DeclineRequestBuilder.php index 903a294c204..4894f9b7172 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php index 57ee262d0de..22327ba5411 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/EventItemRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/EventItemRequestBuilder.php index 76e70e3fa3a..1cbb4685e47 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/EventItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Accept\AcceptRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Attachments\AttachmentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Calendar\CalendarRequestBuilder; @@ -122,19 +121,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar view for the calendar. Navigation property. Read-only. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -147,7 +143,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -155,6 +150,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Extensions/Count/CountRequestBuilder.php index cd7e77ef968..f42603b4dfe 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php index 199ff2b849c..25dad577893 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 7c8ca933e9d..d96cf5ec643 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for groups * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in groups * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Forward/ForwardRequestBuilder.php index b7c35ab12df..166d0f9b9de 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Count/CountRequestBuilder.php index 2fa0e582001..7f3633db2f2 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php index 20956aa0be9..23f88e6b45c 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/InstancesRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/InstancesRequestBuilder.php index a67b7f90268..942636e7361 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Instances\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Instances\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Instances\Item\EventItemRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php index 9f09f517337..984dc90edc6 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php index 07383cae6d5..a076aad8037 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Instances\Item\Attachments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Instances\Item\Attachments\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Instances\Item\Attachments\Item\AttachmentItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php index 6a545bd48bf..11be25adff5 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 507ca4323bd..8d8ad129c32 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 7c6b8cf73bf..b0a1b660d13 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php index 13af21778c6..dcb572536d9 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php index 022fd0f8e36..f6e5f5f429f 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php index a9342cc18b5..8892b8df135 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php index 187e5dd9d12..f6668cd0e4d 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php index 4affc8a80b5..6d5bc61026b 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Instances\Item\Accept\AcceptRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Instances\Item\Attachments\AttachmentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Instances\Item\Calendar\CalendarRequestBuilder; @@ -114,19 +113,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -139,7 +135,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +142,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php index 4f1647a4467..3be61925106 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php index db27efb2c14..7b6da38e0aa 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Instances\Item\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\CalendarView\Item\Instances\Item\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php index b715699c1dc..971f6e179d5 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for groups * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in groups * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php index e68e43d0129..3201618275b 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index 0982d4dea5d..10ab6ae41d7 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index b10e04ba664..9b0ca280e79 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index 559c001c124..cd6b4c39cc3 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Groups/Item/Calendar/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index d66256656de..5d0a773a136 100644 --- a/src/Generated/Groups/Item/Calendar/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Count/CountRequestBuilder.php index f26aff31a0c..603120f5671 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Delta/DeltaRequestBuilder.php index 8039dd1745e..35e4a06f9e8 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/EventsRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/EventsRequestBuilder.php index 14c1ab6e04e..21bd526fdd0 100644 --- a/src/Generated/Groups/Item/Calendar/Events/EventsRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/EventsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\EventItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of events in a calendar. The calendar can be one for a user, or the default calendar of a Microsoft 365 group. The list of events contains single instance meetings and series masters. To get expanded event instances, you can get the calendar view, or get the instances of an event. This API is available in the following national cloud deployments. * @param EventsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-list-events?view=graph-rest-1.0 Find more info here */ public function get(?EventsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new event in a calendar. The calendar can be one for a user, or the default calendar of a Microsoft 365 group. This API is available in the following national cloud deployments. * @param Event $body The request body * @param EventsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-post-events?view=graph-rest-1.0 Find more info here */ public function post(Event $body, ?EventsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?EventsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?EventsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Event $body, ?EventsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Accept/AcceptRequestBuilder.php index 3daf970aaf9..40c49c40cba 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/AttachmentsRequestBuilder.php index d04d08a3fe2..c3bbc334989 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Attachments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Attachments\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Attachments\Item\AttachmentItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/Count/CountRequestBuilder.php index 5faae339926..becd6358371 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index a50462dbda1..82bb80ad3b9 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 4551ed1552f..ae659a9f628 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Calendar/CalendarRequestBuilder.php index a42f06dd50e..3ab2a94a254 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Cancel/CancelRequestBuilder.php index 72154595deb..b4c8e1b8400 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Decline/DeclineRequestBuilder.php index 1667a789628..fe6ab829536 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/DismissReminder/DismissReminderRequestBuilder.php index 3c9f0250545..96324e5df08 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/EventItemRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/EventItemRequestBuilder.php index bd9f0fc7116..5d1fb7f7e2b 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/EventItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Accept\AcceptRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Attachments\AttachmentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Calendar\CalendarRequestBuilder; @@ -122,57 +121,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property events for groups * @param EventItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EventItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The events in the calendar. Navigation property. Read-only. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an event object. This API is available in the following national cloud deployments. * @param Event $body The request body * @param EventItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-update-event?view=graph-rest-1.0 Find more info here */ public function patch(Event $body, ?EventItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -189,6 +179,7 @@ public function toDeleteRequestInformation(?EventItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -202,7 +193,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -210,6 +200,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -224,11 +215,11 @@ public function toPatchRequestInformation(Event $body, ?EventItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Extensions/Count/CountRequestBuilder.php index d1da17361cd..5e6d5ff5e46 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Extensions/ExtensionsRequestBuilder.php index 9d23071622a..890c791a7e2 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 117ca07a56c..186072c6ab6 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for groups * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in groups * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Forward/ForwardRequestBuilder.php index b86163a7c18..fcd255d3d4f 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Count/CountRequestBuilder.php index d419bce351d..1505402c9a7 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Delta/DeltaRequestBuilder.php index 43ae63b21f2..f2d58b46e44 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/InstancesRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/InstancesRequestBuilder.php index 35e4857d680..f7317264b04 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Instances\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Instances\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Instances\Item\EventItemRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php index a7ac3b2e258..42ce73b2395 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php index cea1564f397..46c62b88dac 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Instances\Item\Attachments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Instances\Item\Attachments\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Instances\Item\Attachments\Item\AttachmentItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php index ceae649bda7..8a0f243e19e 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index c422d003c9a..041c300e3ba 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 1df6bb67655..fb95b18f472 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php index 44ecc81f673..6fe1291e2c9 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php index 0e9abff29b0..7d2b1231453 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php index 1022208593f..d89fc71a6f2 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php index 418d31f8fb8..47bec0b7025 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/EventItemRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/EventItemRequestBuilder.php index fea66814810..6164cc36c68 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/EventItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Instances\Item\Accept\AcceptRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Instances\Item\Attachments\AttachmentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Instances\Item\Calendar\CalendarRequestBuilder; @@ -114,19 +113,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -139,7 +135,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +142,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php index 2e3b8cdddff..3397cbd3206 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php index d25d9545bf1..bd9078a5f67 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Instances\Item\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Calendar\Events\Item\Instances\Item\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 581996bddbb..42ad7c1376b 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for groups * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in groups * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php index a063902a5d0..b09bd5d1c34 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index e074e0c4cad..1f8dccde739 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index 16ec20e824f..a3476977757 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index 9c3e1737fcc..74f53e0e084 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Groups/Item/Calendar/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index d98f8bcd03e..af02e7c4126 100644 --- a/src/Generated/Groups/Item/Calendar/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Calendar/GetSchedule/GetScheduleRequestBuilder.php b/src/Generated/Groups/Item/Calendar/GetSchedule/GetScheduleRequestBuilder.php index 41d55a9d0e6..93b0b6670bf 100644 --- a/src/Generated/Groups/Item/Calendar/GetSchedule/GetScheduleRequestBuilder.php +++ b/src/Generated/Groups/Item/Calendar/GetSchedule/GetScheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Get the free/busy availability information for a collection of users, distributions lists, or resources (rooms or equipment) for a specified time period. This API is available in the following national cloud deployments. * @param GetSchedulePostRequestBody $body The request body * @param GetScheduleRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-getschedule?view=graph-rest-1.0 Find more info here */ public function post(GetSchedulePostRequestBody $body, ?GetScheduleRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetSchedulePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetSchedulePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetSchedulePostRequestBody $body, ?GetS $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/CalendarViewRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/CalendarViewRequestBuilder.php index eece922d7f4..eeb9ef4887b 100644 --- a/src/Generated/Groups/Item/CalendarView/CalendarViewRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/CalendarViewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\EventItemRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar view for the calendar. Read-only. * @param CalendarViewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-calendarview?view=graph-rest-1.0 Find more info here */ public function get(?CalendarViewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Count/CountRequestBuilder.php index 9cc0d152285..d6ca4e7e24e 100644 --- a/src/Generated/Groups/Item/CalendarView/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Delta/DeltaRequestBuilder.php index c001b065dc8..dd6ee3c0aea 100644 --- a/src/Generated/Groups/Item/CalendarView/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php index 69088bfacf8..b9c03648956 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php index cbe57e6c48b..e03bdbe075b 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Attachments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Attachments\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Attachments\Item\AttachmentItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php index 36c6769b4ec..c723b74b1aa 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index dd69364e69f..262420b73f6 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 2c4e471fbaf..8aea3d99d79 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php index b044c079462..fd25ce6fd5a 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php index 12f17e1618c..02bc13cdb3a 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php index 51496467dbe..301826f7a02 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php index 30f0af5957f..77b632e9be1 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/EventItemRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/EventItemRequestBuilder.php index ade78c84342..054560dc514 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/EventItemRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Accept\AcceptRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Attachments\AttachmentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Calendar\CalendarRequestBuilder; @@ -122,19 +121,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar view for the calendar. Read-only. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -147,7 +143,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -155,6 +150,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php index 2dda5888a0c..f1d0bd07691 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php index aa5e731221b..e0f43bbd8bd 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php index b5ec556cf5a..a833872fff8 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for groups * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in groups * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php index 089ca742fa3..428e6443eab 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php index 4a411dc85bb..9b389044666 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php index 975cb12c625..e9c6e94ccd7 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php index 9f83e1262bf..dbca59cd749 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Instances\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Instances\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Instances\Item\EventItemRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php index f0d26e529e9..0528787596c 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php index 7031f77aa13..eae2f5e640d 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Instances\Item\Attachments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Instances\Item\Attachments\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Instances\Item\Attachments\Item\AttachmentItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php index c8205bbbc54..b138e94efcd 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 2f88476f60b..9238e30e5da 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php index e1089045592..038a5d3e21d 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php index 9554224b3bf..201768d8340 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php index 10360de4200..03711d91efd 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php index dcce0aa1d10..fbed56b9cfe 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php index 7085130d41a..a557b5b18c7 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php index e88019426b5..32ebe164894 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Instances\Item\Accept\AcceptRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Instances\Item\Attachments\AttachmentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Instances\Item\Calendar\CalendarRequestBuilder; @@ -114,19 +113,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -139,7 +135,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +142,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php index b4e8c9b24d7..0acc1412353 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php index 86ebb2c9ffe..a006fcfcc01 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Instances\Item\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\CalendarView\Item\Instances\Item\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 8ecf56e5234..0717ab7bb0e 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for groups * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in groups * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php index 32875d0c10e..6eef3dff4d5 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index d7a499a3511..9c1e566438f 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index d4c379efe47..3b8174b5d77 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index ec090e93d16..0899ac291dc 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Groups/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index 54f6913c99b..a49a94f4624 100644 --- a/src/Generated/Groups/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CheckGrantedPermissionsForApp/CheckGrantedPermissionsForAppRequestBuilder.php b/src/Generated/Groups/Item/CheckGrantedPermissionsForApp/CheckGrantedPermissionsForAppRequestBuilder.php index 5f8ee2c2648..c6b8ba57699 100644 --- a/src/Generated/Groups/Item/CheckGrantedPermissionsForApp/CheckGrantedPermissionsForAppRequestBuilder.php +++ b/src/Generated/Groups/Item/CheckGrantedPermissionsForApp/CheckGrantedPermissionsForAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action checkGrantedPermissionsForApp * @param CheckGrantedPermissionsForAppRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?CheckGrantedPermissionsForAppRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckGrantedPermissionsForAppPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckGrantedPermissionsForAppPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toPostRequestInformation(?CheckGrantedPermissionsForAppRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/Groups/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index 46b8b05b522..7290768611d 100644 --- a/src/Generated/Groups/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/Groups/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/Groups/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index 3953de218fd..8262273f3ed 100644 --- a/src/Generated/Groups/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/Groups/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/ConversationsRequestBuilder.php b/src/Generated/Groups/Item/Conversations/ConversationsRequestBuilder.php index dca9f4ef486..26f4f1243f1 100644 --- a/src/Generated/Groups/Item/Conversations/ConversationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/ConversationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Conversations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\ConversationItemRequestBuilder; use Microsoft\Graph\Generated\Models\Conversation; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of conversations in this group. This API is available in the following national cloud deployments. * @param ConversationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-conversations?view=graph-rest-1.0 Find more info here */ public function get(?ConversationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. + * Use reply thread or reply post to further post to that conversation. This API is available in the following national cloud deployments. * @param Conversation $body The request body * @param ConversationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/group-post-conversations?view=graph-rest-1.0 Find more info here */ public function post(Conversation $body, ?ConversationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Conversation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Conversation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ConversationsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,11 +101,12 @@ public function toGetRequestInformation(?ConversationsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. + * Use reply thread or reply post to further post to that conversation. This API is available in the following national cloud deployments. * @param Conversation $body The request body * @param ConversationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -123,11 +116,11 @@ public function toPostRequestInformation(Conversation $body, ?ConversationsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Count/CountRequestBuilder.php index 7a8881dd2b7..bd34fa587cd 100644 --- a/src/Generated/Groups/Item/Conversations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/ConversationItemRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/ConversationItemRequestBuilder.php index 00aefcd9545..3c6a5e8e38b 100644 --- a/src/Generated/Groups/Item/Conversations/Item/ConversationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/ConversationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\ThreadsRequestBuilder; use Microsoft\Graph\Generated\Models\Conversation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,39 +41,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete conversation. This API is available in the following national cloud deployments. * @param ConversationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversation-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Retrieve the properties and relationships of conversation object. This API is available in the following national cloud deployments. + * This API is available in the following national cloud deployments. * @param ConversationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/conversation-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/group-get-conversation?view=graph-rest-1.0 Find more info here */ public function get(?ConversationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Conversation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Conversation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -91,11 +84,12 @@ public function toDeleteRequestInformation(?ConversationItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Retrieve the properties and relationships of conversation object. This API is available in the following national cloud deployments. + * This API is available in the following national cloud deployments. * @param ConversationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -104,7 +98,6 @@ public function toGetRequestInformation(?ConversationItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -112,6 +105,7 @@ public function toGetRequestInformation(?ConversationItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/ConversationItemRequestBuilderGetQueryParameters.php b/src/Generated/Groups/Item/Conversations/Item/ConversationItemRequestBuilderGetQueryParameters.php index 91039b9f9bb..7f1ca986e69 100644 --- a/src/Generated/Groups/Item/Conversations/Item/ConversationItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Groups/Item/Conversations/Item/ConversationItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the properties and relationships of conversation object. This API is available in the following national cloud deployments. + * This API is available in the following national cloud deployments. */ class ConversationItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Count/CountRequestBuilder.php index d84bff78511..37633a1ee7b 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/ConversationThreadItemRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/ConversationThreadItemRequestBuilder.php index 6eaf2d84211..4e9e025d078 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/ConversationThreadItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/ConversationThreadItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\PostsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Reply\ReplyRequestBuilder; use Microsoft\Graph\Generated\Models\ConversationThread; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property threads for groups * @param ConversationThreadItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ConversationThreadItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of all the conversation threads in the conversation. A navigation property. Read-only. Nullable. * @param ConversationThreadItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ConversationThreadItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationThread::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationThread::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property threads in groups * @param ConversationThread $body The request body * @param ConversationThreadItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ConversationThread $body, ?ConversationThreadItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationThread::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationThread::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ConversationThreadItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ConversationThreadItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ConversationThreadItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(ConversationThread $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Count/CountRequestBuilder.php index 3bce96d89c6..3f12144f512 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/AttachmentsRequestBuilder.php index 76f033ad282..82d64d40cb4 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\Attachments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\Attachments\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\Attachments\Item\AttachmentItemRequestBuilder; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to a post. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/post-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to attachments for groups * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/Count/CountRequestBuilder.php index 26f3a802831..9b85fa9c9de 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 9fa29c5a621..ba111566245 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 92248bec310..d5072dbce91 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,37 +33,31 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attachments for groups * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -81,6 +74,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -94,7 +88,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -102,6 +95,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Extensions/Count/CountRequestBuilder.php index d62be0b8b37..022316e36dd 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Extensions/ExtensionsRequestBuilder.php index 05db261c503..b8f41ba98f2 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for groups * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Extensions/Item/ExtensionItemRequestBuilder.php index bd3f68b482a..54b84ff769a 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for groups * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an open extension (openTypeExtension object) with the properties in the request body: The data in an extension can be primitive types, or arrays of primitive types. See the table in the Permissions section for the list of resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-update?view=graph-rest-1.0 Find more info here */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Forward/ForwardRequestBuilder.php index 622af36ecbb..3f2ccbbd845 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Forward a post to a recipient. You can specify both the parent conversation and thread in the request, or, you can specify just the parent thread without the parent conversation. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/post-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/AttachmentsRequestBuilder.php index 66efc70ad93..6af2dfaabdb 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\InReplyTo\Attachments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\InReplyTo\Attachments\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\InReplyTo\Attachments\Item\AttachmentItemRequestBuilder; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to a post. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/post-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to attachments for groups * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Count/CountRequestBuilder.php index b0630cbb71e..70a7283ce86 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 6e12fdc605e..837fc880325 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Item/AttachmentItemRequestBuilder.php index 9ba216336af..07ff9003a7a 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,37 +33,31 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attachments for groups * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -81,6 +74,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -94,7 +88,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -102,6 +95,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Count/CountRequestBuilder.php index 9f6621a91cb..44b8796f745 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/ExtensionsRequestBuilder.php index ff88f9a8582..09fcc5d17ee 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\InReplyTo\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\InReplyTo\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for groups * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Item/ExtensionItemRequestBuilder.php index f52c7138943..0fcdbcd8559 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for groups * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an open extension (openTypeExtension object) with the properties in the request body: The data in an extension can be primitive types, or arrays of primitive types. See the table in the Permissions section for the list of resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-update?view=graph-rest-1.0 Find more info here */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Forward/ForwardRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Forward/ForwardRequestBuilder.php index 7f2db792bba..b7c5cf83ab8 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Forward a post to a recipient. You can specify both the parent conversation and thread in the request, or, you can specify just the parent thread without the parent conversation. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/post-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/InReplyToRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/InReplyToRequestBuilder.php index 59795423948..94a9ad9d14f 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/InReplyToRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/InReplyToRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\InReplyTo\Attachments\AttachmentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\InReplyTo\Extensions\ExtensionsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\InReplyTo\Forward\ForwardRequestBuilder; @@ -66,19 +65,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Supports $expand. * @param InReplyToRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InReplyToRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Post::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Post::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -91,7 +87,6 @@ public function toGetRequestInformation(?InReplyToRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -99,6 +94,7 @@ public function toGetRequestInformation(?InReplyToRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Reply/ReplyRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Reply/ReplyRequestBuilder.php index f799c17aa24..59780e6c313 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Reply/ReplyRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/InReplyTo/Reply/ReplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. + * Reply to a post and add a new post to the specified thread in a group conversation. You can specify both the parent conversation and thread in the request, or, you can specify just the parent thread without the parent conversation. This API is available in the following national cloud deployments. * @param ReplyPostRequestBody $body The request body * @param ReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/post-reply?view=graph-rest-1.0 Find more info here */ public function post(ReplyPostRequestBody $body, ?ReplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. + * Reply to a post and add a new post to the specified thread in a group conversation. You can specify both the parent conversation and thread in the request, or, you can specify just the parent thread without the parent conversation. This API is available in the following national cloud deployments. * @param ReplyPostRequestBody $body The request body * @param ReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -65,6 +61,7 @@ public function toPostRequestInformation(ReplyPostRequestBody $body, ?ReplyReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/PostItemRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/PostItemRequestBuilder.php index 0b409dcb8a1..5b08280f10e 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/PostItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/PostItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\Attachments\AttachmentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\Extensions\ExtensionsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\Forward\ForwardRequestBuilder; @@ -74,19 +73,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get posts from groups * @param PostItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PostItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Post::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Post::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +95,6 @@ public function toGetRequestInformation(?PostItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +102,7 @@ public function toGetRequestInformation(?PostItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Reply/ReplyRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Reply/ReplyRequestBuilder.php index cc168a7b04c..93138c333d2 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Reply/ReplyRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/Item/Reply/ReplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. + * Reply to a post and add a new post to the specified thread in a group conversation. You can specify both the parent conversation and thread in the request, or, you can specify just the parent thread without the parent conversation. This API is available in the following national cloud deployments. * @param ReplyPostRequestBody $body The request body * @param ReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/post-reply?view=graph-rest-1.0 Find more info here */ public function post(ReplyPostRequestBody $body, ?ReplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. + * Reply to a post and add a new post to the specified thread in a group conversation. You can specify both the parent conversation and thread in the request, or, you can specify just the parent thread without the parent conversation. This API is available in the following national cloud deployments. * @param ReplyPostRequestBody $body The request body * @param ReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -65,6 +61,7 @@ public function toPostRequestInformation(ReplyPostRequestBody $body, ?ReplyReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/PostsRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/PostsRequestBuilder.php index 379e8576c83..9156d4809e9 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/PostsRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Posts/PostsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\Posts\Item\PostItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the posts of the specified thread. You can specify both the parent conversation and the thread, or, you can specify the thread without referencing the parent conversation. This API is available in the following national cloud deployments. * @param PostsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationthread-list-posts?view=graph-rest-1.0 Find more info here */ public function get(?PostsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PostCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PostCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?PostsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?PostsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Reply/ReplyRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Reply/ReplyRequestBuilder.php index f09b45457a3..fc49f20d617 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Reply/ReplyRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/Item/Reply/ReplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Reply to a thread in a group conversation and add a new post to it. You can specify the parent conversation in the request, or, you can specify just the thread without the parent conversation. This API is available in the following national cloud deployments. * @param ReplyPostRequestBody $body The request body * @param ReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationthread-reply?view=graph-rest-1.0 Find more info here */ public function post(ReplyPostRequestBody $body, ?ReplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ReplyPostRequestBody $body, ?ReplyReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Conversations/Item/Threads/ThreadsRequestBuilder.php b/src/Generated/Groups/Item/Conversations/Item/Threads/ThreadsRequestBuilder.php index 96c0f091832..f4adcabdd8c 100644 --- a/src/Generated/Groups/Item/Conversations/Item/Threads/ThreadsRequestBuilder.php +++ b/src/Generated/Groups/Item/Conversations/Item/Threads/ThreadsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Conversations\Item\Threads\Item\ConversationThreadItemRequestBuilder; use Microsoft\Graph\Generated\Models\ConversationThread; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get all the threads in a group conversation. Note: You can also get all the threads of a group. This API is available in the following national cloud deployments. * @param ThreadsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversation-list-threads?view=graph-rest-1.0 Find more info here */ public function get(?ThreadsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationThreadCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationThreadCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new thread in the specified conversation. A thread and post are created as specified. Use reply thread to further post to that thread. Or, if you get the post ID, you can also reply to that post in that thread. Note: You can also start a new conversation by first creating a thread. This API is available in the following national cloud deployments. * @param ConversationThread $body The request body * @param ThreadsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversation-post-threads?view=graph-rest-1.0 Find more info here */ public function post(ConversationThread $body, ?ThreadsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationThread::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationThread::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ThreadsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ThreadsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ConversationThread $body, ?ThreadsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/CreatedOnBehalfOf/CreatedOnBehalfOfRequestBuilder.php b/src/Generated/Groups/Item/CreatedOnBehalfOf/CreatedOnBehalfOfRequestBuilder.php index 26c9caeb75e..ee82ed86c46 100644 --- a/src/Generated/Groups/Item/CreatedOnBehalfOf/CreatedOnBehalfOfRequestBuilder.php +++ b/src/Generated/Groups/Item/CreatedOnBehalfOf/CreatedOnBehalfOfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The user (or application) that created the group. NOTE: This is not set if the user is an administrator. Read-only. * @param CreatedOnBehalfOfRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedOnBehalfOfRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CreatedOnBehalfOfRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CreatedOnBehalfOfRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Drive/DriveRequestBuilder.php b/src/Generated/Groups/Item/Drive/DriveRequestBuilder.php index 9d8535481d2..3be723dcb3f 100644 --- a/src/Generated/Groups/Item/Drive/DriveRequestBuilder.php +++ b/src/Generated/Groups/Item/Drive/DriveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Drive; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The group's default drive. Read-only. * @param DriveRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Drives/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Drives/Count/CountRequestBuilder.php index 636e9ad8d22..595dbfbdb2e 100644 --- a/src/Generated/Groups/Item/Drives/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Drives/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Drives/DrivesRequestBuilder.php b/src/Generated/Groups/Item/Drives/DrivesRequestBuilder.php index 3445b9cbcb4..3c8ca6e6e79 100644 --- a/src/Generated/Groups/Item/Drives/DrivesRequestBuilder.php +++ b/src/Generated/Groups/Item/Drives/DrivesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Drives\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Drives\Item\DriveItemRequestBuilder; use Microsoft\Graph\Generated\Models\DriveCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The group's drives. Read-only. * @param DrivesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DrivesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?DrivesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?DrivesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Drives/Item/DriveItemRequestBuilder.php b/src/Generated/Groups/Item/Drives/Item/DriveItemRequestBuilder.php index c26db2dc7c6..304c102f6dc 100644 --- a/src/Generated/Groups/Item/Drives/Item/DriveItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Drives/Item/DriveItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Drive; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The group's drives. Read-only. * @param DriveItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Events/Count/CountRequestBuilder.php index 6ebca90439c..4c09d64a5c0 100644 --- a/src/Generated/Groups/Item/Events/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Item/Events/Delta/DeltaRequestBuilder.php index 1cd59dfef19..0a56daa75d5 100644 --- a/src/Generated/Groups/Item/Events/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/EventsRequestBuilder.php b/src/Generated/Groups/Item/Events/EventsRequestBuilder.php index bf89497b35d..ba893a0fc9c 100644 --- a/src/Generated/Groups/Item/Events/EventsRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/EventsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Events\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Item\EventItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of event objects. This API is available in the following national cloud deployments. * @param EventsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-events?view=graph-rest-1.0 Find more info here */ public function get(?EventsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new event. This API is available in the following national cloud deployments. * @param Event $body The request body * @param EventsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-post-events?view=graph-rest-1.0 Find more info here */ public function post(Event $body, ?EventsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?EventsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?EventsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Event $body, ?EventsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Accept/AcceptRequestBuilder.php index 8ebec807570..7bf3852954e 100644 --- a/src/Generated/Groups/Item/Events/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php index 839e3019dc8..92c0dcab863 100644 --- a/src/Generated/Groups/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Attachments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Attachments\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Attachments\Item\AttachmentItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Attachments/Count/CountRequestBuilder.php index 21a4a6bd68c..007c320a525 100644 --- a/src/Generated/Groups/Item/Events/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index e5ec7b99e73..6cc0bf3ab5a 100644 --- a/src/Generated/Groups/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 2a0e4089aec..d2a0df259df 100644 --- a/src/Generated/Groups/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Calendar/CalendarRequestBuilder.php index cf7ff81f663..200b504e3f9 100644 --- a/src/Generated/Groups/Item/Events/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Cancel/CancelRequestBuilder.php index d10f34d024c..e878a327ead 100644 --- a/src/Generated/Groups/Item/Events/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Decline/DeclineRequestBuilder.php index d91d7172ebd..c9ca594b725 100644 --- a/src/Generated/Groups/Item/Events/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php index de4ba330cac..df186bfa81a 100644 --- a/src/Generated/Groups/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/EventItemRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/EventItemRequestBuilder.php index 760098ea8db..fa44e49da90 100644 --- a/src/Generated/Groups/Item/Events/Item/EventItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Accept\AcceptRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Attachments\AttachmentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Calendar\CalendarRequestBuilder; @@ -122,58 +121,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an event object. This API is available in the following national cloud deployments. * @param EventItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-delete-event?view=graph-rest-1.0 Find more info here */ public function delete(?EventItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an event object. This API is available in the following national cloud deployments. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-get-event?view=graph-rest-1.0 Find more info here */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property events in groups * @param Event $body The request body * @param EventItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Event $body, ?EventItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -190,6 +180,7 @@ public function toDeleteRequestInformation(?EventItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -203,7 +194,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -211,6 +201,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -225,11 +216,11 @@ public function toPatchRequestInformation(Event $body, ?EventItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Extensions/Count/CountRequestBuilder.php index 9505d8f3053..62eb5348259 100644 --- a/src/Generated/Groups/Item/Events/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php index b9dd60051a8..e161653e337 100644 --- a/src/Generated/Groups/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php index e288bf3cded..609bf628a46 100644 --- a/src/Generated/Groups/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for groups * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in groups * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Forward/ForwardRequestBuilder.php index d45f481a7ba..6c82b819ea4 100644 --- a/src/Generated/Groups/Item/Events/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Count/CountRequestBuilder.php index 7bc860295e2..a3d92c4775b 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php index 1e966bfc987..67057fdfcdb 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/InstancesRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/InstancesRequestBuilder.php index 59e223d0704..9de5099c594 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Instances\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Instances\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Instances\Item\EventItemRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php index bf0e916e3ca..ab65a2bbf6f 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php index 50229de2937..75bad0e7055 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Instances\Item\Attachments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Instances\Item\Attachments\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Instances\Item\Attachments\Item\AttachmentItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php index e38ed61a723..3afd95370ec 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index a7f98bd72a2..f44b5e5f7de 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php index c8bb1ef403c..dbc5dd4350e 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php index e9df0227517..bea3f12a63f 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php index c8618312a4c..e51f6b9bc41 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php index 992269b6313..540dadbb731 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php index ff19ec4c54e..021141b6195 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php index 2a860b88790..fd56af3c6f6 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Instances\Item\Accept\AcceptRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Instances\Item\Attachments\AttachmentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Instances\Item\Calendar\CalendarRequestBuilder; @@ -114,19 +113,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -139,7 +135,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +142,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php index 9033748e7e5..476d2e0eb4b 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php index d1268742b83..ce56b8b7912 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Instances\Item\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Events\Item\Instances\Item\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 92fda93af09..7e16a2d5064 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for groups * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in groups * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php index deaeeab7d05..e70c6a621b2 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index 38556fbc128..6707e7b0024 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index e0e467fd370..f192e019dd5 100644 --- a/src/Generated/Groups/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index fa209aa23fc..660149e454d 100644 --- a/src/Generated/Groups/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Groups/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index 1def3283895..cc60b63b485 100644 --- a/src/Generated/Groups/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Groups/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Extensions/Count/CountRequestBuilder.php index f915b8f2c44..327b4d685d0 100644 --- a/src/Generated/Groups/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Groups/Item/Extensions/ExtensionsRequestBuilder.php index c52588885a9..21f0372e9f6 100644 --- a/src/Generated/Groups/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of open extensions defined for the group. Read-only. Nullable. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for groups * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Groups/Item/Extensions/Item/ExtensionItemRequestBuilder.php index fe8bceab192..6438e6c5b8d 100644 --- a/src/Generated/Groups/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for groups * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of open extensions defined for the group. Read-only. Nullable. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in groups * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/Groups/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index 5bf98df25e1..c1393d5ec96 100644 --- a/src/Generated/Groups/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/Groups/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/Groups/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index fb901144e65..cd16b03c415 100644 --- a/src/Generated/Groups/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/Groups/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/GroupItemRequestBuilder.php b/src/Generated/Groups/Item/GroupItemRequestBuilder.php index 4295934ee75..eaeea53628d 100644 --- a/src/Generated/Groups/Item/GroupItemRequestBuilder.php +++ b/src/Generated/Groups/Item/GroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\AcceptedSenders\AcceptedSendersRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\AddFavorite\AddFavoriteRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\AppRoleAssignments\AppRoleAssignmentsRequestBuilder; @@ -378,59 +377,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete group. When deleted, Microsoft 365 groups are moved to a temporary container and can be restored within 30 days. After that time, they're permanently deleted. This isn't applicable to Security groups and Distribution groups which are permanently deleted immediately. To learn more, see deletedItems. This API is available in the following national cloud deployments. * @param GroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-delete?view=graph-rest-1.0 Find more info here */ public function delete(?GroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a group object. This operation returns by default only a subset of all the available properties, as noted in the Properties section. To get properties that aren't_ returned by default, specify them in a $select OData query option. The hasMembersWithLicenseErrors and isArchived properties are an exception and aren't returned in the $select query. This API is available in the following national cloud deployments. * @param GroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-get?view=graph-rest-1.0 Find more info here */ public function get(?GroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update the properties of a group object. This API is available in the following national cloud deployments. + * Add a member to a security or Microsoft 365 group through the members navigation property. The following table shows the types of members that can be added to either security groups or Microsoft 365 groups. This API is available in the following national cloud deployments. * @param Group $body The request body * @param GroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/group-update?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/group-post-members?view=graph-rest-1.0 Find more info here */ public function patch(Group $body, ?GroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -447,6 +437,7 @@ public function toDeleteRequestInformation(?GroupItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -460,7 +451,6 @@ public function toGetRequestInformation(?GroupItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -468,11 +458,12 @@ public function toGetRequestInformation(?GroupItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the properties of a group object. This API is available in the following national cloud deployments. + * Add a member to a security or Microsoft 365 group through the members navigation property. The following table shows the types of members that can be added to either security groups or Microsoft 365 groups. This API is available in the following national cloud deployments. * @param Group $body The request body * @param GroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -482,11 +473,11 @@ public function toPatchRequestInformation(Group $body, ?GroupItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/GroupLifecyclePolicies/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/GroupLifecyclePolicies/Count/CountRequestBuilder.php index 000877e3d93..c48fde168ab 100644 --- a/src/Generated/Groups/Item/GroupLifecyclePolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/GroupLifecyclePolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/GroupLifecyclePolicies/GroupLifecyclePoliciesRequestBuilder.php b/src/Generated/Groups/Item/GroupLifecyclePolicies/GroupLifecyclePoliciesRequestBuilder.php index 708e63aa027..adebd0a2153 100644 --- a/src/Generated/Groups/Item/GroupLifecyclePolicies/GroupLifecyclePoliciesRequestBuilder.php +++ b/src/Generated/Groups/Item/GroupLifecyclePolicies/GroupLifecyclePoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\GroupLifecyclePolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\GroupLifecyclePolicies\Item\GroupLifecyclePolicyItemRequestBuilder; use Microsoft\Graph\Generated\Models\GroupLifecyclePolicy; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieves a list of groupLifecyclePolicy objects to which a group belongs. This API is available in the following national cloud deployments. * @param GroupLifecyclePoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-grouplifecyclepolicies?view=graph-rest-1.0 Find more info here */ public function get(?GroupLifecyclePoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to groupLifecyclePolicies for groups * @param GroupLifecyclePolicy $body The request body * @param GroupLifecyclePoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(GroupLifecyclePolicy $body, ?GroupLifecyclePoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?GroupLifecyclePoliciesRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?GroupLifecyclePoliciesRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(GroupLifecyclePolicy $body, ?GroupLifec $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/GroupLifecyclePolicies/Item/AddGroup/AddGroupRequestBuilder.php b/src/Generated/Groups/Item/GroupLifecyclePolicies/Item/AddGroup/AddGroupRequestBuilder.php index 34751310545..a6a7807abed 100644 --- a/src/Generated/Groups/Item/GroupLifecyclePolicies/Item/AddGroup/AddGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/GroupLifecyclePolicies/Item/AddGroup/AddGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Adds specific groups to a lifecycle policy. This action limits the group lifecycle policy to a set of groups only if the managedGroupTypes property of groupLifecyclePolicy is set to Selected. This API is available in the following national cloud deployments. * @param AddGroupPostRequestBody $body The request body * @param AddGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/grouplifecyclepolicy-addgroup?view=graph-rest-1.0 Find more info here */ public function post(AddGroupPostRequestBody $body, ?AddGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddGroupPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddGroupPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddGroupPostRequestBody $body, ?AddGrou $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/GroupLifecyclePolicies/Item/GroupLifecyclePolicyItemRequestBuilder.php b/src/Generated/Groups/Item/GroupLifecyclePolicies/Item/GroupLifecyclePolicyItemRequestBuilder.php index 389468f6da5..f32dd2a6f58 100644 --- a/src/Generated/Groups/Item/GroupLifecyclePolicies/Item/GroupLifecyclePolicyItemRequestBuilder.php +++ b/src/Generated/Groups/Item/GroupLifecyclePolicies/Item/GroupLifecyclePolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\GroupLifecyclePolicies\Item\AddGroup\AddGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\GroupLifecyclePolicies\Item\RemoveGroup\RemoveGroupRequestBuilder; use Microsoft\Graph\Generated\Models\GroupLifecyclePolicy; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property groupLifecyclePolicies for groups * @param GroupLifecyclePolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?GroupLifecyclePolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of lifecycle policies for this group. Read-only. Nullable. * @param GroupLifecyclePolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupLifecyclePolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property groupLifecyclePolicies in groups * @param GroupLifecyclePolicy $body The request body * @param GroupLifecyclePolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(GroupLifecyclePolicy $body, ?GroupLifecyclePolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupLifecyclePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?GroupLifecyclePolicyItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?GroupLifecyclePolicyItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?GroupLifecyclePolicyItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(GroupLifecyclePolicy $body, ?GroupLife $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/GroupLifecyclePolicies/Item/RemoveGroup/RemoveGroupRequestBuilder.php b/src/Generated/Groups/Item/GroupLifecyclePolicies/Item/RemoveGroup/RemoveGroupRequestBuilder.php index ef77c96d611..28bd8e0f3a0 100644 --- a/src/Generated/Groups/Item/GroupLifecyclePolicies/Item/RemoveGroup/RemoveGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/GroupLifecyclePolicies/Item/RemoveGroup/RemoveGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Removes a group from a lifecycle policy. This API is available in the following national cloud deployments. * @param RemoveGroupPostRequestBody $body The request body * @param RemoveGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/grouplifecyclepolicy-removegroup?view=graph-rest-1.0 Find more info here */ public function post(RemoveGroupPostRequestBody $body, ?RemoveGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RemoveGroupPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RemoveGroupPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RemoveGroupPostRequestBody $body, ?Remo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MemberOf/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/MemberOf/Count/CountRequestBuilder.php index e6324902113..83903900da3 100644 --- a/src/Generated/Groups/Item/MemberOf/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/MemberOf/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php index 08d60fe440b..1ac45c086f1 100644 --- a/src/Generated/Groups/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Groups/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index b551352a672..129c9cd25f5 100644 --- a/src/Generated/Groups/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Groups/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\MemberOf\GraphAdministrativeUnit\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\AdministrativeUnitCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.administrativeUnit in the microsoft.graph.directoryObject collection * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php index 8b9c701dc11..2e6ec640a35 100644 --- a/src/Generated/Groups/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Groups/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php index 17f0bfba306..a308d193d62 100644 --- a/src/Generated/Groups/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\MemberOf\GraphGroup\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Groups/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php index 2db2ae2993e..ddbac8bf724 100644 --- a/src/Generated/Groups/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Groups/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\MemberOf\Item\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\MemberOf\Item\GraphGroup\GraphGroupRequestBuilder; use Microsoft\Graph\Generated\Models\DirectoryObject; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Groups that this group is a member of. HTTP Methods: GET (supported for all groups). Read-only. Nullable. Supports $expand. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Groups/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index 0677207a3b8..1e78d891da9 100644 --- a/src/Generated/Groups/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Groups/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnit; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.administrativeUnit * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Groups/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php index 15aa4189309..0c817aa6dae 100644 --- a/src/Generated/Groups/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MemberOf/MemberOfRequestBuilder.php b/src/Generated/Groups/Item/MemberOf/MemberOfRequestBuilder.php index 1d2492bdd06..cd3b71dc758 100644 --- a/src/Generated/Groups/Item/MemberOf/MemberOfRequestBuilder.php +++ b/src/Generated/Groups/Item/MemberOf/MemberOfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\MemberOf\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\MemberOf\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\MemberOf\GraphGroup\GraphGroupRequestBuilder; @@ -70,20 +69,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Groups that this group is a member of. HTTP Methods: GET (supported for all groups). Read-only. Nullable. Supports $expand. * @param MemberOfRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-memberof?view=graph-rest-1.0 Find more info here */ public function get(?MemberOfRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -96,7 +92,6 @@ public function toGetRequestInformation(?MemberOfRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -104,6 +99,7 @@ public function toGetRequestInformation(?MemberOfRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Members/Count/CountRequestBuilder.php index 186acfc4376..480281d880e 100644 --- a/src/Generated/Groups/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/GraphApplication/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Members/GraphApplication/Count/CountRequestBuilder.php index fea42bffc17..eb242f548c5 100644 --- a/src/Generated/Groups/Item/Members/GraphApplication/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/GraphApplication/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Groups/Item/Members/GraphApplication/GraphApplicationRequestBuilder.php index 959732a0d0f..5b5cb9e0e9f 100644 --- a/src/Generated/Groups/Item/Members/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Members\GraphApplication\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ApplicationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.application in the microsoft.graph.directoryObject collection * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/GraphDevice/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Members/GraphDevice/Count/CountRequestBuilder.php index e5e7f82e939..0fa63b9b1dc 100644 --- a/src/Generated/Groups/Item/Members/GraphDevice/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/GraphDevice/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Groups/Item/Members/GraphDevice/GraphDeviceRequestBuilder.php index 021323ef02a..775e078d7df 100644 --- a/src/Generated/Groups/Item/Members/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Members\GraphDevice\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.device in the microsoft.graph.directoryObject collection * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Members/GraphGroup/Count/CountRequestBuilder.php index 48a533eb5f8..1b4bebe4da5 100644 --- a/src/Generated/Groups/Item/Members/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Groups/Item/Members/GraphGroup/GraphGroupRequestBuilder.php index 8cd58901255..9e0d20353d8 100644 --- a/src/Generated/Groups/Item/Members/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Members\GraphGroup\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/GraphOrgContact/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Members/GraphOrgContact/Count/CountRequestBuilder.php index 6180142c504..86b09af7b61 100644 --- a/src/Generated/Groups/Item/Members/GraphOrgContact/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/GraphOrgContact/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Groups/Item/Members/GraphOrgContact/GraphOrgContactRequestBuilder.php index 82b71638991..1d3e58c3e30 100644 --- a/src/Generated/Groups/Item/Members/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Members\GraphOrgContact\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContactCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.orgContact in the microsoft.graph.directoryObject collection * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Members/GraphServicePrincipal/Count/CountRequestBuilder.php index c988ab5198c..857d7edf2c3 100644 --- a/src/Generated/Groups/Item/Members/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Groups/Item/Members/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 5bfd7c4d945..bbad05df31d 100644 --- a/src/Generated/Groups/Item/Members/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Members\GraphServicePrincipal\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/GraphUser/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Members/GraphUser/Count/CountRequestBuilder.php index 4e4f7664a0f..ba390ff7f95 100644 --- a/src/Generated/Groups/Item/Members/GraphUser/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/GraphUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Groups/Item/Members/GraphUser/GraphUserRequestBuilder.php index a2560b6d0de..f168edd28c5 100644 --- a/src/Generated/Groups/Item/Members/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Members\GraphUser\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.user in the microsoft.graph.directoryObject collection * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/Item/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Groups/Item/Members/Item/GraphApplication/GraphApplicationRequestBuilder.php index 90a2da7c7ea..6073283311c 100644 --- a/src/Generated/Groups/Item/Members/Item/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/Item/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Application; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.application * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/Item/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Groups/Item/Members/Item/GraphDevice/GraphDeviceRequestBuilder.php index 34a7cf8d3b0..c6efd79a045 100644 --- a/src/Generated/Groups/Item/Members/Item/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/Item/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Device; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.device * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Groups/Item/Members/Item/GraphGroup/GraphGroupRequestBuilder.php index fb0c3ffeb44..9d4db807bc1 100644 --- a/src/Generated/Groups/Item/Members/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Groups/Item/Members/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php index 917371a092e..42ac1033872 100644 --- a/src/Generated/Groups/Item/Members/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContact; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.orgContact * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Groups/Item/Members/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 3550eb7c394..259a9e2f4fa 100644 --- a/src/Generated/Groups/Item/Members/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/Item/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Groups/Item/Members/Item/GraphUser/GraphUserRequestBuilder.php index 5cbe30130cb..8d5193be3b7 100644 --- a/src/Generated/Groups/Item/Members/Item/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/Item/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.user * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/Item/Ref/RefRequestBuilder.php b/src/Generated/Groups/Item/Members/Item/Ref/RefRequestBuilder.php index 075837fee58..6d9044d0f72 100644 --- a/src/Generated/Groups/Item/Members/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a member from a group via the members navigation property. You can't remove a member from groups with dynamic memberships. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-delete-members?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/MembersRequestBuilder.php b/src/Generated/Groups/Item/Members/MembersRequestBuilder.php index c16460d5fcd..2747f7ba537 100644 --- a/src/Generated/Groups/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Members\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Members\GraphApplication\GraphApplicationRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Members\GraphDevice\GraphDeviceRequestBuilder; @@ -110,20 +109,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The members of this group, who can be users, devices, other groups, or service principals. Supports the List members, Add member, and Remove member operations. Nullable. Supports $expand including nested $select. For example, /groups?$filter=startsWith(displayName,'Role')&$select=id,displayName&$expand=members($select=id,userPrincipalName,displayName). * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -136,7 +132,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -144,6 +139,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Members/Ref/RefRequestBuilder.php b/src/Generated/Groups/Item/Members/Ref/RefRequestBuilder.php index c7c6da319d6..e4c330e876e 100644 --- a/src/Generated/Groups/Item/Members/Ref/RefRequestBuilder.php +++ b/src/Generated/Groups/Item/Members/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The members of this group, who can be users, devices, other groups, or service principals. Supports the List members, Add member, and Remove member operations. Nullable. Supports $expand including nested $select. For example, /groups?$filter=startsWith(displayName,'Role')&$select=id,displayName&$expand=members($select=id,userPrincipalName,displayName). * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-members?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a member to a security or Microsoft 365 group through the members navigation property. The following table shows the types of members that can be added to either security groups or Microsoft 365 groups. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-post-members?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/Count/CountRequestBuilder.php index 2d6c956359f..35f1e2ad74d 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphApplication/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphApplication/Count/CountRequestBuilder.php index a672f7d306e..ce58498c588 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphApplication/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphApplication/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphApplication/GraphApplicationRequestBuilder.php index a32d2c22f19..79ce1548674 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\MembersWithLicenseErrors\GraphApplication\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ApplicationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.application in the microsoft.graph.directoryObject collection * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphDevice/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphDevice/Count/CountRequestBuilder.php index 2029d9b4131..79f608649a4 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphDevice/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphDevice/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphDevice/GraphDeviceRequestBuilder.php index 5d90f813583..4cb03cb131f 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\MembersWithLicenseErrors\GraphDevice\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.device in the microsoft.graph.directoryObject collection * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphGroup/Count/CountRequestBuilder.php index 0c453fbcb9a..6550140cbcf 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphGroup/GraphGroupRequestBuilder.php index fa6fbccc84c..6e09899e62d 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\MembersWithLicenseErrors\GraphGroup\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphOrgContact/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphOrgContact/Count/CountRequestBuilder.php index fa2ed0a491b..f98075643b7 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphOrgContact/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphOrgContact/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphOrgContact/GraphOrgContactRequestBuilder.php index 60a22a2d08e..5383ee32668 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\MembersWithLicenseErrors\GraphOrgContact\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContactCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.orgContact in the microsoft.graph.directoryObject collection * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphServicePrincipal/Count/CountRequestBuilder.php index 630ca05644e..b082a2fdd51 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index a877449db09..dcc1746352a 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\MembersWithLicenseErrors\GraphServicePrincipal\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphUser/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphUser/Count/CountRequestBuilder.php index 190ed9f0b2a..cb88d4842d0 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphUser/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphUser/GraphUserRequestBuilder.php index b43dee06bb3..9e75bb4c635 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\MembersWithLicenseErrors\GraphUser\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.user in the microsoft.graph.directoryObject collection * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/DirectoryObjectItemRequestBuilder.php index 9e62f7c561d..b40a2cb758e 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\MembersWithLicenseErrors\Item\GraphApplication\GraphApplicationRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\MembersWithLicenseErrors\Item\GraphDevice\GraphDeviceRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\MembersWithLicenseErrors\Item\GraphGroup\GraphGroupRequestBuilder; @@ -82,19 +81,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A list of group members with license errors from this group-based license assignment. Read-only. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -107,7 +103,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -115,6 +110,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphApplication/GraphApplicationRequestBuilder.php index df1c3195833..293d6e17f58 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Application; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.application * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphDevice/GraphDeviceRequestBuilder.php index c4a3632e0e5..7c42f1629e9 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Device; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.device * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphGroup/GraphGroupRequestBuilder.php index 810fb7c178f..c39a7d018fa 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php index ebcdb64004e..975febc84ce 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContact; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.orgContact * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index bc8ab02a232..e7ebb20cd11 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphUser/GraphUserRequestBuilder.php index fd933d3f276..a195bd08ca4 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/Item/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.user * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/MembersWithLicenseErrors/MembersWithLicenseErrorsRequestBuilder.php b/src/Generated/Groups/Item/MembersWithLicenseErrors/MembersWithLicenseErrorsRequestBuilder.php index 886fdc6f072..9b796b0140d 100644 --- a/src/Generated/Groups/Item/MembersWithLicenseErrors/MembersWithLicenseErrorsRequestBuilder.php +++ b/src/Generated/Groups/Item/MembersWithLicenseErrors/MembersWithLicenseErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\MembersWithLicenseErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\MembersWithLicenseErrors\GraphApplication\GraphApplicationRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\MembersWithLicenseErrors\GraphDevice\GraphDeviceRequestBuilder; @@ -102,19 +101,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A list of group members with license errors from this group-based license assignment. Read-only. * @param MembersWithLicenseErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MembersWithLicenseErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,7 +123,6 @@ public function toGetRequestInformation(?MembersWithLicenseErrorsRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -135,6 +130,7 @@ public function toGetRequestInformation(?MembersWithLicenseErrorsRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Count/CountRequestBuilder.php index bbd5018ddcc..9c42a8182d1 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php index 29de7111d47..e7952572b10 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CopyNotebookModel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Retrieve the properties and relationships of a notebook object by using its URL path. The location can be user notebooks on Microsoft 365, group notebooks, or SharePoint site-hosted team notebooks on Microsoft 365. This API is available in the following national cloud deployments. * @param GetNotebookFromWebUrlPostRequestBody $body The request body * @param GetNotebookFromWebUrlRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-getnotebookfromweburl?view=graph-rest-1.0 Find more info here */ public function post(GetNotebookFromWebUrlPostRequestBody $body, ?GetNotebookFromWebUrlRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CopyNotebookModel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CopyNotebookModel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(GetNotebookFromWebUrlPostRequestBody $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php index efa3f985dbb..db93210f8bc 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getRecentNotebooks * @param GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetRecentNotebooksWithIncludePersonalNotebooksGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetRecentNotebooksWithIncludePersonalNotebooksGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?GetRecentNotebooksWithIncludePersonalNo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?GetRecentNotebooksWithIncludePersonalNo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php index 289fbdc801d..dd2ce325adc 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyNotebookPostRequestBody $body The request body * @param CopyNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-copynotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyNotebookPostRequestBody $body, ?CopyNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyNotebookPostRequestBody $body, ?Cop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php index 0e0ba5eb481..0754d25ab86 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\CopyNotebook\CopyNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\SectionGroupsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\Sections\SectionsRequestBuilder; @@ -58,57 +57,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property notebooks for groups * @param NotebookItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?NotebookItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a notebook object. This API is available in the following national cloud deployments. * @param NotebookItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-get?view=graph-rest-1.0 Find more info here */ public function get(?NotebookItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property notebooks in groups * @param Notebook $body The request body * @param NotebookItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Notebook $body, ?NotebookItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -125,6 +115,7 @@ public function toDeleteRequestInformation(?NotebookItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -138,7 +129,6 @@ public function toGetRequestInformation(?NotebookItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -146,6 +136,7 @@ public function toGetRequestInformation(?NotebookItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -160,11 +151,11 @@ public function toPatchRequestInformation(Notebook $body, ?NotebookItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php index 26bdb3ffd1b..8895d5ea54a 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php index f0974364bde..2df5feebaff 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section group. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index 58d75cdee9d..f5ce6effdde 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section group. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php index 85b7ae3d120..c2545b032f0 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\ParentNotebook\ParentNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\ParentSectionGroup\ParentSectionGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\SectionGroups\SectionGroupsRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sectionGroups for groups * @param SectionGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SectionGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The section groups in the notebook. Read-only. Nullable. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sectionGroups in groups * @param SectionGroup $body The request body * @param SectionGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SectionGroup $body, ?SectionGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?SectionGroupItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(SectionGroup $body, ?SectionGroupItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php index ac63f0f8cd4..1acb6cc458b 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php index 82c8c33d69a..a1a669639d5 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section groups in the section. Read-only. Nullable. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php index 2925aa94b85..e07b4daf47b 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\SectionGroups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\SectionGroups\Item\SectionGroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of section groups from the specified section group. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php index df2c07c7781..fb0c63d4e32 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index aa5db455854..69703c4efb8 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index f6d4c610991..002d5aac2a6 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php index cc62404f72a..855f26eae2a 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\CopyToSectionGroup\CopyToSectionGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\PagesRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for groups * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The sections in the section group. Read-only. Nullable. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in groups * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php index 6b57811d1ba..ee97fe8c100 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index ef9442d445a..d3244a8e812 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index ed25a531dec..66785c3c95b 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index facc83be8d5..4ed35e9dfda 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\Item\CopyToSection\CopyToSectionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\Item\OnenotePatchContent\OnenotePatchContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for groups * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in groups * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index afd819c4b84..86db17e7734 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 9e16c5a2a61..73e8db5bb42 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index bc168b71b4b..82eb9d470e6 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index 806c6440c38..bdca80bfe19 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php index 1c21ca06350..5a46a4e3e92 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\Item\OnenotePageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index ec74f3e6e55..428a8fd5eac 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index 57d7b3e9330..29b251f3fdd 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php index 6da6ed285ab..1b851cc946c 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\OnenoteSectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects from the specified section group. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new onenoteSection in the specified section group. This API is available in the following national cloud deployments. * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-post-sections?view=graph-rest-1.0 Find more info here */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php index 5e6cb42b119..ff2b42b8302 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\SectionGroups\Item\SectionGroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of section groups from the specified notebook. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new section group in the specified notebook. This API is available in the following national cloud deployments. * @param SectionGroup $body The request body * @param SectionGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-post-sectiongroups?view=graph-rest-1.0 Find more info here */ public function post(SectionGroup $body, ?SectionGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SectionGroup $body, ?SectionGroupsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php index f4099a217cd..725c160cf4f 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index 73da90db11e..42477c7ba80 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index 92384d4e5f7..4e891d1eaef 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php index 4fa8f1ea992..e63c3722e8f 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\Sections\Item\CopyToSectionGroup\CopyToSectionGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\Sections\Item\Pages\PagesRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for groups * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The sections in the notebook. Read-only. Nullable. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in groups * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php index 5bc242e8278..b13a25f4436 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index 731751b4e86..577b42fad7a 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index 87f72bc0dd4..7b90f3120c9 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index 35470136ba6..8c97d94c22f 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\Sections\Item\Pages\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\Sections\Item\Pages\Item\CopyToSection\CopyToSectionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\Sections\Item\Pages\Item\OnenotePatchContent\OnenotePatchContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for groups * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in groups * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 731497c0e80..225dd769b07 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 41ec4b1273f..ff44b819c4e 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index 0bb8773f81f..be2a2df3d80 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index be2dc81759f..0b33154a04d 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php index d2ff2f7c33a..97aaba16320 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\Sections\Item\Pages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\Sections\Item\Pages\Item\OnenotePageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index c5c0c422f9c..774d995149d 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index 5f3e519e0b1..b32fda79b7e 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php index 0189e545b43..46a9c334065 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\Sections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Item\Sections\Item\OnenoteSectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects from the specified notebook. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new onenoteSection in the specified notebook. This API is available in the following national cloud deployments. * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-post-sections?view=graph-rest-1.0 Find more info here */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Notebooks/NotebooksRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Notebooks/NotebooksRequestBuilder.php index 5e2bb8af4f7..b928b83aed6 100644 --- a/src/Generated/Groups/Item/Onenote/Notebooks/NotebooksRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Notebooks/NotebooksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\GetNotebookFromWebUrl\GetNotebookFromWebUrlRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\GetRecentNotebooksWithIncludePersonalNotebooks\GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder; @@ -64,20 +63,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of notebook objects. This API is available in the following national cloud deployments. * @param NotebooksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-notebooks?view=graph-rest-1.0 Find more info here */ public function get(?NotebooksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [NotebookCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [NotebookCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,20 +89,17 @@ public function getRecentNotebooksWithIncludePersonalNotebooks(bool $includePers * Create a new OneNote notebook. This API is available in the following national cloud deployments. * @param Notebook $body The request body * @param NotebooksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-post-notebooks?view=graph-rest-1.0 Find more info here */ public function post(Notebook $body, ?NotebooksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,7 +112,6 @@ public function toGetRequestInformation(?NotebooksRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -127,6 +119,7 @@ public function toGetRequestInformation(?NotebooksRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -141,11 +134,11 @@ public function toPostRequestInformation(Notebook $body, ?NotebooksRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/OnenoteRequestBuilder.php b/src/Generated/Groups/Item/Onenote/OnenoteRequestBuilder.php index f1723e38dc0..adc6135f0a3 100644 --- a/src/Generated/Groups/Item/Onenote/OnenoteRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/OnenoteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Notebooks\NotebooksRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Operations\OperationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Pages\PagesRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property onenote for groups * @param OnenoteRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get onenote from groups * @param OnenoteRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property onenote in groups * @param Onenote $body The request body * @param OnenoteRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Onenote $body, ?OnenoteRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenoteRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenoteRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenoteRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(Onenote $body, ?OnenoteRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Operations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Operations/Count/CountRequestBuilder.php index 24b67c707f1..076bb1f888e 100644 --- a/src/Generated/Groups/Item/Onenote/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php index 68e72830d75..16a08770b35 100644 --- a/src/Generated/Groups/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for groups * @param OnenoteOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the status of a long-running OneNote operation. This applies to operations that return the Operation-Location header in the response, such as CopyNotebook, CopyToNotebook, CopyToSectionGroup, and CopyToSection. You can poll the Operation-Location endpoint until the status property returns completed or failed. If the status is completed, the resourceLocation property contains the resource endpoint URI. If the status is failed, the error and @api.diagnostics properties provide error information. This API is available in the following national cloud deployments. * @param OnenoteOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenoteoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?OnenoteOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in groups * @param OnenoteOperation $body The request body * @param OnenoteOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteOperation $body, ?OnenoteOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?OnenoteOperationItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?OnenoteOperationItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?OnenoteOperationItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(OnenoteOperation $body, ?OnenoteOperat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Operations/OperationsRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Operations/OperationsRequestBuilder.php index a539b890a86..4990e154a92 100644 --- a/src/Generated/Groups/Item/Onenote/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Operations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Operations\Item\OnenoteOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the status of a long-running OneNote operation. This applies to operations that return the Operation-Location header in the response, such as CopyNotebook, CopyToNotebook, CopyToSectionGroup, and CopyToSection. You can poll the Operation-Location endpoint until the status property returns completed or failed. If the status is completed, the resourceLocation property contains the resource endpoint URI. If the status is failed, the error and @api.diagnostics properties provide error information. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for groups * @param OnenoteOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenoteOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(OnenoteOperation $body, ?OperationsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Pages/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Pages/Count/CountRequestBuilder.php index c957b1cdd8c..82fa9133cf8 100644 --- a/src/Generated/Groups/Item/Onenote/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php index e5aaa1ae31f..822754ac26e 100644 --- a/src/Generated/Groups/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index ceae02fccae..551ee8bf3fd 100644 --- a/src/Generated/Groups/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php index 501355c0216..c140d159a75 100644 --- a/src/Generated/Groups/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Pages\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Pages\Item\CopyToSection\CopyToSectionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Pages\Item\OnenotePatchContent\OnenotePatchContentRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a OneNote page. This API is available in the following national cloud deployments. * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-delete?view=graph-rest-1.0 Find more info here */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a page object. Getting page information Access a page's metadata by page identifier: Getting page content You can use the page's content endpoint to get the HTML content of a page: The includeIDs=true query option is used to update pages. This API is available in the following national cloud deployments. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-get?view=graph-rest-1.0 Find more info here */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in groups * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index d49858618f5..436c5919917 100644 --- a/src/Generated/Groups/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 95a37ab30d0..e1b54dd0b5f 100644 --- a/src/Generated/Groups/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index e6ec04009a2..2f5af0402da 100644 --- a/src/Generated/Groups/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php index 3cd7f73a63e..c268045147c 100644 --- a/src/Generated/Groups/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Pages/PagesRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Pages/PagesRequestBuilder.php index 74a653be6e9..8cdb73cc941 100644 --- a/src/Generated/Groups/Item/Onenote/Pages/PagesRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Pages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Pages\Item\OnenotePageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new OneNote page in the default section of the default notebook. To create a page in a different section in the default notebook, you can use the sectionName query parameter. Example: ../onenote/pages?sectionName=My%20section The POST /onenote/pages operation is used only to create pages in the current user's default notebook. If you're targeting other notebooks, you can create pages in a specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Resources/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Resources/Count/CountRequestBuilder.php index 756ba2940c4..68aaa8a124f 100644 --- a/src/Generated/Groups/Item/Onenote/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php index 42787d2639e..21e30f9ba65 100644 --- a/src/Generated/Groups/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteResource; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php index 8a2e2f588d6..01d4ebc0fd6 100644 --- a/src/Generated/Groups/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Resources\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteResource; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resources for groups * @param OnenoteResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The image and other file resources in OneNote pages. Getting a resources collection isn't supported, but you can get the binary content of a specific resource. Read-only. Nullable. * @param OnenoteResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in groups * @param OnenoteResource $body The request body * @param OnenoteResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteResource $body, ?OnenoteResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?OnenoteResourceItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?OnenoteResourceItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?OnenoteResourceItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(OnenoteResource $body, ?OnenoteResourc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Resources/ResourcesRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Resources/ResourcesRequestBuilder.php index 04d151ae69e..6afed81c410 100644 --- a/src/Generated/Groups/Item/Onenote/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Resources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Resources\Item\OnenoteResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The image and other file resources in OneNote pages. Getting a resources collection isn't supported, but you can get the binary content of a specific resource. Read-only. Nullable. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resources for groups * @param OnenoteResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenoteResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(OnenoteResource $body, ?ResourcesReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php index fe1e62c0ed7..74ab631ad02 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 995763a77e0..d135f892138 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section group. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index 25870657137..3ed7cc82530 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section group. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php index d432787d862..8eac53ffe29 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\ParentNotebook\ParentNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\ParentSectionGroup\ParentSectionGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\SectionGroups\SectionGroupsRequestBuilder; @@ -66,57 +65,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sectionGroups for groups * @param SectionGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SectionGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a sectionGroup object. This API is available in the following national cloud deployments. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-get?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sectionGroups in groups * @param SectionGroup $body The request body * @param SectionGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SectionGroup $body, ?SectionGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,6 +123,7 @@ public function toDeleteRequestInformation(?SectionGroupItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -146,7 +137,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -154,6 +144,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -168,11 +159,11 @@ public function toPatchRequestInformation(SectionGroup $body, ?SectionGroupItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php index d9b472195bd..21732f7132b 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php index 7b5be0fe235..53c582cb9fa 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section groups in the section. Read-only. Nullable. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php index e038b011d97..afe61c4a427 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\SectionGroups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\SectionGroups\Item\SectionGroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of section groups from the specified section group. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php index 28a88a4d40a..b40352b8f26 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index ea27c5438cc..df39d47e466 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index b16e81cacd2..5952c9a5a07 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php index 81bf7d32101..cc84dcabde5 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\Sections\Item\CopyToSectionGroup\CopyToSectionGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\PagesRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for groups * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The sections in the section group. Read-only. Nullable. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in groups * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php index 89ff5ea51a7..d8351408045 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index 57f496967c5..4f86755468e 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index 2b9bc8510fc..95827185809 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index 7979178c737..81aad9b369e 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\Item\CopyToSection\CopyToSectionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\Item\OnenotePatchContent\OnenotePatchContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for groups * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in groups * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index c3f00d077c6..cb83cab3ccb 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index b70b1c3d988..1d986dbf162 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index b56396fefc1..77dcb3e8032 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index 16a0ecec96c..a70a5771016 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php index 7d671064b5d..43f3b8f0b28 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\Item\OnenotePageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 652d1c9f208..94438bedf60 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index e456b04c96b..d1042453136 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php index 82257aeb5b5..22ac85512ff 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\Sections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\Sections\Item\OnenoteSectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects from the specified section group. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new onenoteSection in the specified section group. This API is available in the following national cloud deployments. * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-post-sections?view=graph-rest-1.0 Find more info here */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Groups/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php index 739565b8fa5..4118cf5e86b 100644 --- a/src/Generated/Groups/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\SectionGroups\Item\SectionGroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of sectionGroup objects. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sectionGroups for groups * @param SectionGroup $body The request body * @param SectionGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SectionGroup $body, ?SectionGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SectionGroup $body, ?SectionGroupsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Count/CountRequestBuilder.php index ea888f8cbc3..7f7c215b368 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index 08d0754420c..c4f94e891cf 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index 367cd7269ac..d5b8a694b6f 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php index d4dcac139e1..32d0dd845cb 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Sections\Item\CopyToSectionGroup\CopyToSectionGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Sections\Item\Pages\PagesRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for groups * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a onenoteSection object. This API is available in the following national cloud deployments. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-get?view=graph-rest-1.0 Find more info here */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in groups * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php index 4bb1bd5c9a9..9c06d41afcf 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index b517932bc58..73cd9ceb0c3 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index 3e8849503d2..f30581b7fc9 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index 09222eb7202..9f1bc13beca 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Sections\Item\Pages\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Sections\Item\Pages\Item\CopyToSection\CopyToSectionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Sections\Item\Pages\Item\OnenotePatchContent\OnenotePatchContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for groups * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in groups * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index f096c052e88..b9d82775962 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 6b1ba0e4989..e5b090d1c85 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index 39d18d39b2a..1f3158eb408 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index f679ffd9592..1d737cb6f74 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php index afeddf711a8..8422809a77a 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Sections\Item\Pages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Sections\Item\Pages\Item\OnenotePageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index a37a9002c4c..195f2e4e7d4 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index 0fd0a7d6ba0..5bbcf15bf4a 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Onenote/Sections/SectionsRequestBuilder.php b/src/Generated/Groups/Item/Onenote/Sections/SectionsRequestBuilder.php index 329f253adaa..96cca202785 100644 --- a/src/Generated/Groups/Item/Onenote/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Onenote/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Onenote\Sections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Onenote\Sections\Item\OnenoteSectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sections for groups * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Owners/Count/CountRequestBuilder.php index 2d26298844b..759e0498e24 100644 --- a/src/Generated/Groups/Item/Owners/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/GraphApplication/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Owners/GraphApplication/Count/CountRequestBuilder.php index b3a18bbf01f..3afe02b57e6 100644 --- a/src/Generated/Groups/Item/Owners/GraphApplication/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/GraphApplication/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Groups/Item/Owners/GraphApplication/GraphApplicationRequestBuilder.php index 05428ba7db9..d5f12861508 100644 --- a/src/Generated/Groups/Item/Owners/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Owners\GraphApplication\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ApplicationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.application in the microsoft.graph.directoryObject collection * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/GraphDevice/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Owners/GraphDevice/Count/CountRequestBuilder.php index 3e6edcc1dce..da7451d7b79 100644 --- a/src/Generated/Groups/Item/Owners/GraphDevice/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/GraphDevice/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Groups/Item/Owners/GraphDevice/GraphDeviceRequestBuilder.php index 0beb35149d5..ab0c4e11305 100644 --- a/src/Generated/Groups/Item/Owners/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Owners\GraphDevice\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.device in the microsoft.graph.directoryObject collection * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Owners/GraphGroup/Count/CountRequestBuilder.php index 9ede4d44a0d..dc027afaad7 100644 --- a/src/Generated/Groups/Item/Owners/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Groups/Item/Owners/GraphGroup/GraphGroupRequestBuilder.php index 1fc25a228cf..a7d6e106721 100644 --- a/src/Generated/Groups/Item/Owners/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Owners\GraphGroup\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/GraphOrgContact/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Owners/GraphOrgContact/Count/CountRequestBuilder.php index 4db8201599e..44987c515d6 100644 --- a/src/Generated/Groups/Item/Owners/GraphOrgContact/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/GraphOrgContact/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Groups/Item/Owners/GraphOrgContact/GraphOrgContactRequestBuilder.php index 5b312784f0c..896c1c59977 100644 --- a/src/Generated/Groups/Item/Owners/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Owners\GraphOrgContact\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContactCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.orgContact in the microsoft.graph.directoryObject collection * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Owners/GraphServicePrincipal/Count/CountRequestBuilder.php index 973c69acf85..50570396324 100644 --- a/src/Generated/Groups/Item/Owners/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Groups/Item/Owners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 26e4c781580..96bcbde5da8 100644 --- a/src/Generated/Groups/Item/Owners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Owners\GraphServicePrincipal\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/GraphUser/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Owners/GraphUser/Count/CountRequestBuilder.php index 0a9cd3da847..1f0a6568e1b 100644 --- a/src/Generated/Groups/Item/Owners/GraphUser/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/GraphUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Groups/Item/Owners/GraphUser/GraphUserRequestBuilder.php index 307ca0b1a98..df59b06c33c 100644 --- a/src/Generated/Groups/Item/Owners/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Owners\GraphUser\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.user in the microsoft.graph.directoryObject collection * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/Item/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Groups/Item/Owners/Item/GraphApplication/GraphApplicationRequestBuilder.php index af7c7371d2a..259e9319f3e 100644 --- a/src/Generated/Groups/Item/Owners/Item/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/Item/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Application; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.application * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/Item/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Groups/Item/Owners/Item/GraphDevice/GraphDeviceRequestBuilder.php index b5476c1f8f4..8f93e044c9c 100644 --- a/src/Generated/Groups/Item/Owners/Item/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/Item/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Device; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.device * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Groups/Item/Owners/Item/GraphGroup/GraphGroupRequestBuilder.php index d0953e49bea..643318190d1 100644 --- a/src/Generated/Groups/Item/Owners/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Groups/Item/Owners/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php index a7fee24c482..f3273b06393 100644 --- a/src/Generated/Groups/Item/Owners/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContact; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.orgContact * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Groups/Item/Owners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index beed1376b04..ddaeaea526e 100644 --- a/src/Generated/Groups/Item/Owners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/Item/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Groups/Item/Owners/Item/GraphUser/GraphUserRequestBuilder.php index 71e88d70ad1..7efc0e420b1 100644 --- a/src/Generated/Groups/Item/Owners/Item/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/Item/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.user * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/Item/Ref/RefRequestBuilder.php b/src/Generated/Groups/Item/Owners/Item/Ref/RefRequestBuilder.php index c17e3e915b3..f9d0407925a 100644 --- a/src/Generated/Groups/Item/Owners/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an owner from a Microsoft 365 group or a security group through the owners navigation property. Once owners are assigned to a group, the last owner (a user object) of the group cannot be removed. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-delete-owners?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/OwnersRequestBuilder.php b/src/Generated/Groups/Item/Owners/OwnersRequestBuilder.php index fec25ff3b2a..902cd340af6 100644 --- a/src/Generated/Groups/Item/Owners/OwnersRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/OwnersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Owners\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Owners\GraphApplication\GraphApplicationRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Owners\GraphDevice\GraphDeviceRequestBuilder; @@ -110,20 +109,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The owners of the group. Limited to 100 owners. Nullable. If this property is not specified when creating a Microsoft 365 group, the calling user is automatically assigned as the group owner. Supports $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1). Supports $expand including nested $select. For example, /groups?$filter=startsWith(displayName,'Role')&$select=id,displayName&$expand=owners($select=id,userPrincipalName,displayName). * @param OwnersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-owners?view=graph-rest-1.0 Find more info here */ public function get(?OwnersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -136,7 +132,6 @@ public function toGetRequestInformation(?OwnersRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -144,6 +139,7 @@ public function toGetRequestInformation(?OwnersRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Owners/Ref/RefRequestBuilder.php b/src/Generated/Groups/Item/Owners/Ref/RefRequestBuilder.php index 9fa16513f0c..3417f78b5a4 100644 --- a/src/Generated/Groups/Item/Owners/Ref/RefRequestBuilder.php +++ b/src/Generated/Groups/Item/Owners/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The owners of the group. Limited to 100 owners. Nullable. If this property is not specified when creating a Microsoft 365 group, the calling user is automatically assigned as the group owner. Supports $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1). Supports $expand including nested $select. For example, /groups?$filter=startsWith(displayName,'Role')&$select=id,displayName&$expand=owners($select=id,userPrincipalName,displayName). * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-owners?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a user or service principal to a Microsoft 365 or security group's owners. The owners are a set of users or service principals who are allowed to modify the group object. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-post-owners?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/PermissionGrants/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/PermissionGrants/Count/CountRequestBuilder.php index 5333520aea6..e0e8a68ac38 100644 --- a/src/Generated/Groups/Item/PermissionGrants/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/PermissionGrants/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php b/src/Generated/Groups/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php index abda929db35..5b15f6cc868 100644 --- a/src/Generated/Groups/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php +++ b/src/Generated/Groups/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrant; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property permissionGrants for groups * @param ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get permissionGrants from groups * @param ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property permissionGrants in groups * @param ResourceSpecificPermissionGrant $body The request body * @param ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ResourceSpecificPermissionGrant $body, ?ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ResourceSpecificPermissionGrantItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/PermissionGrants/PermissionGrantsRequestBuilder.php b/src/Generated/Groups/Item/PermissionGrants/PermissionGrantsRequestBuilder.php index 7424929edd6..61b68cd1db6 100644 --- a/src/Generated/Groups/Item/PermissionGrants/PermissionGrantsRequestBuilder.php +++ b/src/Generated/Groups/Item/PermissionGrants/PermissionGrantsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\PermissionGrants\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\PermissionGrants\Item\ResourceSpecificPermissionGrantItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List all resource-specific permission grants on the group. This list specifies the Azure AD apps that have access to the group, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the group. This list specifies the Microsoft Entra apps that have access to the group, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. * @param PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-permissiongrants?view=graph-rest-1.0 Find more info here */ public function get(?PermissionGrantsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to permissionGrants for groups * @param ResourceSpecificPermissionGrant $body The request body * @param PermissionGrantsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ResourceSpecificPermissionGrant $body, ?PermissionGrantsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List all resource-specific permission grants on the group. This list specifies the Azure AD apps that have access to the group, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the group. This list specifies the Microsoft Entra apps that have access to the group, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. * @param PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php b/src/Generated/Groups/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php index 1a45bf435bf..214b7022f62 100644 --- a/src/Generated/Groups/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Groups/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List all resource-specific permission grants on the group. This list specifies the Azure AD apps that have access to the group, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the group. This list specifies the Microsoft Entra apps that have access to the group, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. */ class PermissionGrantsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Groups/Item/Photo/PhotoRequestBuilder.php b/src/Generated/Groups/Item/Photo/PhotoRequestBuilder.php index db5517115d3..6e1da204f85 100644 --- a/src/Generated/Groups/Item/Photo/PhotoRequestBuilder.php +++ b/src/Generated/Groups/Item/Photo/PhotoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Photo\Value\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProfilePhoto; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property photo for groups * @param PhotoRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PhotoRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The group's profile photo * @param PhotoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PhotoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property photo in groups * @param ProfilePhoto $body The request body * @param PhotoRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ProfilePhoto $body, ?PhotoRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?PhotoRequestBuilderDeleteRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ProfilePhoto $body, ?PhotoRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Photo/Value/ContentRequestBuilder.php b/src/Generated/Groups/Item/Photo/Value/ContentRequestBuilder.php index 0f49a25b8d4..70efd64808b 100644 --- a/src/Generated/Groups/Item/Photo/Value/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Photo/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,38 +33,36 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property photo from groups * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property photo in groups * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -82,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -100,7 +98,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Photos/Item/ProfilePhotoItemRequestBuilder.php b/src/Generated/Groups/Item/Photos/Item/ProfilePhotoItemRequestBuilder.php index 4a5a57f0c9a..aa13f65a004 100644 --- a/src/Generated/Groups/Item/Photos/Item/ProfilePhotoItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Photos/Item/ProfilePhotoItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Photos\Item\Value\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProfilePhoto; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The profile photos owned by the group. Read-only. Nullable. * @param ProfilePhotoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ProfilePhotoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ProfilePhotoItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ProfilePhotoItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Photos/Item/Value/ContentRequestBuilder.php b/src/Generated/Groups/Item/Photos/Item/Value/ContentRequestBuilder.php index 5825da9ba88..9bcfb8149b4 100644 --- a/src/Generated/Groups/Item/Photos/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Photos/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property photos from groups * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-photos?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property photos in groups * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Photos/PhotosRequestBuilder.php b/src/Generated/Groups/Item/Photos/PhotosRequestBuilder.php index cff409db253..d71a1079b71 100644 --- a/src/Generated/Groups/Item/Photos/PhotosRequestBuilder.php +++ b/src/Generated/Groups/Item/Photos/PhotosRequestBuilder.php @@ -4,8 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; -use Microsoft\Graph\Generated\Groups\Item\Photos\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Photos\Item\ProfilePhotoItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProfilePhotoCollectionResponse; @@ -19,13 +17,6 @@ */ class PhotosRequestBuilder extends BaseRequestBuilder { - /** - * Provides operations to count the resources in the collection. - */ - public function count(): CountRequestBuilder { - return new CountRequestBuilder($this->pathParameters, $this->requestAdapter); - } - /** * Provides operations to manage the photos property of the microsoft.graph.group entity. * @param string $profilePhotoId The unique identifier of profilePhoto @@ -43,7 +34,7 @@ public function byProfilePhotoId(string $profilePhotoId): ProfilePhotoItemReques * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. */ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { - parent::__construct($requestAdapter, [], '{+baseurl}/groups/{group%2Did}/photos{?%24top,%24skip,%24filter,%24count,%24orderby,%24select}'); + parent::__construct($requestAdapter, [], '{+baseurl}/groups/{group%2Did}/photos{?%24top,%24skip,%24filter,%24orderby,%24select}'); if (is_array($pathParametersOrRawUrl)) { $this->pathParameters = $pathParametersOrRawUrl; } else { @@ -54,20 +45,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of profilePhoto objects. This API is available in the following national cloud deployments. * @param PhotosRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-photos?view=graph-rest-1.0 Find more info here */ public function get(?PhotosRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhotoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhotoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +68,6 @@ public function toGetRequestInformation(?PhotosRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +75,7 @@ public function toGetRequestInformation(?PhotosRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Photos/PhotosRequestBuilderGetQueryParameters.php b/src/Generated/Groups/Item/Photos/PhotosRequestBuilderGetQueryParameters.php index 54389750876..2f3610baacb 100644 --- a/src/Generated/Groups/Item/Photos/PhotosRequestBuilderGetQueryParameters.php +++ b/src/Generated/Groups/Item/Photos/PhotosRequestBuilderGetQueryParameters.php @@ -9,12 +9,6 @@ */ class PhotosRequestBuilderGetQueryParameters { - /** - * @QueryParameter("%24count") - * @var bool|null $count Include count of items - */ - public ?bool $count = null; - /** * @QueryParameter("%24filter") * @var string|null $filter Filter items by property values @@ -47,15 +41,13 @@ class PhotosRequestBuilderGetQueryParameters /** * Instantiates a new photosRequestBuilderGetQueryParameters and sets the default values. - * @param bool|null $count Include count of items * @param string|null $filter Filter items by property values * @param array|null $orderby Order items by property values * @param array|null $select Select properties to be returned * @param int|null $skip Skip the first n items * @param int|null $top Show only the first n items */ - public function __construct(?bool $count = null, ?string $filter = null, ?array $orderby = null, ?array $select = null, ?int $skip = null, ?int $top = null) { - $this->count = $count; + public function __construct(?string $filter = null, ?array $orderby = null, ?array $select = null, ?int $skip = null, ?int $top = null) { $this->filter = $filter; $this->orderby = $orderby; $this->select = $select; diff --git a/src/Generated/Groups/Item/Photos/PhotosRequestBuilderGetRequestConfiguration.php b/src/Generated/Groups/Item/Photos/PhotosRequestBuilderGetRequestConfiguration.php index ecbb0c9f455..3176ae4fae2 100644 --- a/src/Generated/Groups/Item/Photos/PhotosRequestBuilderGetRequestConfiguration.php +++ b/src/Generated/Groups/Item/Photos/PhotosRequestBuilderGetRequestConfiguration.php @@ -28,7 +28,6 @@ public function __construct(?array $headers = null, ?array $options = null, ?Pho /** * Instantiates a new photosRequestBuilderGetQueryParameters. - * @param bool|null $count Include count of items * @param string|null $filter Filter items by property values * @param array|null $orderby Order items by property values * @param array|null $select Select properties to be returned @@ -36,8 +35,8 @@ public function __construct(?array $headers = null, ?array $options = null, ?Pho * @param int|null $top Show only the first n items * @return PhotosRequestBuilderGetQueryParameters */ - public static function createQueryParameters(?bool $count = null, ?string $filter = null, ?array $orderby = null, ?array $select = null, ?int $skip = null, ?int $top = null): PhotosRequestBuilderGetQueryParameters { - return new PhotosRequestBuilderGetQueryParameters($count, $filter, $orderby, $select, $skip, $top); + public static function createQueryParameters(?string $filter = null, ?array $orderby = null, ?array $select = null, ?int $skip = null, ?int $top = null): PhotosRequestBuilderGetQueryParameters { + return new PhotosRequestBuilderGetQueryParameters($filter, $orderby, $select, $skip, $top); } } diff --git a/src/Generated/Groups/Item/Planner/PlannerRequestBuilder.php b/src/Generated/Groups/Item/Planner/PlannerRequestBuilder.php index 6812ec361fa..e0858159da9 100644 --- a/src/Generated/Groups/Item/Planner/PlannerRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/PlannerRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\PlansRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerGroup; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property planner for groups * @param PlannerRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Entry-point to Planner resource that might exist for a Unified Group. * @param PlannerRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property planner in groups * @param PlannerGroup $body The request body * @param PlannerRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerGroup $body, ?PlannerRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?PlannerRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?PlannerRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?PlannerRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(PlannerGroup $body, ?PlannerRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Count/CountRequestBuilder.php index 5e94798e837..9da8bae2247 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/BucketsRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/BucketsRequestBuilder.php index fdace31d8d1..933018d1181 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/BucketsRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/BucketsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Buckets\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Buckets\Item\PlannerBucketItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannerBucket objects contained by a plannerPlan object. This API is available in the following national cloud deployments. * @param BucketsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplan-list-buckets?view=graph-rest-1.0 Find more info here */ public function get(?BucketsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to buckets for groups * @param PlannerBucket $body The request body * @param BucketsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PlannerBucket $body, ?BucketsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?BucketsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?BucketsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PlannerBucket $body, ?BucketsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Count/CountRequestBuilder.php index 356defc129f..b65b3197105 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/PlannerBucketItemRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/PlannerBucketItemRequestBuilder.php index f9a7df1efac..7e18ba92e45 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/PlannerBucketItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/PlannerBucketItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Buckets\Item\Tasks\TasksRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucket; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property buckets for groups * @param PlannerBucketItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerBucketItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Collection of buckets in the plan. * @param PlannerBucketItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerBucketItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property buckets in groups * @param PlannerBucket $body The request body * @param PlannerBucketItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerBucket $body, ?PlannerBucketItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?PlannerBucketItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?PlannerBucketItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?PlannerBucketItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(PlannerBucket $body, ?PlannerBucketIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Count/CountRequestBuilder.php index e03d0302178..82e4ce5724c 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php index 58fc3808831..052dd993212 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerAssignedToTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignedToTaskBoardFormat for groups * @param AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerAssignedToTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignedToTaskBoardFormat in groups * @param PlannerAssignedToTaskBoardTaskFormat $body The request body * @param AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerAssignedToTaskBoardTaskFormat $body, ?AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AssignedToTaskBoardFormatRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerAssignedToTaskBoardTaskFormat $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php index c33fabc68fa..03bccea7081 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucketTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property bucketTaskBoardFormat for groups * @param BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerBucketTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param BucketTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?BucketTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property bucketTaskBoardFormat in groups * @param PlannerBucketTaskBoardTaskFormat $body The request body * @param BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerBucketTaskBoardTaskFormat $body, ?BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?BucketTaskBoardFormatRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerBucketTaskBoardTaskFormat $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php index 3f6e665159e..d4ac9b1d5bd 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTaskDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for groups * @param DetailsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DetailsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerTaskDetails object. This API is available in the following national cloud deployments. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-get?view=graph-rest-1.0 Find more info here */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in groups * @param PlannerTaskDetails $body The request body * @param DetailsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerTaskDetails $body, ?DetailsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DetailsRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerTaskDetails $body, ?DetailsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php index d0885510383..48d2c813b9c 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Buckets\Item\Tasks\Item\AssignedToTaskBoardFormat\AssignedToTaskBoardFormatRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Buckets\Item\Tasks\Item\BucketTaskBoardFormat\BucketTaskBoardFormatRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Buckets\Item\Tasks\Item\Details\DetailsRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for groups * @param PlannerTaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerTaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. The collection of tasks in the bucket. * @param PlannerTaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerTaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in groups * @param PlannerTask $body The request body * @param PlannerTaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerTask $body, ?PlannerTaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?PlannerTaskItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(PlannerTask $body, ?PlannerTaskItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php index 52d7bde5517..921b608c570 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerProgressTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property progressTaskBoardFormat for groups * @param ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerProgressTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property progressTaskBoardFormat in groups * @param PlannerProgressTaskBoardTaskFormat $body The request body * @param ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerProgressTaskBoardTaskFormat $body, ?ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ProgressTaskBoardFormatRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerProgressTaskBoardTaskFormat $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/TasksRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/TasksRequestBuilder.php index eea1c16359a..06b1b2e889a 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Buckets/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Buckets\Item\Tasks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Buckets\Item\Tasks\Item\PlannerTaskItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannerTask objects associated to a plannerBucket object. This API is available in the following national cloud deployments. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbucket-list-tasks?view=graph-rest-1.0 Find more info here */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for groups * @param PlannerTask $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PlannerTask $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PlannerTask $body, ?TasksRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Details/DetailsRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Details/DetailsRequestBuilder.php index a667ae3d49d..b75d7ce9559 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerPlanDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for groups * @param DetailsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DetailsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerPlanDetails object. This API is available in the following national cloud deployments. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplandetails-get?view=graph-rest-1.0 Find more info here */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in groups * @param PlannerPlanDetails $body The request body * @param DetailsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplandetails-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerPlanDetails $body, ?DetailsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DetailsRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerPlanDetails $body, ?DetailsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/PlannerPlanItemRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/PlannerPlanItemRequestBuilder.php index 8027e22296f..0a20bf86375 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/PlannerPlanItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/PlannerPlanItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Buckets\BucketsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Details\DetailsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Tasks\TasksRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property plans for groups * @param PlannerPlanItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerPlanItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Returns the plannerPlans owned by the group. * @param PlannerPlanItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerPlanItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property plans in groups * @param PlannerPlan $body The request body * @param PlannerPlanItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerPlan $body, ?PlannerPlanItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?PlannerPlanItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?PlannerPlanItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?PlannerPlanItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(PlannerPlan $body, ?PlannerPlanItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Count/CountRequestBuilder.php index 2082d80a44b..1c5b89a107a 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php index 727a3bf7108..3cec60729c3 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerAssignedToTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignedToTaskBoardFormat for groups * @param AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerAssignedToTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignedToTaskBoardFormat in groups * @param PlannerAssignedToTaskBoardTaskFormat $body The request body * @param AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerAssignedToTaskBoardTaskFormat $body, ?AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AssignedToTaskBoardFormatRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerAssignedToTaskBoardTaskFormat $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php index 501f168b961..4cacc6948b1 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucketTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property bucketTaskBoardFormat for groups * @param BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerBucketTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param BucketTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?BucketTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property bucketTaskBoardFormat in groups * @param PlannerBucketTaskBoardTaskFormat $body The request body * @param BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerBucketTaskBoardTaskFormat $body, ?BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?BucketTaskBoardFormatRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerBucketTaskBoardTaskFormat $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/Details/DetailsRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/Details/DetailsRequestBuilder.php index ef82be7477b..7a5636ca8e0 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTaskDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for groups * @param DetailsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DetailsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerTaskDetails object. This API is available in the following national cloud deployments. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-get?view=graph-rest-1.0 Find more info here */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in groups * @param PlannerTaskDetails $body The request body * @param DetailsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerTaskDetails $body, ?DetailsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DetailsRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerTaskDetails $body, ?DetailsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php index 5be31bf35ff..8314df5bb48 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Tasks\Item\AssignedToTaskBoardFormat\AssignedToTaskBoardFormatRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Tasks\Item\BucketTaskBoardFormat\BucketTaskBoardFormatRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Tasks\Item\Details\DetailsRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for groups * @param PlannerTaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerTaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Collection of tasks in the plan. * @param PlannerTaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerTaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in groups * @param PlannerTask $body The request body * @param PlannerTaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerTask $body, ?PlannerTaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?PlannerTaskItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(PlannerTask $body, ?PlannerTaskItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php index f2a9d7d7a51..57254325ef5 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerProgressTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property progressTaskBoardFormat for groups * @param ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerProgressTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property progressTaskBoardFormat in groups * @param PlannerProgressTaskBoardTaskFormat $body The request body * @param ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerProgressTaskBoardTaskFormat $body, ?ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ProgressTaskBoardFormatRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerProgressTaskBoardTaskFormat $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/TasksRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/TasksRequestBuilder.php index 53d411648ee..a9bac8c4ed5 100644 --- a/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Tasks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\Tasks\Item\PlannerTaskItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannerTask objects associated with a plannerPlan object. This API is available in the following national cloud deployments. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplan-list-tasks?view=graph-rest-1.0 Find more info here */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for groups * @param PlannerTask $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PlannerTask $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PlannerTask $body, ?TasksRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Planner/Plans/PlansRequestBuilder.php b/src/Generated/Groups/Item/Planner/Plans/PlansRequestBuilder.php index 67044e01254..f648b22e70d 100644 --- a/src/Generated/Groups/Item/Planner/Plans/PlansRequestBuilder.php +++ b/src/Generated/Groups/Item/Planner/Plans/PlansRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Planner\Plans\Item\PlannerPlanItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannerPlan objects owned by a group object. This API is available in the following national cloud deployments. * @param PlansRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannergroup-list-plans?view=graph-rest-1.0 Find more info here */ public function get(?PlansRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to plans for groups * @param PlannerPlan $body The request body * @param PlansRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PlannerPlan $body, ?PlansRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?PlansRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?PlansRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PlannerPlan $body, ?PlansRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/RejectedSenders/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/RejectedSenders/Count/CountRequestBuilder.php index 2e29f61ffa6..2197c2fc5b3 100644 --- a/src/Generated/Groups/Item/RejectedSenders/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/RejectedSenders/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/RejectedSenders/Item/Ref/RefRequestBuilder.php b/src/Generated/Groups/Item/RejectedSenders/Item/Ref/RefRequestBuilder.php index c4f737fc54e..4bb534e6685 100644 --- a/src/Generated/Groups/Item/RejectedSenders/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Groups/Item/RejectedSenders/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove rejectedSender * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-delete-rejectedsenders?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/RejectedSenders/Ref/RefRequestBuilder.php b/src/Generated/Groups/Item/RejectedSenders/Ref/RefRequestBuilder.php index 35a3ead30fe..12c6eeb3e0f 100644 --- a/src/Generated/Groups/Item/RejectedSenders/Ref/RefRequestBuilder.php +++ b/src/Generated/Groups/Item/RejectedSenders/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Users in the rejected senders list can't post to conversations of the group (identified in the GET request URL). Make sure you don't specify the same user or group in the rejected senders and accepted senders lists, otherwise you get an error. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-rejectedsenders?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Specify the user or group in @odata.id in the request body. Users in the rejected senders list can't post to conversations of the group (identified in the POST request URL). Make sure you don't specify the same user or group in the rejected senders and accepted senders lists, otherwise you'll get an error. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-post-rejectedsenders?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/RejectedSenders/RejectedSendersRequestBuilder.php b/src/Generated/Groups/Item/RejectedSenders/RejectedSendersRequestBuilder.php index 050197ec270..1b54c63dac1 100644 --- a/src/Generated/Groups/Item/RejectedSenders/RejectedSendersRequestBuilder.php +++ b/src/Generated/Groups/Item/RejectedSenders/RejectedSendersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\RejectedSenders\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\RejectedSenders\Item\DirectoryObjectItemRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\RejectedSenders\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Users in the rejected senders list can't post to conversations of the group (identified in the GET request URL). Make sure you don't specify the same user or group in the rejected senders and accepted senders lists, otherwise you get an error. This API is available in the following national cloud deployments. * @param RejectedSendersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-rejectedsenders?view=graph-rest-1.0 Find more info here */ public function get(?RejectedSendersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?RejectedSendersRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?RejectedSendersRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/RemoveFavorite/RemoveFavoriteRequestBuilder.php b/src/Generated/Groups/Item/RemoveFavorite/RemoveFavoriteRequestBuilder.php index 2ac5f3f2c4a..4a7dc9c4afb 100644 --- a/src/Generated/Groups/Item/RemoveFavorite/RemoveFavoriteRequestBuilder.php +++ b/src/Generated/Groups/Item/RemoveFavorite/RemoveFavoriteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove the group from the list of the current user's favorite groups. Supported for Microsoft 365 groups only. This API is available in the following national cloud deployments. * @param RemoveFavoriteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-removefavorite?view=graph-rest-1.0 Find more info here */ public function post(?RemoveFavoriteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RemoveFavoriteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Renew/RenewRequestBuilder.php b/src/Generated/Groups/Item/Renew/RenewRequestBuilder.php index a12079334bb..623430b271b 100644 --- a/src/Generated/Groups/Item/Renew/RenewRequestBuilder.php +++ b/src/Generated/Groups/Item/Renew/RenewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Renews a group's expiration. When a group is renewed, the group expiration is extended by the number of days defined in the policy. This API is available in the following national cloud deployments. * @param RenewRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-renew?view=graph-rest-1.0 Find more info here */ public function post(?RenewRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RenewRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/ResetUnseenCount/ResetUnseenCountRequestBuilder.php b/src/Generated/Groups/Item/ResetUnseenCount/ResetUnseenCountRequestBuilder.php index c71590e84cd..db1d47525fd 100644 --- a/src/Generated/Groups/Item/ResetUnseenCount/ResetUnseenCountRequestBuilder.php +++ b/src/Generated/Groups/Item/ResetUnseenCount/ResetUnseenCountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reset the unseenCount of all the posts that the current user hasn't seen since their last visit. Supported for Microsoft 365 groups only. This API is available in the following national cloud deployments. * @param ResetUnseenCountRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-resetunseencount?view=graph-rest-1.0 Find more info here */ public function post(?ResetUnseenCountRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ResetUnseenCountRequestBuilderPostRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Restore/RestoreRequestBuilder.php b/src/Generated/Groups/Item/Restore/RestoreRequestBuilder.php index 705dc877e13..19603a621f3 100644 --- a/src/Generated/Groups/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/Groups/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/RetryServiceProvisioning/RetryServiceProvisioningRequestBuilder.php b/src/Generated/Groups/Item/RetryServiceProvisioning/RetryServiceProvisioningRequestBuilder.php index b90161f9c8c..c698df3622b 100644 --- a/src/Generated/Groups/Item/RetryServiceProvisioning/RetryServiceProvisioningRequestBuilder.php +++ b/src/Generated/Groups/Item/RetryServiceProvisioning/RetryServiceProvisioningRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action retryServiceProvisioning * @param RetryServiceProvisioningRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RetryServiceProvisioningRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RetryServiceProvisioningRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php index baa0553682c..61d6778ee59 100644 --- a/src/Generated/Groups/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Groups/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 1711b36dfb3..92390d7e0f4 100644 --- a/src/Generated/Groups/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Groups/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Settings/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Settings/Count/CountRequestBuilder.php index 22de30fc64d..dbf7e6ada17 100644 --- a/src/Generated/Groups/Item/Settings/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Settings/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Settings/Item/GroupSettingItemRequestBuilder.php b/src/Generated/Groups/Item/Settings/Item/GroupSettingItemRequestBuilder.php index e5d0b4d6e06..5b64feccf2c 100644 --- a/src/Generated/Groups/Item/Settings/Item/GroupSettingItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Settings/Item/GroupSettingItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\GroupSetting; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property settings for groups * @param GroupSettingItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?GroupSettingItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of a specific group setting object. The setting can be a tenant-level or group-specific setting. This API is available in the following national cloud deployments. * @param GroupSettingItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/groupsetting-get?view=graph-rest-1.0 Find more info here */ public function get(?GroupSettingItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupSetting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupSetting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a groupSetting object for tenant-wide group settings or a specific group setting. This API is available in the following national cloud deployments. * @param GroupSetting $body The request body * @param GroupSettingItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/groupsetting-update?view=graph-rest-1.0 Find more info here */ public function patch(GroupSetting $body, ?GroupSettingItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupSetting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupSetting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?GroupSettingItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?GroupSettingItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?GroupSettingItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(GroupSetting $body, ?GroupSettingItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Settings/SettingsRequestBuilder.php b/src/Generated/Groups/Item/Settings/SettingsRequestBuilder.php index 257d35a1ce2..81753f96e45 100644 --- a/src/Generated/Groups/Item/Settings/SettingsRequestBuilder.php +++ b/src/Generated/Groups/Item/Settings/SettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Settings\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Settings\Item\GroupSettingItemRequestBuilder; use Microsoft\Graph\Generated\Models\GroupSetting; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of tenant-level or group-specific group settings objects. This API is available in the following national cloud deployments. * @param SettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-settings?view=graph-rest-1.0 Find more info here */ public function get(?SettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupSettingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupSettingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new setting based on the templates available in groupSettingTemplates. These settings can be at the tenant-level or at the group level. Group settings apply to only Microsoft 365 groups. The template named Group.Unified can be used to configure tenant-wide Microsoft 365 group settings, while the template named Group.Unified.Guest can be used to configure group-specific settings. This API is available in the following national cloud deployments. * @param GroupSetting $body The request body * @param SettingsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-post-settings?view=graph-rest-1.0 Find more info here */ public function post(GroupSetting $body, ?SettingsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupSetting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupSetting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SettingsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SettingsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(GroupSetting $body, ?SettingsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Add/AddRequestBuilder.php b/src/Generated/Groups/Item/Sites/Add/AddRequestBuilder.php index 9a00a87be1c..703c1b4bfc0 100644 --- a/src/Generated/Groups/Item/Sites/Add/AddRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Follow a user's site or multiple sites. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-follow?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Count/CountRequestBuilder.php index 03405824134..e32993b3348 100644 --- a/src/Generated/Groups/Item/Sites/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Delta/DeltaGetResponse.php b/src/Generated/Groups/Item/Sites/Delta/DeltaGetResponse.php new file mode 100644 index 00000000000..247699393c6 --- /dev/null +++ b/src/Generated/Groups/Item/Sites/Delta/DeltaGetResponse.php @@ -0,0 +1,72 @@ + + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'value' => fn(ParseNode $n) => $o->setValue($n->getCollectionOfObjectValues([Site::class, 'createFromDiscriminatorValue'])), + ]); + } + + /** + * Gets the value property value. The value property + * @return array|null + */ + public function getValue(): ?array { + $val = $this->getBackingStore()->get('value'); + if (is_array($val) || is_null($val)) { + TypeUtils::validateCollectionValues($val, Site::class); + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'value'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeCollectionOfObjectValues('value', $this->getValue()); + } + + /** + * Sets the value property value. The value property + * @param array|null $value Value to set for the value property. + */ + public function setValue(?array $value): void { + $this->getBackingStore()->set('value', $value); + } + +} diff --git a/src/Generated/Groups/Item/Sites/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Item/Sites/Delta/DeltaRequestBuilder.php new file mode 100644 index 00000000000..07f426f1285 --- /dev/null +++ b/src/Generated/Groups/Item/Sites/Delta/DeltaRequestBuilder.php @@ -0,0 +1,77 @@ +|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/groups/{group%2Did}/sites/delta(){?%24top,%24skip,%24search,%24filter,%24count,%24select,%24orderby}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * Invoke function delta + * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Invoke function delta + * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return DeltaRequestBuilder + */ + public function withUrl(string $rawUrl): DeltaRequestBuilder { + return new DeltaRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/Groups/Item/Sites/Delta/DeltaRequestBuilderGetQueryParameters.php b/src/Generated/Groups/Item/Sites/Delta/DeltaRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..3033c1576bc --- /dev/null +++ b/src/Generated/Groups/Item/Sites/Delta/DeltaRequestBuilderGetQueryParameters.php @@ -0,0 +1,74 @@ +|null $orderby Order items by property values + */ + public ?array $orderby = null; + + /** + * @QueryParameter("%24search") + * @var string|null $search Search items by search phrases + */ + public ?string $search = null; + + /** + * @QueryParameter("%24select") + * @var array|null $select Select properties to be returned + */ + public ?array $select = null; + + /** + * @QueryParameter("%24skip") + * @var int|null $skip Skip the first n items + */ + public ?int $skip = null; + + /** + * @QueryParameter("%24top") + * @var int|null $top Show only the first n items + */ + public ?int $top = null; + + /** + * Instantiates a new deltaRequestBuilderGetQueryParameters and sets the default values. + * @param bool|null $count Include count of items + * @param string|null $filter Filter items by property values + * @param array|null $orderby Order items by property values + * @param string|null $search Search items by search phrases + * @param array|null $select Select properties to be returned + * @param int|null $skip Skip the first n items + * @param int|null $top Show only the first n items + */ + public function __construct(?bool $count = null, ?string $filter = null, ?array $orderby = null, ?string $search = null, ?array $select = null, ?int $skip = null, ?int $top = null) { + $this->count = $count; + $this->filter = $filter; + $this->orderby = $orderby; + $this->search = $search; + $this->select = $select; + $this->skip = $skip; + $this->top = $top; + } + +} diff --git a/src/Generated/Groups/Item/Sites/Delta/DeltaRequestBuilderGetRequestConfiguration.php b/src/Generated/Groups/Item/Sites/Delta/DeltaRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..91ce64435cf --- /dev/null +++ b/src/Generated/Groups/Item/Sites/Delta/DeltaRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,44 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param DeltaRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?DeltaRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new deltaRequestBuilderGetQueryParameters. + * @param bool|null $count Include count of items + * @param string|null $filter Filter items by property values + * @param array|null $orderby Order items by property values + * @param string|null $search Search items by search phrases + * @param array|null $select Select properties to be returned + * @param int|null $skip Skip the first n items + * @param int|null $top Show only the first n items + * @return DeltaRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?bool $count = null, ?string $filter = null, ?array $orderby = null, ?string $search = null, ?array $select = null, ?int $skip = null, ?int $top = null): DeltaRequestBuilderGetQueryParameters { + return new DeltaRequestBuilderGetQueryParameters($count, $filter, $orderby, $search, $select, $skip, $top); + } + +} diff --git a/src/Generated/Groups/Item/Sites/GetAllSites/GetAllSitesRequestBuilder.php b/src/Generated/Groups/Item/Sites/GetAllSites/GetAllSitesRequestBuilder.php index a69086d8f7e..a44c903c9d6 100644 --- a/src/Generated/Groups/Item/Sites/GetAllSites/GetAllSitesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/GetAllSites/GetAllSitesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAllSites * @param GetAllSitesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAllSitesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAllSitesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAllSitesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAllSitesRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAllSitesRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Analytics/AllTime/AllTimeRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Analytics/AllTime/AllTimeRequestBuilder.php index 4c44af0da94..53224d7ae72 100644 --- a/src/Generated/Groups/Item/Sites/Item/Analytics/AllTime/AllTimeRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Analytics/AllTime/AllTimeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemActivityStat; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get [itemAnalytics][] about the views that took place under this resource.The itemAnalytics resource is a convenient way to get activity stats for allTime and the lastSevenDays.For a custom time range or interval, use the getActivitiesByInterval][] API. This API is available in the following [national cloud deployments. * @param AllTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/itemanalytics-get?view=graph-rest-1.0 Find more info here */ public function get(?AllTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?AllTimeRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?AllTimeRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Analytics/AnalyticsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Analytics/AnalyticsRequestBuilder.php index 63703b76f4e..1114b4873d8 100644 --- a/src/Generated/Groups/Item/Sites/Item/Analytics/AnalyticsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Analytics/AnalyticsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Analytics\AllTime\AllTimeRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Analytics\ItemActivityStats\ItemActivityStatsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Analytics\LastSevenDays\LastSevenDaysRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property analytics for groups * @param AnalyticsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AnalyticsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Analytics about the view activities that took place in this site. * @param AnalyticsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AnalyticsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property analytics in groups * @param ItemAnalytics $body The request body * @param AnalyticsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ItemAnalytics $body, ?AnalyticsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?AnalyticsRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(ItemAnalytics $body, ?AnalyticsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Count/CountRequestBuilder.php index 19d90a447e4..be20b87cfec 100644 --- a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/ActivitiesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/ActivitiesRequestBuilder.php index e3a6070b8be..565d507afea 100644 --- a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/ActivitiesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/ActivitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Analytics\ItemActivityStats\Item\Activities\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Analytics\ItemActivityStats\Item\Activities\Item\ItemActivityItemRequestBuilder; use Microsoft\Graph\Generated\Models\ItemActivity; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Exposes the itemActivities represented in this itemActivityStat resource. * @param ActivitiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivitiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to activities for groups * @param ItemActivity $body The request body * @param ActivitiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ItemActivity $body, ?ActivitiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ActivitiesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ActivitiesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ItemActivity $body, ?ActivitiesRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Count/CountRequestBuilder.php index 6feec86428c..c8c7ec3a8ef 100644 --- a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/Content/ContentRequestBuilder.php index cb644de028a..81984d2bcba 100644 --- a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/DriveItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/DriveItemRequestBuilder.php index b8aa547d66e..df733b6f175 100644 --- a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/DriveItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/DriveItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Analytics\ItemActivityStats\Item\Activities\Item\DriveItem\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Exposes the driveItem that was the target of this activity. * @param DriveItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/ItemActivityItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/ItemActivityItemRequestBuilder.php index f3f90460fe7..d625d99b512 100644 --- a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/ItemActivityItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/ItemActivityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Analytics\ItemActivityStats\Item\Activities\Item\DriveItem\DriveItemRequestBuilder; use Microsoft\Graph\Generated\Models\ItemActivity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property activities for groups * @param ItemActivityItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ItemActivityItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Exposes the itemActivities represented in this itemActivityStat resource. * @param ItemActivityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemActivityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property activities in groups * @param ItemActivity $body The request body * @param ItemActivityItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ItemActivity $body, ?ItemActivityItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ItemActivityItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ItemActivityItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ItemActivityItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ItemActivity $body, ?ItemActivityItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/ItemActivityStatItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/ItemActivityStatItemRequestBuilder.php index 03b6ac501b8..e77fbc3d0e4 100644 --- a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/ItemActivityStatItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/Item/ItemActivityStatItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Analytics\ItemActivityStats\Item\Activities\ActivitiesRequestBuilder; use Microsoft\Graph\Generated\Models\ItemActivityStat; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property itemActivityStats for groups * @param ItemActivityStatItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ItemActivityStatItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get itemActivityStats from groups * @param ItemActivityStatItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemActivityStatItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property itemActivityStats in groups * @param ItemActivityStat $body The request body * @param ItemActivityStatItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ItemActivityStat $body, ?ItemActivityStatItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ItemActivityStatItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ItemActivityStatItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ItemActivityStatItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ItemActivityStat $body, ?ItemActivityS $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/ItemActivityStatsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/ItemActivityStatsRequestBuilder.php index a76e0369b73..3578b71f0c4 100644 --- a/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/ItemActivityStatsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Analytics/ItemActivityStats/ItemActivityStatsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Analytics\ItemActivityStats\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Analytics\ItemActivityStats\Item\ItemActivityStatItemRequestBuilder; use Microsoft\Graph\Generated\Models\ItemActivityStat; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get itemActivityStats from groups * @param ItemActivityStatsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemActivityStatsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStatCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStatCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to itemActivityStats for groups * @param ItemActivityStat $body The request body * @param ItemActivityStatsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ItemActivityStat $body, ?ItemActivityStatsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ItemActivityStatsRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ItemActivityStatsRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ItemActivityStat $body, ?ItemActivitySt $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Analytics/LastSevenDays/LastSevenDaysRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Analytics/LastSevenDays/LastSevenDaysRequestBuilder.php index cfa3d00372c..b92a7a6ef3c 100644 --- a/src/Generated/Groups/Item/Sites/Item/Analytics/LastSevenDays/LastSevenDaysRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Analytics/LastSevenDays/LastSevenDaysRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemActivityStat; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get lastSevenDays from groups * @param LastSevenDaysRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastSevenDaysRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?LastSevenDaysRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?LastSevenDaysRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Columns/ColumnsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Columns/ColumnsRequestBuilder.php index a93a54a2656..1534236f941 100644 --- a/src/Generated/Groups/Item/Sites/Item/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Columns\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Columns\Item\ColumnDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinition; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of columns represented as columnDefinition][columnDefinition] resources in a [site][site]. This API is available in the following [national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a column for a site][site] with a request that specifies a [columnDefinition][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-post-columns?view=graph-rest-1.0 Find more info here */ public function post(ColumnDefinition $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ColumnDefinition $body, ?ColumnsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Columns/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Columns/Count/CountRequestBuilder.php index 25e14d46d77..9cbea2a1ebd 100644 --- a/src/Generated/Groups/Item/Sites/Item/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php index 41e4fe8e82c..7c615954faa 100644 --- a/src/Generated/Groups/Item/Sites/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Columns\Item\SourceColumn\SourceColumnRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property columns for groups * @param ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of column definitions reusable across lists under this site. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property columns in groups * @param ColumnDefinition $body The request body * @param ColumnDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ColumnDefinition $body, ?ColumnDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ColumnDefinitionItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ColumnDefinition $body, ?ColumnDefinit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php index 8dbf6b137b8..43af8efb72c 100644 --- a/src/Generated/Groups/Item/Sites/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The source column for the content type column. * @param SourceColumnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SourceColumnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php index 5019e8bd235..d25994903d5 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add a copy of a content type][contentType] from a [site][site] to a [list][list]. This API is available in the following [national cloud deployments. * @param AddCopyPostRequestBody $body The request body * @param AddCopyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-addcopy?view=graph-rest-1.0 Find more info here */ public function post(AddCopyPostRequestBody $body, ?AddCopyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddCopyPostRequestBody $body, ?AddCopyR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php index ee274ee62b7..5bc577c12d4 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add or sync a copy of a published content type from the content type hub to a target site or a list. This method is part of the content type publishing changes to optimize the syncing of published content types to sites and lists, effectively switching from a 'push everywhere' to 'pull as needed' approach. The method allows users to pull content types directly from the content type hub to a site or list. For more information, see contentType: getCompatibleHubContentTypes and the blog post Syntex Product Updates – August 2021. This API is available in the following national cloud deployments. * @param AddCopyFromContentTypeHubPostRequestBody $body The request body * @param AddCopyFromContentTypeHubRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-addcopyfromcontenttypehub?view=graph-rest-1.0 Find more info here */ public function post(AddCopyFromContentTypeHubPostRequestBody $body, ?AddCopyFromContentTypeHubRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddCopyFromContentTypeHubPostRequestBod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/ContentTypesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/ContentTypesRequestBuilder.php index 581d307e4c0..e281ddaa807 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/ContentTypesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/ContentTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\AddCopy\AddCopyRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\AddCopyFromContentTypeHub\AddCopyFromContentTypeHubRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\Count\CountRequestBuilder; @@ -79,40 +78,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of contentType][contentType] resources in a [site][]. This API is available in the following [national cloud deployments. * @param ContentTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-list-contenttypes?view=graph-rest-1.0 Find more info here */ public function get(?ContentTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new contentType][] in a [site][]. This API is available in the following [national cloud deployments. * @param ContentType $body The request body * @param ContentTypesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-post-contenttypes?view=graph-rest-1.0 Find more info here */ public function post(ContentType $body, ?ContentTypesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -125,7 +118,6 @@ public function toGetRequestInformation(?ContentTypesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -133,6 +125,7 @@ public function toGetRequestInformation(?ContentTypesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -147,11 +140,11 @@ public function toPostRequestInformation(ContentType $body, ?ContentTypesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Count/CountRequestBuilder.php index c42090ee339..7026bc19830 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php index 347089858de..12fc06da5bb 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getCompatibleHubContentTypes * @param GetCompatibleHubContentTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetCompatibleHubContentTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetCompatibleHubContentTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetCompatibleHubContentTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetCompatibleHubContentTypesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetCompatibleHubContentTypesRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php index 44942f20e00..e622f753be4 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Associate a published content type][contentType] present in a content type hub with a list of hub sites. This API is available in the following [national cloud deployments. * @param AssociateWithHubSitesPostRequestBody $body The request body * @param AssociateWithHubSitesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-associatewithhubsites?view=graph-rest-1.0 Find more info here */ public function post(AssociateWithHubSitesPostRequestBody $body, ?AssociateWithHubSitesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AssociateWithHubSitesPostRequestBody $b $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php index 093f8fe31d7..6eef3ac43f2 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Parent contentType from which this content type is derived. * @param BaseRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?BaseRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?BaseRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php index d0a0351c085..e582874fefd 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\Item\BaseTypes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\Item\BaseTypes\Item\ContentTypeItemRequestBuilder; use Microsoft\Graph\Generated\Models\ContentTypeCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of content types that are ancestors of this content type. * @param BaseTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?BaseTypesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?BaseTypesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php index 165cbdfb14f..428b25bbbde 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php index e89da27579b..c9f3f326465 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of content types that are ancestors of this content type. * @param ContentTypeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentTypeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php index 6c9c1312e8f..d58ac860caa 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\Item\ColumnLinks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\Item\ColumnLinks\Item\ColumnLinkItemRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnLink; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of columns that are required by this content type. * @param ColumnLinksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnLinksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLinkCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLinkCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to columnLinks for groups * @param ColumnLink $body The request body * @param ColumnLinksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ColumnLink $body, ?ColumnLinksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ColumnLinksRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ColumnLinksRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ColumnLink $body, ?ColumnLinksRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php index 9ae92755f09..91833e0379c 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php index 6c3a8f18c3f..7ac08a4a46a 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnLink; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property columnLinks for groups * @param ColumnLinkItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ColumnLinkItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of columns that are required by this content type. * @param ColumnLinkItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnLinkItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property columnLinks in groups * @param ColumnLink $body The request body * @param ColumnLinkItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ColumnLink $body, ?ColumnLinkItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ColumnLinkItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ColumnLinkItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ColumnLinkItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ColumnLink $body, ?ColumnLinkItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php index 5f71eccb16f..2a83bece4cc 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\Item\ColumnPositions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\Item\ColumnPositions\Item\ColumnDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Column order information in a content type. * @param ColumnPositionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnPositionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ColumnPositionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ColumnPositionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php index d369d29ba33..054aa787d95 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php index 89d9b0dacc8..3cdeaf05746 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Column order information in a content type. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php index 7938e07a12d..60114e3c13a 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\Item\Columns\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\Item\Columns\Item\ColumnDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinition; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of columns represented as columnDefinition][columnDefinition] resources in a [content type][contentType]. This API is available in the following [national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a column to a content type][contentType] in a site, or a list with a request that specifies a [columnDefinition][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-post-columns?view=graph-rest-1.0 Find more info here */ public function post(ColumnDefinition $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ColumnDefinition $body, ?ColumnsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php index 58914d20c19..cab747332ba 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php index bd3885e40cd..ffc2cb57a9c 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\Item\Columns\Item\SourceColumn\SourceColumnRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a column][columndefinition] from a [site][], a [list][], or a [content type][contentType]. This API is available in the following [national cloud deployments. * @param ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the metadata for a site][], a [list][], or a [contentType][] [column][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a site][], a [list][], or a [content type][contentType] [column][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-update?view=graph-rest-1.0 Find more info here */ public function patch(ColumnDefinition $body, ?ColumnDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?ColumnDefinitionItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(ColumnDefinition $body, ?ColumnDefinit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php index 18b2918ec62..5f8b473f3dc 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The source column for the content type column. * @param SourceColumnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SourceColumnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php index 1b89328473c..3134dfc8e4a 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\Item\AssociateWithHubSites\AssociateWithHubSitesRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\Item\Base\EscapedBaseRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\Item\BaseTypes\BaseTypesRequestBuilder; @@ -114,59 +113,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a content type][contentType] from a [list][] or a [site][]. This API is available in the following [national cloud deployments. * @param ContentTypeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ContentTypeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the metadata for a content type][contentType] in a [site][] or a [list][]. This API is available in the following [national cloud deployments. * @param ContentTypeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-get?view=graph-rest-1.0 Find more info here */ public function get(?ContentTypeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a content type][contentType]. This API is available in the following [national cloud deployments. * @param ContentType $body The request body * @param ContentTypeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-update?view=graph-rest-1.0 Find more info here */ public function patch(ContentType $body, ?ContentTypeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -183,6 +173,7 @@ public function toDeleteRequestInformation(?ContentTypeItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -196,7 +187,6 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -204,6 +194,7 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -218,11 +209,11 @@ public function toPatchRequestInformation(ContentType $body, ?ContentTypeItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php index 86038684d99..4705b1e73e3 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a file to a default content location in a content type][contentType]. The file can then be added as a default file or template via a POST operation. This API is available in the following [national cloud deployments. * @param CopyToDefaultContentLocationPostRequestBody $body The request body * @param CopyToDefaultContentLocationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-copytodefaultcontentlocation?view=graph-rest-1.0 Find more info here */ public function post(CopyToDefaultContentLocationPostRequestBody $body, ?CopyToDefaultContentLocationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CopyToDefaultContentLocationPostRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php index 01783737516..c96b04a81df 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function isPublished * @param IsPublishedRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IsPublishedRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IsPublishedGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IsPublishedGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?IsPublishedRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php index 8f1df797379..32f740084e4 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Publishes a contentType][] present in the content type hub site. This API is available in the following [national cloud deployments. * @param PublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-publish?view=graph-rest-1.0 Find more info here */ public function post(?PublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?PublishRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php index 6e747d377e5..9ec4fbad4c9 100644 --- a/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unpublish a contentType][] from a content type hub site. This API is available in the following [national cloud deployments. * @param UnpublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-unpublish?view=graph-rest-1.0 Find more info here */ public function post(?UnpublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnpublishRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/CreatedByUser/CreatedByUserRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/CreatedByUser/CreatedByUserRequestBuilder.php index 6af0adc667f..f3599133ad6 100644 --- a/src/Generated/Groups/Item/Sites/Item/CreatedByUser/CreatedByUserRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/CreatedByUser/CreatedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\CreatedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\CreatedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who created the item. Read-only. * @param CreatedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 202f9d26a25..01e77bfea95 100644 --- a/src/Generated/Groups/Item/Sites/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 62277a9635a..4c49fb8f794 100644 --- a/src/Generated/Groups/Item/Sites/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index bb05348a814..77fd4ebb3a0 100644 --- a/src/Generated/Groups/Item/Sites/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\CreatedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Drive/DriveRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Drive/DriveRequestBuilder.php index 55bf6d734fe..90bae602d93 100644 --- a/src/Generated/Groups/Item/Sites/Item/Drive/DriveRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Drive/DriveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Drive; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The default drive (document library) for this site. * @param DriveRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Drives/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Drives/Count/CountRequestBuilder.php index 93ecb764f0d..19920238291 100644 --- a/src/Generated/Groups/Item/Sites/Item/Drives/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Drives/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Drives/DrivesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Drives/DrivesRequestBuilder.php index bdd92e1e835..925c505b9cf 100644 --- a/src/Generated/Groups/Item/Sites/Item/Drives/DrivesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Drives/DrivesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Drives\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Drives\Item\DriveItemRequestBuilder; use Microsoft\Graph\Generated\Models\DriveCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of drives (document libraries) under this site. * @param DrivesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DrivesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?DrivesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?DrivesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Drives/Item/DriveItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Drives/Item/DriveItemRequestBuilder.php index af37d5e18f1..5bec83bb089 100644 --- a/src/Generated/Groups/Item/Sites/Item/Drives/Item/DriveItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Drives/Item/DriveItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Drive; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of drives (document libraries) under this site. * @param DriveItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ExternalColumns/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ExternalColumns/Count/CountRequestBuilder.php index 33c3570411c..354350d70ee 100644 --- a/src/Generated/Groups/Item/Sites/Item/ExternalColumns/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ExternalColumns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ExternalColumns/ExternalColumnsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ExternalColumns/ExternalColumnsRequestBuilder.php index d942ee023e2..324264d7a0b 100644 --- a/src/Generated/Groups/Item/Sites/Item/ExternalColumns/ExternalColumnsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ExternalColumns/ExternalColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ExternalColumns\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ExternalColumns\Item\ColumnDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get externalColumns from groups * @param ExternalColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExternalColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ExternalColumnsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ExternalColumnsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/ExternalColumns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/ExternalColumns/Item/ColumnDefinitionItemRequestBuilder.php index a9bc2f4eb78..16515ee0648 100644 --- a/src/Generated/Groups/Item/Sites/Item/ExternalColumns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/ExternalColumns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get externalColumns from groups * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php index 24e40d02c42..2e27b4d49e6 100644 --- a/src/Generated/Groups/Item/Sites/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php index 490536a2721..739ed1e786c 100644 --- a/src/Generated/Groups/Item/Sites/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,7 +61,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -73,6 +68,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/GetApplicableContentTypesForListWithListId/GetApplicableContentTypesForListWithListIdRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/GetApplicableContentTypesForListWithListId/GetApplicableContentTypesForListWithListIdRequestBuilder.php index c1085b8bf9f..d379457fb19 100644 --- a/src/Generated/Groups/Item/Sites/Item/GetApplicableContentTypesForListWithListId/GetApplicableContentTypesForListWithListIdRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/GetApplicableContentTypesForListWithListId/GetApplicableContentTypesForListWithListIdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getApplicableContentTypesForList * @param GetApplicableContentTypesForListWithListIdRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetApplicableContentTypesForListWithListIdRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetApplicableContentTypesForListWithListIdGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetApplicableContentTypesForListWithListIdGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?GetApplicableContentTypesForListWithLis $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?GetApplicableContentTypesForListWithLis } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/GetByPathWithPath/GetByPathWithPathRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/GetByPathWithPath/GetByPathWithPathRequestBuilder.php index e97b241a979..5bbccab7f9e 100644 --- a/src/Generated/Groups/Item/Sites/Item/GetByPathWithPath/GetByPathWithPathRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/GetByPathWithPath/GetByPathWithPathRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Site; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getByPath * @param GetByPathWithPathRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetByPathWithPathRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?GetByPathWithPathRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Items/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Items/Count/CountRequestBuilder.php index 9c0f5758946..12d306d7b02 100644 --- a/src/Generated/Groups/Item/Sites/Item/Items/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Items/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Items/Item/BaseItemItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Items/Item/BaseItemItemRequestBuilder.php index 3dde141ecbb..74e0aa2a861 100644 --- a/src/Generated/Groups/Item/Sites/Item/Items/Item/BaseItemItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Items/Item/BaseItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BaseItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Used to address any item contained in this site. This collection can't be enumerated. * @param BaseItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BaseItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BaseItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?BaseItemItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?BaseItemItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Items/ItemsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Items/ItemsRequestBuilder.php index 5bcbb079b49..400a45cef98 100644 --- a/src/Generated/Groups/Item/Sites/Item/Items/ItemsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Items/ItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Items\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Items\Item\BaseItemItemRequestBuilder; use Microsoft\Graph\Generated\Models\BaseItemCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Used to address any item contained in this site. This collection can't be enumerated. * @param ItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BaseItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BaseItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php index 2947b9fde84..e89b7c3b581 100644 --- a/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\LastModifiedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\LastModifiedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who last modified the item. Read-only. * @param LastModifiedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index a55d2847f47..fcd11c06d27 100644 --- a/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 7aca3543483..72c4d3644f5 100644 --- a/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index ebd5712e13d..6bc78e0a06b 100644 --- a/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\LastModifiedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Count/CountRequestBuilder.php index ae10cc34aff..af05b454508 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/ColumnsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/ColumnsRequestBuilder.php index cb2c4e3e2bb..69ce70e5fe3 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Columns\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Columns\Item\ColumnDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinition; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of columns represented as columnDefinition][columnDefinition] resources in a [list][list]. This API is available in the following [national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a column for a list][list] with a request that specifies a [columnDefinition][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-post-columns?view=graph-rest-1.0 Find more info here */ public function post(ColumnDefinition $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ColumnDefinition $body, ?ColumnsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/Count/CountRequestBuilder.php index 234069e9732..0861aca4043 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php index 00d0c3e2419..40adf116498 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Columns\Item\SourceColumn\SourceColumnRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property columns for groups * @param ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of field definitions for this list. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property columns in groups * @param ColumnDefinition $body The request body * @param ColumnDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ColumnDefinition $body, ?ColumnDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ColumnDefinitionItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ColumnDefinition $body, ?ColumnDefinit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php index b5df753d525..b639cef3be6 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The source column for the content type column. * @param SourceColumnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SourceColumnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php index 960aa7fbe65..ab5621bd2c0 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add a copy of a content type][contentType] from a [site][site] to a [list][list]. This API is available in the following [national cloud deployments. * @param AddCopyPostRequestBody $body The request body * @param AddCopyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-addcopy?view=graph-rest-1.0 Find more info here */ public function post(AddCopyPostRequestBody $body, ?AddCopyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddCopyPostRequestBody $body, ?AddCopyR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php index 50f99696dee..afdf9831bf4 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add or sync a copy of a published content type from the content type hub to a target site or a list. This method is part of the content type publishing changes to optimize the syncing of published content types to sites and lists, effectively switching from a 'push everywhere' to 'pull as needed' approach. The method allows users to pull content types directly from the content type hub to a site or list. For more information, see contentType: getCompatibleHubContentTypes and the blog post Syntex Product Updates – August 2021. This API is available in the following national cloud deployments. * @param AddCopyFromContentTypeHubPostRequestBody $body The request body * @param AddCopyFromContentTypeHubRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-addcopyfromcontenttypehub?view=graph-rest-1.0 Find more info here */ public function post(AddCopyFromContentTypeHubPostRequestBody $body, ?AddCopyFromContentTypeHubRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddCopyFromContentTypeHubPostRequestBod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/ContentTypesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/ContentTypesRequestBuilder.php index de40191ee98..ab6ef71efb5 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/ContentTypesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/ContentTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\AddCopy\AddCopyRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\AddCopyFromContentTypeHub\AddCopyFromContentTypeHubRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\Count\CountRequestBuilder; @@ -79,39 +78,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of contentType][contentType] resources in a [list][]. This API is available in the following [national cloud deployments. * @param ContentTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-list-contenttypes?view=graph-rest-1.0 Find more info here */ public function get(?ContentTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentTypes for groups * @param ContentType $body The request body * @param ContentTypesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ContentType $body, ?ContentTypesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,7 +117,6 @@ public function toGetRequestInformation(?ContentTypesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +124,7 @@ public function toGetRequestInformation(?ContentTypesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +139,11 @@ public function toPostRequestInformation(ContentType $body, ?ContentTypesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Count/CountRequestBuilder.php index 0bced4c0414..93a22c0a35e 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php index db7ebc6056c..74fb5a7d3f3 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getCompatibleHubContentTypes * @param GetCompatibleHubContentTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetCompatibleHubContentTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetCompatibleHubContentTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetCompatibleHubContentTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetCompatibleHubContentTypesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetCompatibleHubContentTypesRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php index 6757bce0c75..79862fdc320 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Associate a published content type][contentType] present in a content type hub with a list of hub sites. This API is available in the following [national cloud deployments. * @param AssociateWithHubSitesPostRequestBody $body The request body * @param AssociateWithHubSitesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-associatewithhubsites?view=graph-rest-1.0 Find more info here */ public function post(AssociateWithHubSitesPostRequestBody $body, ?AssociateWithHubSitesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AssociateWithHubSitesPostRequestBody $b $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php index 617c8766a2c..c867f8b39b4 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Parent contentType from which this content type is derived. * @param BaseRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?BaseRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?BaseRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php index 6ccfd89423e..bd6f24f43a2 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\Item\BaseTypes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\Item\BaseTypes\Item\ContentTypeItemRequestBuilder; use Microsoft\Graph\Generated\Models\ContentTypeCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of content types that are ancestors of this content type. * @param BaseTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?BaseTypesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?BaseTypesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php index ca83e8c7a6e..cfc3046fdd7 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php index f7fb5522b05..ce901e3854f 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of content types that are ancestors of this content type. * @param ContentTypeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentTypeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php index fe512113fe4..4abd4654e3a 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\Item\ColumnLinks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\Item\ColumnLinks\Item\ColumnLinkItemRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnLink; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of columns that are required by this content type. * @param ColumnLinksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnLinksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLinkCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLinkCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to columnLinks for groups * @param ColumnLink $body The request body * @param ColumnLinksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ColumnLink $body, ?ColumnLinksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ColumnLinksRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ColumnLinksRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ColumnLink $body, ?ColumnLinksRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php index 9c8a06ba495..76fa22660d3 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php index ef1c8eaf2c9..c4cb6c1ba4e 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnLink; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property columnLinks for groups * @param ColumnLinkItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ColumnLinkItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of columns that are required by this content type. * @param ColumnLinkItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnLinkItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property columnLinks in groups * @param ColumnLink $body The request body * @param ColumnLinkItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ColumnLink $body, ?ColumnLinkItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ColumnLinkItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ColumnLinkItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ColumnLinkItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ColumnLink $body, ?ColumnLinkItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php index f20ed85f316..d3131e70c3d 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\Item\ColumnPositions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\Item\ColumnPositions\Item\ColumnDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Column order information in a content type. * @param ColumnPositionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnPositionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ColumnPositionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ColumnPositionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php index ff579d670d0..f5e8e29350d 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php index 193dd3a49f3..fdee4b90f79 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Column order information in a content type. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php index 04429c5a05f..c31aa7d0885 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\Item\Columns\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\Item\Columns\Item\ColumnDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinition; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of columns represented as columnDefinition][columnDefinition] resources in a [content type][contentType]. This API is available in the following [national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a column to a content type][contentType] in a site, or a list with a request that specifies a [columnDefinition][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-post-columns?view=graph-rest-1.0 Find more info here */ public function post(ColumnDefinition $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ColumnDefinition $body, ?ColumnsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php index 07ffbeea73e..7a1ab565d82 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php index 97dcafcc51c..33f0b8cb2c5 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\Item\Columns\Item\SourceColumn\SourceColumnRequestBuilder; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a column][columndefinition] from a [site][], a [list][], or a [content type][contentType]. This API is available in the following [national cloud deployments. * @param ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the metadata for a site][], a [list][], or a [contentType][] [column][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a site][], a [list][], or a [content type][contentType] [column][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-update?view=graph-rest-1.0 Find more info here */ public function patch(ColumnDefinition $body, ?ColumnDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?ColumnDefinitionItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(ColumnDefinition $body, ?ColumnDefinit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php index e1b7bb57643..9950614b41d 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The source column for the content type column. * @param SourceColumnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SourceColumnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php index 33c1a8e9797..34825fa5843 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\Item\AssociateWithHubSites\AssociateWithHubSitesRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\Item\Base\EscapedBaseRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\Item\BaseTypes\BaseTypesRequestBuilder; @@ -114,56 +113,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentTypes for groups * @param ContentTypeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ContentTypeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of content types present in this list. * @param ContentTypeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentTypeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentTypes in groups * @param ContentType $body The request body * @param ContentTypeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ContentType $body, ?ContentTypeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -180,6 +170,7 @@ public function toDeleteRequestInformation(?ContentTypeItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -193,7 +184,6 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -201,6 +191,7 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -215,11 +206,11 @@ public function toPatchRequestInformation(ContentType $body, ?ContentTypeItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php index 3fe2611bc10..9701e9c4bcf 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a file to a default content location in a content type][contentType]. The file can then be added as a default file or template via a POST operation. This API is available in the following [national cloud deployments. * @param CopyToDefaultContentLocationPostRequestBody $body The request body * @param CopyToDefaultContentLocationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-copytodefaultcontentlocation?view=graph-rest-1.0 Find more info here */ public function post(CopyToDefaultContentLocationPostRequestBody $body, ?CopyToDefaultContentLocationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CopyToDefaultContentLocationPostRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php index d19cd932274..8eab073fff9 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function isPublished * @param IsPublishedRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IsPublishedRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IsPublishedGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IsPublishedGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?IsPublishedRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php index 536b6bed0e4..97e1fe229c5 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Publishes a contentType][] present in the content type hub site. This API is available in the following [national cloud deployments. * @param PublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-publish?view=graph-rest-1.0 Find more info here */ public function post(?PublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?PublishRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php index 5fb7d9f393d..71f7aa2ecf9 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unpublish a contentType][] from a content type hub site. This API is available in the following [national cloud deployments. * @param UnpublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-unpublish?view=graph-rest-1.0 Find more info here */ public function post(?UnpublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnpublishRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/CreatedByUserRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/CreatedByUserRequestBuilder.php index 536710fbb2a..25513e99d73 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/CreatedByUserRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/CreatedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\CreatedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\CreatedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who created the item. Read-only. * @param CreatedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 0f3d2b89334..8c92eb6e0fe 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 291d6533878..f2c164156b8 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 0e617ddacf9..5915df0f348 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\CreatedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Drive/DriveRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Drive/DriveRequestBuilder.php index c525e7e94b8..1b8e7ad2465 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Drive/DriveRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Drive/DriveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Drive; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Allows access to the list as a drive resource with driveItems. Only present on document libraries. * @param DriveRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Analytics/AnalyticsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Analytics/AnalyticsRequestBuilder.php index 2174e0e942f..e9d46274694 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Analytics/AnalyticsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Analytics/AnalyticsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemAnalytics; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Analytics about the view activities that took place on this item. * @param AnalyticsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AnalyticsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php index 5314263b5bd..69f7f4f65ac 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\CreatedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\CreatedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who created the item. Read-only. * @param CreatedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 31a13e4c8e5..16aa02f7347 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 67188507865..6d7e68df919 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index f659fb5cf59..f45da4e558b 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\CreatedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php index b92ebe90922..404bb943db0 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php index a62179524be..2f9e9c1b89e 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\DocumentSetVersions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\DocumentSetVersions\Item\DocumentSetVersionItemRequestBuilder; use Microsoft\Graph\Generated\Models\DocumentSetVersion; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the versions of a document set item in a list. This API is available in the following national cloud deployments. * @param DocumentSetVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-list-documentsetversions?view=graph-rest-1.0 Find more info here */ public function get(?DocumentSetVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new version of a document set item in a list. This API is available in the following national cloud deployments. * @param DocumentSetVersion $body The request body * @param DocumentSetVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-post-documentsetversions?view=graph-rest-1.0 Find more info here */ public function post(DocumentSetVersion $body, ?DocumentSetVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DocumentSetVersionsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DocumentSetVersionsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DocumentSetVersion $body, ?DocumentSetV $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php index 33806bb6c69..b09b28ac233 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\DocumentSetVersions\Item\Fields\FieldsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\DocumentSetVersions\Item\Restore\RestoreRequestBuilder; use Microsoft\Graph\Generated\Models\DocumentSetVersion; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a version of a document set in a list. This API is available in the following national cloud deployments. * @param DocumentSetVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/documentsetversion-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DocumentSetVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a documentSetVersion object. This API is available in the following national cloud deployments. * @param DocumentSetVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/documentsetversion-get?view=graph-rest-1.0 Find more info here */ public function get(?DocumentSetVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property documentSetVersions in groups * @param DocumentSetVersion $body The request body * @param DocumentSetVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DocumentSetVersion $body, ?DocumentSetVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?DocumentSetVersionItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?DocumentSetVersionItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?DocumentSetVersionItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(DocumentSetVersion $body, ?DocumentSet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php index 0df787d61b8..f07203bd3f9 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FieldValueSet; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fields for groups * @param FieldsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FieldsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of the fields and values for this version of the list item. * @param FieldsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FieldsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fields in groups * @param FieldValueSet $body The request body * @param FieldsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(FieldValueSet $body, ?FieldsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FieldsRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(FieldValueSet $body, ?FieldsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php index 51fcbe85d94..d622756aa03 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a document set version. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/documentsetversion-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DriveItem/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DriveItem/Content/ContentRequestBuilder.php index fbdf42edbb8..a9422688f83 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DriveItem/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DriveItem/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DriveItem/DriveItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DriveItem/DriveItemRequestBuilder.php index 8861d8791ce..e1e22fd736f 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DriveItem/DriveItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/DriveItem/DriveItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\DriveItem\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * For document libraries, the driveItem relationship exposes the listItem as a [driveItem][] * @param DriveItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Fields/FieldsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Fields/FieldsRequestBuilder.php index c6e39c3b14e..244171a1813 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Fields/FieldsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Fields/FieldsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FieldValueSet; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fields for groups * @param FieldsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FieldsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The values of the columns set on this list item. * @param FieldsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FieldsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties on a listItem][]. This API is available in the following [national cloud deployments. * @param FieldValueSet $body The request body * @param FieldsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-update?view=graph-rest-1.0 Find more info here */ public function patch(FieldValueSet $body, ?FieldsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?FieldsRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(FieldValueSet $body, ?FieldsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php index b09cb78ed65..cf0505b0977 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php index b0ba8c40c3e..90076ecd55d 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,7 +61,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -73,6 +68,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php index 952d5ca3387..1fcbab2e831 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\LastModifiedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\LastModifiedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who last modified the item. Read-only. * @param LastModifiedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 085604af9e5..03bd3880c80 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 654645a7782..2f5835f7487 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index fd3bbe49b6b..c6aa0015eb0 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\LastModifiedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/ListItemItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/ListItemItemRequestBuilder.php index 633a0279c4f..b6372b548ba 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/ListItemItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/ListItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\Analytics\AnalyticsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\CreatedByUser\CreatedByUserRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\DocumentSetVersions\DocumentSetVersionsRequestBuilder; @@ -99,39 +98,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Removes an item from a list][]. This API is available in the following [national cloud deployments. * @param ListItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ListItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns the metadata for an item][] in a [list][]. This API is available in the following [national cloud deployments. * @param ListItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-get?view=graph-rest-1.0 Find more info here */ public function get(?ListItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -149,19 +142,16 @@ public function getActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInter * Update the navigation property items in groups * @param ListItem $body The request body * @param ListItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ListItem $body, ?ListItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -178,6 +168,7 @@ public function toDeleteRequestInformation(?ListItemItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -191,7 +182,6 @@ public function toGetRequestInformation(?ListItemItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -199,6 +189,7 @@ public function toGetRequestInformation(?ListItemItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -213,11 +204,11 @@ public function toPatchRequestInformation(ListItem $body, ?ListItemItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Count/CountRequestBuilder.php index 6d73077a8dd..a226da9aef7 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php index 46da8a9b19d..dd9c754b081 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FieldValueSet; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fields for groups * @param FieldsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FieldsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of the fields and values for this version of the list item. * @param FieldsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FieldsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fields in groups * @param FieldValueSet $body The request body * @param FieldsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(FieldValueSet $body, ?FieldsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FieldsRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(FieldValueSet $body, ?FieldsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php index cd63aa8cc80..b98665256ba 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\Versions\Item\Fields\FieldsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\Versions\Item\RestoreVersion\RestoreVersionRequestBuilder; use Microsoft\Graph\Generated\Models\ListItemVersion; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property versions for groups * @param ListItemVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ListItemVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the metadata for a specific version of a ListItem. This API is available in the following national cloud deployments. * @param ListItemVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitemversion-get?view=graph-rest-1.0 Find more info here */ public function get(?ListItemVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property versions in groups * @param ListItemVersion $body The request body * @param ListItemVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ListItemVersion $body, ?ListItemVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?ListItemVersionItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?ListItemVersionItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?ListItemVersionItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(ListItemVersion $body, ?ListItemVersio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php index 3481724db95..b3eda8ef5e3 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a previous version of a ListItem to be the current version. This will create a new version with the contents of the previous version, but preserves all existing versions of the item. This API is available in the following national cloud deployments. * @param RestoreVersionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitemversion-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreVersionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RestoreVersionRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/VersionsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/VersionsRequestBuilder.php index a63f15dcc71..8479d10cd6c 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/VersionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/Item/Versions/VersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\Versions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\Versions\Item\ListItemVersionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ListItemVersion; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * SharePoint can be configured to retain the history for list items. Previous versions may be retained for a finite period of time depending on admin settings which may be unique per user or location. This API is available in the following national cloud deployments. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-list-versions?view=graph-rest-1.0 Find more info here */ public function get(?VersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to versions for groups * @param ListItemVersion $body The request body * @param VersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ListItemVersion $body, ?VersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ListItemVersion $body, ?VersionsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/ItemsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/ItemsRequestBuilder.php index 7df9d2c2cfc..55a97cd352d 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/ItemsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Items/ItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Items\Item\ListItemItemRequestBuilder; use Microsoft\Graph\Generated\Models\ListItem; use Microsoft\Graph\Generated\Models\ListItemCollectionResponse; @@ -47,40 +46,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of items][item] in a [list][]. This API is available in the following [national cloud deployments. * @param ItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-list?view=graph-rest-1.0 Find more info here */ public function get(?ItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new listItem][] in a [list][]. This API is available in the following [national cloud deployments. * @param ListItem $body The request body * @param ItemsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-create?view=graph-rest-1.0 Find more info here */ public function post(ListItem $body, ?ItemsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,7 +86,6 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -101,6 +93,7 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -115,11 +108,11 @@ public function toPostRequestInformation(ListItem $body, ?ItemsRequestBuilderPos $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php index 5db653f222a..4bb87acc927 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\LastModifiedByUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\LastModifiedByUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who last modified the item. Read-only. * @param LastModifiedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index a8351618bf2..89ac2ed0114 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 5cf87f12db8..91a06f15f7f 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 6ffd3ba01ed..ce83c5a5169 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\LastModifiedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ListItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ListItemRequestBuilder.php index 3c0e3728902..b029e4ed2ea 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ListItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ListItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Columns\ColumnsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ContentTypes\ContentTypesRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\CreatedByUser\CreatedByUserRequestBuilder; @@ -98,57 +97,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property lists for groups * @param ListItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ListItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Returns the metadata for a list][]. This API is available in the following [national cloud deployments. + * Get a list of rich long-running operations associated with a list. This API is available in the following national cloud deployments. * @param ListItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/list-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/list-list-operations?view=graph-rest-1.0 Find more info here */ public function get(?ListItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property lists in groups * @param EscapedList $body The request body * @param ListItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EscapedList $body, ?ListItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -165,11 +155,12 @@ public function toDeleteRequestInformation(?ListItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Returns the metadata for a list][]. This API is available in the following [national cloud deployments. + * Get a list of rich long-running operations associated with a list. This API is available in the following national cloud deployments. * @param ListItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -178,7 +169,6 @@ public function toGetRequestInformation(?ListItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -186,6 +176,7 @@ public function toGetRequestInformation(?ListItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -200,11 +191,11 @@ public function toPatchRequestInformation(EscapedList $body, ?ListItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ListItemRequestBuilderGetQueryParameters.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ListItemRequestBuilderGetQueryParameters.php index 38fe2a4b922..c168918ab7e 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/ListItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/ListItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Returns the metadata for a list][]. This API is available in the following [national cloud deployments. + * Get a list of rich long-running operations associated with a list. This API is available in the following national cloud deployments. */ class ListItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Operations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Operations/Count/CountRequestBuilder.php index 6110b6043d2..cf82612b7f8 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php index e12a644cacc..3fcbe20dd96 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RichLongRunningOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for groups * @param RichLongRunningOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RichLongRunningOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of long-running operations on the list. * @param RichLongRunningOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RichLongRunningOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in groups * @param RichLongRunningOperation $body The request body * @param RichLongRunningOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RichLongRunningOperation $body, ?RichLongRunningOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?RichLongRunningOperationItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?RichLongRunningOperationItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?RichLongRunningOperationItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(RichLongRunningOperation $body, ?RichL $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Operations/OperationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Operations/OperationsRequestBuilder.php index 00ab483de76..93cc9673278 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Operations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Operations\Item\RichLongRunningOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of long-running operations on the list. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for groups * @param RichLongRunningOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RichLongRunningOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(RichLongRunningOperation $body, ?Operat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/Count/CountRequestBuilder.php index 7ecd1c11040..20490a918bc 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php index d59dd7440f4..ba1e0536ce0 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reauthorize a subscription when you receive a reauthorizationRequired challenge. This API is available in the following national cloud deployments. * @param ReauthorizeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subscription-reauthorize?view=graph-rest-1.0 Find more info here */ public function post(?ReauthorizeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ReauthorizeRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/Item/SubscriptionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/Item/SubscriptionItemRequestBuilder.php index 130e36ffbe5..1af9aa5d4f0 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/Item/SubscriptionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/Item/SubscriptionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Subscriptions\Item\Reauthorize\ReauthorizeRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Subscription; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property subscriptions for groups * @param SubscriptionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SubscriptionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The set of subscriptions on the list. * @param SubscriptionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubscriptionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property subscriptions in groups * @param Subscription $body The request body * @param SubscriptionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Subscription $body, ?SubscriptionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?SubscriptionItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?SubscriptionItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?SubscriptionItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Subscription $body, ?SubscriptionItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/SubscriptionsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/SubscriptionsRequestBuilder.php index bb14b2a06c2..e5f305fa862 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/SubscriptionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/Item/Subscriptions/SubscriptionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Subscriptions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\Subscriptions\Item\SubscriptionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The set of subscriptions on the list. * @param SubscriptionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubscriptionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubscriptionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubscriptionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to subscriptions for groups * @param Subscription $body The request body * @param SubscriptionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Subscription $body, ?SubscriptionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?SubscriptionsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?SubscriptionsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Subscription $body, ?SubscriptionsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Lists/ListsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Lists/ListsRequestBuilder.php index da7eb233089..d740c1ad62c 100644 --- a/src/Generated/Groups/Item/Sites/Item/Lists/ListsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Lists/ListsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Lists\Item\ListItemRequestBuilder; use Microsoft\Graph\Generated\Models\EscapedList; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of [lists][] for a [site][]. Lists with the [system][] facet are hidden by default.To list them, include system in your $select statement. This API is available in the following national cloud deployments. * @param ListsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-list?view=graph-rest-1.0 Find more info here */ public function get(?ListsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new list][] in a [site][]. This API is available in the following [national cloud deployments. * @param EscapedList $body The request body * @param ListsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-create?view=graph-rest-1.0 Find more info here */ public function post(EscapedList $body, ?ListsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ListsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ListsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EscapedList $body, ?ListsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Count/CountRequestBuilder.php index 9f3c367fb50..c1b157f1c91 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php index 3defe8ea431..160bcfa6284 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CopyNotebookModel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Retrieve the properties and relationships of a notebook object by using its URL path. The location can be user notebooks on Microsoft 365, group notebooks, or SharePoint site-hosted team notebooks on Microsoft 365. This API is available in the following national cloud deployments. * @param GetNotebookFromWebUrlPostRequestBody $body The request body * @param GetNotebookFromWebUrlRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-getnotebookfromweburl?view=graph-rest-1.0 Find more info here */ public function post(GetNotebookFromWebUrlPostRequestBody $body, ?GetNotebookFromWebUrlRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CopyNotebookModel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CopyNotebookModel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(GetNotebookFromWebUrlPostRequestBody $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php index 7f5f0a135b3..5099da4b7fa 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getRecentNotebooks * @param GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetRecentNotebooksWithIncludePersonalNotebooksGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetRecentNotebooksWithIncludePersonalNotebooksGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?GetRecentNotebooksWithIncludePersonalNo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?GetRecentNotebooksWithIncludePersonalNo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php index d7afc44dd77..47a09900d21 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyNotebookPostRequestBody $body The request body * @param CopyNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-copynotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyNotebookPostRequestBody $body, ?CopyNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyNotebookPostRequestBody $body, ?Cop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php index 7dff012c390..35648b87490 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\CopyNotebook\CopyNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\SectionGroupsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\Sections\SectionsRequestBuilder; @@ -58,57 +57,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property notebooks for groups * @param NotebookItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?NotebookItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a notebook object. This API is available in the following national cloud deployments. * @param NotebookItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-get?view=graph-rest-1.0 Find more info here */ public function get(?NotebookItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property notebooks in groups * @param Notebook $body The request body * @param NotebookItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Notebook $body, ?NotebookItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -125,6 +115,7 @@ public function toDeleteRequestInformation(?NotebookItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -138,7 +129,6 @@ public function toGetRequestInformation(?NotebookItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -146,6 +136,7 @@ public function toGetRequestInformation(?NotebookItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -160,11 +151,11 @@ public function toPatchRequestInformation(Notebook $body, ?NotebookItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php index 5bd8c535e78..115ec5d3ccc 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php index b360dc8b985..aba0f3547fa 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section group. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index 6b33c897c5a..7a15f70b32d 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section group. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php index c0efbfaacf2..2862b5e320d 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\ParentNotebook\ParentNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\ParentSectionGroup\ParentSectionGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\SectionGroups\SectionGroupsRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sectionGroups for groups * @param SectionGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SectionGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The section groups in the notebook. Read-only. Nullable. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sectionGroups in groups * @param SectionGroup $body The request body * @param SectionGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SectionGroup $body, ?SectionGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?SectionGroupItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(SectionGroup $body, ?SectionGroupItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php index 8a0e49871cb..f49ba6cc185 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php index 9c3954986c6..a6e8ae1eceb 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section groups in the section. Read-only. Nullable. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php index ac3c9387190..62d838be143 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\SectionGroups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\SectionGroups\Item\SectionGroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of section groups from the specified section group. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php index 42eef4d4ba6..5dc93560069 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index 0ee390d9535..c4b5db6f658 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index baa433561ac..dfa8b7c1703 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php index ad7334aea17..9b8243b6980 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\CopyToSectionGroup\CopyToSectionGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\PagesRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for groups * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The sections in the section group. Read-only. Nullable. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in groups * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php index d5b53d633f6..52db2468e12 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index 2bda779e0b4..49ca430ba61 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index 544271a78cd..9682dd02979 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index 7ff0a0c4cff..499a664aaf1 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\Item\CopyToSection\CopyToSectionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\Item\OnenotePatchContent\OnenotePatchContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for groups * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in groups * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 32fa86b165b..8edb88930f5 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index f81cf2e7f83..012abff7bd4 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index ee5cae2a468..0dc27587afc 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index dbcf7c0b8d0..827ce1f138b 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php index 113c7f18086..329de29d951 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\Item\OnenotePageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 965fc1bdb3e..a63a9ef2429 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index b346921d361..fa3685bd47f 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php index 259abb7e7a4..717c1f8ff60 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\OnenoteSectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects from the specified section group. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new onenoteSection in the specified section group. This API is available in the following national cloud deployments. * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-post-sections?view=graph-rest-1.0 Find more info here */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php index a1768d3a5f1..354f7fd23fd 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\SectionGroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of section groups from the specified notebook. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new section group in the specified notebook. This API is available in the following national cloud deployments. * @param SectionGroup $body The request body * @param SectionGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-post-sectiongroups?view=graph-rest-1.0 Find more info here */ public function post(SectionGroup $body, ?SectionGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SectionGroup $body, ?SectionGroupsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php index acc06fa5081..59bc458d19f 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index aecb05933f0..094ed397961 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index bda5a48083c..102667e32e3 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php index d5a4945cedb..5f97816e8bc 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\Sections\Item\CopyToSectionGroup\CopyToSectionGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\Sections\Item\Pages\PagesRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for groups * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The sections in the notebook. Read-only. Nullable. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in groups * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php index 6f4e7fb6d22..31436112b66 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index b311f4f65bc..de9e34d95da 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index 124637f5595..215cf78544a 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index a071e8709cf..51c7d0cae70 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\Sections\Item\Pages\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\Sections\Item\Pages\Item\CopyToSection\CopyToSectionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\Sections\Item\Pages\Item\OnenotePatchContent\OnenotePatchContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for groups * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in groups * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 4b40c7accce..73c1144587c 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index fd719033063..69e7fdc2465 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index 7a3ea9b2506..6164aa66bb5 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index 0d927683a37..640885c32c6 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php index 733394e7098..de50f4f28ab 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\Sections\Item\Pages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\Sections\Item\Pages\Item\OnenotePageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 083fc059708..55f2d80d6d9 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index a2deef8e063..65e7cd8fb19 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php index e7c8d1ada60..b3a3fdd33a4 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\Sections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Item\Sections\Item\OnenoteSectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects from the specified notebook. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new onenoteSection in the specified notebook. This API is available in the following national cloud deployments. * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-post-sections?view=graph-rest-1.0 Find more info here */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/NotebooksRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/NotebooksRequestBuilder.php index 03f02580ef9..bfdc3cf6db1 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/NotebooksRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Notebooks/NotebooksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\GetNotebookFromWebUrl\GetNotebookFromWebUrlRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\GetRecentNotebooksWithIncludePersonalNotebooks\GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder; @@ -64,20 +63,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of notebook objects. This API is available in the following national cloud deployments. * @param NotebooksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-notebooks?view=graph-rest-1.0 Find more info here */ public function get(?NotebooksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [NotebookCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [NotebookCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,20 +89,17 @@ public function getRecentNotebooksWithIncludePersonalNotebooks(bool $includePers * Create a new OneNote notebook. This API is available in the following national cloud deployments. * @param Notebook $body The request body * @param NotebooksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-post-notebooks?view=graph-rest-1.0 Find more info here */ public function post(Notebook $body, ?NotebooksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,7 +112,6 @@ public function toGetRequestInformation(?NotebooksRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -127,6 +119,7 @@ public function toGetRequestInformation(?NotebooksRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -141,11 +134,11 @@ public function toPostRequestInformation(Notebook $body, ?NotebooksRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/OnenoteRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/OnenoteRequestBuilder.php index 8b249b882fa..8ba370bbbf9 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/OnenoteRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/OnenoteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Notebooks\NotebooksRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Operations\OperationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Pages\PagesRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property onenote for groups * @param OnenoteRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Calls the OneNote service for notebook related operations. * @param OnenoteRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property onenote in groups * @param Onenote $body The request body * @param OnenoteRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Onenote $body, ?OnenoteRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenoteRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenoteRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenoteRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(Onenote $body, ?OnenoteRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Operations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Operations/Count/CountRequestBuilder.php index ca4572e84a6..b850121b1ca 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php index 12f5a95244f..b179d21dee6 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for groups * @param OnenoteOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the status of a long-running OneNote operation. This applies to operations that return the Operation-Location header in the response, such as CopyNotebook, CopyToNotebook, CopyToSectionGroup, and CopyToSection. You can poll the Operation-Location endpoint until the status property returns completed or failed. If the status is completed, the resourceLocation property contains the resource endpoint URI. If the status is failed, the error and @api.diagnostics properties provide error information. This API is available in the following national cloud deployments. * @param OnenoteOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenoteoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?OnenoteOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in groups * @param OnenoteOperation $body The request body * @param OnenoteOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteOperation $body, ?OnenoteOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?OnenoteOperationItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?OnenoteOperationItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?OnenoteOperationItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(OnenoteOperation $body, ?OnenoteOperat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Operations/OperationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Operations/OperationsRequestBuilder.php index e4ccd8af2c7..79ea0cef3dd 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Operations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Operations\Item\OnenoteOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the status of a long-running OneNote operation. This applies to operations that return the Operation-Location header in the response, such as CopyNotebook, CopyToNotebook, CopyToSectionGroup, and CopyToSection. You can poll the Operation-Location endpoint until the status property returns completed or failed. If the status is completed, the resourceLocation property contains the resource endpoint URI. If the status is failed, the error and @api.diagnostics properties provide error information. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for groups * @param OnenoteOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenoteOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(OnenoteOperation $body, ?OperationsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Count/CountRequestBuilder.php index 89eb2739abb..3d7b225f9ad 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php index 938b7e00c43..84f974b8ce2 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index d037900bec3..acc3f401711 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php index 361b3b35073..9a847c7fb25 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Pages\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Pages\Item\CopyToSection\CopyToSectionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Pages\Item\OnenotePatchContent\OnenotePatchContentRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a OneNote page. This API is available in the following national cloud deployments. * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-delete?view=graph-rest-1.0 Find more info here */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a page object. Getting page information Access a page's metadata by page identifier: Getting page content You can use the page's content endpoint to get the HTML content of a page: The includeIDs=true query option is used to update pages. This API is available in the following national cloud deployments. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-get?view=graph-rest-1.0 Find more info here */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in groups * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 3c824d721a8..8dae472adfc 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 7e585543614..92c126eebe2 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index fdb5c108b2a..805c207ebcf 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php index b37187bb4d3..c53d9c4d508 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/PagesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/PagesRequestBuilder.php index 3a0d6f946fb..8af7dbdf5d4 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/PagesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Pages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Pages\Item\OnenotePageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new OneNote page in the default section of the default notebook. To create a page in a different section in the default notebook, you can use the sectionName query parameter. Example: ../onenote/pages?sectionName=My%20section The POST /onenote/pages operation is used only to create pages in the current user's default notebook. If you're targeting other notebooks, you can create pages in a specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/Count/CountRequestBuilder.php index 9252596827b..d88c7634f48 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php index 7c15fda0d69..845f231df1f 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteResource; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php index 9e81ab33944..d63882374fc 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Resources\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteResource; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resources for groups * @param OnenoteResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The image and other file resources in OneNote pages. Getting a resources collection isn't supported, but you can get the binary content of a specific resource. Read-only. Nullable. * @param OnenoteResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in groups * @param OnenoteResource $body The request body * @param OnenoteResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteResource $body, ?OnenoteResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?OnenoteResourceItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?OnenoteResourceItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?OnenoteResourceItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(OnenoteResource $body, ?OnenoteResourc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/ResourcesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/ResourcesRequestBuilder.php index fe7b869191c..478cb9aee48 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Resources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Resources\Item\OnenoteResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The image and other file resources in OneNote pages. Getting a resources collection isn't supported, but you can get the binary content of a specific resource. Read-only. Nullable. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resources for groups * @param OnenoteResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenoteResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(OnenoteResource $body, ?ResourcesReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php index f82bd2317a2..1694481d153 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 329720a4505..ee63727aa3e 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section group. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index c1ac020865e..a15bc8707ca 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section group. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php index 3b06bf76581..5503d1bb13d 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\ParentNotebook\ParentNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\ParentSectionGroup\ParentSectionGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\SectionGroups\SectionGroupsRequestBuilder; @@ -66,57 +65,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sectionGroups for groups * @param SectionGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SectionGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a sectionGroup object. This API is available in the following national cloud deployments. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-get?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sectionGroups in groups * @param SectionGroup $body The request body * @param SectionGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SectionGroup $body, ?SectionGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,6 +123,7 @@ public function toDeleteRequestInformation(?SectionGroupItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -146,7 +137,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -154,6 +144,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -168,11 +159,11 @@ public function toPatchRequestInformation(SectionGroup $body, ?SectionGroupItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php index 067582513bd..13f00d70d62 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php index 2d3ce9e3877..1bce83ef8d3 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section groups in the section. Read-only. Nullable. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php index cdc5bc2f0fd..7e573fbd2ed 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\SectionGroups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\SectionGroups\Item\SectionGroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of section groups from the specified section group. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php index 7e82c1b4ba1..1378e79caeb 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index daaf141e44e..4142e051320 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index 5f6bd441fc5..58d4de14943 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php index fd0a79b7d84..5cda0f0762d 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\Sections\Item\CopyToSectionGroup\CopyToSectionGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\PagesRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for groups * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The sections in the section group. Read-only. Nullable. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in groups * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php index 40b1e4455cf..7e1eb49efe0 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index f58bba3dffb..873bb4bb47d 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index 1e50cf27090..99ad1f068fc 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index 1381889db38..8767b6ddd0d 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\Item\CopyToSection\CopyToSectionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\Item\OnenotePatchContent\OnenotePatchContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for groups * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in groups * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 86e42709f10..458f0e17219 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 61785fdbe7d..82d12410724 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index 7785e607250..df0325cbedb 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index ba0170032aa..847fabb90c5 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php index ef93c36d956..9472f8ea4af 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\Item\OnenotePageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 75ee72d595a..e453f86a2cd 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index c53200280cf..116b4428308 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php index 342b09232c2..7a5c1611825 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\Sections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\Sections\Item\OnenoteSectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects from the specified section group. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new onenoteSection in the specified section group. This API is available in the following national cloud deployments. * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-post-sections?view=graph-rest-1.0 Find more info here */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php index 21e4582d26c..6ff7111e52e 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\SectionGroups\Item\SectionGroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of sectionGroup objects. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sectionGroups for groups * @param SectionGroup $body The request body * @param SectionGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SectionGroup $body, ?SectionGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SectionGroup $body, ?SectionGroupsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Count/CountRequestBuilder.php index 2d939923fac..7484e411880 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index d2cba87f8ea..abfadd8ce29 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index 718b5d10fd9..6aee75b2a88 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php index 28bdadccb84..99b94cfab84 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Sections\Item\CopyToSectionGroup\CopyToSectionGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Sections\Item\Pages\PagesRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for groups * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a onenoteSection object. This API is available in the following national cloud deployments. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-get?view=graph-rest-1.0 Find more info here */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in groups * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php index 735d105a36b..e6921104269 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index c8acaf5131b..8bf2ccb7b54 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index 8ef0fcae1e2..27e7738bc3b 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index 238593b7838..f038031e87b 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Sections\Item\Pages\Item\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Sections\Item\Pages\Item\CopyToSection\CopyToSectionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Sections\Item\Pages\Item\OnenotePatchContent\OnenotePatchContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for groups * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in groups * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 33fdebcd295..70a55c57d81 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index de539c4afb0..c79e325535d 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index b77f0a476f9..3d30d6213aa 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index 854bd5094bc..e48f54f21e5 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php index f36e73a05d9..14a61981348 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Sections\Item\Pages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Sections\Item\Pages\Item\OnenotePageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 657b65a2c8b..68804a42297 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index 3b43504b331..8179b8084e5 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/SectionsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/SectionsRequestBuilder.php index 6dd3b173be6..f95aa31e880 100644 --- a/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Onenote/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Sections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Onenote\Sections\Item\OnenoteSectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sections for groups * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Operations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Operations/Count/CountRequestBuilder.php index dfdfb4c981d..428f3271683 100644 --- a/src/Generated/Groups/Item/Sites/Item/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php index d4270757fcc..67578f86c9e 100644 --- a/src/Generated/Groups/Item/Sites/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RichLongRunningOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for groups * @param RichLongRunningOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RichLongRunningOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the status of a rich long-running operation on a site or a list. This API is available in the following national cloud deployments. * @param RichLongRunningOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/richlongrunningoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?RichLongRunningOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in groups * @param RichLongRunningOperation $body The request body * @param RichLongRunningOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RichLongRunningOperation $body, ?RichLongRunningOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?RichLongRunningOperationItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?RichLongRunningOperationItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?RichLongRunningOperationItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(RichLongRunningOperation $body, ?RichL $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Operations/OperationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Operations/OperationsRequestBuilder.php index da3391fc2d1..550975dc7a9 100644 --- a/src/Generated/Groups/Item/Sites/Item/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Operations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Operations\Item\RichLongRunningOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of rich long-running operations associated with a site. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-list-operations?view=graph-rest-1.0 Find more info here */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for groups * @param RichLongRunningOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RichLongRunningOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(RichLongRunningOperation $body, ?Operat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Permissions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Permissions/Count/CountRequestBuilder.php index e7ef43c9a66..9aab66c0a0c 100644 --- a/src/Generated/Groups/Item/Sites/Item/Permissions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Permissions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Permissions/Item/Grant/GrantRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Permissions/Item/Grant/GrantRequestBuilder.php index e677fa39bfd..1c8ad054883 100644 --- a/src/Generated/Groups/Item/Sites/Item/Permissions/Item/Grant/GrantRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Permissions/Item/Grant/GrantRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Grant users access to a link represented by a permission][]. This API is available in the following [national cloud deployments. * @param GrantPostRequestBody $body The request body * @param GrantRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permission-grant?view=graph-rest-1.0 Find more info here */ public function post(GrantPostRequestBody $body, ?GrantRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GrantPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GrantPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GrantPostRequestBody $body, ?GrantReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Permissions/Item/PermissionItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Permissions/Item/PermissionItemRequestBuilder.php index 0cd28578204..74b4714bddb 100644 --- a/src/Generated/Groups/Item/Sites/Item/Permissions/Item/PermissionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Permissions/Item/PermissionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Permissions\Item\Grant\GrantRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Permission; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a permission object on a site. This API is available in the following national cloud deployments. * @param PermissionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-delete-permission?view=graph-rest-1.0 Find more info here */ public function delete(?PermissionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a permission object on a site. This API is available in the following national cloud deployments. * @param PermissionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-get-permission?view=graph-rest-1.0 Find more info here */ public function get(?PermissionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an application permission object on a site. This API is available in the following national cloud deployments. * @param Permission $body The request body * @param PermissionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-update-permission?view=graph-rest-1.0 Find more info here */ public function patch(Permission $body, ?PermissionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?PermissionItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?PermissionItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?PermissionItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(Permission $body, ?PermissionItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Permissions/PermissionsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Permissions/PermissionsRequestBuilder.php index cb67aed36bc..bfebe7fde24 100644 --- a/src/Generated/Groups/Item/Sites/Item/Permissions/PermissionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Permissions/PermissionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Permissions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Permissions\Item\PermissionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the permission resources from the permissions navigation property on a site. This API is available in the following national cloud deployments. * @param PermissionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-list-permissions?view=graph-rest-1.0 Find more info here */ public function get(?PermissionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new permission object on a site. This API is available in the following national cloud deployments. * @param Permission $body The request body * @param PermissionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-post-permissions?view=graph-rest-1.0 Find more info here */ public function post(Permission $body, ?PermissionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PermissionsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PermissionsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Permission $body, ?PermissionsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/SiteItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/SiteItemRequestBuilder.php index e79ddbc7ba1..6c2da651afb 100644 --- a/src/Generated/Groups/Item/Sites/Item/SiteItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/SiteItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Analytics\AnalyticsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Columns\ColumnsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\ContentTypes\ContentTypesRequestBuilder; @@ -173,19 +172,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of SharePoint sites in this group. Access the default site with /sites/root. * @param SiteItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SiteItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -221,19 +217,16 @@ public function getByPathWithPath(string $path): GetByPathWithPathRequestBuilder * Update the navigation property sites in groups * @param Site $body The request body * @param SiteItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Site $body, ?SiteItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -246,7 +239,6 @@ public function toGetRequestInformation(?SiteItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -254,6 +246,7 @@ public function toGetRequestInformation(?SiteItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -268,11 +261,11 @@ public function toPatchRequestInformation(Site $body, ?SiteItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Sites/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Sites/Count/CountRequestBuilder.php index 1a2d09c0dd7..ba2bca2b539 100644 --- a/src/Generated/Groups/Item/Sites/Item/Sites/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Sites/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Sites/Item/SiteItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Sites/Item/SiteItemRequestBuilder.php index b93e0002b19..6ec66fd3c5e 100644 --- a/src/Generated/Groups/Item/Sites/Item/Sites/Item/SiteItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Sites/Item/SiteItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Site; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of the sub-sites under this site. * @param SiteItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SiteItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SiteItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SiteItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/Sites/SitesRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/Sites/SitesRequestBuilder.php index 2b7b497ae9e..4c522856f70 100644 --- a/src/Generated/Groups/Item/Sites/Item/Sites/SitesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/Sites/SitesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Sites\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\Sites\Item\SiteItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a collection of subsites defined for a site][]. This API is available in the following [national cloud deployments. * @param SitesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-list-subsites?view=graph-rest-1.0 Find more info here */ public function get(?SitesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SiteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SiteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SitesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SitesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Count/CountRequestBuilder.php index 14cb94f6647..3141ad44aaa 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/GroupsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/GroupsRequestBuilder.php index 877486347d5..1365b6e512f 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/GroupsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/GroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\GroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of group objects in a term store. This API is available in the following national cloud deployments. * @param GroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-list-groups?view=graph-rest-1.0 Find more info here */ public function get(?GroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new group object in a term store. This API is available in the following national cloud deployments. * @param Group $body The request body * @param GroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-post?view=graph-rest-1.0 Find more info here */ public function post(Group $body, ?GroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Group $body, ?GroupsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/GroupItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/GroupItemRequestBuilder.php index 66af3e7ad72..34231fd67a3 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/GroupItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/GroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\SetsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a group object in a term store]. This API is available in the following [national cloud deployments. * @param GroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-delete?view=graph-rest-1.0 Find more info here */ public function delete(?GroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term store group object. This API is available in the following national cloud deployments. * @param GroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-get?view=graph-rest-1.0 Find more info here */ public function get(?GroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property groups in groups * @param Group $body The request body * @param GroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Group $body, ?GroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?GroupItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?GroupItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?GroupItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(Group $body, ?GroupItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Count/CountRequestBuilder.php index 8815aea81cc..ef4612ff3fe 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php index 08fd732fe41..01fe2a0ec4e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the first level children of a set] or [term] resource using the children navigation property. This API is available in the following [national cloud deployments. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-post?view=graph-rest-1.0 Find more info here */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php index 23b9b187339..ad174eb5c2c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php index 4604e97f84a..765b1fe081f 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for groups * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php index 7cae7426432..5f6e65e7e9d 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 0fe11d0a1cb..cdbacde1fb8 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 039cf7adb34..c90d01c0eeb 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 329c9594e6a..20a23d18a1a 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 39835d0bcc5..954ee3a7cf4 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index ad2c6b620f2..85580965ace 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php index f69f990e470..9ce7e962b9d 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php index f79ac2da6cf..b006af59881 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php index cf4bc106ea5..cf1e7b8de07 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Children\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 17e6ebf4791..24c4d9eb9de 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 75328fc1cc8..5a64413e26e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index c37194725fb..8c7b6ce2706 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index a490ed4724f..aa32a5f48f3 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index ed549bfa8fe..d5ff145a8b6 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php index 346005e4e15..1287173f926 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php index 086503f5ef1..fd396fc5614 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php index 03c3db7e90a..9b9a7bdf42e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Set\SetRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children terms of set in term [store]. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php index a611496366a..9bc54e4883f 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property parentGroup for groups * @param ParentGroupRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ParentGroupRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The parent [group] that contains the set. * @param ParentGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property parentGroup in groups * @param Group $body The request body * @param ParentGroupRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Group $body, ?ParentGroupRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ParentGroupRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Group $body, ?ParentGroupRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php index f7a254a197b..b3656556e8f 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index aef42fdcdf3..0c17095b04d 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php index 4a76c7f942b..e7f284508eb 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Indicates which terms have been pinned or reused directly under the set. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php index 337377b6a4c..239896f5609 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index e3fc9afb647..a63fb969d33 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php index 0864f254892..a8b5e90d2aa 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the different relation of a term] or [set] from the relations navigation property. This API is available in the following [national cloud deployments. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-relations?view=graph-rest-1.0 Find more info here */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/SetItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/SetItemRequestBuilder.php index f50fd9f23bc..74b3a652b60 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/SetItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/SetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\ParentGroup\ParentGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Relations\RelationsRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sets for groups * @param SetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * All sets under the group in a term [store]. * @param SetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sets in groups * @param Set $body The request body * @param SetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Set $body, ?SetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?SetItemRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(Set $body, ?SetItemRequestBuilderPatch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php index bae8e4a7103..1e5e991cd0d 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php index c4ff07dafba..66af0ce1067 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for groups * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php index c80a5413c8c..6307c693811 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php index e71a783183e..fc753c4a50d 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index e83e618dadd..80159729989 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index e82d4aa8c1f..27ba1fc5a7e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 168e4bfaae5..b35cacf8af5 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 31d245e358a..a0b5ce0a1f4 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php index 28bd41953b4..222fbbab1c5 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php index 3154a3fde14..62b83869382 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php index 51bc149d7e2..0cc07e75617 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Children\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php index edad5754efb..2545c6c5dc6 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 4f832467df6..ee821202ee4 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php index 4dc561a7f6d..cc47c583fe0 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php index da4dbc862a9..332aaf2691b 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 53a89e5d76c..e71ceb9fff0 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php index 6986cda2f30..fe44fee3f0e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php index d5eb11b43d2..547942ff1f8 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php index 932272625c3..6c4f1de2a39 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Set\SetRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-get?view=graph-rest-1.0 Find more info here */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-update?view=graph-rest-1.0 Find more info here */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php index 725f756fb16..54c00c13252 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to terms for groups * @param Term $body The request body * @param TermsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?TermsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?TermsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/SetsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/SetsRequestBuilder.php index 9153ad29032..2234403b36c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/SetsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Groups/Item/Sets/SetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\Item\Sets\Item\SetItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the set objects and their properties. This API is available in the following national cloud deployments. * @param SetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-list-sets?view=graph-rest-1.0 Find more info here */ public function get(?SetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sets for groups * @param Set $body The request body * @param SetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Set $body, ?SetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Set $body, ?SetsRequestBuilderPostReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Count/CountRequestBuilder.php index b5cccbdb4ce..e87e1084b3e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/ChildrenRequestBuilder.php index 8288b683d9c..a51e58504ee 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the first level children of a set] or [term] resource using the children navigation property. This API is available in the following [national cloud deployments. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-post?view=graph-rest-1.0 Find more info here */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Count/CountRequestBuilder.php index 48615c7a4a7..09c2e93ad99 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php index 9aed4467ec4..d8859bfe3ee 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for groups * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php index 94c565c60fe..c925c71524e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php index ad57da7d60a..44dc3882d99 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 22ef5c9d310..af439faceb3 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 2cdd5e52ab9..50c9625fc24 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 50fa57fe564..189dfefad41 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 9a57d3ed7ed..4cd92e2e6e7 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php index 2aba571c8f5..1defc7e0bd5 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php index d6af5e88bd4..502859b53b3 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php index 6d098386f94..a5ac8098d58 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Children\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php index ac6e96ec8da..646338e1e01 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index e5a376d1c4f..46740332396 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 395ba5f099e..79142c103ba 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 8bcb0eb2fb2..a85e7b74ffc 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index affc4503d59..0a78791810a 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php index aee9ed54ff7..30181a7b5fb 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Set/SetRequestBuilder.php index 8d3d744a2d1..6690e505497 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/TermItemRequestBuilder.php index 7d812eba98c..e833c1fefb1 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\Item\Set\SetRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children terms of set in term [store]. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php index 9803be7a435..302e019c7c6 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\SetsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property parentGroup for groups * @param ParentGroupRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ParentGroupRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The parent [group] that contains the set. * @param ParentGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property parentGroup in groups * @param Group $body The request body * @param ParentGroupRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Group $body, ?ParentGroupRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ParentGroupRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Group $body, ?ParentGroupRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php index 65854fd4166..96bc136372d 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php index 96981db45e9..f648abd35ce 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the first level children of a set] or [term] resource using the children navigation property. This API is available in the following [national cloud deployments. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-post?view=graph-rest-1.0 Find more info here */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php index 566d727c518..a5770b4156b 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php index 3ecbbc66cc5..d4c3e860f5f 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for groups * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php index d91e54c2353..3ca4e0e67d3 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php index f8ab364843c..4e21bcece27 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index bef12578f95..e85a277b51c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index d3ad6911431..ac569c22491 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index b50ec7bda42..cc934752dd3 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 371191de247..1426d1b6681 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php index 8a16490bea3..43d5d05c2dc 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php index e128f12827f..89687f69c05 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php index 4b6cd44deb0..935269bb10d 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php index eff624035b6..403852379f4 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index a3468c929e0..a6e77dfc2d3 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 408d164c160..88cee0fa174 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 1e2849a4ae6..62961a1f5f0 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index f5a1f1dbb12..8bcee3f2671 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php index edf3bfa3930..df3ace27886 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php index 8253ff47382..163d250b084 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php index e460c8158c5..4dad72c732b 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Set\SetRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children terms of set in term [store]. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php index 93d61a2b59f..128df8bb629 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index f61d9563eec..c7307902a24 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php index 9ed3dbc8644..4a277d6b5d2 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Indicates which terms have been pinned or reused directly under the set. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php index c5209bdc955..e537f348463 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 41e9f849c5a..634d9a4cd65 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php index 63311ad27ca..23f6e23e232 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the different relation of a term] or [set] from the relations navigation property. This API is available in the following [national cloud deployments. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-relations?view=graph-rest-1.0 Find more info here */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php index 47ffd4490c6..8d6cb72665e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\TermsRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sets for groups * @param SetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * All sets under the group in a term [store]. * @param SetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sets in groups * @param Set $body The request body * @param SetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Set $body, ?SetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?SetItemRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Set $body, ?SetItemRequestBuilderPatch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php index 9c36966bc3a..aae40c96184 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php index c25dedba834..80f750be792 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for groups * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php index c18813bd7d5..97d2f76fc79 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 19135300643..3858df67a18 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 9a34a1e8d58..93dd506fe92 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 577eaa857af..a86257d74b2 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 8a30c2d40cb..80148ad8269 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index b9eb0cce360..717e614ebf7 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php index 1054b0acb98..ba369b64fc7 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php index 4ab5c704b27..3730c7c4961 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php index e0bc8cbe144..f5150ae5c41 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php index 94714a02e18..3b6f1c14ba4 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 5c0cd232efb..64da97f1206 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php index a7f58c6e129..d3246cba85d 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php index bf611fc5c63..93df84c21d8 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 9319f64c508..558fef694f8 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php index 4560f7ca6c7..61954613e73 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php index 22a2dd9b9ec..79342eefaa5 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php index 01c798a0fd2..73d539ecf05 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Set\SetRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-get?view=graph-rest-1.0 Find more info here */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-update?view=graph-rest-1.0 Find more info here */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php index 26291b2aff4..ea5eda2e008 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to terms for groups * @param Term $body The request body * @param TermsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?TermsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?TermsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php index 1d366b8b3a9..66c2b05353e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\SetItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the set objects and their properties. This API is available in the following national cloud deployments. * @param SetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-list-sets?view=graph-rest-1.0 Find more info here */ public function get(?SetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sets for groups * @param Set $body The request body * @param SetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Set $body, ?SetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Set $body, ?SetsRequestBuilderPostReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Count/CountRequestBuilder.php index 54383b11a2f..11435651714 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index e454d29ee2c..4b9c7df2a65 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/RelationItemRequestBuilder.php index 2ef71cc6453..de0f5a6eba9 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Indicates which terms have been pinned or reused directly under the set. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/Set/SetRequestBuilder.php index 4744c0b5203..79bff80ac30 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 818bbdd1972..1fe596c6b5d 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/RelationsRequestBuilder.php index 1236c7966ee..e7c03d663e0 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the different relation of a term] or [set] from the relations navigation property. This API is available in the following [national cloud deployments. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-relations?view=graph-rest-1.0 Find more info here */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/SetItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/SetItemRequestBuilder.php index 08d0435ddfd..b8818e7d91e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/SetItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/SetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\ParentGroup\ParentGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Relations\RelationsRequestBuilder; @@ -66,59 +65,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a set object. This API is available in the following national cloud deployments. * @param SetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a set object. This API is available in the following national cloud deployments. * @param SetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-get?view=graph-rest-1.0 Find more info here */ public function get(?SetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a set object. This API is available in the following national cloud deployments. * @param Set $body The request body * @param SetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-update?view=graph-rest-1.0 Find more info here */ public function patch(Set $body, ?SetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -135,6 +125,7 @@ public function toDeleteRequestInformation(?SetItemRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -148,7 +139,6 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -156,6 +146,7 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -170,11 +161,11 @@ public function toPatchRequestInformation(Set $body, ?SetItemRequestBuilderPatch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Count/CountRequestBuilder.php index ad3003dec1d..99ae01da345 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php index 9cd043c72ec..572f18432bb 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for groups * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php index 39928881ce7..958ddda2f5a 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 8d7235e784d..da673215ae8 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 41ebf00abe0..ce277a187fe 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index d14d6c51338..bcbb7b720c9 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 7a8ae017277..bdcc0343d9b 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 9cb8df164c5..96a763e72f1 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php index a451b3f019b..d5e9f84c057 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php index 55dc754d682..e1a315c03c2 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php index 3a068173235..67cae8ff19b 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Children\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php index b279e661d75..cbb309d3582 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 000ebc51289..776959d5f26 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php index a3cf2d90ba6..feaad3d3acd 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php index a3376b63bad..eaf10f13f27 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index ea181535304..88c59376069 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php index 82bc512981a..0e6f65a16ba 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Set/SetRequestBuilder.php index 808be49b8af..0584ba634b4 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/TermItemRequestBuilder.php index 98c7bbbb3d6..d4044c04675 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\Set\SetRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-get?view=graph-rest-1.0 Find more info here */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-update?view=graph-rest-1.0 Find more info here */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/TermsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/TermsRequestBuilder.php index 7018de6e6bd..5350aae51e5 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/TermsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/Item/Terms/TermsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\Terms\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to terms for groups * @param Term $body The request body * @param TermsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?TermsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?TermsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/SetsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/SetsRequestBuilder.php index 019865685ef..116210dab81 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/SetsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/Sets/SetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\Item\SetItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a set object. This API is available in the following national cloud deployments. * @param SetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new set object. This API is available in the following national cloud deployments. * @param Set $body The request body * @param SetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-post?view=graph-rest-1.0 Find more info here */ public function post(Set $body, ?SetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Set $body, ?SetsRequestBuilderPostReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStore/TermStoreRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStore/TermStoreRequestBuilder.php index c89426290f2..189776673c3 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStore/TermStoreRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStore/TermStoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Groups\GroupsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStore\Sets\SetsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property termStore for groups * @param TermStoreRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermStoreRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a store object. This API is available in the following national cloud deployments. * @param TermStoreRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-store-get?view=graph-rest-1.0 Find more info here */ public function get(?TermStoreRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a store object. This API is available in the following national cloud deployments. * @param Store $body The request body * @param TermStoreRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-store-update?view=graph-rest-1.0 Find more info here */ public function patch(Store $body, ?TermStoreRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?TermStoreRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?TermStoreRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?TermStoreRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(Store $body, ?TermStoreRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Count/CountRequestBuilder.php index b51183d582b..fbab5ee625c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Count/CountRequestBuilder.php index 1e8cb0f2fda..e8c8d7ed55a 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/GroupsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/GroupsRequestBuilder.php index eaae9b5440f..2d956b1fb3c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/GroupsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/GroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\GroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of group objects in a term store. This API is available in the following national cloud deployments. * @param GroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-list-groups?view=graph-rest-1.0 Find more info here */ public function get(?GroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new group object in a term store. This API is available in the following national cloud deployments. * @param Group $body The request body * @param GroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-post?view=graph-rest-1.0 Find more info here */ public function post(Group $body, ?GroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Group $body, ?GroupsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/GroupItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/GroupItemRequestBuilder.php index 1284007367d..3253cb1c26d 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/GroupItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/GroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\SetsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a group object in a term store]. This API is available in the following [national cloud deployments. * @param GroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-delete?view=graph-rest-1.0 Find more info here */ public function delete(?GroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term store group object. This API is available in the following national cloud deployments. * @param GroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-get?view=graph-rest-1.0 Find more info here */ public function get(?GroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property groups in groups * @param Group $body The request body * @param GroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Group $body, ?GroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?GroupItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?GroupItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?GroupItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(Group $body, ?GroupItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Count/CountRequestBuilder.php index a2ae62a4343..19c7353b7ec 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php index c0384637607..e6ff106a9e5 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the first level children of a set] or [term] resource using the children navigation property. This API is available in the following [national cloud deployments. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-post?view=graph-rest-1.0 Find more info here */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php index 273b3a2cd21..bdfa4edd547 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php index 19e3ae5e330..c841e88ad97 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for groups * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php index bce7d250010..6625f8f91ef 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 8258549c6ae..78d78114a40 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 3aebcc7ee31..dace5375624 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index b44c982b17a..52c0695f36c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 14509a3c9d3..cbfb3b36361 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 1dbd579b9d4..dd2aa259626 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php index daddf1c2d5c..955b9a44e8b 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php index a4e5d773a4b..e9bb09279a1 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php index c2fe12b8d4a..9ba601c139c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Children\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 809fcb41292..716af574f19 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index a1fb82033e7..bfc36539c10 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index fafd44b390d..5c97723ed0c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 020ed647187..73f7a0b2ea9 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index d083da95171..98408267ddd 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php index 8acc4f3c1d1..2ce5f788f08 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php index d0fc733da3e..c79b8d753fd 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php index bdbec758119..58e31f4b0d0 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Set\SetRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children terms of set in term [store]. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php index bd6d885edae..48bc089284b 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property parentGroup for groups * @param ParentGroupRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ParentGroupRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The parent [group] that contains the set. * @param ParentGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property parentGroup in groups * @param Group $body The request body * @param ParentGroupRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Group $body, ?ParentGroupRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ParentGroupRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Group $body, ?ParentGroupRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php index dffd88443d0..38ae2934fe1 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index cb9f8e98d18..db75720524a 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php index 5995867a0c1..40ac0abe536 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Indicates which terms have been pinned or reused directly under the set. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php index 710bcab3692..8b22c89c027 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 45dfa39f6aa..1e55a470361 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php index 18a8cc8d0cb..47eb5a50b91 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the different relation of a term] or [set] from the relations navigation property. This API is available in the following [national cloud deployments. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-relations?view=graph-rest-1.0 Find more info here */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/SetItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/SetItemRequestBuilder.php index 3802f7d0bdd..be9884ccfe1 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/SetItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/SetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\ParentGroup\ParentGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Relations\RelationsRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sets for groups * @param SetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * All sets under the group in a term [store]. * @param SetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sets in groups * @param Set $body The request body * @param SetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Set $body, ?SetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?SetItemRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(Set $body, ?SetItemRequestBuilderPatch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php index 15f2d84e1b1..528d0f2319f 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php index 7b9aecebbcd..f3a5b9911d8 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for groups * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php index dac9b90fa42..7843a7406f8 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 75fb66d0b74..f172c0ce6c4 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 523636d7a18..1f1bdace4fe 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index f5173480f81..94fb4c3cd7e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index af58bc42ca5..1c98b19b7a3 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 47ffa8325ee..325c805495c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php index 15af12defe1..23d55eedba5 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php index 3a139dda5dd..d92d586e4f1 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php index e9a6c14266d..3779ed18df8 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Children\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php index cdbc4d00a28..82ccb84b20f 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 7317f5d6e29..a74cfc094b6 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php index fddc6042a4c..e4a9ff07096 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php index 69d894fcbdf..3eec3170804 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 24a889f4db3..65dd5c53421 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php index 7dbc431c966..96c74856346 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php index a734e9950e4..1c995ac8321 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php index b24c9898d9e..32abcea8633 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Set\SetRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-get?view=graph-rest-1.0 Find more info here */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-update?view=graph-rest-1.0 Find more info here */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php index dd410a33a11..ff2e1c1543a 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to terms for groups * @param Term $body The request body * @param TermsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?TermsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?TermsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/SetsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/SetsRequestBuilder.php index 965faaf670e..bceedda8f0c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/SetsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Groups/Item/Sets/SetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\SetItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the set objects and their properties. This API is available in the following national cloud deployments. * @param SetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-list-sets?view=graph-rest-1.0 Find more info here */ public function get(?SetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sets for groups * @param Set $body The request body * @param SetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Set $body, ?SetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Set $body, ?SetsRequestBuilderPostReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Count/CountRequestBuilder.php index f55517b1327..d80bd4224c5 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/ChildrenRequestBuilder.php index f98fccc5082..02d5edd4c15 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the first level children of a set] or [term] resource using the children navigation property. This API is available in the following [national cloud deployments. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-post?view=graph-rest-1.0 Find more info here */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Count/CountRequestBuilder.php index c299592292e..7e4322c7bed 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php index 09f10fb71b3..9ed063ce40c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for groups * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php index 89f3613c63e..6dbebf06047 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 125eb662030..c5e28673eb6 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index a07ddfa4ea9..f303c79bf03 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 2b0b34ffab8..4ce42cd0a5f 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index c3ba2733924..3c48c4c1354 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index feaa040fa28..6998e8ce10e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php index 243db8c3b3c..fb8344593a5 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php index 29385401ae0..f9086db2e3e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php index cb5e3162aa4..8fde1366179 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Children\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 1db7fa863f5..57e18a10496 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index c0f8fcbd3fc..0057ca6c69c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index af8db1a5f32..96eae5d72b4 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index c7beaa482a3..294ea1beea2 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index ed991aa0585..140f011e199 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php index 2a1a7934b2c..278fa2d9367 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php index 608b8c94344..c02116825c2 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php index 22f35ec51b2..be8d128de97 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Set\SetRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children terms of set in term [store]. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php index 3d8ca8197d2..5d8ad729476 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\SetsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property parentGroup for groups * @param ParentGroupRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ParentGroupRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The parent [group] that contains the set. * @param ParentGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property parentGroup in groups * @param Group $body The request body * @param ParentGroupRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Group $body, ?ParentGroupRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ParentGroupRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Group $body, ?ParentGroupRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php index d1a56dbf5bb..74b5f7d8ce0 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php index c0a048aa45f..0121d82c736 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the first level children of a set] or [term] resource using the children navigation property. This API is available in the following [national cloud deployments. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-post?view=graph-rest-1.0 Find more info here */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php index d48d11b3e32..efa66d9ab93 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php index e5ffaa601b8..0df0a2f8437 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for groups * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php index d17e3f8c871..a315ad48f54 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php index bfa88dd3f8c..a3994047086 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 730d153db10..ca0ac20ee42 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 454a5652cc4..304834e60d2 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 77bbc093053..8f87bb8bf79 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 6616f0575e8..182a64b3605 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php index 922979c4b2b..a1d690b75e1 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php index ebcc7102e33..7ab794ae32f 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php index 63ca7310f01..acefca068db 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 710948ad1b8..e06ce85baaf 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index faddb534bef..af14800090b 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 3ac879c8ac7..16e49d06d08 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index b7cd95f44cf..0082f816062 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index ecdc12c4812..34587cd420b 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php index 81e273c4fa1..a6aa6b3e0a8 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php index 566e2721ccd..7e76aac5d67 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php index 86e9deea2cc..d197c025a3c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Set\SetRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children terms of set in term [store]. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php index 276d4c7ee4b..f7e69ac61bd 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 1ec54a66bcd..272689a4ba4 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php index 5dbffc170c9..8b99d8353bc 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Indicates which terms have been pinned or reused directly under the set. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php index e73f0e9065d..15bc881f7b6 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index d797a61b49a..7bae82b0231 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php index c7db77186ed..ef8339f3709 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the different relation of a term] or [set] from the relations navigation property. This API is available in the following [national cloud deployments. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-relations?view=graph-rest-1.0 Find more info here */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php index a63f66e234b..f3b5c9be0cb 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\TermsRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sets for groups * @param SetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * All sets under the group in a term [store]. * @param SetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sets in groups * @param Set $body The request body * @param SetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Set $body, ?SetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?SetItemRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Set $body, ?SetItemRequestBuilderPatch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php index 6583dfd25d6..f6ffe20f202 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php index 2f5de1eaa39..490207e17a7 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for groups * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php index 86d58b8e94e..87c914bc808 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 9c4f929415d..d11c3134c2f 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 58468936381..e4fa6b038fa 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index f02d0bfdce2..dbb8274a080 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 7708024fce6..b360ced2087 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 85cd5067d77..8ab3cc7d222 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php index 759970ec8cd..5ecd83cbdd7 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php index 86af04d61e8..fe26fb42ffb 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php index 0b5a90169ad..d96c62c24cd 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php index 0c1ff4c0efd..49431c76a65 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 61ffead60e7..b103ce71624 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php index e9b5bf1e08a..48f268bc5a6 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php index 548c2d1f38f..4cc523c7e97 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index f4e279d76e2..fe96161a4f8 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php index a837e4f5981..6aa0137f745 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php index 50dd571b2b6..3727219ff26 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php index 3e2bfc61808..1fb09feff00 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Set\SetRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-get?view=graph-rest-1.0 Find more info here */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-update?view=graph-rest-1.0 Find more info here */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php index af252103b6e..5451d70e9a3 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to terms for groups * @param Term $body The request body * @param TermsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?TermsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?TermsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php index 41ef1457d20..7133e8217b5 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\SetItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the set objects and their properties. This API is available in the following national cloud deployments. * @param SetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-list-sets?view=graph-rest-1.0 Find more info here */ public function get(?SetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sets for groups * @param Set $body The request body * @param SetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Set $body, ?SetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Set $body, ?SetsRequestBuilderPostReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Count/CountRequestBuilder.php index b8da2b06b99..73cc3b0535a 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 259cea00ce3..f38e13a02f5 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php index 5e3641a8b5e..648bdc57710 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Indicates which terms have been pinned or reused directly under the set. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php index 59cd967599f..78ed2ef70d3 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 75e096835fa..0ff34a29bee 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/RelationsRequestBuilder.php index 6e30b514cc1..8fec76fb760 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the different relation of a term] or [set] from the relations navigation property. This API is available in the following [national cloud deployments. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-relations?view=graph-rest-1.0 Find more info here */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/SetItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/SetItemRequestBuilder.php index f0da47c3a93..0f1a46e211c 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/SetItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/SetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\ParentGroupRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Relations\RelationsRequestBuilder; @@ -66,59 +65,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a set object. This API is available in the following national cloud deployments. * @param SetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a set object. This API is available in the following national cloud deployments. * @param SetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-get?view=graph-rest-1.0 Find more info here */ public function get(?SetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a set object. This API is available in the following national cloud deployments. * @param Set $body The request body * @param SetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-update?view=graph-rest-1.0 Find more info here */ public function patch(Set $body, ?SetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -135,6 +125,7 @@ public function toDeleteRequestInformation(?SetItemRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -148,7 +139,6 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -156,6 +146,7 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -170,11 +161,11 @@ public function toPatchRequestInformation(Set $body, ?SetItemRequestBuilderPatch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Count/CountRequestBuilder.php index b142c1c3921..48cd59e1a2e 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php index 0675de1d34a..e8c6ed4cd41 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Children\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Children\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for groups * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php index 3c56eb2db7f..e50c4fa1e38 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php index bc4ef18188a..f16bc576e6f 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 242ee7b0b38..749de4df869 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 9e32218d627..c332ee0ccd8 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index add1413b5f7..9aa130c6db3 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index f70a823fe92..525c22ee035 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php index 1d2fdc50933..3952f4ec846 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Children\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php index 3ea0b605c62..ace1d535ddb 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php index bf585e53b64..fc72358e80d 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Children\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Children\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for groups * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in groups * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php index db8e7e74102..33a679da92b 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index fd62c4f3816..c57493c74e5 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php index d52ae446c3f..1cde9a1d4f7 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Relations\Item\FromTerm\FromTermRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Relations\Item\Set\SetRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Relations\Item\ToTerm\ToTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for groups * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in groups * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php index af594b0ac5f..5f8af80e5fa 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 3c0dcf90562..88b9ab93011 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php index b32ee75039c..d04dc06717a 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Relations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Relations\Item\RelationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for groups * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php index 8df3da7f45f..025d3cf752a 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php index 2731a79f173..38ee40d1541 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Children\ChildrenRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Relations\RelationsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Set\SetRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-get?view=graph-rest-1.0 Find more info here */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-update?view=graph-rest-1.0 Find more info here */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/TermsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/TermsRequestBuilder.php index d3212d8dce0..b06c90275cf 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/TermsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/Item/Terms/TermsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\TermItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to terms for groups * @param Term $body The request body * @param TermsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?TermsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?TermsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/SetsRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/SetsRequestBuilder.php index 18baeb6a5b9..c6adf8f8fcf 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/SetsRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/Sets/SetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\Item\SetItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a set object. This API is available in the following national cloud deployments. * @param SetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new set object. This API is available in the following national cloud deployments. * @param Set $body The request body * @param SetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-post?view=graph-rest-1.0 Find more info here */ public function post(Set $body, ?SetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Set $body, ?SetsRequestBuilderPostReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/StoreItemRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/StoreItemRequestBuilder.php index 3e538514e26..1870ad45cb9 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/Item/StoreItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/Item/StoreItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Groups\GroupsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\Sets\SetsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property termStores for groups * @param StoreItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?StoreItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of termStores under this site. * @param StoreItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?StoreItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property termStores in groups * @param Store $body The request body * @param StoreItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Store $body, ?StoreItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?StoreItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?StoreItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?StoreItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Store $body, ?StoreItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Item/TermStores/TermStoresRequestBuilder.php b/src/Generated/Groups/Item/Sites/Item/TermStores/TermStoresRequestBuilder.php index aa46bd08633..68feb791214 100644 --- a/src/Generated/Groups/Item/Sites/Item/TermStores/TermStoresRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Item/TermStores/TermStoresRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\TermStores\Item\StoreItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of termStores under this site. * @param TermStoresRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermStoresRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StoreCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StoreCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to termStores for groups * @param Store $body The request body * @param TermStoresRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Store $body, ?TermStoresRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermStoresRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermStoresRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Store $body, ?TermStoresRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/Remove/RemoveRequestBuilder.php b/src/Generated/Groups/Item/Sites/Remove/RemoveRequestBuilder.php index 126962f5acc..0343f944152 100644 --- a/src/Generated/Groups/Item/Sites/Remove/RemoveRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/Remove/RemoveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Unfollow a user's site or multiple sites. * @param RemovePostRequestBody $body The request body * @param RemoveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-unfollow?view=graph-rest-1.0 Find more info here */ public function post(RemovePostRequestBody $body, ?RemoveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RemovePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RemovePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RemovePostRequestBody $body, ?RemoveReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Sites/SitesRequestBuilder.php b/src/Generated/Groups/Item/Sites/SitesRequestBuilder.php index a427ee310a2..19271471ca9 100644 --- a/src/Generated/Groups/Item/Sites/SitesRequestBuilder.php +++ b/src/Generated/Groups/Item/Sites/SitesRequestBuilder.php @@ -4,9 +4,9 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Sites\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Count\CountRequestBuilder; +use Microsoft\Graph\Generated\Groups\Item\Sites\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\GetAllSites\GetAllSitesRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Item\SiteItemRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Sites\Remove\RemoveRequestBuilder; @@ -36,6 +36,13 @@ public function count(): CountRequestBuilder { return new CountRequestBuilder($this->pathParameters, $this->requestAdapter); } + /** + * Provides operations to call the delta method. + */ + public function delta(): DeltaRequestBuilder { + return new DeltaRequestBuilder($this->pathParameters, $this->requestAdapter); + } + /** * Provides operations to call the getAllSites method. */ @@ -78,19 +85,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of SharePoint sites in this group. Access the default site with /sites/root. * @param SitesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SitesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SiteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SiteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,7 +107,6 @@ public function toGetRequestInformation(?SitesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -111,6 +114,7 @@ public function toGetRequestInformation(?SitesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/SubscribeByMail/SubscribeByMailRequestBuilder.php b/src/Generated/Groups/Item/SubscribeByMail/SubscribeByMailRequestBuilder.php index 28a3b67784f..cdae803f0c2 100644 --- a/src/Generated/Groups/Item/SubscribeByMail/SubscribeByMailRequestBuilder.php +++ b/src/Generated/Groups/Item/SubscribeByMail/SubscribeByMailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Calling this method will enable the current user to receive email notifications for this group, about new posts, events, and files in that group. Supported for Microsoft 365 groups only. This API is available in the following national cloud deployments. * @param SubscribeByMailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-subscribebymail?view=graph-rest-1.0 Find more info here */ public function post(?SubscribeByMailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SubscribeByMailRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/AllChannels/AllChannelsRequestBuilder.php b/src/Generated/Groups/Item/Team/AllChannels/AllChannelsRequestBuilder.php index d2a33d11632..385c9a6ff83 100644 --- a/src/Generated/Groups/Item/Team/AllChannels/AllChannelsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/AllChannels/AllChannelsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\AllChannels\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\AllChannels\Item\ChannelItemRequestBuilder; use Microsoft\Graph\Generated\Models\ChannelCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of channels either in this team or shared with this team (incoming channels). This API is available in the following national cloud deployments. * @param AllChannelsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-allchannels?view=graph-rest-1.0 Find more info here */ public function get(?AllChannelsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?AllChannelsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?AllChannelsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/AllChannels/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/AllChannels/Count/CountRequestBuilder.php index 359e585c4f7..51f8fe8f06f 100644 --- a/src/Generated/Groups/Item/Team/AllChannels/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/AllChannels/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/AllChannels/Item/ChannelItemRequestBuilder.php b/src/Generated/Groups/Item/Team/AllChannels/Item/ChannelItemRequestBuilder.php index 315f734371c..18931f67c67 100644 --- a/src/Generated/Groups/Item/Team/AllChannels/Item/ChannelItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/AllChannels/Item/ChannelItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List of channels either hosted in or shared with the team (incoming channels). * @param ChannelItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChannelItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Archive/ArchiveRequestBuilder.php b/src/Generated/Groups/Item/Team/Archive/ArchiveRequestBuilder.php index c2e9afbf1b8..8a204ed0a80 100644 --- a/src/Generated/Groups/Item/Team/Archive/ArchiveRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Archive/ArchiveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Archive the specified team. When a team is archived, users can no longer send or like messages on any channel in the team, edit the team's name, description, or other settings, or in general make most changes to the team.Membership changes to the team continue to be allowed. Archiving is an async operation. A team is archived once the async operation completes successfully, which may occur subsequent to a response from this API. To archive a team, the team and group must have an owner. To restore a team from its archived state, use the API to unarchive. This API is available in the following national cloud deployments. * @param ArchivePostRequestBody $body The request body * @param ArchiveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-archive?view=graph-rest-1.0 Find more info here */ public function post(ArchivePostRequestBody $body, ?ArchiveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ArchivePostRequestBody $body, ?ArchiveR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/ChannelsRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/ChannelsRequestBuilder.php index a102997f4c5..a35523b1876 100644 --- a/src/Generated/Groups/Item/Team/Channels/ChannelsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/ChannelsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\GetAllMessages\GetAllMessagesRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\ChannelItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of channels in this team. This API is available in the following national cloud deployments. * @param ChannelsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list?view=graph-rest-1.0 Find more info here */ public function get(?ChannelsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new channel in a team, as specified in the request body. When you create a channel, the maximum length of the channel's displayName is 50 characters. This is the name that appears to the user in Microsoft Teams. If you're creating a private channel, you can add a maximum of 200 members. This API is available in the following national cloud deployments. * @param Channel $body The request body * @param ChannelsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post?view=graph-rest-1.0 Find more info here */ public function post(Channel $body, ?ChannelsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ChannelsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ChannelsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Channel $body, ?ChannelsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Count/CountRequestBuilder.php index d3166acb005..17e6d10302e 100644 --- a/src/Generated/Groups/Item/Team/Channels/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php index e51175e7de4..77436763dda 100644 --- a/src/Generated/Groups/Item/Team/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAllMessages * @param GetAllMessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAllMessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/ChannelItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/ChannelItemRequestBuilder.php index f480e4b1bbc..503f8c81a2c 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/ChannelItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/ChannelItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\CompleteMigration\CompleteMigrationRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName\DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\FilesFolder\FilesFolderRequestBuilder; @@ -106,59 +105,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the channel. This API is available in the following national cloud deployments. * @param ChannelItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ChannelItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a channel. This method supports federation. Only a user who is a member of the shared channel can retrieve channel information. This API is available in the following national cloud deployments. * @param ChannelItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get?view=graph-rest-1.0 Find more info here */ public function get(?ChannelItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified channel. This API is available in the following national cloud deployments. * @param Channel $body The request body * @param ChannelItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-patch?view=graph-rest-1.0 Find more info here */ public function patch(Channel $body, ?ChannelItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -175,6 +165,7 @@ public function toDeleteRequestInformation(?ChannelItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -188,7 +179,6 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -196,6 +186,7 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -210,11 +201,11 @@ public function toPatchRequestInformation(Channel $body, ?ChannelItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php index 57c53eed3d2..d19be554693 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Complete the message migration process by removing migration mode from a channel in a team. Migration mode is a special state that prevents certain operations, like sending messages and adding members, during the data migration process. After a completeMigration request is made, you can't import additional messages into the team. You can add members to the team after the request returns a successful response. This API is available in the following national cloud deployments. * @param CompleteMigrationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-completemigration?view=graph-rest-1.0 Find more info here */ public function post(?CompleteMigrationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CompleteMigrationRequestBuilderPostReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php index ea1cae26c50..5cb5a779ee7 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function doesUserHaveAccess * @param DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php index e7c6b39e945..a09091107ea 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php index 2709f3309d6..6f5ef7ff239 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\FilesFolder\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,20 +41,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the metadata for the location where the files of a channel are stored. This API is available in the following national cloud deployments. * @param FilesFolderRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?FilesFolderRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -68,7 +64,6 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -76,6 +71,7 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Members/Add/AddRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Members/Add/AddRequestBuilder.php index f6c110baddf..ac0a9a1ddc7 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Members/Add/AddRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Members/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add multiple members in a single request to a team. The response provides details about which memberships could and couldn't be created. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmembers-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Members/Count/CountRequestBuilder.php index 579d181a129..3d924b34c8e 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php index 601c32f0bb0..9ceb5e1be43 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,65 +31,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-delete-members?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/conversationmember-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-members?view=graph-rest-1.0 Find more info here */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the role of a conversationMember in a team or channel. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param ConversationMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmember-update?view=graph-rest-1.0 Find more info here */ public function patch(ConversationMember $body, ?ConversationMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ConversationMemberItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ConversationMember $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Members/MembersRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Members/MembersRequestBuilder.php index e3cac107c56..a79258f4502 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Members\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Members\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Members\Item\ConversationMemberItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of conversationMembers from a channel. This method supports federation. Only a user who is a member of the shared channel can retrieve the channel member list. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a conversationMember to a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-members?view=graph-rest-1.0 Find more info here */ public function post(ConversationMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ConversationMember $body, ?MembersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Count/CountRequestBuilder.php index e4f64f5cf3c..4d3dec63d17 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Delta/DeltaRequestBuilder.php index 13475184647..b2728d78642 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php index 8ab33f66d1d..0d690847942 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\HostedContents\HostedContentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\Replies\RepliesRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\SetReaction\SetReactionRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property messages for groups * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a chatMessage object. With the exception of the policyViolation property, all properties of a chatMessage can be updated in delegated permissions scenarios.Only the policyViolation property of a chatMessage can be updated in application permissions scenarios. The update only works for chats where members are Microsoft Teams users. If one of the participants is using Skype, the operation will fail. This method does not support federation. Only the user in the tenant who sent the message can perform data loss prevention (DLP) updates on the specified chat message. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-update?view=graph-rest-1.0 Find more info here */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php index 8370e235035..40d6418f464 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php index af3ce13de33..8791fd00b78 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\HostedContents\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\HostedContents\Item\ChatMessageHostedContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for groups * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 98a141578a2..50531ae29e6 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index 08583bb3c84..0fdd0c363dd 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\HostedContents\Item\Value\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for groups * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in groups * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php index 0ab2d6bdaa9..7dce2152b6f 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from groups * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in groups * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php index c383ebd2ac4..13014314609 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php index 2bb6c443f79..76aba0bba85 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php index db80154f79a..b482f66604a 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\Replies\Item\HostedContents\HostedContentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\Replies\Item\SetReaction\SetReactionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\Replies\Item\SoftDelete\SoftDeleteRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property replies for groups * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property replies in groups * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php index 626e50b1309..aa9f3c73c8d 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php index 84da00ec48c..7c10e4b85f8 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\Replies\Item\HostedContents\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\Replies\Item\HostedContents\Item\ChatMessageHostedContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for groups * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 24d35f0e2cf..500341bc8ef 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index e198fc2ab29..a5c892106d8 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\Replies\Item\HostedContents\Item\Value\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for groups * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in groups * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php index cdd1b0eb6f0..ab007a0f494 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from groups * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in groups * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php index fc07bbce1b9..4d94cb4c746 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php index b1d7b1eb425..6700013e797 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index 76c414256dd..50caaa7f110 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php index 707575d79ff..c97e8531b4a 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php index 79107eb6570..deccf097e20 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\Replies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\Replies\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\Replies\Item\ChatMessageItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the replies to a message in a channel of a team. This method lists only the replies of the specified message, if any. To get the message itself, simply call get channel message. This API is available in the following national cloud deployments. * @param RepliesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-replies?view=graph-rest-1.0 Find more info here */ public function get(?RepliesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new reply to a chatMessage in a specified channel. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param RepliesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-messagereply?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?RepliesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?RepliesRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php index 3754a5e8134..b5c2f626534 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php index d6882e37c27..dd4adb06da9 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index b66d77e07e2..e2f9f335a15 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php index 948cd3f1c1d..1bc73daae2d 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Messages/MessagesRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Messages/MessagesRequestBuilder.php index 3baf2f919a4..6817995a0f5 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Messages/MessagesRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Messages/MessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Messages\Item\ChatMessageItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of messages (without the replies) in a channel of a team. To get the replies for a message, call the list message replies or the get message reply API. This method supports federation. To list channel messages in application context, the request must be made from the tenant that the channel owner belongs to (represented by the tenantId property on the channel). This API is available in the following national cloud deployments. * @param MessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?MessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-post-messages?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/chatmessage-post?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?MessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,11 +109,12 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?MessagesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php index fe5e5ff2068..84273a2d23d 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProvisionChannelEmailResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Provision an email address for a channel. Microsoft Teams doesn't automatically provision an email address for a channel by default. To have Teams provision an email address, you can call provisionEmail, or through the Teams user interface, select Get email address, which triggers Teams to generate an email address if it has not already provisioned one. To remove the email address of a channel, use the removeEmail method. This API is available in the following national cloud deployments. * @param ProvisionEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-provisionemail?view=graph-rest-1.0 Find more info here */ public function post(?ProvisionEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ProvisionEmailRequestBuilderPostReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php index f0e0fc57f24..09eff1dcf35 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove the email address of a channel. You can remove an email address only if it was provisioned using the provisionEmail method or through the Microsoft Teams client. This API is available in the following national cloud deployments. * @param RemoveEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-removeemail?view=graph-rest-1.0 Find more info here */ public function post(?RemoveEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RemoveEmailRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php index 7fd73843d3e..e4708feb07a 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php index cd6defbbcda..e5087ca779a 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\SharedWithTeams\Item\AllowedMembers\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\SharedWithTeams\Item\AllowedMembers\Item\ConversationMemberItemRequestBuilder; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of conversationMembers who can access a shared channel. This method does not return the following conversationMembers from the team:- Users with Guest role- Users who are externally authenticated in the tenant This API is available in the following national cloud deployments. * @param AllowedMembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list-allowedmembers?view=graph-rest-1.0 Find more info here */ public function get(?AllowedMembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php index d4543d92c59..b79a5340d8e 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php index 036ede79ac8..e2115865a7f 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A collection of team members who have access to the shared channel. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php index 459fddf8c90..00a8df9ad2f 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\SharedWithTeams\Item\AllowedMembers\AllowedMembersRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\SharedWithTeams\Item\Team\TeamRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unshare a channel with a team by deleting the corresponding sharedWithChannelTeamInfo resource. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a team that has been shared with a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-get?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sharedWithTeams in groups * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SharedWithChannelTeamInfo $body, ?SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?SharedWithChannelTeamInfoItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(SharedWithChannelTeamInfo $body, ?Shar $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php index d74d20f0e5b..145350841fe 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get team from groups * @param TeamRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php index 3b912b5015d..1bdcbd6fff8 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\SharedWithTeams\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\SharedWithTeams\Item\SharedWithChannelTeamInfoItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of teams that has been shared a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithTeamsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithTeamsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sharedWithTeams for groups * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithTeamsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SharedWithChannelTeamInfo $body, ?SharedWithTeamsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SharedWithChannelTeamInfo $body, ?Share $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Tabs/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Tabs/Count/CountRequestBuilder.php index f4977f6e869..434099d2b45 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Tabs/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Tabs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php index c8b547d3ea5..46b861a60ca 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The application that is linked to the tab. This can't be changed after tab creation. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php index 7e06d674e91..c2ada21a880 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Tabs\Item\TeamsApp\TeamsAppRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Removes (unpins) a tab from the specified channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-delete-tabs?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsTabItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of the specified tab in a channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TeamsTabItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified tab.This can be used to configure the content of the tab. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TeamsTabItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-patch-tabs?view=graph-rest-1.0 Find more info here */ public function patch(TeamsTab $body, ?TeamsTabItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TeamsTabItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TeamsTab $body, ?TeamsTabItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Channels/Item/Tabs/TabsRequestBuilder.php b/src/Generated/Groups/Item/Team/Channels/Item/Tabs/TabsRequestBuilder.php index 00be6c57f20..d928f5d330a 100644 --- a/src/Generated/Groups/Item/Team/Channels/Item/Tabs/TabsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Channels/Item/Tabs/TabsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Tabs\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\Item\Tabs\Item\TeamsTabItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of tabs in the specified channel within a team. This API is available in the following national cloud deployments. * @param TabsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TabsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Adds (pins) a tab to the specified channel within a team. The corresponding app must already be installed in the team. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TabsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-tabs?view=graph-rest-1.0 Find more info here */ public function post(TeamsTab $body, ?TabsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsTab $body, ?TabsRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/CompleteMigration/CompleteMigrationRequestBuilder.php b/src/Generated/Groups/Item/Team/CompleteMigration/CompleteMigrationRequestBuilder.php index 62a839650c8..25dbde744dc 100644 --- a/src/Generated/Groups/Item/Team/CompleteMigration/CompleteMigrationRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/CompleteMigration/CompleteMigrationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Complete the message migration process by removing migration mode from a team. Migration mode is a special state where certain operations are barred, like message POST and membership operations during the data migration process. After a completeMigration request is made, you can't import additional messages into the team. You can add members to the team after the request returns a successful response. This API is available in the following national cloud deployments. * @param CompleteMigrationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-completemigration?view=graph-rest-1.0 Find more info here */ public function post(?CompleteMigrationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CompleteMigrationRequestBuilderPostReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/EscapedClone/CloneRequestBuilder.php b/src/Generated/Groups/Item/Team/EscapedClone/CloneRequestBuilder.php index 420fc5f1daf..dcb306fdf30 100644 --- a/src/Generated/Groups/Item/Team/EscapedClone/CloneRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/EscapedClone/CloneRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a copy of a team. This operation also creates a copy of the corresponding group.You can specify which parts of the team to clone: When tabs are cloned, they aren't configured. The tabs are displayed on the tab bar in Microsoft Teams, and the first time a user opens them, they must go through the configuration screen. If the user who opens the tab doesn't have permission to configure apps, they'll see a message that says that the tab isn't configured. Cloning is a long-running operation. After the POST clone returns, you need to GET the operation returned by the Location: header to see if it's running, succeeded, or failed. You should continue to GET until the status isn't running. The recommended delay between GETs is 5 seconds. This API is available in the following national cloud deployments. * @param ClonePostRequestBody $body The request body * @param CloneRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-clone?view=graph-rest-1.0 Find more info here */ public function post(ClonePostRequestBody $body, ?CloneRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ClonePostRequestBody $body, ?CloneReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Group/GroupRequestBuilder.php b/src/Generated/Groups/Item/Team/Group/GroupRequestBuilder.php index bcbad3c58b3..08af2b01516 100644 --- a/src/Generated/Groups/Item/Team/Group/GroupRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Group/GroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Group\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get group from groups * @param GroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php index e15644e226a..e0f07d4f0af 100644 --- a/src/Generated/Groups/Item/Team/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Groups/Item/Team/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 0549a28d5fe..efed83c9ee6 100644 --- a/src/Generated/Groups/Item/Team/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Group\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/IncomingChannels/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/IncomingChannels/Count/CountRequestBuilder.php index 067d5ec36d3..eac797fbc7d 100644 --- a/src/Generated/Groups/Item/Team/IncomingChannels/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/IncomingChannels/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/IncomingChannels/IncomingChannelsRequestBuilder.php b/src/Generated/Groups/Item/Team/IncomingChannels/IncomingChannelsRequestBuilder.php index 884dece8518..9aaddd4e518 100644 --- a/src/Generated/Groups/Item/Team/IncomingChannels/IncomingChannelsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/IncomingChannels/IncomingChannelsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\IncomingChannels\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\IncomingChannels\Item\ChannelItemRequestBuilder; use Microsoft\Graph\Generated\Models\ChannelCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of incoming channels (channels shared with a team). This API is available in the following national cloud deployments. * @param IncomingChannelsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-incomingchannels?view=graph-rest-1.0 Find more info here */ public function get(?IncomingChannelsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?IncomingChannelsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?IncomingChannelsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/IncomingChannels/Item/ChannelItemRequestBuilder.php b/src/Generated/Groups/Item/Team/IncomingChannels/Item/ChannelItemRequestBuilder.php index 1a16d915f14..8f05bbd03a4 100644 --- a/src/Generated/Groups/Item/Team/IncomingChannels/Item/ChannelItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/IncomingChannels/Item/ChannelItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an incoming channel (a channel shared with a team) from a team. * @param ChannelItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-delete-incomingchannels?view=graph-rest-1.0 Find more info here */ public function delete(?ChannelItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * List of channels shared with the team. * @param ChannelItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChannelItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?ChannelItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/InstalledApps/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/InstalledApps/Count/CountRequestBuilder.php index 3b5aca7d94f..2f2be2b92e5 100644 --- a/src/Generated/Groups/Item/Team/InstalledApps/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/InstalledApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/InstalledApps/InstalledAppsRequestBuilder.php b/src/Generated/Groups/Item/Team/InstalledApps/InstalledAppsRequestBuilder.php index fa2027be208..100c23a9f77 100644 --- a/src/Generated/Groups/Item/Team/InstalledApps/InstalledAppsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/InstalledApps/InstalledAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\InstalledApps\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\InstalledApps\Item\TeamsAppInstallationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of apps installed in the specified team. This API is available in the following national cloud deployments. * @param InstalledAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-installedapps?view=graph-rest-1.0 Find more info here */ public function get(?InstalledAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Install an app to the specified team. This API is available in the following national cloud deployments. * @param TeamsAppInstallation $body The request body * @param InstalledAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-post-installedapps?view=graph-rest-1.0 Find more info here */ public function post(TeamsAppInstallation $body, ?InstalledAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?InstalledAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?InstalledAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsAppInstallation $body, ?InstalledA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Groups/Item/Team/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php index 86837c30953..a0212fccbc1 100644 --- a/src/Generated/Groups/Item/Team/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The app that is installed. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php b/src/Generated/Groups/Item/Team/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php index 09820025476..14250156087 100644 --- a/src/Generated/Groups/Item/Team/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The details of this version of the app. * @param TeamsAppDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppDefinitionRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppDefinitionRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php b/src/Generated/Groups/Item/Team/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php index 66178417b0b..e5edb83a88c 100644 --- a/src/Generated/Groups/Item/Team/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\InstalledApps\Item\TeamsApp\TeamsAppRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\InstalledApps\Item\TeamsAppDefinition\TeamsAppDefinitionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\InstalledApps\Item\Upgrade\UpgradeRequestBuilder; @@ -58,58 +57,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Uninstalls an app from the specified team. This API is available in the following national cloud deployments. * @param TeamsAppInstallationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-delete-installedapps?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsAppInstallationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the app installed in the specified team. This API is available in the following national cloud deployments. * @param TeamsAppInstallationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-get-installedapps?view=graph-rest-1.0 Find more info here */ public function get(?TeamsAppInstallationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property installedApps in groups * @param TeamsAppInstallation $body The request body * @param TeamsAppInstallationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamsAppInstallation $body, ?TeamsAppInstallationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -126,6 +116,7 @@ public function toDeleteRequestInformation(?TeamsAppInstallationItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -139,7 +130,6 @@ public function toGetRequestInformation(?TeamsAppInstallationItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +137,7 @@ public function toGetRequestInformation(?TeamsAppInstallationItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -161,11 +152,11 @@ public function toPatchRequestInformation(TeamsAppInstallation $body, ?TeamsAppI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php b/src/Generated/Groups/Item/Team/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php index 163905fb819..0ccb99b9cd1 100644 --- a/src/Generated/Groups/Item/Team/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Upgrade an app installation within a chat. This API is available in the following national cloud deployments. * @param UpgradePostRequestBody $body The request body * @param UpgradeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-teamsappinstallation-upgrade?view=graph-rest-1.0 Find more info here */ public function post(UpgradePostRequestBody $body, ?UpgradeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(UpgradePostRequestBody $body, ?UpgradeR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Members/Add/AddRequestBuilder.php b/src/Generated/Groups/Item/Team/Members/Add/AddRequestBuilder.php index f6fe2e4b197..48ed134807c 100644 --- a/src/Generated/Groups/Item/Team/Members/Add/AddRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Members/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add multiple members in a single request to a team. The response provides details about which memberships could and couldn't be created. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmembers-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Members/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Members/Count/CountRequestBuilder.php index 3aeda5ee479..ec6f736f980 100644 --- a/src/Generated/Groups/Item/Team/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Members/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Members/Item/ConversationMemberItemRequestBuilder.php index c5028300d11..18d2d664e9f 100644 --- a/src/Generated/Groups/Item/Team/Members/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Members/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a conversationMember from a team. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-delete-members?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a conversationMember from a team. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-get-members?view=graph-rest-1.0 Find more info here */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the role of a conversationMember in a team. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param ConversationMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-update-members?view=graph-rest-1.0 Find more info here */ public function patch(ConversationMember $body, ?ConversationMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ConversationMemberItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ConversationMember $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Members/MembersRequestBuilder.php b/src/Generated/Groups/Item/Team/Members/MembersRequestBuilder.php index abc49ba50e2..64ef87fc79b 100644 --- a/src/Generated/Groups/Item/Team/Members/MembersRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Members\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Members\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Members\Item\ConversationMemberItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the conversationMember collection of a team. The membership IDs returned by the server must be treated as opaque strings. The client should not try to parse or make assumptions about these resource IDs. In the future, membership results may include users from various tenants, as indicated in the response. Clients should avoid assuming that all members exclusively belong to the current tenant. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a new conversationMember to a team. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-post-members?view=graph-rest-1.0 Find more info here */ public function post(ConversationMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ConversationMember $body, ?MembersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Operations/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Operations/Count/CountRequestBuilder.php index 7f137991383..3a8994510ff 100644 --- a/src/Generated/Groups/Item/Team/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Operations/Item/TeamsAsyncOperationItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Operations/Item/TeamsAsyncOperationItemRequestBuilder.php index 19849bde902..4a57b545ffe 100644 --- a/src/Generated/Groups/Item/Team/Operations/Item/TeamsAsyncOperationItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Operations/Item/TeamsAsyncOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAsyncOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for groups * @param TeamsAsyncOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TeamsAsyncOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The async operations that ran or are running on this team. * @param TeamsAsyncOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAsyncOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in groups * @param TeamsAsyncOperation $body The request body * @param TeamsAsyncOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamsAsyncOperation $body, ?TeamsAsyncOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?TeamsAsyncOperationItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?TeamsAsyncOperationItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?TeamsAsyncOperationItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(TeamsAsyncOperation $body, ?TeamsAsync $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Operations/OperationsRequestBuilder.php b/src/Generated/Groups/Item/Team/Operations/OperationsRequestBuilder.php index 4adff8437c0..096dc880ee5 100644 --- a/src/Generated/Groups/Item/Team/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Operations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Operations\Item\TeamsAsyncOperationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The async operations that ran or are running on this team. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for groups * @param TeamsAsyncOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TeamsAsyncOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(TeamsAsyncOperation $body, ?OperationsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PermissionGrants/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/PermissionGrants/Count/CountRequestBuilder.php index e7d117c7ec7..d69a5f4cf2d 100644 --- a/src/Generated/Groups/Item/Team/PermissionGrants/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PermissionGrants/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php b/src/Generated/Groups/Item/Team/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php index 3d0af7c84cf..d7682bd5ae6 100644 --- a/src/Generated/Groups/Item/Team/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrant; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property permissionGrants for groups * @param ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of permissions granted to apps to access the team. * @param ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property permissionGrants in groups * @param ResourceSpecificPermissionGrant $body The request body * @param ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ResourceSpecificPermissionGrant $body, ?ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ResourceSpecificPermissionGrantItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PermissionGrants/PermissionGrantsRequestBuilder.php b/src/Generated/Groups/Item/Team/PermissionGrants/PermissionGrantsRequestBuilder.php index ca829f74775..c868b6e55bd 100644 --- a/src/Generated/Groups/Item/Team/PermissionGrants/PermissionGrantsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PermissionGrants/PermissionGrantsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PermissionGrants\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PermissionGrants\Item\ResourceSpecificPermissionGrantItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List all resource-specific permission grants on the team. This list specifies the Azure AD apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the team. This list specifies the Microsoft Entra apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. * @param PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-permissiongrants?view=graph-rest-1.0 Find more info here */ public function get(?PermissionGrantsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to permissionGrants for groups * @param ResourceSpecificPermissionGrant $body The request body * @param PermissionGrantsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ResourceSpecificPermissionGrant $body, ?PermissionGrantsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List all resource-specific permission grants on the team. This list specifies the Azure AD apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the team. This list specifies the Microsoft Entra apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. * @param PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php b/src/Generated/Groups/Item/Team/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php index cc4849c59cf..971c1575d08 100644 --- a/src/Generated/Groups/Item/Team/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Groups/Item/Team/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List all resource-specific permission grants on the team. This list specifies the Azure AD apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the team. This list specifies the Microsoft Entra apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. */ class PermissionGrantsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Groups/Item/Team/Photo/PhotoRequestBuilder.php b/src/Generated/Groups/Item/Team/Photo/PhotoRequestBuilder.php index 3934ef58427..05b544f10a3 100644 --- a/src/Generated/Groups/Item/Team/Photo/PhotoRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Photo/PhotoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Photo\Value\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProfilePhoto; @@ -40,45 +39,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Azure Active Directory. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. + * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Microsoft Entra ID. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. * @param PhotoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/profilephoto-get?view=graph-rest-1.0 Find more info here */ public function get(?PhotoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property photo in groups * @param ProfilePhoto $body The request body * @param PhotoRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ProfilePhoto $body, ?PhotoRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Azure Active Directory. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. + * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Microsoft Entra ID. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. * @param PhotoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -87,7 +80,6 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -95,6 +87,7 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -109,11 +102,11 @@ public function toPatchRequestInformation(ProfilePhoto $body, ?PhotoRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Photo/PhotoRequestBuilderGetQueryParameters.php b/src/Generated/Groups/Item/Team/Photo/PhotoRequestBuilderGetQueryParameters.php index c8014022ea1..a53347a14fe 100644 --- a/src/Generated/Groups/Item/Team/Photo/PhotoRequestBuilderGetQueryParameters.php +++ b/src/Generated/Groups/Item/Team/Photo/PhotoRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Azure Active Directory. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. + * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Microsoft Entra ID. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. */ class PhotoRequestBuilderGetQueryParameters { diff --git a/src/Generated/Groups/Item/Team/Photo/Value/ContentRequestBuilder.php b/src/Generated/Groups/Item/Team/Photo/Value/ContentRequestBuilder.php index f80c31459fa..5e1b29fd007 100644 --- a/src/Generated/Groups/Item/Team/Photo/Value/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Photo/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property photo from groups * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/profilephoto-get?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property photo in groups * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/CompleteMigration/CompleteMigrationRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/CompleteMigration/CompleteMigrationRequestBuilder.php index b0853788427..4c92cf75605 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/CompleteMigration/CompleteMigrationRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/CompleteMigration/CompleteMigrationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Complete the message migration process by removing migration mode from a channel in a team. Migration mode is a special state that prevents certain operations, like sending messages and adding members, during the data migration process. After a completeMigration request is made, you can't import additional messages into the team. You can add members to the team after the request returns a successful response. This API is available in the following national cloud deployments. * @param CompleteMigrationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-completemigration?view=graph-rest-1.0 Find more info here */ public function post(?CompleteMigrationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CompleteMigrationRequestBuilderPostReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php index 2bbf29c3e57..e1a37bb1883 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function doesUserHaveAccess * @param DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/FilesFolder/Content/ContentRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/FilesFolder/Content/ContentRequestBuilder.php index d88138d78d7..576c574b532 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/FilesFolder/Content/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/FilesFolder/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/FilesFolder/FilesFolderRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/FilesFolder/FilesFolderRequestBuilder.php index 169153f044f..b02fa945ab0 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/FilesFolder/FilesFolderRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/FilesFolder/FilesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\FilesFolder\Content\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,20 +41,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the metadata for the location where the files of a channel are stored. This API is available in the following national cloud deployments. * @param FilesFolderRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?FilesFolderRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -68,7 +64,6 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -76,6 +71,7 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Members/Add/AddRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Members/Add/AddRequestBuilder.php index 20065e3338c..27330f0b961 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Members/Add/AddRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Members/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add multiple members in a single request to a team. The response provides details about which memberships could and couldn't be created. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmembers-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Members/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Members/Count/CountRequestBuilder.php index b1f339378e0..47895ae335d 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Members/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Members/Item/ConversationMemberItemRequestBuilder.php index a09d0617718..59a5a476732 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Members/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Members/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,65 +31,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-delete-members?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/conversationmember-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-members?view=graph-rest-1.0 Find more info here */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the role of a conversationMember in a team or channel. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param ConversationMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmember-update?view=graph-rest-1.0 Find more info here */ public function patch(ConversationMember $body, ?ConversationMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ConversationMemberItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ConversationMember $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Members/MembersRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Members/MembersRequestBuilder.php index 2bdfc8dc81d..d3cae6c5edf 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Members/MembersRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Members\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Members\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Members\Item\ConversationMemberItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of conversationMembers from a channel. This method supports federation. Only a user who is a member of the shared channel can retrieve the channel member list. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a conversationMember to a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-members?view=graph-rest-1.0 Find more info here */ public function post(ConversationMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ConversationMember $body, ?MembersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Count/CountRequestBuilder.php index fb2d21f43c5..8bdba2cabe6 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Delta/DeltaRequestBuilder.php index 7449f91c0a4..21fb6d7530d 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/ChatMessageItemRequestBuilder.php index d241c1f0e68..01e91eb9d95 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\HostedContents\HostedContentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\Replies\RepliesRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\SetReaction\SetReactionRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property messages for groups * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a chatMessage object. With the exception of the policyViolation property, all properties of a chatMessage can be updated in delegated permissions scenarios.Only the policyViolation property of a chatMessage can be updated in application permissions scenarios. The update only works for chats where members are Microsoft Teams users. If one of the participants is using Skype, the operation will fail. This method does not support federation. Only the user in the tenant who sent the message can perform data loss prevention (DLP) updates on the specified chat message. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-update?view=graph-rest-1.0 Find more info here */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/Count/CountRequestBuilder.php index be2e0d466c8..6acff48e988 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilder.php index ab03a6661e1..89996321cd8 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\HostedContents\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\HostedContents\Item\ChatMessageHostedContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for groups * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 0975e365e8a..644fa4368a2 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index eb46e943f82..7426ec1dc6d 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\HostedContents\Item\Value\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for groups * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in groups * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php index 6977bac4a6a..3c607eb18bd 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from groups * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in groups * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Count/CountRequestBuilder.php index 78f60b78c8c..f359387d679 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Delta/DeltaRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Delta/DeltaRequestBuilder.php index e699e35408d..d6856e03c4f 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php index 334804c0727..42c088f98d5 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\Replies\Item\HostedContents\HostedContentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\Replies\Item\SetReaction\SetReactionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\Replies\Item\SoftDelete\SoftDeleteRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property replies for groups * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property replies in groups * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php index 47ed9ce4820..13aa5a59cb6 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php index 39cb70e8001..b108a07ff79 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\Replies\Item\HostedContents\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\Replies\Item\HostedContents\Item\ChatMessageHostedContentItemRequestBuilder; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for groups * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 58b24c773ba..5ece130a168 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index a86fab70943..d50c1473006 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\Replies\Item\HostedContents\Item\Value\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for groups * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in groups * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php index 8ceb86fc6a4..35d73164ec9 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from groups * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in groups * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php index ba7531bb8e1..8788cb53050 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php index 0a0195d2ad4..b788bb4cf2a 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index fd70d163021..0a417b09db4 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php index a813f4919f9..7715ae46a0e 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/RepliesRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/RepliesRequestBuilder.php index 527c6aad9cb..7d14e769648 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/RepliesRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/Replies/RepliesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\Replies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\Replies\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\Replies\Item\ChatMessageItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the replies to a message in a channel of a team. This method lists only the replies of the specified message, if any. To get the message itself, simply call get channel message. This API is available in the following national cloud deployments. * @param RepliesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-replies?view=graph-rest-1.0 Find more info here */ public function get(?RepliesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new reply to a chatMessage in a specified channel. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param RepliesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-messagereply?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?RepliesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?RepliesRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/SetReaction/SetReactionRequestBuilder.php index 51234693682..a9c8573758b 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php index ae60aa7dbbd..63944285a0a 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index 260dce461b9..974a65d6742 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php index a515af41c05..f6b73ab75f8 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/MessagesRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/MessagesRequestBuilder.php index 5fd4f5bd747..23517f9777c 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/MessagesRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Messages/MessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Messages\Item\ChatMessageItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of messages (without the replies) in a channel of a team. To get the replies for a message, call the list message replies or the get message reply API. This method supports federation. To list channel messages in application context, the request must be made from the tenant that the channel owner belongs to (represented by the tenantId property on the channel). This API is available in the following national cloud deployments. * @param MessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?MessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-post-messages?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/chatmessage-post?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?MessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,11 +109,12 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?MessagesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/PrimaryChannelRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/PrimaryChannelRequestBuilder.php index e430dc19f22..77661e4e44b 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/PrimaryChannelRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/PrimaryChannelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\CompleteMigration\CompleteMigrationRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName\DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\FilesFolder\FilesFolderRequestBuilder; @@ -106,57 +105,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property primaryChannel for groups * @param PrimaryChannelRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrimaryChannelRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the default channel, General, of a team. This API is available in the following national cloud deployments. * @param PrimaryChannelRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-get-primarychannel?view=graph-rest-1.0 Find more info here */ public function get(?PrimaryChannelRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property primaryChannel in groups * @param Channel $body The request body * @param PrimaryChannelRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Channel $body, ?PrimaryChannelRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -173,6 +163,7 @@ public function toDeleteRequestInformation(?PrimaryChannelRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -186,7 +177,6 @@ public function toGetRequestInformation(?PrimaryChannelRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -194,6 +184,7 @@ public function toGetRequestInformation(?PrimaryChannelRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -208,11 +199,11 @@ public function toPatchRequestInformation(Channel $body, ?PrimaryChannelRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/ProvisionEmail/ProvisionEmailRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/ProvisionEmail/ProvisionEmailRequestBuilder.php index a3efdf01929..98b0b723ef5 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/ProvisionEmail/ProvisionEmailRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/ProvisionEmail/ProvisionEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProvisionChannelEmailResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Provision an email address for a channel. Microsoft Teams doesn't automatically provision an email address for a channel by default. To have Teams provision an email address, you can call provisionEmail, or through the Teams user interface, select Get email address, which triggers Teams to generate an email address if it has not already provisioned one. To remove the email address of a channel, use the removeEmail method. This API is available in the following national cloud deployments. * @param ProvisionEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-provisionemail?view=graph-rest-1.0 Find more info here */ public function post(?ProvisionEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ProvisionEmailRequestBuilderPostReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/RemoveEmail/RemoveEmailRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/RemoveEmail/RemoveEmailRequestBuilder.php index b7243342022..7b1fada912d 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/RemoveEmail/RemoveEmailRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/RemoveEmail/RemoveEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove the email address of a channel. You can remove an email address only if it was provisioned using the provisionEmail method or through the Microsoft Teams client. This API is available in the following national cloud deployments. * @param RemoveEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-removeemail?view=graph-rest-1.0 Find more info here */ public function post(?RemoveEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RemoveEmailRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Count/CountRequestBuilder.php index ac92af428e5..146085cf397 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php index 38e2bc48367..18e078ba729 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\SharedWithTeams\Item\AllowedMembers\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\SharedWithTeams\Item\AllowedMembers\Item\ConversationMemberItemRequestBuilder; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of conversationMembers who can access a shared channel. This method does not return the following conversationMembers from the team:- Users with Guest role- Users who are externally authenticated in the tenant This API is available in the following national cloud deployments. * @param AllowedMembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list-allowedmembers?view=graph-rest-1.0 Find more info here */ public function get(?AllowedMembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php index 8514c29f67e..ef62b99550c 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php index 1165d5686f4..fb8b66b3199 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A collection of team members who have access to the shared channel. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php index a286c1c886b..a9f318f5335 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\SharedWithTeams\Item\AllowedMembers\AllowedMembersRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\SharedWithTeams\Item\Team\TeamRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unshare a channel with a team by deleting the corresponding sharedWithChannelTeamInfo resource. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a team that has been shared with a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-get?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sharedWithTeams in groups * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SharedWithChannelTeamInfo $body, ?SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?SharedWithChannelTeamInfoItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(SharedWithChannelTeamInfo $body, ?Shar $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/Team/TeamRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/Team/TeamRequestBuilder.php index 95ad8c7b20f..db5cebd2d97 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/Team/TeamRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/Item/Team/TeamRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get team from groups * @param TeamRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/SharedWithTeamsRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/SharedWithTeamsRequestBuilder.php index c06f9d8954e..2b1c52af650 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/SharedWithTeamsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/SharedWithTeams/SharedWithTeamsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\SharedWithTeams\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\SharedWithTeams\Item\SharedWithChannelTeamInfoItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of teams that has been shared a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithTeamsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithTeamsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sharedWithTeams for groups * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithTeamsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SharedWithChannelTeamInfo $body, ?SharedWithTeamsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SharedWithChannelTeamInfo $body, ?Share $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/Count/CountRequestBuilder.php index e1337a2454c..4cefa5450a2 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php index ca95887e4b6..5be4be47009 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The application that is linked to the tab. This can't be changed after tab creation. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/Item/TeamsTabItemRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/Item/TeamsTabItemRequestBuilder.php index 86d0c381146..558b2ea0c9b 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/Item/TeamsTabItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/Item/TeamsTabItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Tabs\Item\TeamsApp\TeamsAppRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Removes (unpins) a tab from the specified channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-delete-tabs?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsTabItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of the specified tab in a channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TeamsTabItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified tab.This can be used to configure the content of the tab. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TeamsTabItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-patch-tabs?view=graph-rest-1.0 Find more info here */ public function patch(TeamsTab $body, ?TeamsTabItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TeamsTabItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TeamsTab $body, ?TeamsTabItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/TabsRequestBuilder.php b/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/TabsRequestBuilder.php index a2009096195..3fb67945aaf 100644 --- a/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/TabsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/PrimaryChannel/Tabs/TabsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Tabs\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\PrimaryChannel\Tabs\Item\TeamsTabItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of tabs in the specified channel within a team. This API is available in the following national cloud deployments. * @param TabsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TabsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Adds (pins) a tab to the specified channel within a team. The corresponding app must already be installed in the team. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TabsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-tabs?view=graph-rest-1.0 Find more info here */ public function post(TeamsTab $body, ?TabsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsTab $body, ?TabsRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/OfferShiftRequests/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/OfferShiftRequests/Count/CountRequestBuilder.php index c1dc0301722..b197527c225 100644 --- a/src/Generated/Groups/Item/Team/Schedule/OfferShiftRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/OfferShiftRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/OfferShiftRequests/Item/OfferShiftRequestItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/OfferShiftRequests/Item/OfferShiftRequestItemRequestBuilder.php index d2b7b1d83d8..fd770ca218f 100644 --- a/src/Generated/Groups/Item/Team/Schedule/OfferShiftRequests/Item/OfferShiftRequestItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/OfferShiftRequests/Item/OfferShiftRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OfferShiftRequest; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property offerShiftRequests for groups * @param OfferShiftRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OfferShiftRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an offerShiftRequest object. This API is available in the following national cloud deployments. * @param OfferShiftRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/offershiftrequest-get?view=graph-rest-1.0 Find more info here */ public function get(?OfferShiftRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property offerShiftRequests in groups * @param OfferShiftRequest $body The request body * @param OfferShiftRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OfferShiftRequest $body, ?OfferShiftRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?OfferShiftRequestItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?OfferShiftRequestItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?OfferShiftRequestItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(OfferShiftRequest $body, ?OfferShiftRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/OfferShiftRequests/OfferShiftRequestsRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/OfferShiftRequests/OfferShiftRequestsRequestBuilder.php index 0a00684d7b5..100b552eb6c 100644 --- a/src/Generated/Groups/Item/Team/Schedule/OfferShiftRequests/OfferShiftRequestsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/OfferShiftRequests/OfferShiftRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\OfferShiftRequests\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\OfferShiftRequests\Item\OfferShiftRequestItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of all offerShiftRequest objects in a team. This API is available in the following national cloud deployments. * @param OfferShiftRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/offershiftrequest-list?view=graph-rest-1.0 Find more info here */ public function get(?OfferShiftRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an instance of an offerShiftRequest. This API is available in the following national cloud deployments. * @param OfferShiftRequest $body The request body * @param OfferShiftRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/offershiftrequest-post?view=graph-rest-1.0 Find more info here */ public function post(OfferShiftRequest $body, ?OfferShiftRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OfferShiftRequestsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OfferShiftRequestsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OfferShiftRequest $body, ?OfferShiftReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/OpenShiftChangeRequests/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/OpenShiftChangeRequests/Count/CountRequestBuilder.php index 0f19338e9e3..27719a30a94 100644 --- a/src/Generated/Groups/Item/Team/Schedule/OpenShiftChangeRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/OpenShiftChangeRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/OpenShiftChangeRequests/Item/OpenShiftChangeRequestItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/OpenShiftChangeRequests/Item/OpenShiftChangeRequestItemRequestBuilder.php index c17d0113a18..b57e78c08ee 100644 --- a/src/Generated/Groups/Item/Team/Schedule/OpenShiftChangeRequests/Item/OpenShiftChangeRequestItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/OpenShiftChangeRequests/Item/OpenShiftChangeRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OpenShiftChangeRequest; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property openShiftChangeRequests for groups * @param OpenShiftChangeRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OpenShiftChangeRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an openShiftChangeRequest object. This API is available in the following national cloud deployments. * @param OpenShiftChangeRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshiftchangerequest-get?view=graph-rest-1.0 Find more info here */ public function get(?OpenShiftChangeRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property openShiftChangeRequests in groups * @param OpenShiftChangeRequest $body The request body * @param OpenShiftChangeRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OpenShiftChangeRequest $body, ?OpenShiftChangeRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?OpenShiftChangeRequestItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?OpenShiftChangeRequestItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?OpenShiftChangeRequestItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(OpenShiftChangeRequest $body, ?OpenShi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/OpenShiftChangeRequests/OpenShiftChangeRequestsRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/OpenShiftChangeRequests/OpenShiftChangeRequestsRequestBuilder.php index 71b34a26494..be264cfa16e 100644 --- a/src/Generated/Groups/Item/Team/Schedule/OpenShiftChangeRequests/OpenShiftChangeRequestsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/OpenShiftChangeRequests/OpenShiftChangeRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\OpenShiftChangeRequests\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\OpenShiftChangeRequests\Item\OpenShiftChangeRequestItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of openShiftChangeRequest objects in a team. This API is available in the following national cloud deployments. * @param OpenShiftChangeRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshiftchangerequest-list?view=graph-rest-1.0 Find more info here */ public function get(?OpenShiftChangeRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create instance of an openShiftChangeRequest object. This API is available in the following national cloud deployments. * @param OpenShiftChangeRequest $body The request body * @param OpenShiftChangeRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshiftchangerequest-post?view=graph-rest-1.0 Find more info here */ public function post(OpenShiftChangeRequest $body, ?OpenShiftChangeRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OpenShiftChangeRequestsRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OpenShiftChangeRequestsRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OpenShiftChangeRequest $body, ?OpenShif $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/OpenShifts/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/OpenShifts/Count/CountRequestBuilder.php index 924118a4c8e..163f54b45a1 100644 --- a/src/Generated/Groups/Item/Team/Schedule/OpenShifts/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/OpenShifts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/OpenShifts/Item/OpenShiftItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/OpenShifts/Item/OpenShiftItemRequestBuilder.php index 0f16356cb61..925037b4c79 100644 --- a/src/Generated/Groups/Item/Team/Schedule/OpenShifts/Item/OpenShiftItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/OpenShifts/Item/OpenShiftItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OpenShift; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an openShift object. This API is available in the following national cloud deployments. * @param OpenShiftItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-delete?view=graph-rest-1.0 Find more info here */ public function delete(?OpenShiftItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an openshift object. This API is available in the following national cloud deployments. * @param OpenShiftItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-get?view=graph-rest-1.0 Find more info here */ public function get(?OpenShiftItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an openShift object. * @param OpenShift $body The request body * @param OpenShiftItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-update?view=graph-rest-1.0 Find more info here */ public function patch(OpenShift $body, ?OpenShiftItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?OpenShiftItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?OpenShiftItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?OpenShiftItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(OpenShift $body, ?OpenShiftItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/OpenShifts/OpenShiftsRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/OpenShifts/OpenShiftsRequestBuilder.php index d36761a65e6..3578f916836 100644 --- a/src/Generated/Groups/Item/Team/Schedule/OpenShifts/OpenShiftsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/OpenShifts/OpenShiftsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\OpenShifts\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\OpenShifts\Item\OpenShiftItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List openShift objects in a team. This API is available in the following national cloud deployments. * @param OpenShiftsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-list?view=graph-rest-1.0 Find more info here */ public function get(?OpenShiftsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an instance of an openShift object. This API is available in the following national cloud deployments. * @param OpenShift $body The request body * @param OpenShiftsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-post?view=graph-rest-1.0 Find more info here */ public function post(OpenShift $body, ?OpenShiftsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OpenShiftsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OpenShiftsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OpenShift $body, ?OpenShiftsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/ScheduleRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/ScheduleRequestBuilder.php index 50acf49670a..46a21921ca4 100644 --- a/src/Generated/Groups/Item/Team/Schedule/ScheduleRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/ScheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\OfferShiftRequests\OfferShiftRequestsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\OpenShiftChangeRequests\OpenShiftChangeRequestsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\OpenShifts\OpenShiftsRequestBuilder; @@ -114,57 +113,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property schedule for groups * @param ScheduleRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ScheduleRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a schedule object. The schedule creation process conforms to the One API guideline for resource based long running operations (RELO).When clients use the PUT method, if the schedule is provisioned, the operation updates the schedule; otherwise, the operation starts the schedule provisioning process in the background. During schedule provisioning, clients can use the GET method to get the schedule and look at the provisionStatus property for the current state of the provisioning. If the provisioning failed, clients can get additional information from the provisionStatusCode property. Clients can also inspect the configuration of the schedule. This API is available in the following national cloud deployments. * @param ScheduleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-get?view=graph-rest-1.0 Find more info here */ public function get(?ScheduleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Schedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Schedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property schedule in groups * @param Schedule $body The request body * @param ScheduleRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(Schedule $body, ?ScheduleRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Schedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Schedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -181,6 +171,7 @@ public function toDeleteRequestInformation(?ScheduleRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -194,7 +185,6 @@ public function toGetRequestInformation(?ScheduleRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -202,6 +192,7 @@ public function toGetRequestInformation(?ScheduleRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -216,11 +207,11 @@ public function toPutRequestInformation(Schedule $body, ?ScheduleRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/SchedulingGroups/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/SchedulingGroups/Count/CountRequestBuilder.php index 2ece1e57823..2870f232a3c 100644 --- a/src/Generated/Groups/Item/Team/Schedule/SchedulingGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/SchedulingGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/SchedulingGroups/Item/SchedulingGroupItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/SchedulingGroups/Item/SchedulingGroupItemRequestBuilder.php index 4b53ef24275..0750808109e 100644 --- a/src/Generated/Groups/Item/Team/Schedule/SchedulingGroups/Item/SchedulingGroupItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/SchedulingGroups/Item/SchedulingGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SchedulingGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Mark a schedulingGroup as inactive by setting its isActive property.This method does not remove the schedulingGroup from the schedule. Existing shift instances assigned to the scheduling group remain part of the group. This API is available in the following national cloud deployments. * @param SchedulingGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedulinggroup-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SchedulingGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a schedulingGroup by ID. This API is available in the following national cloud deployments. * @param SchedulingGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedulinggroup-get?view=graph-rest-1.0 Find more info here */ public function get(?SchedulingGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Replace an existing schedulingGroup. If the specified schedulingGroup doesn't exist, this method returns 404 Not found. * @param SchedulingGroup $body The request body * @param SchedulingGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedulinggroup-put?view=graph-rest-1.0 Find more info here */ public function patch(SchedulingGroup $body, ?SchedulingGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?SchedulingGroupItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?SchedulingGroupItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?SchedulingGroupItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(SchedulingGroup $body, ?SchedulingGrou $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/SchedulingGroups/SchedulingGroupsRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/SchedulingGroups/SchedulingGroupsRequestBuilder.php index d91e1575194..f80264ffdf3 100644 --- a/src/Generated/Groups/Item/Team/Schedule/SchedulingGroups/SchedulingGroupsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/SchedulingGroups/SchedulingGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\SchedulingGroups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\SchedulingGroups\Item\SchedulingGroupItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of schedulingGroups in this schedule. This API is available in the following national cloud deployments. * @param SchedulingGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-list-schedulinggroups?view=graph-rest-1.0 Find more info here */ public function get(?SchedulingGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new schedulingGroup. This API is available in the following national cloud deployments. * @param SchedulingGroup $body The request body * @param SchedulingGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-post-schedulinggroups?view=graph-rest-1.0 Find more info here */ public function post(SchedulingGroup $body, ?SchedulingGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SchedulingGroupsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SchedulingGroupsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SchedulingGroup $body, ?SchedulingGroup $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/Share/ShareRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/Share/ShareRequestBuilder.php index 2298dde3b9d..d96a4d76602 100644 --- a/src/Generated/Groups/Item/Team/Schedule/Share/ShareRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/Share/ShareRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Share a schedule time range with schedule members.Make the collections of shift, openshift and timeOff items in the specified time range of the schedule viewable by the specified team members, including employees and managers.Each shift, openshift and timeOff instance in a schedule supports a draft version and a shared version of the item. The draft version is viewable by only managers, and the shared version is viewable by employees and managers. For each shift, openshift and timeOff instance in the specified time range, the share action updates the shared version from the draft version, so that in addition to managers, employees can also view the most current information about the item. The notifyTeam parameter further specifies which employees can view the item. This API is available in the following national cloud deployments. * @param SharePostRequestBody $body The request body * @param ShareRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-share?view=graph-rest-1.0 Find more info here */ public function post(SharePostRequestBody $body, ?ShareRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SharePostRequestBody $body, ?ShareReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/Shifts/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/Shifts/Count/CountRequestBuilder.php index baccff5bc6b..00cded10604 100644 --- a/src/Generated/Groups/Item/Team/Schedule/Shifts/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/Shifts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/Shifts/Item/ShiftItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/Shifts/Item/ShiftItemRequestBuilder.php index 76e34a324ed..933aff3a2db 100644 --- a/src/Generated/Groups/Item/Team/Schedule/Shifts/Item/ShiftItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/Shifts/Item/ShiftItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Shift; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a shift from the schedule. This API is available in the following national cloud deployments. * @param ShiftItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shift-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ShiftItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a shift object by ID. This API is available in the following national cloud deployments. * @param ShiftItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shift-get?view=graph-rest-1.0 Find more info here */ public function get(?ShiftItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Replace an existing shift. If the specified shift doesn't exist, this method returns 404 Not found. The duration of a shift can't be less than 1 minute or longer than 24 hours. * @param Shift $body The request body * @param ShiftItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shift-put?view=graph-rest-1.0 Find more info here */ public function patch(Shift $body, ?ShiftItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ShiftItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ShiftItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ShiftItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(Shift $body, ?ShiftItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/Shifts/ShiftsRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/Shifts/ShiftsRequestBuilder.php index 6a16f269adb..be994ad754a 100644 --- a/src/Generated/Groups/Item/Team/Schedule/Shifts/ShiftsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/Shifts/ShiftsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\Shifts\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\Shifts\Item\ShiftItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of shift instances in a schedule. This API is available in the following national cloud deployments. * @param ShiftsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-list-shifts?view=graph-rest-1.0 Find more info here */ public function get(?ShiftsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ShiftCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ShiftCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new shift instance in a schedule. The duration of a shift cannot be less than 1 minute or longer than 24 hours. This API is available in the following national cloud deployments. * @param Shift $body The request body * @param ShiftsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-post-shifts?view=graph-rest-1.0 Find more info here */ public function post(Shift $body, ?ShiftsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ShiftsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ShiftsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Shift $body, ?ShiftsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/SwapShiftsChangeRequests/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/SwapShiftsChangeRequests/Count/CountRequestBuilder.php index bf88a730807..fe793a8a386 100644 --- a/src/Generated/Groups/Item/Team/Schedule/SwapShiftsChangeRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/SwapShiftsChangeRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/SwapShiftsChangeRequests/Item/SwapShiftsChangeRequestItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/SwapShiftsChangeRequests/Item/SwapShiftsChangeRequestItemRequestBuilder.php index 071badef86a..9d8feecd382 100644 --- a/src/Generated/Groups/Item/Team/Schedule/SwapShiftsChangeRequests/Item/SwapShiftsChangeRequestItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/SwapShiftsChangeRequests/Item/SwapShiftsChangeRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SwapShiftsChangeRequest; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property swapShiftsChangeRequests for groups * @param SwapShiftsChangeRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SwapShiftsChangeRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a swapShiftsChangeRequest object. This API is available in the following national cloud deployments. * @param SwapShiftsChangeRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/swapshiftschangerequest-get?view=graph-rest-1.0 Find more info here */ public function get(?SwapShiftsChangeRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property swapShiftsChangeRequests in groups * @param SwapShiftsChangeRequest $body The request body * @param SwapShiftsChangeRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SwapShiftsChangeRequest $body, ?SwapShiftsChangeRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?SwapShiftsChangeRequestItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?SwapShiftsChangeRequestItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?SwapShiftsChangeRequestItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(SwapShiftsChangeRequest $body, ?SwapSh $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/SwapShiftsChangeRequests/SwapShiftsChangeRequestsRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/SwapShiftsChangeRequests/SwapShiftsChangeRequestsRequestBuilder.php index ce01ed07fe1..f8ac4b5408b 100644 --- a/src/Generated/Groups/Item/Team/Schedule/SwapShiftsChangeRequests/SwapShiftsChangeRequestsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/SwapShiftsChangeRequests/SwapShiftsChangeRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\SwapShiftsChangeRequests\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\SwapShiftsChangeRequests\Item\SwapShiftsChangeRequestItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of swapShiftsChangeRequest objects in the team. This API is available in the following national cloud deployments. * @param SwapShiftsChangeRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/swapshiftschangerequest-list?view=graph-rest-1.0 Find more info here */ public function get(?SwapShiftsChangeRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an instance of a swapShiftsChangeRequest object. This API is available in the following national cloud deployments. * @param SwapShiftsChangeRequest $body The request body * @param SwapShiftsChangeRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/swapshiftschangerequest-post?view=graph-rest-1.0 Find more info here */ public function post(SwapShiftsChangeRequest $body, ?SwapShiftsChangeRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SwapShiftsChangeRequestsRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SwapShiftsChangeRequestsRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SwapShiftsChangeRequest $body, ?SwapShi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/TimeOffReasons/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/TimeOffReasons/Count/CountRequestBuilder.php index c3d8a1b865e..7aca8a4dc0a 100644 --- a/src/Generated/Groups/Item/Team/Schedule/TimeOffReasons/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/TimeOffReasons/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/TimeOffReasons/Item/TimeOffReasonItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/TimeOffReasons/Item/TimeOffReasonItemRequestBuilder.php index d7e6887c66a..72d234cc6c6 100644 --- a/src/Generated/Groups/Item/Team/Schedule/TimeOffReasons/Item/TimeOffReasonItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/TimeOffReasons/Item/TimeOffReasonItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOffReason; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Mark a timeOffReason as inactive by setting the isActive property. Every team must include at least one timeoff reason. This method doesn't remove the specified timeOffReason instance. timeOffItem instances that have been assigned this reason remain assigned to this reason. This API is available in the following national cloud deployments. * @param TimeOffReasonItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffreason-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TimeOffReasonItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a timeOffReason object by ID. This API is available in the following national cloud deployments. * @param TimeOffReasonItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffreason-get?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffReasonItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Replace an existing timeOffReason. If the specified timeOffReason doesn't exist, this method returns 404 Not found. * @param TimeOffReason $body The request body * @param TimeOffReasonItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffreason-put?view=graph-rest-1.0 Find more info here */ public function patch(TimeOffReason $body, ?TimeOffReasonItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?TimeOffReasonItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?TimeOffReasonItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?TimeOffReasonItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(TimeOffReason $body, ?TimeOffReasonIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/TimeOffReasons/TimeOffReasonsRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/TimeOffReasons/TimeOffReasonsRequestBuilder.php index 2924a510565..cbce71c22af 100644 --- a/src/Generated/Groups/Item/Team/Schedule/TimeOffReasons/TimeOffReasonsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/TimeOffReasons/TimeOffReasonsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\TimeOffReasons\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\TimeOffReasons\Item\TimeOffReasonItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of timeOffReasons in a schedule. This API is available in the following national cloud deployments. * @param TimeOffReasonsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-list-timeoffreasons?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffReasonsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReasonCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReasonCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new timeOffReason. This API is available in the following national cloud deployments. * @param TimeOffReason $body The request body * @param TimeOffReasonsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-post-timeoffreasons?view=graph-rest-1.0 Find more info here */ public function post(TimeOffReason $body, ?TimeOffReasonsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TimeOffReasonsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TimeOffReasonsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TimeOffReason $body, ?TimeOffReasonsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/TimeOffRequests/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/TimeOffRequests/Count/CountRequestBuilder.php index 436f9d6eda5..bff07257317 100644 --- a/src/Generated/Groups/Item/Team/Schedule/TimeOffRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/TimeOffRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/TimeOffRequests/Item/TimeOffRequestItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/TimeOffRequests/Item/TimeOffRequestItemRequestBuilder.php index 2e7881880d2..c66ed7afacd 100644 --- a/src/Generated/Groups/Item/Team/Schedule/TimeOffRequests/Item/TimeOffRequestItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/TimeOffRequests/Item/TimeOffRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOffRequest; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a timeOffRequest object. This API is available in the following national cloud deployments. * @param TimeOffRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffrequest-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TimeOffRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a timeoffrequest object. This API is available in the following national cloud deployments. * @param TimeOffRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffrequest-get?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property timeOffRequests in groups * @param TimeOffRequest $body The request body * @param TimeOffRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TimeOffRequest $body, ?TimeOffRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?TimeOffRequestItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?TimeOffRequestItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?TimeOffRequestItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(TimeOffRequest $body, ?TimeOffRequestI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/TimeOffRequests/TimeOffRequestsRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/TimeOffRequests/TimeOffRequestsRequestBuilder.php index 3bff5e668de..72c8828691f 100644 --- a/src/Generated/Groups/Item/Team/Schedule/TimeOffRequests/TimeOffRequestsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/TimeOffRequests/TimeOffRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\TimeOffRequests\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\TimeOffRequests\Item\TimeOffRequestItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of timeOffRequest objects in the team. This API is available in the following national cloud deployments. * @param TimeOffRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffrequest-list?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to timeOffRequests for groups * @param TimeOffRequest $body The request body * @param TimeOffRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TimeOffRequest $body, ?TimeOffRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TimeOffRequestsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TimeOffRequestsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(TimeOffRequest $body, ?TimeOffRequestsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/TimesOff/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/TimesOff/Count/CountRequestBuilder.php index 76138f7bb72..b9943214a2a 100644 --- a/src/Generated/Groups/Item/Team/Schedule/TimesOff/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/TimesOff/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/TimesOff/Item/TimeOffItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/TimesOff/Item/TimeOffItemRequestBuilder.php index 2a920a8a601..b2d55fb35e1 100644 --- a/src/Generated/Groups/Item/Team/Schedule/TimesOff/Item/TimeOffItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/TimesOff/Item/TimeOffItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOff; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a timeOff instance from a schedule. This API is available in the following national cloud deployments. * @param TimeOffItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoff-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TimeOffItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a timeOff object by ID. This API is available in the following national cloud deployments. * @param TimeOffItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoff-get?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Replace an existing timeOff object. If the specified timeOff object doesn't exist, this method returns 404 Not found. * @param TimeOff $body The request body * @param TimeOffItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoff-put?view=graph-rest-1.0 Find more info here */ public function patch(TimeOff $body, ?TimeOffItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?TimeOffItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?TimeOffItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?TimeOffItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(TimeOff $body, ?TimeOffItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Schedule/TimesOff/TimesOffRequestBuilder.php b/src/Generated/Groups/Item/Team/Schedule/TimesOff/TimesOffRequestBuilder.php index bdd18a7b972..3c0cbc4dcf6 100644 --- a/src/Generated/Groups/Item/Team/Schedule/TimesOff/TimesOffRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Schedule/TimesOff/TimesOffRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\TimesOff\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Schedule\TimesOff\Item\TimeOffItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of timeOff instances in a schedule. This API is available in the following national cloud deployments. * @param TimesOffRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-list-timesoff?view=graph-rest-1.0 Find more info here */ public function get(?TimesOffRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new timeOff instance in a schedule. This API is available in the following national cloud deployments. * @param TimeOff $body The request body * @param TimesOffRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-post-timesoff?view=graph-rest-1.0 Find more info here */ public function post(TimeOff $body, ?TimesOffRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TimesOffRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TimesOffRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TimeOff $body, ?TimesOffRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/SendActivityNotification/SendActivityNotificationRequestBuilder.php b/src/Generated/Groups/Item/Team/SendActivityNotification/SendActivityNotificationRequestBuilder.php index 318da0ffff2..b29eda5e462 100644 --- a/src/Generated/Groups/Item/Team/SendActivityNotification/SendActivityNotificationRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/SendActivityNotification/SendActivityNotificationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Send an activity feed notification in the scope of a team. For more details about sending notifications and the requirements for doing so, seesending Teams activity notifications. This API is available in the following national cloud deployments. * @param SendActivityNotificationPostRequestBody $body The request body * @param SendActivityNotificationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-sendactivitynotification?view=graph-rest-1.0 Find more info here */ public function post(SendActivityNotificationPostRequestBody $body, ?SendActivityNotificationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SendActivityNotificationPostRequestBody $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Tags/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Tags/Count/CountRequestBuilder.php index f3a7f087c71..e7ad3d10228 100644 --- a/src/Generated/Groups/Item/Team/Tags/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Tags/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Tags/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Team/Tags/Item/Members/Count/CountRequestBuilder.php index 4ae08029aeb..1943066286b 100644 --- a/src/Generated/Groups/Item/Team/Tags/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Tags/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Tags/Item/Members/Item/TeamworkTagMemberItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Tags/Item/Members/Item/TeamworkTagMemberItemRequestBuilder.php index 5b6eccf9e3a..528a5e5054b 100644 --- a/src/Generated/Groups/Item/Team/Tags/Item/Members/Item/TeamworkTagMemberItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Tags/Item/Members/Item/TeamworkTagMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamworkTagMember; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a member from a standard tag in a team. This API is available in the following national cloud deployments. * @param TeamworkTagMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktagmember-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TeamworkTagMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a member of a standard tag in a team. This API is available in the following national cloud deployments. * @param TeamworkTagMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktagmember-get?view=graph-rest-1.0 Find more info here */ public function get(?TeamworkTagMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property members in groups * @param TeamworkTagMember $body The request body * @param TeamworkTagMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamworkTagMember $body, ?TeamworkTagMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?TeamworkTagMemberItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?TeamworkTagMemberItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?TeamworkTagMemberItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(TeamworkTagMember $body, ?TeamworkTagM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Tags/Item/Members/MembersRequestBuilder.php b/src/Generated/Groups/Item/Team/Tags/Item/Members/MembersRequestBuilder.php index 1ad7f8e7e32..a73e06dc050 100644 --- a/src/Generated/Groups/Item/Team/Tags/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Tags/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Tags\Item\Members\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Tags\Item\Members\Item\TeamworkTagMemberItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the members of a standard tag in a team and their properties. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktagmember-list?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new teamworkTagMember object in a team. This API is available in the following national cloud deployments. * @param TeamworkTagMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktagmember-post?view=graph-rest-1.0 Find more info here */ public function post(TeamworkTagMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamworkTagMember $body, ?MembersReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Tags/Item/TeamworkTagItemRequestBuilder.php b/src/Generated/Groups/Item/Team/Tags/Item/TeamworkTagItemRequestBuilder.php index e06423ad5e0..a2cc5d147c9 100644 --- a/src/Generated/Groups/Item/Team/Tags/Item/TeamworkTagItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Tags/Item/TeamworkTagItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Tags\Item\Members\MembersRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamworkTag; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a tag object permanently. This API is available in the following national cloud deployments. * @param TeamworkTagItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TeamworkTagItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a tag object. This API is available in the following national cloud deployments. * @param TeamworkTagItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-get?view=graph-rest-1.0 Find more info here */ public function get(?TeamworkTagItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a tag object. This API is available in the following national cloud deployments. * @param TeamworkTag $body The request body * @param TeamworkTagItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-update?view=graph-rest-1.0 Find more info here */ public function patch(TeamworkTag $body, ?TeamworkTagItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TeamworkTagItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TeamworkTagItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TeamworkTagItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TeamworkTag $body, ?TeamworkTagItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Tags/TagsRequestBuilder.php b/src/Generated/Groups/Item/Team/Tags/TagsRequestBuilder.php index 35b17246a76..259da8c93ba 100644 --- a/src/Generated/Groups/Item/Team/Tags/TagsRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Tags/TagsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\Tags\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Tags\Item\TeamworkTagItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the tag objects and their properties. This API is available in the following national cloud deployments. * @param TagsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-list?view=graph-rest-1.0 Find more info here */ public function get(?TagsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a standard tag for members in a team. This API is available in the following national cloud deployments. * @param TeamworkTag $body The request body * @param TagsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-post?view=graph-rest-1.0 Find more info here */ public function post(TeamworkTag $body, ?TagsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TagsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TagsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamworkTag $body, ?TagsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/TeamRequestBuilder.php b/src/Generated/Groups/Item/Team/TeamRequestBuilder.php index 5cd4721c1a0..07dddfd93b1 100644 --- a/src/Generated/Groups/Item/Team/TeamRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/TeamRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Team\AllChannels\AllChannelsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Archive\ArchiveRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Team\Channels\ChannelsRequestBuilder; @@ -178,56 +177,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property team for groups * @param TeamRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TeamRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The team associated with this group. * @param TeamRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property team in groups * @param Team $body The request body * @param TeamRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(Team $body, ?TeamRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -244,6 +234,7 @@ public function toDeleteRequestInformation(?TeamRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -257,7 +248,6 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -265,6 +255,7 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -279,11 +270,11 @@ public function toPutRequestInformation(Team $body, ?TeamRequestBuilderPutReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Template/TemplateRequestBuilder.php b/src/Generated/Groups/Item/Team/Template/TemplateRequestBuilder.php index f7e29d2bb86..a8b808d3219 100644 --- a/src/Generated/Groups/Item/Team/Template/TemplateRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Template/TemplateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTemplate; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The template this team was created from. See available templates. * @param TemplateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TemplateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TemplateRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TemplateRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Team/Unarchive/UnarchiveRequestBuilder.php b/src/Generated/Groups/Item/Team/Unarchive/UnarchiveRequestBuilder.php index 0bd1971d7e0..fb12b12bd21 100644 --- a/src/Generated/Groups/Item/Team/Unarchive/UnarchiveRequestBuilder.php +++ b/src/Generated/Groups/Item/Team/Unarchive/UnarchiveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore an archived team. This restores users' ability to send messages and edit the team, abiding by tenant and team settings. A Team is archived using the archive API. Unarchiving is an async operation. A team is unarchived once the async operation completes successfully, which may occur subsequent to a response from this API. This API is available in the following national cloud deployments. * @param UnarchiveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-unarchive?view=graph-rest-1.0 Find more info here */ public function post(?UnarchiveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnarchiveRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Threads/Count/CountRequestBuilder.php index 8242f0ae23d..6ebb9095692 100644 --- a/src/Generated/Groups/Item/Threads/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/ConversationThreadItemRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/ConversationThreadItemRequestBuilder.php index 4e591c3d117..04870bb9298 100644 --- a/src/Generated/Groups/Item/Threads/Item/ConversationThreadItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/ConversationThreadItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\PostsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Reply\ReplyRequestBuilder; use Microsoft\Graph\Generated\Models\ConversationThread; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete conversationThread. This API is available in the following national cloud deployments. * @param ConversationThreadItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationthread-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationThreadItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a thread object. This API is available in the following national cloud deployments. * @param ConversationThreadItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-get-thread?view=graph-rest-1.0 Find more info here */ public function get(?ConversationThreadItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationThread::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationThread::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * This API is available in the following national cloud deployments. * @param ConversationThread $body The request body * @param ConversationThreadItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-update-thread?view=graph-rest-1.0 Find more info here */ public function patch(ConversationThread $body, ?ConversationThreadItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationThread::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationThread::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?ConversationThreadItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?ConversationThreadItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?ConversationThreadItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(ConversationThread $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Count/CountRequestBuilder.php index 684859e35d4..d20bea33d9d 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/AttachmentsRequestBuilder.php index e673a5eb200..980c9b839d0 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\Attachments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\Attachments\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\Attachments\Item\AttachmentItemRequestBuilder; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to a post. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/post-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to attachments for groups * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/Count/CountRequestBuilder.php index c16f9909082..714a9fce814 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 4009002d8e9..eefebb3362c 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 54b8158a986..0cdfc6a9dd6 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,37 +33,31 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attachments for groups * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -81,6 +74,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -94,7 +88,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -102,6 +95,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Extensions/Count/CountRequestBuilder.php index 236d5874671..bf692b42e6e 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Extensions/ExtensionsRequestBuilder.php index c81da3bff2b..f61170adf7c 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for groups * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 747a8c40998..820d086339f 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for groups * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an open extension (openTypeExtension object) with the properties in the request body: The data in an extension can be primitive types, or arrays of primitive types. See the table in the Permissions section for the list of resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-update?view=graph-rest-1.0 Find more info here */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Forward/ForwardRequestBuilder.php index cc1e7013a04..bb63f325c92 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Forward a post to a recipient. You can specify both the parent conversation and thread in the request, or, you can specify just the parent thread without the parent conversation. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/post-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/AttachmentsRequestBuilder.php index 826dd4c143e..d909e8eda07 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\InReplyTo\Attachments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\InReplyTo\Attachments\CreateUploadSession\CreateUploadSessionRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\InReplyTo\Attachments\Item\AttachmentItemRequestBuilder; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to a post. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/post-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to attachments for groups * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Count/CountRequestBuilder.php index 203b5367b69..17a1aec8604 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 13d7fa843a1..117ba9bb7e1 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Item/AttachmentItemRequestBuilder.php index 5d07ed61918..fe96a7d9cd9 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,37 +33,31 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attachments for groups * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -81,6 +74,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -94,7 +88,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -102,6 +95,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Count/CountRequestBuilder.php index 52d9b675eac..60380fbdc7f 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/ExtensionsRequestBuilder.php index d0b72dbe769..d43dce0480a 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\InReplyTo\Extensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\InReplyTo\Extensions\Item\ExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\Extension; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for groups * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Item/ExtensionItemRequestBuilder.php index 1f546430ae0..48be21ec528 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for groups * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an open extension (openTypeExtension object) with the properties in the request body: The data in an extension can be primitive types, or arrays of primitive types. See the table in the Permissions section for the list of resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-update?view=graph-rest-1.0 Find more info here */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Forward/ForwardRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Forward/ForwardRequestBuilder.php index f38e3918c5d..281e7304455 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Forward a post to a recipient. You can specify both the parent conversation and thread in the request, or, you can specify just the parent thread without the parent conversation. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/post-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/InReplyToRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/InReplyToRequestBuilder.php index 6e1f054d69f..e11941b8ffd 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/InReplyToRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/InReplyToRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\InReplyTo\Attachments\AttachmentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\InReplyTo\Extensions\ExtensionsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\InReplyTo\Forward\ForwardRequestBuilder; @@ -66,19 +65,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Supports $expand. * @param InReplyToRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InReplyToRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Post::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Post::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -91,7 +87,6 @@ public function toGetRequestInformation(?InReplyToRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -99,6 +94,7 @@ public function toGetRequestInformation(?InReplyToRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Reply/ReplyRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Reply/ReplyRequestBuilder.php index 90fdda07f94..34b4dac1829 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Reply/ReplyRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/InReplyTo/Reply/ReplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. + * Reply to a post and add a new post to the specified thread in a group conversation. You can specify both the parent conversation and thread in the request, or, you can specify just the parent thread without the parent conversation. This API is available in the following national cloud deployments. * @param ReplyPostRequestBody $body The request body * @param ReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/post-reply?view=graph-rest-1.0 Find more info here */ public function post(ReplyPostRequestBody $body, ?ReplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. + * Reply to a post and add a new post to the specified thread in a group conversation. You can specify both the parent conversation and thread in the request, or, you can specify just the parent thread without the parent conversation. This API is available in the following national cloud deployments. * @param ReplyPostRequestBody $body The request body * @param ReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -65,6 +61,7 @@ public function toPostRequestInformation(ReplyPostRequestBody $body, ?ReplyReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/PostItemRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/PostItemRequestBuilder.php index 5dd1716bf4a..9daffb5d1c3 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/PostItemRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/PostItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\Attachments\AttachmentsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\Extensions\ExtensionsRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\Forward\ForwardRequestBuilder; @@ -74,19 +73,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get posts from groups * @param PostItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PostItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Post::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Post::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +95,6 @@ public function toGetRequestInformation(?PostItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +102,7 @@ public function toGetRequestInformation(?PostItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Reply/ReplyRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Reply/ReplyRequestBuilder.php index 98cdc117ab4..9e6deca7d41 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/Item/Reply/ReplyRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/Item/Reply/ReplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. + * Reply to a post and add a new post to the specified thread in a group conversation. You can specify both the parent conversation and thread in the request, or, you can specify just the parent thread without the parent conversation. This API is available in the following national cloud deployments. * @param ReplyPostRequestBody $body The request body * @param ReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/post-reply?view=graph-rest-1.0 Find more info here */ public function post(ReplyPostRequestBody $body, ?ReplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. + * Reply to a post and add a new post to the specified thread in a group conversation. You can specify both the parent conversation and thread in the request, or, you can specify just the parent thread without the parent conversation. This API is available in the following national cloud deployments. * @param ReplyPostRequestBody $body The request body * @param ReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -65,6 +61,7 @@ public function toPostRequestInformation(ReplyPostRequestBody $body, ?ReplyReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Posts/PostsRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Posts/PostsRequestBuilder.php index 3c79b3edf60..434eaf77bd4 100644 --- a/src/Generated/Groups/Item/Threads/Item/Posts/PostsRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Posts/PostsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\Posts\Item\PostItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the posts of the specified thread. You can specify both the parent conversation and the thread, or, you can specify the thread without referencing the parent conversation. This API is available in the following national cloud deployments. * @param PostsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationthread-list-posts?view=graph-rest-1.0 Find more info here */ public function get(?PostsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PostCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PostCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?PostsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?PostsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/Item/Reply/ReplyRequestBuilder.php b/src/Generated/Groups/Item/Threads/Item/Reply/ReplyRequestBuilder.php index d29fc7af896..8f1efe22c9c 100644 --- a/src/Generated/Groups/Item/Threads/Item/Reply/ReplyRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/Item/Reply/ReplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Reply to a thread in a group conversation and add a new post to it. You can specify the parent conversation in the request, or, you can specify just the thread without the parent conversation. This API is available in the following national cloud deployments. * @param ReplyPostRequestBody $body The request body * @param ReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationthread-reply?view=graph-rest-1.0 Find more info here */ public function post(ReplyPostRequestBody $body, ?ReplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ReplyPostRequestBody $body, ?ReplyReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Threads/ThreadsRequestBuilder.php b/src/Generated/Groups/Item/Threads/ThreadsRequestBuilder.php index 20109b1d261..c50eae75601 100644 --- a/src/Generated/Groups/Item/Threads/ThreadsRequestBuilder.php +++ b/src/Generated/Groups/Item/Threads/ThreadsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\Threads\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\Threads\Item\ConversationThreadItemRequestBuilder; use Microsoft\Graph\Generated\Models\ConversationThread; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get all the threads of a group. This API is available in the following national cloud deployments. * @param ThreadsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-threads?view=graph-rest-1.0 Find more info here */ public function get(?ThreadsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationThreadCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationThreadCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Start a new group conversation by first creating a thread. A new conversation, conversation thread, and post are created in the group.Use reply thread or reply post to further post to that thread. Note: You can also start a new thread in an existing conversation. This API is available in the following national cloud deployments. * @param ConversationThread $body The request body * @param ThreadsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-post-threads?view=graph-rest-1.0 Find more info here */ public function post(ConversationThread $body, ?ThreadsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationThread::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationThread::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ThreadsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ThreadsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ConversationThread $body, ?ThreadsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMemberOf/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMemberOf/Count/CountRequestBuilder.php index 8ba33349f42..e1ca70ed6ed 100644 --- a/src/Generated/Groups/Item/TransitiveMemberOf/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMemberOf/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php index a873d7b181d..aa2a471ab59 100644 --- a/src/Generated/Groups/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index ce175d57efd..015340ba400 100644 --- a/src/Generated/Groups/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\TransitiveMemberOf\GraphAdministrativeUnit\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\AdministrativeUnitCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.administrativeUnit in the microsoft.graph.directoryObject collection * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php index bdae32c8013..5bc97830309 100644 --- a/src/Generated/Groups/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php index 593d5488bf4..129f94ce772 100644 --- a/src/Generated/Groups/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\TransitiveMemberOf\GraphGroup\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php index c8196479c18..82f63917c12 100644 --- a/src/Generated/Groups/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\TransitiveMemberOf\Item\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\TransitiveMemberOf\Item\GraphGroup\GraphGroupRequestBuilder; use Microsoft\Graph\Generated\Models\DirectoryObject; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The groups that a group is a member of, either directly and through nested membership. Nullable. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index fc301555e57..c83dfd93a06 100644 --- a/src/Generated/Groups/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnit; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.administrativeUnit * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php index d0be923f40b..e3c63f61fe2 100644 --- a/src/Generated/Groups/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php index c7f27f30fb2..10296851db2 100644 --- a/src/Generated/Groups/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\TransitiveMemberOf\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\TransitiveMemberOf\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\TransitiveMemberOf\GraphGroup\GraphGroupRequestBuilder; @@ -70,20 +69,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The groups that a group is a member of, either directly and through nested membership. Nullable. * @param TransitiveMemberOfRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-transitivememberof?view=graph-rest-1.0 Find more info here */ public function get(?TransitiveMemberOfRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -96,7 +92,6 @@ public function toGetRequestInformation(?TransitiveMemberOfRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -104,6 +99,7 @@ public function toGetRequestInformation(?TransitiveMemberOfRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/Count/CountRequestBuilder.php index 9670f33a6c0..24aa5d49f2d 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/GraphApplication/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/GraphApplication/Count/CountRequestBuilder.php index 621a6b12577..858ffc38595 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/GraphApplication/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/GraphApplication/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/GraphApplication/GraphApplicationRequestBuilder.php index dfb7f13b4f7..13328a705e2 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\TransitiveMembers\GraphApplication\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ApplicationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.application in the microsoft.graph.directoryObject collection * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/GraphDevice/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/GraphDevice/Count/CountRequestBuilder.php index 1358b2b6be2..9d2be5ec761 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/GraphDevice/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/GraphDevice/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/GraphDevice/GraphDeviceRequestBuilder.php index 424c48bd04d..baa40c5ad06 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\TransitiveMembers\GraphDevice\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\DeviceCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.device in the microsoft.graph.directoryObject collection * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/GraphGroup/Count/CountRequestBuilder.php index 0ba3ba66b08..6eaadb1b6cc 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/GraphGroup/GraphGroupRequestBuilder.php index 1e1e99f3b53..1f94b37bc83 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\TransitiveMembers\GraphGroup\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/GraphOrgContact/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/GraphOrgContact/Count/CountRequestBuilder.php index 2e424fb7b9c..97a9a178f85 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/GraphOrgContact/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/GraphOrgContact/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/GraphOrgContact/GraphOrgContactRequestBuilder.php index c406d0eb985..9ff37fc3fe9 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\TransitiveMembers\GraphOrgContact\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContactCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.orgContact in the microsoft.graph.directoryObject collection * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/GraphServicePrincipal/Count/CountRequestBuilder.php index f7a4ea76003..91353e7ee15 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index cb6c03714f2..0e0f9fc432a 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\TransitiveMembers\GraphServicePrincipal\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/GraphUser/Count/CountRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/GraphUser/Count/CountRequestBuilder.php index 03af9d870f1..769ead508a1 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/GraphUser/Count/CountRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/GraphUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/GraphUser/GraphUserRequestBuilder.php index 36d4c6f824c..4f48a48cf1d 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\TransitiveMembers\GraphUser\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.user in the microsoft.graph.directoryObject collection * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/Item/DirectoryObjectItemRequestBuilder.php index 4578325a3ec..f96e6fca413 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\TransitiveMembers\Item\GraphApplication\GraphApplicationRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\TransitiveMembers\Item\GraphDevice\GraphDeviceRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\TransitiveMembers\Item\GraphGroup\GraphGroupRequestBuilder; @@ -82,19 +81,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The direct and transitive members of a group. Nullable. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -107,7 +103,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -115,6 +110,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/Item/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/Item/GraphApplication/GraphApplicationRequestBuilder.php index 1459afaf718..13d97d51a8b 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/Item/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/Item/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Application; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.application * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/Item/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/Item/GraphDevice/GraphDeviceRequestBuilder.php index e236c6ef971..346e28fe539 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/Item/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/Item/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Device; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.device * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/Item/GraphGroup/GraphGroupRequestBuilder.php index 80ea0a378cf..b0a7e512775 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php index 56d44a878d9..99899899c57 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContact; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.orgContact * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 970ef11e6e1..5b39f0b946a 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/Item/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/Item/GraphUser/GraphUserRequestBuilder.php index db14a2bec4a..0e932334cab 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/Item/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/Item/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.user * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/TransitiveMembers/TransitiveMembersRequestBuilder.php b/src/Generated/Groups/Item/TransitiveMembers/TransitiveMembersRequestBuilder.php index 865c361c1e7..2950895cf20 100644 --- a/src/Generated/Groups/Item/TransitiveMembers/TransitiveMembersRequestBuilder.php +++ b/src/Generated/Groups/Item/TransitiveMembers/TransitiveMembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Groups\Item\TransitiveMembers\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\TransitiveMembers\GraphApplication\GraphApplicationRequestBuilder; use Microsoft\Graph\Generated\Groups\Item\TransitiveMembers\GraphDevice\GraphDeviceRequestBuilder; @@ -102,20 +101,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The direct and transitive members of a group. Nullable. * @param TransitiveMembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-list-transitivemembers?view=graph-rest-1.0 Find more info here */ public function get(?TransitiveMembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -128,7 +124,6 @@ public function toGetRequestInformation(?TransitiveMembersRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -136,6 +131,7 @@ public function toGetRequestInformation(?TransitiveMembersRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/UnsubscribeByMail/UnsubscribeByMailRequestBuilder.php b/src/Generated/Groups/Item/UnsubscribeByMail/UnsubscribeByMailRequestBuilder.php index 8f22a4e9124..39e7d786b5d 100644 --- a/src/Generated/Groups/Item/UnsubscribeByMail/UnsubscribeByMailRequestBuilder.php +++ b/src/Generated/Groups/Item/UnsubscribeByMail/UnsubscribeByMailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Calling this method prevents the current user from receiving email notifications for this group about new posts, events, and files in that group. Supported for Microsoft 365 groups only. This API is available in the following national cloud deployments. * @param UnsubscribeByMailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-unsubscribebymail?view=graph-rest-1.0 Find more info here */ public function post(?UnsubscribeByMailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnsubscribeByMailRequestBuilderPostReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/Groups/Item/ValidateProperties/ValidatePropertiesRequestBuilder.php index 63ab8e1eb90..ad697ddcf15 100644 --- a/src/Generated/Groups/Item/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/Groups/Item/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to update a Microsoft 365 group. To validate the properties before creating a group, use the directoryobject:validateProperties function. The following policy validations are performed for the display name and mail nickname properties: This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Groups/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/Groups/ValidateProperties/ValidatePropertiesRequestBuilder.php index e0e1bfea88f..e8563eb7437 100644 --- a/src/Generated/Groups/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/Groups/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ApiConnectors/ApiConnectorsRequestBuilder.php b/src/Generated/Identity/ApiConnectors/ApiConnectorsRequestBuilder.php index 8065cfa1042..118311ac4ab 100644 --- a/src/Generated/Identity/ApiConnectors/ApiConnectorsRequestBuilder.php +++ b/src/Generated/Identity/ApiConnectors/ApiConnectorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\ApiConnectors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\ApiConnectors\Item\IdentityApiConnectorItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityApiConnector; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties of an identityApiConnector object. This API is available in the following national cloud deployments. * @param ApiConnectorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityapiconnector-list?view=graph-rest-1.0 Find more info here */ public function get(?ApiConnectorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnectorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnectorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new identityApiConnector object. This API is available in the following national cloud deployments. * @param IdentityApiConnector $body The request body * @param ApiConnectorsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityapiconnector-create?view=graph-rest-1.0 Find more info here */ public function post(IdentityApiConnector $body, ?ApiConnectorsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ApiConnectorsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ApiConnectorsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(IdentityApiConnector $body, ?ApiConnect $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ApiConnectors/Count/CountRequestBuilder.php b/src/Generated/Identity/ApiConnectors/Count/CountRequestBuilder.php index cc732c0c22a..282c38361e5 100644 --- a/src/Generated/Identity/ApiConnectors/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/ApiConnectors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/ApiConnectors/Item/IdentityApiConnectorItemRequestBuilder.php b/src/Generated/Identity/ApiConnectors/Item/IdentityApiConnectorItemRequestBuilder.php index 39281551ebe..763e8199214 100644 --- a/src/Generated/Identity/ApiConnectors/Item/IdentityApiConnectorItemRequestBuilder.php +++ b/src/Generated/Identity/ApiConnectors/Item/IdentityApiConnectorItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\ApiConnectors\Item\UploadClientCertificate\UploadClientCertificateRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityApiConnector; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an identityApiConnector object. This API is available in the following national cloud deployments. * @param IdentityApiConnectorItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityapiconnector-delete?view=graph-rest-1.0 Find more info here */ public function delete(?IdentityApiConnectorItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties of an identityApiConnector object. This API is available in the following national cloud deployments. * @param IdentityApiConnectorItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityapiconnector-get?view=graph-rest-1.0 Find more info here */ public function get(?IdentityApiConnectorItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an identityApiConnector object. This API is available in the following national cloud deployments. * @param IdentityApiConnector $body The request body * @param IdentityApiConnectorItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityapiconnector-update?view=graph-rest-1.0 Find more info here */ public function patch(IdentityApiConnector $body, ?IdentityApiConnectorItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?IdentityApiConnectorItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?IdentityApiConnectorItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?IdentityApiConnectorItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(IdentityApiConnector $body, ?IdentityA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ApiConnectors/Item/UploadClientCertificate/UploadClientCertificateRequestBuilder.php b/src/Generated/Identity/ApiConnectors/Item/UploadClientCertificate/UploadClientCertificateRequestBuilder.php index b4f9c32e657..8ed4e9da835 100644 --- a/src/Generated/Identity/ApiConnectors/Item/UploadClientCertificate/UploadClientCertificateRequestBuilder.php +++ b/src/Generated/Identity/ApiConnectors/Item/UploadClientCertificate/UploadClientCertificateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityApiConnector; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Upload a PKCS 12 format key (.pfx) to an API connector's authentication configuration. The input is a base-64 encoded value of the PKCS 12 certificate contents. This method returns an apiConnector. This API is available in the following national cloud deployments. * @param UploadClientCertificatePostRequestBody $body The request body * @param UploadClientCertificateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityapiconnector-uploadclientcertificate?view=graph-rest-1.0 Find more info here */ public function post(UploadClientCertificatePostRequestBody $body, ?UploadClientCertificateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(UploadClientCertificatePostRequestBody $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/B2xUserFlowsRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/B2xUserFlowsRequestBuilder.php index 16b047dc286..dbe27e6e755 100644 --- a/src/Generated/Identity/B2xUserFlows/B2xUserFlowsRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/B2xUserFlowsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\B2xIdentityUserFlowItemRequestBuilder; use Microsoft\Graph\Generated\Models\B2xIdentityUserFlow; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of b2xIdentityUserFlow objects. This API is available in the following national cloud deployments. * @param B2xUserFlowsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitycontainer-list-b2xuserflows?view=graph-rest-1.0 Find more info here */ public function get(?B2xUserFlowsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [B2xIdentityUserFlowCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [B2xIdentityUserFlowCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new b2xIdentityUserFlow object. This API is available in the following national cloud deployments. * @param B2xIdentityUserFlow $body The request body * @param B2xUserFlowsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitycontainer-post-b2xuserflows?view=graph-rest-1.0 Find more info here */ public function post(B2xIdentityUserFlow $body, ?B2xUserFlowsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [B2xIdentityUserFlow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [B2xIdentityUserFlow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?B2xUserFlowsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?B2xUserFlowsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(B2xIdentityUserFlow $body, ?B2xUserFlow $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Count/CountRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Count/CountRequestBuilder.php index 08f9d552501..bc85316d57f 100644 --- a/src/Generated/Identity/B2xUserFlows/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/ApiConnectorConfigurationRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/ApiConnectorConfigurationRequestBuilder.php index bcba485f7cd..427424d296c 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/ApiConnectorConfigurationRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/ApiConnectorConfigurationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\ApiConnectorConfiguration\PostAttributeCollection\PostAttributeCollectionRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\ApiConnectorConfiguration\PostFederationSignup\PostFederationSignupRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Configuration for enabling an API connector for use as part of the self-service sign-up user flow. You can only obtain the value of this object using Get userFlowApiConnectorConfiguration. * @param ApiConnectorConfigurationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ApiConnectorConfigurationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserFlowApiConnectorConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserFlowApiConnectorConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?ApiConnectorConfigurationRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ApiConnectorConfigurationRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostAttributeCollection/PostAttributeCollectionRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostAttributeCollection/PostAttributeCollectionRequestBuilder.php index 19d359f4a42..9fb6d4c2155 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostAttributeCollection/PostAttributeCollectionRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostAttributeCollection/PostAttributeCollectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\ApiConnectorConfiguration\PostAttributeCollection\Ref\RefRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\ApiConnectorConfiguration\PostAttributeCollection\UploadClientCertificate\UploadClientCertificateRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityApiConnector; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property postAttributeCollection for identity * @param PostAttributeCollectionRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PostAttributeCollectionRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get postAttributeCollection from identity * @param PostAttributeCollectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PostAttributeCollectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property postAttributeCollection in identity * @param IdentityApiConnector $body The request body * @param PostAttributeCollectionRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(IdentityApiConnector $body, ?PostAttributeCollectionRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?PostAttributeCollectionRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?PostAttributeCollectionRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?PostAttributeCollectionRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(IdentityApiConnector $body, ?PostAttri $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostAttributeCollection/Ref/RefRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostAttributeCollection/Ref/RefRequestBuilder.php index f80422a01ac..fee414c116c 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostAttributeCollection/Ref/RefRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostAttributeCollection/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceUpdate; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete ref of navigation property postAttributeCollection for identity * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get ref of postAttributeCollection from identity * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'string', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'string', $errorMappings); + return $result; } /** * Update the ref of navigation property postAttributeCollection in identity * @param ReferenceUpdate $body The request body * @param RefRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(ReferenceUpdate $body, ?RefRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -100,6 +92,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,11 +106,11 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,6 +129,7 @@ public function toPutRequestInformation(ReferenceUpdate $body, ?RefRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostAttributeCollection/UploadClientCertificate/UploadClientCertificateRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostAttributeCollection/UploadClientCertificate/UploadClientCertificateRequestBuilder.php index 73d37b9aba1..1cb744f00c6 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostAttributeCollection/UploadClientCertificate/UploadClientCertificateRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostAttributeCollection/UploadClientCertificate/UploadClientCertificateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityApiConnector; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Upload a PKCS 12 format key (.pfx) to an API connector's authentication configuration. The input is a base-64 encoded value of the PKCS 12 certificate contents. This method returns an apiConnector. This API is available in the following national cloud deployments. * @param UploadClientCertificatePostRequestBody $body The request body * @param UploadClientCertificateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityapiconnector-uploadclientcertificate?view=graph-rest-1.0 Find more info here */ public function post(UploadClientCertificatePostRequestBody $body, ?UploadClientCertificateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(UploadClientCertificatePostRequestBody $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostFederationSignup/PostFederationSignupRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostFederationSignup/PostFederationSignupRequestBuilder.php index ec053196e0f..f33551559d5 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostFederationSignup/PostFederationSignupRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostFederationSignup/PostFederationSignupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\ApiConnectorConfiguration\PostFederationSignup\Ref\RefRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\ApiConnectorConfiguration\PostFederationSignup\UploadClientCertificate\UploadClientCertificateRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityApiConnector; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property postFederationSignup for identity * @param PostFederationSignupRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PostFederationSignupRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get postFederationSignup from identity * @param PostFederationSignupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PostFederationSignupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property postFederationSignup in identity * @param IdentityApiConnector $body The request body * @param PostFederationSignupRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(IdentityApiConnector $body, ?PostFederationSignupRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?PostFederationSignupRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?PostFederationSignupRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?PostFederationSignupRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(IdentityApiConnector $body, ?PostFeder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostFederationSignup/Ref/RefRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostFederationSignup/Ref/RefRequestBuilder.php index 4b3260fdf46..b585594ac8c 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostFederationSignup/Ref/RefRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostFederationSignup/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceUpdate; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete ref of navigation property postFederationSignup for identity * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get ref of postFederationSignup from identity * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'string', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'string', $errorMappings); + return $result; } /** * Update the ref of navigation property postFederationSignup in identity * @param ReferenceUpdate $body The request body * @param RefRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(ReferenceUpdate $body, ?RefRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -100,6 +92,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,11 +106,11 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,6 +129,7 @@ public function toPutRequestInformation(ReferenceUpdate $body, ?RefRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostFederationSignup/UploadClientCertificate/UploadClientCertificateRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostFederationSignup/UploadClientCertificate/UploadClientCertificateRequestBuilder.php index 4a2a30e3f69..d44b345b39d 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostFederationSignup/UploadClientCertificate/UploadClientCertificateRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/ApiConnectorConfiguration/PostFederationSignup/UploadClientCertificate/UploadClientCertificateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityApiConnector; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Upload a PKCS 12 format key (.pfx) to an API connector's authentication configuration. The input is a base-64 encoded value of the PKCS 12 certificate contents. This method returns an apiConnector. This API is available in the following national cloud deployments. * @param UploadClientCertificatePostRequestBody $body The request body * @param UploadClientCertificateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityapiconnector-uploadclientcertificate?view=graph-rest-1.0 Find more info here */ public function post(UploadClientCertificatePostRequestBody $body, ?UploadClientCertificateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityApiConnector::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(UploadClientCertificatePostRequestBody $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/B2xIdentityUserFlowItemRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/B2xIdentityUserFlowItemRequestBuilder.php index 029957d2d91..299e19abec3 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/B2xIdentityUserFlowItemRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/B2xIdentityUserFlowItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\ApiConnectorConfiguration\ApiConnectorConfigurationRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\IdentityProviders\IdentityProvidersRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\Languages\LanguagesRequestBuilder; @@ -74,58 +73,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a b2xIdentityUserFlow object. This API is available in the following national cloud deployments. * @param B2xIdentityUserFlowItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/b2xidentityuserflow-delete?view=graph-rest-1.0 Find more info here */ public function delete(?B2xIdentityUserFlowItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a b2xIdentityUserFlow object. This API is available in the following national cloud deployments. * @param B2xIdentityUserFlowItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/b2xidentityuserflow-get?view=graph-rest-1.0 Find more info here */ public function get(?B2xIdentityUserFlowItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [B2xIdentityUserFlow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [B2xIdentityUserFlow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property b2xUserFlows in identity * @param B2xIdentityUserFlow $body The request body * @param B2xIdentityUserFlowItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(B2xIdentityUserFlow $body, ?B2xIdentityUserFlowItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [B2xIdentityUserFlow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [B2xIdentityUserFlow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -142,6 +132,7 @@ public function toDeleteRequestInformation(?B2xIdentityUserFlowItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -155,7 +146,6 @@ public function toGetRequestInformation(?B2xIdentityUserFlowItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -163,6 +153,7 @@ public function toGetRequestInformation(?B2xIdentityUserFlowItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -177,11 +168,11 @@ public function toPatchRequestInformation(B2xIdentityUserFlow $body, ?B2xIdentit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/IdentityProviders/Count/CountRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/IdentityProviders/Count/CountRequestBuilder.php index 38e68902e4e..7e486c36930 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/IdentityProviders/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/IdentityProviders/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/IdentityProviders/IdentityProvidersRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/IdentityProviders/IdentityProvidersRequestBuilder.php index 6259986b78e..327a25713da 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/IdentityProviders/IdentityProvidersRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/IdentityProviders/IdentityProvidersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\IdentityProviders\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\IdentityProviders\Item\IdentityProviderItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityProviderCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the identity providers in a b2xIdentityUserFlow object. This API is available in the following national cloud deployments. * @param IdentityProvidersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/b2xidentityuserflow-list-identityproviders?view=graph-rest-1.0 Find more info here */ public function get(?IdentityProvidersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?IdentityProvidersRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?IdentityProvidersRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/IdentityProviders/Item/IdentityProviderItemRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/IdentityProviders/Item/IdentityProviderItemRequestBuilder.php index a4df4025574..738bf1e1428 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/IdentityProviders/Item/IdentityProviderItemRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/IdentityProviders/Item/IdentityProviderItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityProvider; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an identity provider from a b2xIdentityUserFlow object. For self-service sign-up user flows, the values can be Google-OAUTH or Facebook-OAUTH. * @param IdentityProviderItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/b2xidentityuserflow-delete-identityproviders?view=graph-rest-1.0 Find more info here */ public function delete(?IdentityProviderItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The identity providers included in the user flow. * @param IdentityProviderItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IdentityProviderItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProvider::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProvider::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?IdentityProviderItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?IdentityProviderItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?IdentityProviderItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/Languages/Count/CountRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/Languages/Count/CountRequestBuilder.php index 7d7a7e86ca6..0b866ca449e 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/Languages/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/Languages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/Count/CountRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/Count/CountRequestBuilder.php index 1bb6dfa71e3..bdc27d7a1ec 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/DefaultPagesRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/DefaultPagesRequestBuilder.php index 167d700b5af..a9226d73d9d 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/DefaultPagesRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/DefaultPagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\Languages\Item\DefaultPages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\Languages\Item\DefaultPages\Item\UserFlowLanguagePageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of pages with the default content to display in a user flow for a specified language. This collection doesn't allow any kind of modification. * @param DefaultPagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DefaultPagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to defaultPages for identity * @param UserFlowLanguagePage $body The request body * @param DefaultPagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserFlowLanguagePage $body, ?DefaultPagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DefaultPagesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DefaultPagesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UserFlowLanguagePage $body, ?DefaultPag $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/Item/UserFlowLanguagePageItemRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/Item/UserFlowLanguagePageItemRequestBuilder.php index 6f7f0676a3c..d3e6c9db016 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/Item/UserFlowLanguagePageItemRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/Item/UserFlowLanguagePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\Languages\Item\DefaultPages\Item\Value\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserFlowLanguagePage; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property defaultPages for identity * @param UserFlowLanguagePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserFlowLanguagePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Collection of pages with the default content to display in a user flow for a specified language. This collection doesn't allow any kind of modification. * @param UserFlowLanguagePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserFlowLanguagePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property defaultPages in identity * @param UserFlowLanguagePage $body The request body * @param UserFlowLanguagePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserFlowLanguagePage $body, ?UserFlowLanguagePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?UserFlowLanguagePageItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?UserFlowLanguagePageItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?UserFlowLanguagePageItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(UserFlowLanguagePage $body, ?UserFlowL $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/Item/Value/ContentRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/Item/Value/ContentRequestBuilder.php index 567fa2c8f05..1cd360f72ea 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/DefaultPages/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,38 +33,36 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property defaultPages from identity * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property defaultPages in identity * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -82,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -100,7 +98,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/Count/CountRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/Count/CountRequestBuilder.php index 710a0f70520..8afbf81c8b7 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/Item/UserFlowLanguagePageItemRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/Item/UserFlowLanguagePageItemRequestBuilder.php index 09e9656676a..5e98f5d227d 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/Item/UserFlowLanguagePageItemRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/Item/UserFlowLanguagePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\Languages\Item\OverridesPages\Item\Value\ContentRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserFlowLanguagePage; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property overridesPages for identity * @param UserFlowLanguagePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserFlowLanguagePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Collection of pages with the overrides messages to display in a user flow for a specified language. This collection only allows you to modify the content of the page, any other modification isn't allowed (creation or deletion of pages). * @param UserFlowLanguagePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserFlowLanguagePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property overridesPages in identity * @param UserFlowLanguagePage $body The request body * @param UserFlowLanguagePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserFlowLanguagePage $body, ?UserFlowLanguagePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?UserFlowLanguagePageItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?UserFlowLanguagePageItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?UserFlowLanguagePageItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(UserFlowLanguagePage $body, ?UserFlowL $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/Item/Value/ContentRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/Item/Value/ContentRequestBuilder.php index 92d024326b1..d44d37443eb 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property overridesPages from identity * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/userflowlanguageconfiguration-list-overridespages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property overridesPages in identity * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/OverridesPagesRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/OverridesPagesRequestBuilder.php index e8323385986..7817882a051 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/OverridesPagesRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/OverridesPages/OverridesPagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\Languages\Item\OverridesPages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\Languages\Item\OverridesPages\Item\UserFlowLanguagePageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the userFlowLanguagePage resources from the overridesPages navigation property. These pages are used to customize the values shown to the user during a user journey in a user flow. This API is available in the following national cloud deployments. * @param OverridesPagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/userflowlanguageconfiguration-list-overridespages?view=graph-rest-1.0 Find more info here */ public function get(?OverridesPagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to overridesPages for identity * @param UserFlowLanguagePage $body The request body * @param OverridesPagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserFlowLanguagePage $body, ?OverridesPagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguagePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?OverridesPagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?OverridesPagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(UserFlowLanguagePage $body, ?OverridesP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/UserFlowLanguageConfigurationItemRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/UserFlowLanguageConfigurationItemRequestBuilder.php index a1714fb25f8..0ee92d604a4 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/UserFlowLanguageConfigurationItemRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/UserFlowLanguageConfigurationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\Languages\Item\DefaultPages\DefaultPagesRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\Languages\Item\OverridesPages\OverridesPagesRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property languages for identity * @param UserFlowLanguageConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserFlowLanguageConfigurationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read the properties and relationships of a userFlowLanguageConfiguration object. These objects represent a language available in a user flow. Note: Language customization is enabled by default in Azure Active Directory user flows. This API is available in the following national cloud deployments. + * Read the properties and relationships of a userFlowLanguageConfiguration object. These objects represent a language available in a user flow. Note: Language customization is enabled by default in Microsoft Entra user flows. This API is available in the following national cloud deployments. * @param UserFlowLanguageConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/userflowlanguageconfiguration-get?view=graph-rest-1.0 Find more info here */ public function get(?UserFlowLanguageConfigurationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguageConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguageConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property languages in identity * @param UserFlowLanguageConfiguration $body The request body * @param UserFlowLanguageConfigurationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserFlowLanguageConfiguration $body, ?UserFlowLanguageConfigurationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguageConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguageConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,11 +107,12 @@ public function toDeleteRequestInformation(?UserFlowLanguageConfigurationItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read the properties and relationships of a userFlowLanguageConfiguration object. These objects represent a language available in a user flow. Note: Language customization is enabled by default in Azure Active Directory user flows. This API is available in the following national cloud deployments. + * Read the properties and relationships of a userFlowLanguageConfiguration object. These objects represent a language available in a user flow. Note: Language customization is enabled by default in Microsoft Entra user flows. This API is available in the following national cloud deployments. * @param UserFlowLanguageConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -130,7 +121,6 @@ public function toGetRequestInformation(?UserFlowLanguageConfigurationItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?UserFlowLanguageConfigurationItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(UserFlowLanguageConfiguration $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/UserFlowLanguageConfigurationItemRequestBuilderGetQueryParameters.php b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/UserFlowLanguageConfigurationItemRequestBuilderGetQueryParameters.php index 3bf416b07a9..6effb58b362 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/UserFlowLanguageConfigurationItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Identity/B2xUserFlows/Item/Languages/Item/UserFlowLanguageConfigurationItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read the properties and relationships of a userFlowLanguageConfiguration object. These objects represent a language available in a user flow. Note: Language customization is enabled by default in Azure Active Directory user flows. This API is available in the following national cloud deployments. + * Read the properties and relationships of a userFlowLanguageConfiguration object. These objects represent a language available in a user flow. Note: Language customization is enabled by default in Microsoft Entra user flows. This API is available in the following national cloud deployments. */ class UserFlowLanguageConfigurationItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Identity/B2xUserFlows/Item/Languages/LanguagesRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/Languages/LanguagesRequestBuilder.php index b44a75e8c42..faea22c7c58 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/Languages/LanguagesRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/Languages/LanguagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\Languages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\Languages\Item\UserFlowLanguageConfigurationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of languages supported for customization in a B2X user flow. This API is available in the following national cloud deployments. * @param LanguagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/b2xidentityuserflow-list-languages?view=graph-rest-1.0 Find more info here */ public function get(?LanguagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguageConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguageConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to languages for identity * @param UserFlowLanguageConfiguration $body The request body * @param LanguagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserFlowLanguageConfiguration $body, ?LanguagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguageConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserFlowLanguageConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?LanguagesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?LanguagesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(UserFlowLanguageConfiguration $body, ?L $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/Count/CountRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/Count/CountRequestBuilder.php index d07807fede6..71fe574850b 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/GetOrder/GetOrderRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/GetOrder/GetOrderRequestBuilder.php index 9014aa3074b..24e7ed77e52 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/GetOrder/GetOrderRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/GetOrder/GetOrderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AssignmentOrder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOrder * @param GetOrderRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOrderRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AssignmentOrder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AssignmentOrder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?GetOrderRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/Item/IdentityUserFlowAttributeAssignmentItemRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/Item/IdentityUserFlowAttributeAssignmentItemRequestBuilder.php index fbb647b78c5..d127acc5bb1 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/Item/IdentityUserFlowAttributeAssignmentItemRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/Item/IdentityUserFlowAttributeAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\UserAttributeAssignments\Item\UserAttribute\UserAttributeRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityUserFlowAttributeAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an identityUserFlowAttributeAssignment object. This API is available in the following national cloud deployments. * @param IdentityUserFlowAttributeAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityuserflowattributeassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?IdentityUserFlowAttributeAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an identityUserFlowAttributeAssignment object. This API is available in the following national cloud deployments. * @param IdentityUserFlowAttributeAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityuserflowattributeassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?IdentityUserFlowAttributeAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttributeAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttributeAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a identityUserFlowAttributeAssignment object. This API is available in the following national cloud deployments. * @param IdentityUserFlowAttributeAssignment $body The request body * @param IdentityUserFlowAttributeAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityuserflowattributeassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(IdentityUserFlowAttributeAssignment $body, ?IdentityUserFlowAttributeAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttributeAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttributeAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?IdentityUserFlowAttributeAssignmentI $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?IdentityUserFlowAttributeAssignmentItem $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?IdentityUserFlowAttributeAssignmentItem } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(IdentityUserFlowAttributeAssignment $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/Item/UserAttribute/UserAttributeRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/Item/UserAttribute/UserAttributeRequestBuilder.php index 7772ca1c29f..3b76548a129 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/Item/UserAttribute/UserAttributeRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/Item/UserAttribute/UserAttributeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityUserFlowAttribute; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The user attribute that you want to add to your user flow. * @param UserAttributeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserAttributeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttribute::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttribute::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?UserAttributeRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?UserAttributeRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/SetOrder/SetOrderRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/SetOrder/SetOrderRequestBuilder.php index 3c83c494ba1..5f2781f3eb6 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/SetOrder/SetOrderRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/SetOrder/SetOrderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Set the order of identityUserFlowAttributeAssignments being collected within a user flow. This API is available in the following national cloud deployments. * @param SetOrderPostRequestBody $body The request body * @param SetOrderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityuserflowattributeassignment-setorder?view=graph-rest-1.0 Find more info here */ public function post(SetOrderPostRequestBody $body, ?SetOrderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetOrderPostRequestBody $body, ?SetOrde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/UserAttributeAssignmentsRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/UserAttributeAssignmentsRequestBuilder.php index b7cde8958dc..3d2e3e81164 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/UserAttributeAssignmentsRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/UserAttributeAssignments/UserAttributeAssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\UserAttributeAssignments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\UserAttributeAssignments\GetOrder\GetOrderRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\UserAttributeAssignments\Item\IdentityUserFlowAttributeAssignmentItemRequestBuilder; @@ -71,40 +70,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the identityUserFlowAttributeAssignment resources from the userAttributeAssignments navigation property in a b2xIdentityUserFlow. This API is available in the following national cloud deployments. * @param UserAttributeAssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/b2xidentityuserflow-list-userattributeassignments?view=graph-rest-1.0 Find more info here */ public function get(?UserAttributeAssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttributeAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttributeAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new identityUserFlowAttributeAssignment object in a b2xIdentityUserFlow. This API is available in the following national cloud deployments. * @param IdentityUserFlowAttributeAssignment $body The request body * @param UserAttributeAssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/b2xidentityuserflow-post-userattributeassignments?view=graph-rest-1.0 Find more info here */ public function post(IdentityUserFlowAttributeAssignment $body, ?UserAttributeAssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttributeAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttributeAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,7 +110,6 @@ public function toGetRequestInformation(?UserAttributeAssignmentsRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -125,6 +117,7 @@ public function toGetRequestInformation(?UserAttributeAssignmentsRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -139,11 +132,11 @@ public function toPostRequestInformation(IdentityUserFlowAttributeAssignment $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/Count/CountRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/Count/CountRequestBuilder.php index 2757e260f2b..af852a241af 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/Item/Ref/RefRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/Item/Ref/RefRequestBuilder.php index 8b9597e9e32..204e0335ea2 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete ref of navigation property userFlowIdentityProviders for identity * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/Ref/RefRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/Ref/RefRequestBuilder.php index 721e8751e0c..d905bd483b7 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/Ref/RefRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,38 +34,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get ref of userFlowIdentityProviders from identity * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property ref to userFlowIdentityProviders for identity * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -79,7 +72,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +79,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -105,6 +98,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/UserFlowIdentityProvidersRequestBuilder.php b/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/UserFlowIdentityProvidersRequestBuilder.php index 707516761bd..7cb9777748b 100644 --- a/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/UserFlowIdentityProvidersRequestBuilder.php +++ b/src/Generated/Identity/B2xUserFlows/Item/UserFlowIdentityProviders/UserFlowIdentityProvidersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\UserFlowIdentityProviders\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\UserFlowIdentityProviders\Item\IdentityProviderBaseItemRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\Item\UserFlowIdentityProviders\Ref\RefRequestBuilder; @@ -62,19 +61,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get userFlowIdentityProviders from identity * @param UserFlowIdentityProvidersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserFlowIdentityProvidersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -87,7 +83,6 @@ public function toGetRequestInformation(?UserFlowIdentityProvidersRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -95,6 +90,7 @@ public function toGetRequestInformation(?UserFlowIdentityProvidersRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationContextClassReferences/AuthenticationContextClassReferencesRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationContextClassReferences/AuthenticationContextClassReferencesRequestBuilder.php index 1ba204716e7..6edf8b3c1e3 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationContextClassReferences/AuthenticationContextClassReferencesRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationContextClassReferences/AuthenticationContextClassReferencesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationContextClassReferences\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationContextClassReferences\Item\AuthenticationContextClassReferenceItemRequestBuilder; use Microsoft\Graph\Generated\Models\AuthenticationContextClassReference; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of authenticationContextClassReference objects. This API is available in the following national cloud deployments. * @param AuthenticationContextClassReferencesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conditionalaccessroot-list-authenticationcontextclassreferences?view=graph-rest-1.0 Find more info here */ public function get(?AuthenticationContextClassReferencesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationContextClassReferenceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationContextClassReferenceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to authenticationContextClassReferences for identity * @param AuthenticationContextClassReference $body The request body * @param AuthenticationContextClassReferencesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AuthenticationContextClassReference $body, ?AuthenticationContextClassReferencesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationContextClassReference::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationContextClassReference::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?AuthenticationContextClassReferencesReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?AuthenticationContextClassReferencesReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AuthenticationContextClassReference $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationContextClassReferences/Count/CountRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationContextClassReferences/Count/CountRequestBuilder.php index d5bb73c25a3..276a91d731a 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationContextClassReferences/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationContextClassReferences/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationContextClassReferences/Item/AuthenticationContextClassReferenceItemRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationContextClassReferences/Item/AuthenticationContextClassReferenceItemRequestBuilder.php index f4c06ae7aea..2a09ff88bd7 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationContextClassReferences/Item/AuthenticationContextClassReferenceItemRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationContextClassReferences/Item/AuthenticationContextClassReferenceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationContextClassReference; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an authenticationContextClassReference object that's not published or used by a conditional access policy. This API is available in the following national cloud deployments. * @param AuthenticationContextClassReferenceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationcontextclassreference-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AuthenticationContextClassReferenceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a authenticationContextClassReference object. This API is available in the following national cloud deployments. * @param AuthenticationContextClassReferenceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationcontextclassreference-get?view=graph-rest-1.0 Find more info here */ public function get(?AuthenticationContextClassReferenceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationContextClassReference::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationContextClassReference::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an authenticationContextClassReference object, if the ID has not been used. If ID has been used, this call updates the authenticationContextClassReference object. This API is available in the following national cloud deployments. * @param AuthenticationContextClassReference $body The request body * @param AuthenticationContextClassReferenceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationcontextclassreference-update?view=graph-rest-1.0 Find more info here */ public function patch(AuthenticationContextClassReference $body, ?AuthenticationContextClassReferenceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationContextClassReference::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationContextClassReference::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?AuthenticationContextClassReferenceI $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?AuthenticationContextClassReferenceItem $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?AuthenticationContextClassReferenceItem } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(AuthenticationContextClassReference $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationMethodModes/AuthenticationMethodModesRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationMethodModes/AuthenticationMethodModesRequestBuilder.php index 22231df47c2..f91fed9c08d 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationMethodModes/AuthenticationMethodModesRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationMethodModes/AuthenticationMethodModesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationStrength\AuthenticationMethodModes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationStrength\AuthenticationMethodModes\Item\AuthenticationMethodModeDetailItemRequestBuilder; use Microsoft\Graph\Generated\Models\AuthenticationMethodModeDetail; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of all supported authentication methods, or all supported authentication method combinations as a list of authenticationMethodModes objects and their properties. This API is available in the following national cloud deployments. * @param AuthenticationMethodModesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthroot-list-authenticationmethodmodes?view=graph-rest-1.0 Find more info here */ public function get(?AuthenticationMethodModesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodModeDetailCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodModeDetailCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to authenticationMethodModes for identity * @param AuthenticationMethodModeDetail $body The request body * @param AuthenticationMethodModesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AuthenticationMethodModeDetail $body, ?AuthenticationMethodModesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodModeDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodModeDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?AuthenticationMethodModesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?AuthenticationMethodModesRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AuthenticationMethodModeDetail $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationMethodModes/Count/CountRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationMethodModes/Count/CountRequestBuilder.php index 652298d6fa3..3a4eea445d7 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationMethodModes/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationMethodModes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationMethodModes/Item/AuthenticationMethodModeDetailItemRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationMethodModes/Item/AuthenticationMethodModeDetailItemRequestBuilder.php index 9cecfdff88f..2474120caa2 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationMethodModes/Item/AuthenticationMethodModeDetailItemRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationMethodModes/Item/AuthenticationMethodModeDetailItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationMethodModeDetail; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property authenticationMethodModes for identity * @param AuthenticationMethodModeDetailItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AuthenticationMethodModeDetailItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Names and descriptions of all valid authentication method modes in the system. * @param AuthenticationMethodModeDetailItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthenticationMethodModeDetailItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodModeDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodModeDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property authenticationMethodModes in identity * @param AuthenticationMethodModeDetail $body The request body * @param AuthenticationMethodModeDetailItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AuthenticationMethodModeDetail $body, ?AuthenticationMethodModeDetailItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodModeDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodModeDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AuthenticationMethodModeDetailItemRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AuthenticationMethodModeDetailItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AuthenticationMethodModeDetailItemReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AuthenticationMethodModeDetail $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationStrengthRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationStrengthRequestBuilder.php index bfee0fdbaef..293b02f91e0 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationStrengthRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/AuthenticationStrengthRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationStrength\AuthenticationMethodModes\AuthenticationMethodModesRequestBuilder; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationStrength\Policies\PoliciesRequestBuilder; use Microsoft\Graph\Generated\Models\AuthenticationStrengthRoot; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property authenticationStrength for identity * @param AuthenticationStrengthRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AuthenticationStrengthRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get authenticationStrength from identity * @param AuthenticationStrengthRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthenticationStrengthRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property authenticationStrength in identity * @param AuthenticationStrengthRoot $body The request body * @param AuthenticationStrengthRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AuthenticationStrengthRoot $body, ?AuthenticationStrengthRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?AuthenticationStrengthRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?AuthenticationStrengthRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?AuthenticationStrengthRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AuthenticationStrengthRoot $body, ?Aut $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Count/CountRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Count/CountRequestBuilder.php index a5ab2ef0661..d135b85dd14 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/AuthenticationStrengthPolicyItemRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/AuthenticationStrengthPolicyItemRequestBuilder.php index f3fa6015f74..7e7c413dab2 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/AuthenticationStrengthPolicyItemRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/AuthenticationStrengthPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationStrength\Policies\Item\CombinationConfigurations\CombinationConfigurationsRequestBuilder; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationStrength\Policies\Item\UpdateAllowedCombinations\UpdateAllowedCombinationsRequestBuilder; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationStrength\Policies\Item\Usage\UsageRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property policies for identity * @param AuthenticationStrengthPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AuthenticationStrengthPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of authentication strength policies that exist for this tenant, including both built-in and custom policies. * @param AuthenticationStrengthPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthenticationStrengthPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property policies in identity * @param AuthenticationStrengthPolicy $body The request body * @param AuthenticationStrengthPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AuthenticationStrengthPolicy $body, ?AuthenticationStrengthPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?AuthenticationStrengthPolicyItemRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?AuthenticationStrengthPolicyItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?AuthenticationStrengthPolicyItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AuthenticationStrengthPolicy $body, ?A $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/CombinationConfigurations/CombinationConfigurationsRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/CombinationConfigurations/CombinationConfigurationsRequestBuilder.php index f95bb66009d..b4075b4da14 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/CombinationConfigurations/CombinationConfigurationsRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/CombinationConfigurations/CombinationConfigurationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationStrength\Policies\Item\CombinationConfigurations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationStrength\Policies\Item\CombinationConfigurations\Item\AuthenticationCombinationConfigurationItemRequestBuilder; use Microsoft\Graph\Generated\Models\AuthenticationCombinationConfiguration; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the authenticationCombinationConfiguration objects for an authentication strength policy. authenticationCombinationConfiguration represents requirements placed on specific authentication method combinations that require specified variants of those authentication methods to be used when authenticating. Currently, only fido2combinationConfigurations objects are supported. authenticationCombinationConfiguration objects are supported only for custom authentication strengths. This API is available in the following national cloud deployments. * @param CombinationConfigurationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthpolicy-list-combinationconfigurations?view=graph-rest-1.0 Find more info here */ public function get(?CombinationConfigurationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new authenticationCombinationConfiguration object. In use, only fido2combinationConfigurations may be created, and these may only be created for custom authentication strength policies. This API is available in the following national cloud deployments. * @param AuthenticationCombinationConfiguration $body The request body * @param CombinationConfigurationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthpolicy-post-combinationconfigurations?view=graph-rest-1.0 Find more info here */ public function post(AuthenticationCombinationConfiguration $body, ?CombinationConfigurationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CombinationConfigurationsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CombinationConfigurationsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AuthenticationCombinationConfiguration $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/CombinationConfigurations/Count/CountRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/CombinationConfigurations/Count/CountRequestBuilder.php index 37caf2c5a36..984c1685162 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/CombinationConfigurations/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/CombinationConfigurations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/CombinationConfigurations/Item/AuthenticationCombinationConfigurationItemRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/CombinationConfigurations/Item/AuthenticationCombinationConfigurationItemRequestBuilder.php index d841a298f57..908d90d873b 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/CombinationConfigurations/Item/AuthenticationCombinationConfigurationItemRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/CombinationConfigurations/Item/AuthenticationCombinationConfigurationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationCombinationConfiguration; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an authenticationCombinationConfiguration for a custom authenticationStrengthPolicy object. This API is available in the following national cloud deployments. * @param AuthenticationCombinationConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthpolicy-delete-combinationconfigurations?view=graph-rest-1.0 Find more info here */ public function delete(?AuthenticationCombinationConfigurationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an authenticationCombinationConfiguration object. This API is available in the following national cloud deployments. * @param AuthenticationCombinationConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationcombinationconfiguration-get?view=graph-rest-1.0 Find more info here */ public function get(?AuthenticationCombinationConfigurationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an authenticationCombinationConfiguration object. In use, only fido2combinationConfigurations may be updated as they're the only type of authenticationCombinationConfiguration that may be created. This API is available in the following national cloud deployments. * @param AuthenticationCombinationConfiguration $body The request body * @param AuthenticationCombinationConfigurationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationcombinationconfiguration-update?view=graph-rest-1.0 Find more info here */ public function patch(AuthenticationCombinationConfiguration $body, ?AuthenticationCombinationConfigurationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?AuthenticationCombinationConfigurati $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?AuthenticationCombinationConfigurationI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?AuthenticationCombinationConfigurationI } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(AuthenticationCombinationConfiguration $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/UpdateAllowedCombinations/UpdateAllowedCombinationsRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/UpdateAllowedCombinations/UpdateAllowedCombinationsRequestBuilder.php index 556c1502f2c..f81d5ce8e91 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/UpdateAllowedCombinations/UpdateAllowedCombinationsRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/UpdateAllowedCombinations/UpdateAllowedCombinationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UpdateAllowedCombinationsResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Update the allowedCombinations property of an authenticationStrengthPolicy object. To update other properties of an authenticationStrengthPolicy object, use the Update authenticationStrengthPolicy method. This API is available in the following national cloud deployments. * @param UpdateAllowedCombinationsPostRequestBody $body The request body * @param UpdateAllowedCombinationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthpolicy-updateallowedcombinations?view=graph-rest-1.0 Find more info here */ public function post(UpdateAllowedCombinationsPostRequestBody $body, ?UpdateAllowedCombinationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UpdateAllowedCombinationsResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UpdateAllowedCombinationsResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(UpdateAllowedCombinationsPostRequestBod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/Usage/UsageRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/Usage/UsageRequestBuilder.php index 374b51fe32f..204a99c5c6f 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/Usage/UsageRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/Item/Usage/UsageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationStrengthUsage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function usage * @param UsageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UsageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthUsage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthUsage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?UsageRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/PoliciesRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/PoliciesRequestBuilder.php index fbd860cf894..770f33301da 100644 --- a/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/PoliciesRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/AuthenticationStrength/Policies/PoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationStrength\Policies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationStrength\Policies\Item\AuthenticationStrengthPolicyItemRequestBuilder; use Microsoft\Graph\Generated\Models\AuthenticationStrengthPolicy; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A collection of authentication strength policies that exist for this tenant, including both built-in and custom policies. * @param PoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to policies for identity * @param AuthenticationStrengthPolicy $body The request body * @param PoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AuthenticationStrengthPolicy $body, ?PoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?PoliciesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?PoliciesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AuthenticationStrengthPolicy $body, ?Po $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/ConditionalAccessRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/ConditionalAccessRequestBuilder.php index dec7b5953a9..22a5a1841ca 100644 --- a/src/Generated/Identity/ConditionalAccess/ConditionalAccessRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/ConditionalAccessRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationContextClassReferences\AuthenticationContextClassReferencesRequestBuilder; use Microsoft\Graph\Generated\Identity\ConditionalAccess\AuthenticationStrength\AuthenticationStrengthRequestBuilder; use Microsoft\Graph\Generated\Identity\ConditionalAccess\NamedLocations\NamedLocationsRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property conditionalAccess for identity * @param ConditionalAccessRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ConditionalAccessRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * the entry point for the Conditional Access (CA) object model. * @param ConditionalAccessRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ConditionalAccessRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property conditionalAccess in identity * @param ConditionalAccessRoot $body The request body * @param ConditionalAccessRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ConditionalAccessRoot $body, ?ConditionalAccessRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?ConditionalAccessRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?ConditionalAccessRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?ConditionalAccessRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(ConditionalAccessRoot $body, ?Conditio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/NamedLocations/Count/CountRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/NamedLocations/Count/CountRequestBuilder.php index e69b4e78e53..3149bf0ed9d 100644 --- a/src/Generated/Identity/ConditionalAccess/NamedLocations/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/NamedLocations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/NamedLocations/Item/NamedLocationItemRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/NamedLocations/Item/NamedLocationItemRequestBuilder.php index 1e11369e344..30f30b769d0 100644 --- a/src/Generated/Identity/ConditionalAccess/NamedLocations/Item/NamedLocationItemRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/NamedLocations/Item/NamedLocationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\NamedLocation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,65 +31,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Delete a namedLocation object. This API is available in the following national cloud deployments. + * Delete a countryNamedLocation object. This API is available in the following national cloud deployments. * @param NamedLocationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/namedlocation-delete?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/countrynamedlocation-delete?view=graph-rest-1.0 Find more info here */ public function delete(?NamedLocationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Retrieve the properties and relationships of a namedLocation object. This API is available in the following national cloud deployments. + * Retrieve the properties and relationships of an ipNamedLocation object. This API is available in the following national cloud deployments. * @param NamedLocationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/namedlocation-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/ipnamedlocation-get?view=graph-rest-1.0 Find more info here */ public function get(?NamedLocationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [NamedLocation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [NamedLocation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update the properties of a countryNamedLocation object. This API is available in the following national cloud deployments. + * Update the properties of an ipNamedLocation object. This API is available in the following national cloud deployments. * @param NamedLocation $body The request body * @param NamedLocationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/countrynamedlocation-update?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/ipnamedlocation-update?view=graph-rest-1.0 Find more info here */ public function patch(NamedLocation $body, ?NamedLocationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [NamedLocation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [NamedLocation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Delete a namedLocation object. This API is available in the following national cloud deployments. + * Delete a countryNamedLocation object. This API is available in the following national cloud deployments. * @param NamedLocationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -103,11 +93,12 @@ public function toDeleteRequestInformation(?NamedLocationItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Retrieve the properties and relationships of a namedLocation object. This API is available in the following national cloud deployments. + * Retrieve the properties and relationships of an ipNamedLocation object. This API is available in the following national cloud deployments. * @param NamedLocationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -116,7 +107,6 @@ public function toGetRequestInformation(?NamedLocationItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,11 +114,12 @@ public function toGetRequestInformation(?NamedLocationItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the properties of a countryNamedLocation object. This API is available in the following national cloud deployments. + * Update the properties of an ipNamedLocation object. This API is available in the following national cloud deployments. * @param NamedLocation $body The request body * @param NamedLocationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -138,11 +129,11 @@ public function toPatchRequestInformation(NamedLocation $body, ?NamedLocationIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/NamedLocations/Item/NamedLocationItemRequestBuilderGetQueryParameters.php b/src/Generated/Identity/ConditionalAccess/NamedLocations/Item/NamedLocationItemRequestBuilderGetQueryParameters.php index 1b4d9e4109a..3b1f9dc1e9b 100644 --- a/src/Generated/Identity/ConditionalAccess/NamedLocations/Item/NamedLocationItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Identity/ConditionalAccess/NamedLocations/Item/NamedLocationItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the properties and relationships of a namedLocation object. This API is available in the following national cloud deployments. + * Retrieve the properties and relationships of an ipNamedLocation object. This API is available in the following national cloud deployments. */ class NamedLocationItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Identity/ConditionalAccess/NamedLocations/NamedLocationsRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/NamedLocations/NamedLocationsRequestBuilder.php index 213fdeb85c6..99c7b273264 100644 --- a/src/Generated/Identity/ConditionalAccess/NamedLocations/NamedLocationsRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/NamedLocations/NamedLocationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\ConditionalAccess\NamedLocations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\ConditionalAccess\NamedLocations\Item\NamedLocationItemRequestBuilder; use Microsoft\Graph\Generated\Models\NamedLocation; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of namedLocation objects. This API is available in the following national cloud deployments. * @param NamedLocationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conditionalaccessroot-list-namedlocations?view=graph-rest-1.0 Find more info here */ public function get(?NamedLocationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [NamedLocationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [NamedLocationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new namedLocation object. Named locations can be either ipNamedLocation or countryNamedLocation objects. This API is available in the following national cloud deployments. * @param NamedLocation $body The request body * @param NamedLocationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conditionalaccessroot-post-namedlocations?view=graph-rest-1.0 Find more info here */ public function post(NamedLocation $body, ?NamedLocationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [NamedLocation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [NamedLocation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?NamedLocationsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?NamedLocationsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(NamedLocation $body, ?NamedLocationsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/Policies/Count/CountRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/Policies/Count/CountRequestBuilder.php index 29ac277bf29..8cfb4872385 100644 --- a/src/Generated/Identity/ConditionalAccess/Policies/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/Policies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/Policies/Item/ConditionalAccessPolicyItemRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/Policies/Item/ConditionalAccessPolicyItemRequestBuilder.php index 6df71335e61..29f1a277bff 100644 --- a/src/Generated/Identity/ConditionalAccess/Policies/Item/ConditionalAccessPolicyItemRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/Policies/Item/ConditionalAccessPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConditionalAccessPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a conditionalAccessPolicy object. This API is available in the following national cloud deployments. * @param ConditionalAccessPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conditionalaccesspolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ConditionalAccessPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a conditionalAccessPolicy object. This API is available in the following national cloud deployments. * @param ConditionalAccessPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conditionalaccesspolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?ConditionalAccessPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a conditionalAccessPolicy object. This API is available in the following national cloud deployments. * @param ConditionalAccessPolicy $body The request body * @param ConditionalAccessPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conditionalaccesspolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(ConditionalAccessPolicy $body, ?ConditionalAccessPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ConditionalAccessPolicyItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ConditionalAccessPolicyItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ConditionalAccessPolicyItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ConditionalAccessPolicy $body, ?Condit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/Policies/PoliciesRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/Policies/PoliciesRequestBuilder.php index 6a2ad79ec71..55bb2b3666c 100644 --- a/src/Generated/Identity/ConditionalAccess/Policies/PoliciesRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/Policies/PoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\ConditionalAccess\Policies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\ConditionalAccess\Policies\Item\ConditionalAccessPolicyItemRequestBuilder; use Microsoft\Graph\Generated\Models\ConditionalAccessPolicy; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of conditionalAccessPolicy objects. This API is available in the following national cloud deployments. * @param PoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conditionalaccessroot-list-policies?view=graph-rest-1.0 Find more info here */ public function get(?PoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new conditionalAccessPolicy. This API is available in the following national cloud deployments. * @param ConditionalAccessPolicy $body The request body * @param PoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conditionalaccessroot-post-policies?view=graph-rest-1.0 Find more info here */ public function post(ConditionalAccessPolicy $body, ?PoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PoliciesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PoliciesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ConditionalAccessPolicy $body, ?Policie $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/Templates/Count/CountRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/Templates/Count/CountRequestBuilder.php index 656a38827f9..94eee7d9cd5 100644 --- a/src/Generated/Identity/ConditionalAccess/Templates/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/Templates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/Templates/Item/ConditionalAccessTemplateItemRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/Templates/Item/ConditionalAccessTemplateItemRequestBuilder.php index 9141d3256e7..505336624b9 100644 --- a/src/Generated/Identity/ConditionalAccess/Templates/Item/ConditionalAccessTemplateItemRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/Templates/Item/ConditionalAccessTemplateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConditionalAccessTemplate; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a conditionalAccessTemplate object. This API is available in the following national cloud deployments. * @param ConditionalAccessTemplateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conditionalaccesstemplate-get?view=graph-rest-1.0 Find more info here */ public function get(?ConditionalAccessTemplateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?ConditionalAccessTemplateItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?ConditionalAccessTemplateItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Identity/ConditionalAccess/Templates/TemplatesRequestBuilder.php b/src/Generated/Identity/ConditionalAccess/Templates/TemplatesRequestBuilder.php index 9ebc0c23e88..cfcdb75ed59 100644 --- a/src/Generated/Identity/ConditionalAccess/Templates/TemplatesRequestBuilder.php +++ b/src/Generated/Identity/ConditionalAccess/Templates/TemplatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\ConditionalAccess\Templates\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\ConditionalAccess\Templates\Item\ConditionalAccessTemplateItemRequestBuilder; use Microsoft\Graph\Generated\Models\ConditionalAccessTemplateCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the conditionalAccessTemplate objects and their properties. This API is available in the following national cloud deployments. * @param TemplatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conditionalaccessroot-list-templates?view=graph-rest-1.0 Find more info here */ public function get(?TemplatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?TemplatesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?TemplatesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Identity/IdentityProviders/AvailableProviderTypes/AvailableProviderTypesRequestBuilder.php b/src/Generated/Identity/IdentityProviders/AvailableProviderTypes/AvailableProviderTypesRequestBuilder.php index 01fe5fb1c7d..802fa7da2e2 100644 --- a/src/Generated/Identity/IdentityProviders/AvailableProviderTypes/AvailableProviderTypesRequestBuilder.php +++ b/src/Generated/Identity/IdentityProviders/AvailableProviderTypes/AvailableProviderTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function availableProviderTypes * @param AvailableProviderTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AvailableProviderTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AvailableProviderTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AvailableProviderTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?AvailableProviderTypesRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?AvailableProviderTypesRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Identity/IdentityProviders/Count/CountRequestBuilder.php b/src/Generated/Identity/IdentityProviders/Count/CountRequestBuilder.php index a4e24967ad2..5d9e067a831 100644 --- a/src/Generated/Identity/IdentityProviders/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/IdentityProviders/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/IdentityProviders/IdentityProvidersRequestBuilder.php b/src/Generated/Identity/IdentityProviders/IdentityProvidersRequestBuilder.php index 7a9bf58fd44..25153e2dfa7 100644 --- a/src/Generated/Identity/IdentityProviders/IdentityProvidersRequestBuilder.php +++ b/src/Generated/Identity/IdentityProviders/IdentityProvidersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\IdentityProviders\AvailableProviderTypes\AvailableProviderTypesRequestBuilder; use Microsoft\Graph\Generated\Identity\IdentityProviders\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\IdentityProviders\Item\IdentityProviderBaseItemRequestBuilder; @@ -61,46 +60,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get a collection of identity provider resources that are configured for a tenant, and that are derived from identityProviderBase. For an Azure AD tenant, the providers can be socialIdentityProviders or builtinIdentityProviders objects. For an Azure AD B2C, the providers can be socialIdentityProvider, or appleManagedIdentityProvider objects. This API is available in the following national cloud deployments. + * Get a collection of identity provider resources that are configured for a tenant, and that are derived from identityProviderBase. For a Microsoft Entra tenant, the providers can be socialIdentityProviders or builtinIdentityProviders objects. For an Azure AD B2C, the providers can be socialIdentityProvider, or appleManagedIdentityProvider objects. This API is available in the following national cloud deployments. * @param IdentityProvidersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitycontainer-list-identityproviders?view=graph-rest-1.0 Find more info here */ public function get(?IdentityProvidersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create an identity provider object that is of the type specified in the request body. Among the types of providers derived from identityProviderBase, you can currently create a socialIdentityProvider resource in Azure AD. In Azure AD B2C, this operation can currently create a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. + * Create an identity provider object that is of the type specified in the request body. Among the types of providers derived from identityProviderBase, you can currently create a socialIdentityProvider resource in Microsoft Entra ID. In Azure AD B2C, this operation can currently create a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. * @param IdentityProviderBase $body The request body * @param IdentityProvidersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitycontainer-post-identityproviders?view=graph-rest-1.0 Find more info here */ public function post(IdentityProviderBase $body, ?IdentityProvidersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get a collection of identity provider resources that are configured for a tenant, and that are derived from identityProviderBase. For an Azure AD tenant, the providers can be socialIdentityProviders or builtinIdentityProviders objects. For an Azure AD B2C, the providers can be socialIdentityProvider, or appleManagedIdentityProvider objects. This API is available in the following national cloud deployments. + * Get a collection of identity provider resources that are configured for a tenant, and that are derived from identityProviderBase. For a Microsoft Entra tenant, the providers can be socialIdentityProviders or builtinIdentityProviders objects. For an Azure AD B2C, the providers can be socialIdentityProvider, or appleManagedIdentityProvider objects. This API is available in the following national cloud deployments. * @param IdentityProvidersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -109,7 +102,6 @@ public function toGetRequestInformation(?IdentityProvidersRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,11 +109,12 @@ public function toGetRequestInformation(?IdentityProvidersRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create an identity provider object that is of the type specified in the request body. Among the types of providers derived from identityProviderBase, you can currently create a socialIdentityProvider resource in Azure AD. In Azure AD B2C, this operation can currently create a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. + * Create an identity provider object that is of the type specified in the request body. Among the types of providers derived from identityProviderBase, you can currently create a socialIdentityProvider resource in Microsoft Entra ID. In Azure AD B2C, this operation can currently create a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. * @param IdentityProviderBase $body The request body * @param IdentityProvidersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -131,11 +124,11 @@ public function toPostRequestInformation(IdentityProviderBase $body, ?IdentityPr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/IdentityProviders/IdentityProvidersRequestBuilderGetQueryParameters.php b/src/Generated/Identity/IdentityProviders/IdentityProvidersRequestBuilderGetQueryParameters.php index 0b8f561cec5..3c78aedd558 100644 --- a/src/Generated/Identity/IdentityProviders/IdentityProvidersRequestBuilderGetQueryParameters.php +++ b/src/Generated/Identity/IdentityProviders/IdentityProvidersRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get a collection of identity provider resources that are configured for a tenant, and that are derived from identityProviderBase. For an Azure AD tenant, the providers can be socialIdentityProviders or builtinIdentityProviders objects. For an Azure AD B2C, the providers can be socialIdentityProvider, or appleManagedIdentityProvider objects. This API is available in the following national cloud deployments. + * Get a collection of identity provider resources that are configured for a tenant, and that are derived from identityProviderBase. For a Microsoft Entra tenant, the providers can be socialIdentityProviders or builtinIdentityProviders objects. For an Azure AD B2C, the providers can be socialIdentityProvider, or appleManagedIdentityProvider objects. This API is available in the following national cloud deployments. */ class IdentityProvidersRequestBuilderGetQueryParameters { diff --git a/src/Generated/Identity/IdentityProviders/Item/IdentityProviderBaseItemRequestBuilder.php b/src/Generated/Identity/IdentityProviders/Item/IdentityProviderBaseItemRequestBuilder.php index d2165731910..6bb0390e5ad 100644 --- a/src/Generated/Identity/IdentityProviders/Item/IdentityProviderBaseItemRequestBuilder.php +++ b/src/Generated/Identity/IdentityProviders/Item/IdentityProviderBaseItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityProviderBase; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,65 +31,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Delete an identity provider resource that is of the type specified by the id in the request. Among the types of providers derived from identityProviderBase, you can currently delete a socialIdentityProvider resource in Azure AD. In Azure AD B2C, this operation can currently delete a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. + * Delete an identity provider resource that is of the type specified by the id in the request. Among the types of providers derived from identityProviderBase, you can currently delete a socialIdentityProvider resource in Microsoft Entra ID. In Azure AD B2C, this operation can currently delete a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. * @param IdentityProviderBaseItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityproviderbase-delete?view=graph-rest-1.0 Find more info here */ public function delete(?IdentityProviderBaseItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Get the properties and relationships of the specified identity provider configured in the tenant. Among the types of providers derived from identityProviderBase, you can currently get a socialIdentityProvider or a builtinIdentityProvider resource in Azure AD. In Azure AD B2C, this operation can currently get a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. + * Get the properties and relationships of the specified identity provider configured in the tenant. Among the types of providers derived from identityProviderBase, you can currently get a socialIdentityProvider or a builtinIdentityProvider resource in Microsoft Entra ID. In Azure AD B2C, this operation can currently get a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. * @param IdentityProviderBaseItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityproviderbase-get?view=graph-rest-1.0 Find more info here */ public function get(?IdentityProviderBaseItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update the properties of the specified identity provider configured in the tenant. Among the types of providers derived from identityProviderBase, you can currently update a socialIdentityProvider resource in Azure AD. In Azure AD B2C, this operation can currently update a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. + * Update the properties of the specified identity provider configured in the tenant. Among the types of providers derived from identityProviderBase, you can currently update a socialIdentityProvider resource in Microsoft Entra ID. In Azure AD B2C, this operation can currently update a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. * @param IdentityProviderBase $body The request body * @param IdentityProviderBaseItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityproviderbase-update?view=graph-rest-1.0 Find more info here */ public function patch(IdentityProviderBase $body, ?IdentityProviderBaseItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Delete an identity provider resource that is of the type specified by the id in the request. Among the types of providers derived from identityProviderBase, you can currently delete a socialIdentityProvider resource in Azure AD. In Azure AD B2C, this operation can currently delete a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. + * Delete an identity provider resource that is of the type specified by the id in the request. Among the types of providers derived from identityProviderBase, you can currently delete a socialIdentityProvider resource in Microsoft Entra ID. In Azure AD B2C, this operation can currently delete a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. * @param IdentityProviderBaseItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -103,11 +93,12 @@ public function toDeleteRequestInformation(?IdentityProviderBaseItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Get the properties and relationships of the specified identity provider configured in the tenant. Among the types of providers derived from identityProviderBase, you can currently get a socialIdentityProvider or a builtinIdentityProvider resource in Azure AD. In Azure AD B2C, this operation can currently get a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. + * Get the properties and relationships of the specified identity provider configured in the tenant. Among the types of providers derived from identityProviderBase, you can currently get a socialIdentityProvider or a builtinIdentityProvider resource in Microsoft Entra ID. In Azure AD B2C, this operation can currently get a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. * @param IdentityProviderBaseItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -116,7 +107,6 @@ public function toGetRequestInformation(?IdentityProviderBaseItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,11 +114,12 @@ public function toGetRequestInformation(?IdentityProviderBaseItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the properties of the specified identity provider configured in the tenant. Among the types of providers derived from identityProviderBase, you can currently update a socialIdentityProvider resource in Azure AD. In Azure AD B2C, this operation can currently update a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. + * Update the properties of the specified identity provider configured in the tenant. Among the types of providers derived from identityProviderBase, you can currently update a socialIdentityProvider resource in Microsoft Entra ID. In Azure AD B2C, this operation can currently update a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. * @param IdentityProviderBase $body The request body * @param IdentityProviderBaseItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -138,11 +129,11 @@ public function toPatchRequestInformation(IdentityProviderBase $body, ?IdentityP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/IdentityProviders/Item/IdentityProviderBaseItemRequestBuilderGetQueryParameters.php b/src/Generated/Identity/IdentityProviders/Item/IdentityProviderBaseItemRequestBuilderGetQueryParameters.php index bfb934565d1..02dc8e69ebf 100644 --- a/src/Generated/Identity/IdentityProviders/Item/IdentityProviderBaseItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Identity/IdentityProviders/Item/IdentityProviderBaseItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get the properties and relationships of the specified identity provider configured in the tenant. Among the types of providers derived from identityProviderBase, you can currently get a socialIdentityProvider or a builtinIdentityProvider resource in Azure AD. In Azure AD B2C, this operation can currently get a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. + * Get the properties and relationships of the specified identity provider configured in the tenant. Among the types of providers derived from identityProviderBase, you can currently get a socialIdentityProvider or a builtinIdentityProvider resource in Microsoft Entra ID. In Azure AD B2C, this operation can currently get a socialIdentityProvider, or an appleManagedIdentityProvider resource. This API is available in the following national cloud deployments. */ class IdentityProviderBaseItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Identity/IdentityRequestBuilder.php b/src/Generated/Identity/IdentityRequestBuilder.php index 97e5205e7c6..11b675f394a 100644 --- a/src/Generated/Identity/IdentityRequestBuilder.php +++ b/src/Generated/Identity/IdentityRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\ApiConnectors\ApiConnectorsRequestBuilder; use Microsoft\Graph\Generated\Identity\B2xUserFlows\B2xUserFlowsRequestBuilder; use Microsoft\Graph\Generated\Identity\ConditionalAccess\ConditionalAccessRequestBuilder; @@ -74,38 +73,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get identity * @param IdentityRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IdentityRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityContainer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityContainer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update identity * @param IdentityContainer $body The request body * @param IdentityRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(IdentityContainer $body, ?IdentityRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityContainer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityContainer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,7 +111,6 @@ public function toGetRequestInformation(?IdentityRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -126,6 +118,7 @@ public function toGetRequestInformation(?IdentityRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -140,11 +133,11 @@ public function toPatchRequestInformation(IdentityContainer $body, ?IdentityRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/UserFlowAttributes/Count/CountRequestBuilder.php b/src/Generated/Identity/UserFlowAttributes/Count/CountRequestBuilder.php index 8b70c52bc78..a05c04087b9 100644 --- a/src/Generated/Identity/UserFlowAttributes/Count/CountRequestBuilder.php +++ b/src/Generated/Identity/UserFlowAttributes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Identity/UserFlowAttributes/Item/IdentityUserFlowAttributeItemRequestBuilder.php b/src/Generated/Identity/UserFlowAttributes/Item/IdentityUserFlowAttributeItemRequestBuilder.php index 90441dda112..7d521c5620e 100644 --- a/src/Generated/Identity/UserFlowAttributes/Item/IdentityUserFlowAttributeItemRequestBuilder.php +++ b/src/Generated/Identity/UserFlowAttributes/Item/IdentityUserFlowAttributeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityUserFlowAttribute; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a custom identityUserFlowAttribute. This API is available in the following national cloud deployments. * @param IdentityUserFlowAttributeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityuserflowattribute-delete?view=graph-rest-1.0 Find more info here */ public function delete(?IdentityUserFlowAttributeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a identityUserFlowAttribute object. This API is available in the following national cloud deployments. * @param IdentityUserFlowAttributeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityuserflowattribute-get?view=graph-rest-1.0 Find more info here */ public function get(?IdentityUserFlowAttributeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttribute::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttribute::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a custom identityUserFlowAttribute object. This API is available in the following national cloud deployments. * @param IdentityUserFlowAttribute $body The request body * @param IdentityUserFlowAttributeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityuserflowattribute-update?view=graph-rest-1.0 Find more info here */ public function patch(IdentityUserFlowAttribute $body, ?IdentityUserFlowAttributeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttribute::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttribute::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?IdentityUserFlowAttributeItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?IdentityUserFlowAttributeItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?IdentityUserFlowAttributeItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(IdentityUserFlowAttribute $body, ?Iden $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Identity/UserFlowAttributes/UserFlowAttributesRequestBuilder.php b/src/Generated/Identity/UserFlowAttributes/UserFlowAttributesRequestBuilder.php index 142e05ecb97..1412892c653 100644 --- a/src/Generated/Identity/UserFlowAttributes/UserFlowAttributesRequestBuilder.php +++ b/src/Generated/Identity/UserFlowAttributes/UserFlowAttributesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Identity\UserFlowAttributes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Identity\UserFlowAttributes\Item\IdentityUserFlowAttributeItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityUserFlowAttribute; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of identityUserFlowAttribute objects. This API is available in the following national cloud deployments. * @param UserFlowAttributesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityuserflowattribute-list?view=graph-rest-1.0 Find more info here */ public function get(?UserFlowAttributesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttributeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttributeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new custom identityUserFlowAttribute object. This API is available in the following national cloud deployments. * @param IdentityUserFlowAttribute $body The request body * @param UserFlowAttributesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityuserflowattribute-post?view=graph-rest-1.0 Find more info here */ public function post(IdentityUserFlowAttribute $body, ?UserFlowAttributesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttribute::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityUserFlowAttribute::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?UserFlowAttributesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?UserFlowAttributesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(IdentityUserFlowAttribute $body, ?UserF $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/AccessReviewsRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/AccessReviewsRequestBuilder.php index 9b73df5a56e..981f9f81243 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/AccessReviewsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/AccessReviewsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\DefinitionsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\HistoryDefinitions\HistoryDefinitionsRequestBuilder; use Microsoft\Graph\Generated\Models\AccessReviewSet; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property accessReviews for identityGovernance * @param AccessReviewsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessReviewsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get accessReviews from identityGovernance * @param AccessReviewsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessReviewsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property accessReviews in identityGovernance * @param AccessReviewSet $body The request body * @param AccessReviewsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessReviewSet $body, ?AccessReviewsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?AccessReviewsRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?AccessReviewsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?AccessReviewsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessReviewSet $body, ?AccessReviewsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Count/CountRequestBuilder.php index 3f03c43769f..9f9939c51ac 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/DefinitionsRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/DefinitionsRequestBuilder.php index f73e29e3f00..84b4f463d8d 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/DefinitionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/DefinitionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\AccessReviewScheduleDefinitionItemRequestBuilder; @@ -65,40 +64,34 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Get a list of the accessReviewScheduleDefinition objects and their properties. This API is available in the following national cloud deployments. * @param DefinitionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewset-list-definitions?view=graph-rest-1.0 Find more info here */ public function get(?DefinitionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewScheduleDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewScheduleDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new accessReviewScheduleDefinition object. This API is available in the following national cloud deployments. * @param AccessReviewScheduleDefinition $body The request body * @param DefinitionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewset-post-definitions?view=graph-rest-1.0 Find more info here */ public function post(AccessReviewScheduleDefinition $body, ?DefinitionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewScheduleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewScheduleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,7 +104,6 @@ public function toGetRequestInformation(?DefinitionsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -119,6 +111,7 @@ public function toGetRequestInformation(?DefinitionsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -133,11 +126,11 @@ public function toPostRequestInformation(AccessReviewScheduleDefinition $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 75789f2b47e..6f7a2407dfd 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/AccessReviewScheduleDefinitionItemRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/AccessReviewScheduleDefinitionItemRequestBuilder.php index 3a3918543cf..6df25802d75 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/AccessReviewScheduleDefinitionItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/AccessReviewScheduleDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\InstancesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Stop\StopRequestBuilder; use Microsoft\Graph\Generated\Models\AccessReviewScheduleDefinition; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes an accessReviewScheduleDefinition object. This API is available in the following national cloud deployments. * @param AccessReviewScheduleDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewscheduledefinition-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AccessReviewScheduleDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an accessReviewScheduleDefinition object. To retrieve the instances of the access review series, use the list accessReviewInstance API. This API is available in the following national cloud deployments. * @param AccessReviewScheduleDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewscheduledefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?AccessReviewScheduleDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewScheduleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewScheduleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an existing accessReviewScheduleDefinition object to change one or more of its properties. * @param AccessReviewScheduleDefinition $body The request body * @param AccessReviewScheduleDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewscheduledefinition-update?view=graph-rest-1.0 Find more info here */ public function patch(AccessReviewScheduleDefinition $body, ?AccessReviewScheduleDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewScheduleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewScheduleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?AccessReviewScheduleDefinitionItemRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?AccessReviewScheduleDefinitionItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?AccessReviewScheduleDefinitionItemReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(AccessReviewScheduleDefinition $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Count/CountRequestBuilder.php index 1089d39bc4b..0b835cedfef 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 880ba8a76b0..a18a3b0242c 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/InstancesRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/InstancesRequestBuilder.php index 5ca6db194ab..098e80c602a 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\AccessReviewInstanceItemRequestBuilder; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Get a list of the accessReviewInstance objects and their properties. This API is available in the following national cloud deployments. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewscheduledefinition-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to instances for identityGovernance * @param AccessReviewInstance $body The request body * @param InstancesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessReviewInstance $body, ?InstancesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(AccessReviewInstance $body, ?InstancesR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/AcceptRecommendations/AcceptRecommendationsRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/AcceptRecommendations/AcceptRecommendationsRequestBuilder.php index b6dbc7a281e..0655873257b 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/AcceptRecommendations/AcceptRecommendationsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/AcceptRecommendations/AcceptRecommendationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Allows the acceptance of recommendations on all accessReviewInstanceDecisionItem objects that haven't been reviewed on an accessReviewInstance object for which the calling user is a reviewer. This API is available in the following national cloud deployments. * @param AcceptRecommendationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstance-acceptrecommendations?view=graph-rest-1.0 Find more info here */ public function post(?AcceptRecommendationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?AcceptRecommendationsRequestBuilderPos $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/AccessReviewInstanceItemRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/AccessReviewInstanceItemRequestBuilder.php index a93087550ef..465cebc986c 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/AccessReviewInstanceItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/AccessReviewInstanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\AcceptRecommendations\AcceptRecommendationsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\ApplyDecisions\ApplyDecisionsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\BatchRecordDecisions\BatchRecordDecisionsRequestBuilder; @@ -106,58 +105,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property instances for identityGovernance * @param AccessReviewInstanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessReviewInstanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an accessReviewInstance object. This API is available in the following national cloud deployments. * @param AccessReviewInstanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstance-get?view=graph-rest-1.0 Find more info here */ public function get(?AccessReviewInstanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an accessReviewInstance object. Only the reviewers and fallbackReviewers properties can be updated but the scope property is also required in the request body. You can only add reviewers to the fallbackReviewers property but can't remove existing fallbackReviewers. To update an accessReviewInstance, it's status must be InProgress. * @param AccessReviewInstance $body The request body * @param AccessReviewInstanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstance-update?view=graph-rest-1.0 Find more info here */ public function patch(AccessReviewInstance $body, ?AccessReviewInstanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -174,6 +164,7 @@ public function toDeleteRequestInformation(?AccessReviewInstanceItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -187,7 +178,6 @@ public function toGetRequestInformation(?AccessReviewInstanceItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -195,6 +185,7 @@ public function toGetRequestInformation(?AccessReviewInstanceItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -209,11 +200,11 @@ public function toPatchRequestInformation(AccessReviewInstance $body, ?AccessRev $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ApplyDecisions/ApplyDecisionsRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ApplyDecisions/ApplyDecisionsRequestBuilder.php index 2db7b39698e..542554ae4c6 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ApplyDecisions/ApplyDecisionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ApplyDecisions/ApplyDecisionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Apply review decisions on an accessReviewInstance if the decisions were not applied automatically because the autoApplyDecisionsEnabled property is false in the review's accessReviewScheduleSettings. The status of the accessReviewInstance must be Completed to call this method. This API is available in the following national cloud deployments. * @param ApplyDecisionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstance-applydecisions?view=graph-rest-1.0 Find more info here */ public function post(?ApplyDecisionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ApplyDecisionsRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/BatchRecordDecisions/BatchRecordDecisionsRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/BatchRecordDecisions/BatchRecordDecisionsRequestBuilder.php index f23b1b33236..107ac5eacb2 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/BatchRecordDecisions/BatchRecordDecisionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/BatchRecordDecisions/BatchRecordDecisionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Enables reviewers to review all accessReviewInstanceDecisionItem objects in batches by using principalId, resourceId, or neither. This API is available in the following national cloud deployments. * @param BatchRecordDecisionsPostRequestBody $body The request body * @param BatchRecordDecisionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstance-batchrecorddecisions?view=graph-rest-1.0 Find more info here */ public function post(BatchRecordDecisionsPostRequestBody $body, ?BatchRecordDecisionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(BatchRecordDecisionsPostRequestBody $bo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ContactedReviewers/ContactedReviewersRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ContactedReviewers/ContactedReviewersRequestBuilder.php index 6555abd71fc..27468f89946 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ContactedReviewers/ContactedReviewersRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ContactedReviewers/ContactedReviewersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\ContactedReviewers\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\ContactedReviewers\Item\AccessReviewReviewerItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessReviewReviewer; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the reviewers for an access review instance, irrespective of whether or not they have received a notification. The reviewers are represented by an accessReviewReviewer object. A list of zero or more objects are returned, including all of their nested properties. This API is available in the following national cloud deployments. * @param ContactedReviewersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstance-list-contactedreviewers?view=graph-rest-1.0 Find more info here */ public function get(?ContactedReviewersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewReviewerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewReviewerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contactedReviewers for identityGovernance * @param AccessReviewReviewer $body The request body * @param ContactedReviewersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessReviewReviewer $body, ?ContactedReviewersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewReviewer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewReviewer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ContactedReviewersRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ContactedReviewersRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AccessReviewReviewer $body, ?ContactedR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ContactedReviewers/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ContactedReviewers/Count/CountRequestBuilder.php index 3250cf3498c..5d14f1fb7f1 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ContactedReviewers/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ContactedReviewers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ContactedReviewers/Item/AccessReviewReviewerItemRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ContactedReviewers/Item/AccessReviewReviewerItemRequestBuilder.php index 405e8edb2b1..eaa6b313569 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ContactedReviewers/Item/AccessReviewReviewerItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ContactedReviewers/Item/AccessReviewReviewerItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessReviewReviewer; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contactedReviewers for identityGovernance * @param AccessReviewReviewerItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessReviewReviewerItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns the collection of reviewers who were contacted to complete this review. While the reviewers and fallbackReviewers properties of the accessReviewScheduleDefinition might specify group owners or managers as reviewers, contactedReviewers returns their individual identities. Supports $select. Read-only. * @param AccessReviewReviewerItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessReviewReviewerItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewReviewer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewReviewer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contactedReviewers in identityGovernance * @param AccessReviewReviewer $body The request body * @param AccessReviewReviewerItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessReviewReviewer $body, ?AccessReviewReviewerItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewReviewer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewReviewer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessReviewReviewerItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessReviewReviewerItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessReviewReviewerItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessReviewReviewer $body, ?AccessRev $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Count/CountRequestBuilder.php index 517e33f3019..c234a4e5edb 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/DecisionsRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/DecisionsRequestBuilder.php index e14d85749e0..4f9605c4b84 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/DecisionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/DecisionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Decisions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Decisions\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Decisions\Item\AccessReviewInstanceDecisionItemItemRequestBuilder; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Retrieve the accessReviewInstanceDecisionItem objects for a specific accessReviewInstance. A list of zero or more accessReviewInstanceDecisionItem objects are returned, including all of their nested properties. This API is available in the following national cloud deployments. * @param DecisionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstance-list-decisions?view=graph-rest-1.0 Find more info here */ public function get(?DecisionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to decisions for identityGovernance * @param AccessReviewInstanceDecisionItem $body The request body * @param DecisionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessReviewInstanceDecisionItem $body, ?DecisionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?DecisionsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?DecisionsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(AccessReviewInstanceDecisionItem $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 7ea9345a32c..cd434bfd968 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/AccessReviewInstanceDecisionItemItemRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/AccessReviewInstanceDecisionItemItemRequestBuilder.php index c98cac229c8..da54fb1d90e 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/AccessReviewInstanceDecisionItemItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/AccessReviewInstanceDecisionItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Decisions\Item\Insights\InsightsRequestBuilder; use Microsoft\Graph\Generated\Models\AccessReviewInstanceDecisionItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property decisions for identityGovernance * @param AccessReviewInstanceDecisionItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessReviewInstanceDecisionItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an accessReviewInstanceDecisionItem object. This API is available in the following national cloud deployments. * @param AccessReviewInstanceDecisionItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstancedecisionitem-get?view=graph-rest-1.0 Find more info here */ public function get(?AccessReviewInstanceDecisionItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property decisions in identityGovernance * @param AccessReviewInstanceDecisionItem $body The request body * @param AccessReviewInstanceDecisionItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessReviewInstanceDecisionItem $body, ?AccessReviewInstanceDecisionItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?AccessReviewInstanceDecisionItemItem $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?AccessReviewInstanceDecisionItemItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?AccessReviewInstanceDecisionItemItemReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(AccessReviewInstanceDecisionItem $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/Insights/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/Insights/Count/CountRequestBuilder.php index 399a6c5c249..9e87543ce08 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/Insights/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/Insights/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/Insights/InsightsRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/Insights/InsightsRequestBuilder.php index f426e7fd0a8..10ded10038f 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/Insights/InsightsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/Insights/InsightsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Decisions\Item\Insights\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Decisions\Item\Insights\Item\GovernanceInsightItemRequestBuilder; use Microsoft\Graph\Generated\Models\GovernanceInsight; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Insights are recommendations to reviewers on whether to approve or deny a decision. There can be multiple insights associated with an accessReviewInstanceDecisionItem. * @param InsightsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InsightsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsightCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsightCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to insights for identityGovernance * @param GovernanceInsight $body The request body * @param InsightsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(GovernanceInsight $body, ?InsightsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsight::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsight::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?InsightsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?InsightsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(GovernanceInsight $body, ?InsightsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/Insights/Item/GovernanceInsightItemRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/Insights/Item/GovernanceInsightItemRequestBuilder.php index 1bb1f927dae..26b26058ce0 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/Insights/Item/GovernanceInsightItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Decisions/Item/Insights/Item/GovernanceInsightItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\GovernanceInsight; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property insights for identityGovernance * @param GovernanceInsightItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?GovernanceInsightItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Insights are recommendations to reviewers on whether to approve or deny a decision. There can be multiple insights associated with an accessReviewInstanceDecisionItem. * @param GovernanceInsightItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GovernanceInsightItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsight::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsight::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property insights in identityGovernance * @param GovernanceInsight $body The request body * @param GovernanceInsightItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(GovernanceInsight $body, ?GovernanceInsightItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsight::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsight::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?GovernanceInsightItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?GovernanceInsightItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?GovernanceInsightItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(GovernanceInsight $body, ?GovernanceIn $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ResetDecisions/ResetDecisionsRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ResetDecisions/ResetDecisionsRequestBuilder.php index 1b4c8aa8b3c..2aadc2dedee 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ResetDecisions/ResetDecisionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/ResetDecisions/ResetDecisionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Resets all accessReviewInstanceDecisionItem objects on an accessReviewInstance to notReviewed. This API is available in the following national cloud deployments. * @param ResetDecisionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstance-resetdecisions?view=graph-rest-1.0 Find more info here */ public function post(?ResetDecisionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ResetDecisionsRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/SendReminder/SendReminderRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/SendReminder/SendReminderRequestBuilder.php index f70652dff76..e82e0b64679 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/SendReminder/SendReminderRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/SendReminder/SendReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Send a reminder to the reviewers of an active accessReviewInstance. This API is available in the following national cloud deployments. * @param SendReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstance-sendreminder?view=graph-rest-1.0 Find more info here */ public function post(?SendReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SendReminderRequestBuilderPostRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Count/CountRequestBuilder.php index 512e5955c0a..29a3eb744a5 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index f960e4ddbc2..978c6968d81 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/AccessReviewStageItemRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/AccessReviewStageItemRequestBuilder.php index 58ce515dd40..84d3e15f6ec 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/AccessReviewStageItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/AccessReviewStageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Stages\Item\Decisions\DecisionsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Stages\Item\Stop\StopRequestBuilder; use Microsoft\Graph\Generated\Models\AccessReviewStage; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property stages for identityGovernance * @param AccessReviewStageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessReviewStageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an accessReviewStage object. This API is available in the following national cloud deployments. * @param AccessReviewStageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewstage-get?view=graph-rest-1.0 Find more info here */ public function get(?AccessReviewStageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewStage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewStage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an accessReviewStage object. Only the reviewers and fallbackReviewers properties can be updated. You can only add reviewers to the fallbackReviewers property but can't remove existing fallbackReviewers. To update an accessReviewStage, its status must be NotStarted, Initializing, or InProgress. This API is available in the following national cloud deployments. * @param AccessReviewStage $body The request body * @param AccessReviewStageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewstage-update?view=graph-rest-1.0 Find more info here */ public function patch(AccessReviewStage $body, ?AccessReviewStageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewStage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewStage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?AccessReviewStageItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?AccessReviewStageItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?AccessReviewStageItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(AccessReviewStage $body, ?AccessReview $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Count/CountRequestBuilder.php index c3657ff18a0..61ce91b979c 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/DecisionsRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/DecisionsRequestBuilder.php index ddb93fda795..dc2546116e2 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/DecisionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/DecisionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Stages\Item\Decisions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Stages\Item\Decisions\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Stages\Item\Decisions\Item\AccessReviewInstanceDecisionItemItemRequestBuilder; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Get the decisions from a stage in a multi-stage access review. The decisions in an accessReviewStage object are represented by an accessReviewInstanceDecisionItem object. This API is available in the following national cloud deployments. * @param DecisionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewstage-list-decisions?view=graph-rest-1.0 Find more info here */ public function get(?DecisionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to decisions for identityGovernance * @param AccessReviewInstanceDecisionItem $body The request body * @param DecisionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessReviewInstanceDecisionItem $body, ?DecisionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?DecisionsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?DecisionsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(AccessReviewInstanceDecisionItem $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 9b7b38341ef..319d80852ac 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/AccessReviewInstanceDecisionItemItemRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/AccessReviewInstanceDecisionItemItemRequestBuilder.php index 63218dde43f..c3182a09cdd 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/AccessReviewInstanceDecisionItemItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/AccessReviewInstanceDecisionItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Stages\Item\Decisions\Item\Insights\InsightsRequestBuilder; use Microsoft\Graph\Generated\Models\AccessReviewInstanceDecisionItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property decisions for identityGovernance * @param AccessReviewInstanceDecisionItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessReviewInstanceDecisionItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an accessReviewInstanceDecisionItem object. This API is available in the following national cloud deployments. * @param AccessReviewInstanceDecisionItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstancedecisionitem-get?view=graph-rest-1.0 Find more info here */ public function get(?AccessReviewInstanceDecisionItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update access decisions, known as accessReviewInstanceDecisionItems, for which the user is the reviewer. This API is available in the following national cloud deployments. * @param AccessReviewInstanceDecisionItem $body The request body * @param AccessReviewInstanceDecisionItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstancedecisionitem-update?view=graph-rest-1.0 Find more info here */ public function patch(AccessReviewInstanceDecisionItem $body, ?AccessReviewInstanceDecisionItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewInstanceDecisionItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?AccessReviewInstanceDecisionItemItem $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?AccessReviewInstanceDecisionItemItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?AccessReviewInstanceDecisionItemItemReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(AccessReviewInstanceDecisionItem $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/Insights/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/Insights/Count/CountRequestBuilder.php index 978bc2dcdb1..edd3868926a 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/Insights/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/Insights/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/Insights/InsightsRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/Insights/InsightsRequestBuilder.php index 0154b799007..0315424c427 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/Insights/InsightsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/Insights/InsightsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Stages\Item\Decisions\Item\Insights\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Stages\Item\Decisions\Item\Insights\Item\GovernanceInsightItemRequestBuilder; use Microsoft\Graph\Generated\Models\GovernanceInsight; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Insights are recommendations to reviewers on whether to approve or deny a decision. There can be multiple insights associated with an accessReviewInstanceDecisionItem. * @param InsightsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InsightsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsightCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsightCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to insights for identityGovernance * @param GovernanceInsight $body The request body * @param InsightsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(GovernanceInsight $body, ?InsightsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsight::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsight::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?InsightsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?InsightsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(GovernanceInsight $body, ?InsightsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/Insights/Item/GovernanceInsightItemRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/Insights/Item/GovernanceInsightItemRequestBuilder.php index 030d36105e8..22a05617b18 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/Insights/Item/GovernanceInsightItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Decisions/Item/Insights/Item/GovernanceInsightItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\GovernanceInsight; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property insights for identityGovernance * @param GovernanceInsightItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?GovernanceInsightItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Insights are recommendations to reviewers on whether to approve or deny a decision. There can be multiple insights associated with an accessReviewInstanceDecisionItem. * @param GovernanceInsightItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GovernanceInsightItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsight::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsight::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property insights in identityGovernance * @param GovernanceInsight $body The request body * @param GovernanceInsightItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(GovernanceInsight $body, ?GovernanceInsightItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsight::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GovernanceInsight::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?GovernanceInsightItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?GovernanceInsightItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?GovernanceInsightItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(GovernanceInsight $body, ?GovernanceIn $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Stop/StopRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Stop/StopRequestBuilder.php index 141515e93f0..242367aa7d3 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Stop/StopRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/Item/Stop/StopRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Stop an access review stage that is inProgress. After the access review stage stops, the stage status will be Completed and the reviewers can no longer give input. If there are subsequent stages that depend on the completed stage, the next stage will be created. The accessReviewInstanceDecisionItem objects will always reflect the last decisions recorded across all stages at that given time, regardless of the status of the stages. This API is available in the following national cloud deployments. * @param StopRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewstage-stop?view=graph-rest-1.0 Find more info here */ public function post(?StopRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?StopRequestBuilderPostRequestConfigura $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/StagesRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/StagesRequestBuilder.php index b2652489aa6..fc0bc6faa85 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/StagesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stages/StagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Stages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Stages\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\Definitions\Item\Instances\Item\Stages\Item\AccessReviewStageItemRequestBuilder; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Retrieve the stages in a multi-stage access review instance. This API is available in the following national cloud deployments. * @param StagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstance-list-stages?view=graph-rest-1.0 Find more info here */ public function get(?StagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewStageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewStageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to stages for identityGovernance * @param AccessReviewStage $body The request body * @param StagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessReviewStage $body, ?StagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewStage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewStage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?StagesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?StagesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(AccessReviewStage $body, ?StagesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stop/StopRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stop/StopRequestBuilder.php index d2afdb516e8..d9f242a4fc1 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stop/StopRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Instances/Item/Stop/StopRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Stop a currently active accessReviewInstance. After the access review instance stops, the instance status is marked as Completed, the reviewers can no longer give input, and the access review decisions are applied. Stopping an instance will not stop future instances. To prevent a recurring access review from starting future instances, update the schedule definition to change its scheduled end date. This API is available in the following national cloud deployments. * @param StopRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewinstance-stop?view=graph-rest-1.0 Find more info here */ public function post(?StopRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?StopRequestBuilderPostRequestConfigura $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Stop/StopRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Stop/StopRequestBuilder.php index 7052200cde4..8d5411c82fd 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Stop/StopRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/Definitions/Item/Stop/StopRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action stop * @param StopRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?StopRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?StopRequestBuilderPostRequestConfigura $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Count/CountRequestBuilder.php index 78719991f46..f6e878a7592 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/HistoryDefinitionsRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/HistoryDefinitionsRequestBuilder.php index bd38ff09d35..1d1e1b3f1a2 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/HistoryDefinitionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/HistoryDefinitionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\HistoryDefinitions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\HistoryDefinitions\Item\AccessReviewHistoryDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessReviewHistoryDefinition; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the accessReviewHistoryDefinition objects created in the last 30 days, including all nested properties. This API is available in the following national cloud deployments. * @param HistoryDefinitionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewset-list-historydefinitions?view=graph-rest-1.0 Find more info here */ public function get(?HistoryDefinitionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new accessReviewHistoryDefinition object. This API is available in the following national cloud deployments. * @param AccessReviewHistoryDefinition $body The request body * @param HistoryDefinitionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewset-post-historydefinitions?view=graph-rest-1.0 Find more info here */ public function post(AccessReviewHistoryDefinition $body, ?HistoryDefinitionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?HistoryDefinitionsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?HistoryDefinitionsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AccessReviewHistoryDefinition $body, ?H $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/AccessReviewHistoryDefinitionItemRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/AccessReviewHistoryDefinitionItemRequestBuilder.php index 2f69f0f966e..e0cecc5256c 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/AccessReviewHistoryDefinitionItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/AccessReviewHistoryDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\HistoryDefinitions\Item\Instances\InstancesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessReviewHistoryDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property historyDefinitions for identityGovernance * @param AccessReviewHistoryDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessReviewHistoryDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve an accessReviewHistoryDefinition object by its identifier. All the properties of the access review history definition object are returned. If the definition is 30 days or older, a 404 Not Found error is returned. This API is available in the following national cloud deployments. * @param AccessReviewHistoryDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewhistorydefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?AccessReviewHistoryDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property historyDefinitions in identityGovernance * @param AccessReviewHistoryDefinition $body The request body * @param AccessReviewHistoryDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessReviewHistoryDefinition $body, ?AccessReviewHistoryDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?AccessReviewHistoryDefinitionItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?AccessReviewHistoryDefinitionItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?AccessReviewHistoryDefinitionItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(AccessReviewHistoryDefinition $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/Count/CountRequestBuilder.php index fa064f37d6b..4900971cb28 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/InstancesRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/InstancesRequestBuilder.php index 39be2921718..04f8ad130ac 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\HistoryDefinitions\Item\Instances\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\HistoryDefinitions\Item\Instances\Item\AccessReviewHistoryInstanceItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessReviewHistoryInstance; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the instances of an access review history definition created in the last 30 days. This API is available in the following national cloud deployments. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewhistorydefinition-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to instances for identityGovernance * @param AccessReviewHistoryInstance $body The request body * @param InstancesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessReviewHistoryInstance $body, ?InstancesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AccessReviewHistoryInstance $body, ?Ins $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/Item/AccessReviewHistoryInstanceItemRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/Item/AccessReviewHistoryInstanceItemRequestBuilder.php index 1f89998ec0b..566e82e32f9 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/Item/AccessReviewHistoryInstanceItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/Item/AccessReviewHistoryInstanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\HistoryDefinitions\Item\Instances\Item\GenerateDownloadUri\GenerateDownloadUriRequestBuilder; use Microsoft\Graph\Generated\Models\AccessReviewHistoryInstance; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property instances for identityGovernance * @param AccessReviewHistoryInstanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessReviewHistoryInstanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * If the accessReviewHistoryDefinition is a recurring definition, instances represent each recurrence. A definition that doesn't recur will have exactly one instance. * @param AccessReviewHistoryInstanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessReviewHistoryInstanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property instances in identityGovernance * @param AccessReviewHistoryInstance $body The request body * @param AccessReviewHistoryInstanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessReviewHistoryInstance $body, ?AccessReviewHistoryInstanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessReviewHistoryInstanceItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessReviewHistoryInstanceItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessReviewHistoryInstanceItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessReviewHistoryInstance $body, ?Ac $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/Item/GenerateDownloadUri/GenerateDownloadUriRequestBuilder.php b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/Item/GenerateDownloadUri/GenerateDownloadUriRequestBuilder.php index b81c3a4333b..ac05ec317e6 100644 --- a/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/Item/GenerateDownloadUri/GenerateDownloadUriRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AccessReviews/HistoryDefinitions/Item/Instances/Item/GenerateDownloadUri/GenerateDownloadUriRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessReviewHistoryInstance; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Generates a URI for an accessReviewHistoryInstance object the status for which is done. Each URI can be used to retrieve the instance's review history data. Each URI is valid for 24 hours and can be retrieved by fetching the downloadUri property from the accessReviewHistoryInstance object. This API is available in the following national cloud deployments. * @param GenerateDownloadUriRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accessreviewhistoryinstance-generatedownloaduri?view=graph-rest-1.0 Find more info here */ public function post(?GenerateDownloadUriRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessReviewHistoryInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?GenerateDownloadUriRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequestBuilder.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequestBuilder.php index 282ec8f580f..64fdf279650 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AppConsent\AppConsentRequests\AppConsentRequestsRequestBuilder; use Microsoft\Graph\Generated\Models\AppConsentApprovalRoute; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property appConsent for identityGovernance * @param AppConsentRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AppConsentRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get appConsent from identityGovernance * @param AppConsentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppConsentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppConsentApprovalRoute::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppConsentApprovalRoute::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property appConsent in identityGovernance * @param AppConsentApprovalRoute $body The request body * @param AppConsentRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AppConsentApprovalRoute $body, ?AppConsentRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppConsentApprovalRoute::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppConsentApprovalRoute::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AppConsentRequestBuilderDeleteReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AppConsentRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AppConsentRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AppConsentApprovalRoute $body, ?AppCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/AppConsentRequestsRequestBuilder.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/AppConsentRequestsRequestBuilder.php index afbf5f4445b..f595ff13906 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/AppConsentRequestsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/AppConsentRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AppConsent\AppConsentRequests\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AppConsent\AppConsentRequests\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AppConsent\AppConsentRequests\Item\AppConsentRequestItemRequestBuilder; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Retrieve appConsentRequest objects and their properties. This API is available in the following national cloud deployments. * @param AppConsentRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/appconsentapprovalroute-list-appconsentrequests?view=graph-rest-1.0 Find more info here */ public function get(?AppConsentRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppConsentRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppConsentRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to appConsentRequests for identityGovernance * @param AppConsentRequest $body The request body * @param AppConsentRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AppConsentRequest $body, ?AppConsentRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppConsentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppConsentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?AppConsentRequestsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?AppConsentRequestsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(AppConsentRequest $body, ?AppConsentReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Count/CountRequestBuilder.php index b78e100c9e3..11248b0bf96 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 1fa6768c1ad..74af2f16bb6 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/AppConsentRequestItemRequestBuilder.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/AppConsentRequestItemRequestBuilder.php index 4da39cace5b..59571a8352f 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/AppConsentRequestItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/AppConsentRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AppConsent\AppConsentRequests\Item\UserConsentRequests\UserConsentRequestsRequestBuilder; use Microsoft\Graph\Generated\Models\AppConsentRequest; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property appConsentRequests for identityGovernance * @param AppConsentRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AppConsentRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an appConsentRequest object. This API is available in the following national cloud deployments. * @param AppConsentRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/appconsentrequest-get?view=graph-rest-1.0 Find more info here */ public function get(?AppConsentRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppConsentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppConsentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property appConsentRequests in identityGovernance * @param AppConsentRequest $body The request body * @param AppConsentRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AppConsentRequest $body, ?AppConsentRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppConsentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppConsentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?AppConsentRequestItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?AppConsentRequestItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?AppConsentRequestItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(AppConsentRequest $body, ?AppConsentRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Count/CountRequestBuilder.php index 2dc76ed4744..7617b6b93b3 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 2f09c333dca..9aa37a5cc41 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/ApprovalRequestBuilder.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/ApprovalRequestBuilder.php index 7359b546933..2dfcf003633 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/ApprovalRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/ApprovalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AppConsent\AppConsentRequests\Item\UserConsentRequests\Item\Approval\Stages\StagesRequestBuilder; use Microsoft\Graph\Generated\Models\Approval; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property approval for identityGovernance * @param ApprovalRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ApprovalRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Approval decisions associated with a request. * @param ApprovalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ApprovalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property approval in identityGovernance * @param Approval $body The request body * @param ApprovalRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Approval $body, ?ApprovalRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ApprovalRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ApprovalRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ApprovalRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Approval $body, ?ApprovalRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/Count/CountRequestBuilder.php index 05550a0b1be..d3d85ff57ec 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/Item/ApprovalStageItemRequestBuilder.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/Item/ApprovalStageItemRequestBuilder.php index 2309d7cced6..a0aea6cba5a 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/Item/ApprovalStageItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/Item/ApprovalStageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ApprovalStage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property stages for identityGovernance * @param ApprovalStageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ApprovalStageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of an approvalStage object. An approval stage is contained within an approval object. This API is available in the following national cloud deployments. * @param ApprovalStageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/approvalstage-get?view=graph-rest-1.0 Find more info here */ public function get(?ApprovalStageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Approve or deny an approvalStage object in an approval. This API is available in the following national cloud deployments. * @param ApprovalStage $body The request body * @param ApprovalStageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/approvalstage-update?view=graph-rest-1.0 Find more info here */ public function patch(ApprovalStage $body, ?ApprovalStageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ApprovalStageItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ApprovalStageItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ApprovalStageItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(ApprovalStage $body, ?ApprovalStageIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/StagesRequestBuilder.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/StagesRequestBuilder.php index 37eec4a38ea..0ae3bc20265 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/StagesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/StagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AppConsent\AppConsentRequests\Item\UserConsentRequests\Item\Approval\Stages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AppConsent\AppConsentRequests\Item\UserConsentRequests\Item\Approval\Stages\Item\ApprovalStageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ApprovalStage; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. * @param StagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/approval-list-stages?view=graph-rest-1.0 Find more info here */ public function get(?StagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to stages for identityGovernance * @param ApprovalStage $body The request body * @param StagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApprovalStage $body, ?StagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. * @param StagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?StagesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?StagesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ApprovalStage $body, ?StagesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/StagesRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/StagesRequestBuilderGetQueryParameters.php index 0f5b0bb1baf..0cfde20072b 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/StagesRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/Approval/Stages/StagesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. */ class StagesRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/UserConsentRequestItemRequestBuilder.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/UserConsentRequestItemRequestBuilder.php index 9e9c41af30c..75349f4eee9 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/UserConsentRequestItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/Item/UserConsentRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AppConsent\AppConsentRequests\Item\UserConsentRequests\Item\Approval\ApprovalRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserConsentRequest; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userConsentRequests for identityGovernance * @param UserConsentRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserConsentRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a userConsentRequest object. This API is available in the following national cloud deployments. * @param UserConsentRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/userconsentrequest-get?view=graph-rest-1.0 Find more info here */ public function get(?UserConsentRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserConsentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserConsentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userConsentRequests in identityGovernance * @param UserConsentRequest $body The request body * @param UserConsentRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserConsentRequest $body, ?UserConsentRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserConsentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserConsentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?UserConsentRequestItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?UserConsentRequestItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?UserConsentRequestItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(UserConsentRequest $body, ?UserConsent $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/UserConsentRequestsRequestBuilder.php b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/UserConsentRequestsRequestBuilder.php index 26d0857949b..a93d84d52bc 100644 --- a/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/UserConsentRequestsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/AppConsent/AppConsentRequests/Item/UserConsentRequests/UserConsentRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AppConsent\AppConsentRequests\Item\UserConsentRequests\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AppConsent\AppConsentRequests\Item\UserConsentRequests\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AppConsent\AppConsentRequests\Item\UserConsentRequests\Item\UserConsentRequestItemRequestBuilder; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Retrieve a collection of userConsentRequest objects and their properties. This API is available in the following national cloud deployments. * @param UserConsentRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/appconsentrequest-list-userconsentrequests?view=graph-rest-1.0 Find more info here */ public function get(?UserConsentRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserConsentRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserConsentRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userConsentRequests for identityGovernance * @param UserConsentRequest $body The request body * @param UserConsentRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserConsentRequest $body, ?UserConsentRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserConsentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserConsentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?UserConsentRequestsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?UserConsentRequestsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(UserConsentRequest $body, ?UserConsentR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/AccessPackageAssignmentApprovalsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/AccessPackageAssignmentApprovalsRequestBuilder.php index 4368a6b4d05..cb9f9927fd3 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/AccessPackageAssignmentApprovalsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/AccessPackageAssignmentApprovalsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackageAssignmentApprovals\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackageAssignmentApprovals\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackageAssignmentApprovals\Item\ApprovalItemRequestBuilder; @@ -63,44 +62,38 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn } /** - * Retrieve the properties of an approval object. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * Retrieve the properties of an approval object. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentApprovalsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageAssignmentApprovalsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to accessPackageAssignmentApprovals for identityGovernance * @param Approval $body The request body * @param AccessPackageAssignmentApprovalsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Approval $body, ?AccessPackageAssignmentApprovalsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the properties of an approval object. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * Retrieve the properties of an approval object. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentApprovalsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AccessPackageAssignmentApprovalsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AccessPackageAssignmentApprovalsRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Approval $body, ?AccessPackageAssignmen $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/AccessPackageAssignmentApprovalsRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/AccessPackageAssignmentApprovalsRequestBuilderGetQueryParameters.php index be25a5d46f9..62b0b7965ed 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/AccessPackageAssignmentApprovalsRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/AccessPackageAssignmentApprovalsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the properties of an approval object. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * Retrieve the properties of an approval object. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. */ class AccessPackageAssignmentApprovalsRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Count/CountRequestBuilder.php index d101c322c1c..c3728dbc4fb 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 2a5683b893b..e0618c64751 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/ApprovalItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/ApprovalItemRequestBuilder.php index fb7cad7d087..6e10ad12d2a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/ApprovalItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/ApprovalItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackageAssignmentApprovals\Item\Stages\StagesRequestBuilder; use Microsoft\Graph\Generated\Models\Approval; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property accessPackageAssignmentApprovals for identityGovernance * @param ApprovalItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ApprovalItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Retrieve the properties of an approval object. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * Retrieve the properties of an approval object. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. * @param ApprovalItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/approval-get?view=graph-rest-1.0 Find more info here */ public function get(?ApprovalItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property accessPackageAssignmentApprovals in identityGovernance * @param Approval $body The request body * @param ApprovalItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Approval $body, ?ApprovalItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,11 +99,12 @@ public function toDeleteRequestInformation(?ApprovalItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Retrieve the properties of an approval object. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * Retrieve the properties of an approval object. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. * @param ApprovalItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ApprovalItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ApprovalItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(Approval $body, ?ApprovalItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/ApprovalItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/ApprovalItemRequestBuilderGetQueryParameters.php index f86e2c55643..bffb8deb5c4 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/ApprovalItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/ApprovalItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the properties of an approval object. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * Retrieve the properties of an approval object. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. */ class ApprovalItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/Count/CountRequestBuilder.php index e3560d76e00..1ccf027f658 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/Item/ApprovalStageItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/Item/ApprovalStageItemRequestBuilder.php index 86b26d9df48..858d3a1bcb3 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/Item/ApprovalStageItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/Item/ApprovalStageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ApprovalStage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property stages for identityGovernance * @param ApprovalStageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ApprovalStageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of an approvalStage object. An approval stage is contained within an approval object. This API is available in the following national cloud deployments. * @param ApprovalStageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/approvalstage-get?view=graph-rest-1.0 Find more info here */ public function get(?ApprovalStageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Approve or deny an approvalStage object in an approval. This API is available in the following national cloud deployments. * @param ApprovalStage $body The request body * @param ApprovalStageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/approvalstage-update?view=graph-rest-1.0 Find more info here */ public function patch(ApprovalStage $body, ?ApprovalStageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ApprovalStageItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ApprovalStageItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ApprovalStageItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(ApprovalStage $body, ?ApprovalStageIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/StagesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/StagesRequestBuilder.php index 667a4032750..f0d0c5e40a1 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/StagesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/StagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackageAssignmentApprovals\Item\Stages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackageAssignmentApprovals\Item\Stages\Item\ApprovalStageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ApprovalStage; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. * @param StagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/approval-list-stages?view=graph-rest-1.0 Find more info here */ public function get(?StagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to stages for identityGovernance * @param ApprovalStage $body The request body * @param StagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApprovalStage $body, ?StagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. * @param StagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?StagesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?StagesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ApprovalStage $body, ?StagesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/StagesRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/StagesRequestBuilderGetQueryParameters.php index 33987735baf..c684fbb071a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/StagesRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackageAssignmentApprovals/Item/Stages/StagesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. */ class StagesRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/AccessPackagesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/AccessPackagesRequestBuilder.php index fd9eb922f76..e8c40e9d7c6 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/AccessPackagesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/AccessPackagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AccessPackageItemRequestBuilder; @@ -65,40 +64,34 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Retrieve a list of accessPackage objects. The resulting list includes all the access packages that the caller has access to read, across all catalogs. This API is available in the following national cloud deployments. * @param AccessPackagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-list-accesspackages?view=graph-rest-1.0 Find more info here */ public function get(?AccessPackagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new accessPackage object. The access package will be added to an existing accessPackageCatalog. This API is available in the following national cloud deployments. * @param AccessPackage $body The request body * @param AccessPackagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-post-accesspackages?view=graph-rest-1.0 Find more info here */ public function post(AccessPackage $body, ?AccessPackagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,7 +104,6 @@ public function toGetRequestInformation(?AccessPackagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -119,6 +111,7 @@ public function toGetRequestInformation(?AccessPackagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -133,11 +126,11 @@ public function toPostRequestInformation(AccessPackage $body, ?AccessPackagesReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Count/CountRequestBuilder.php index dd977c3bf43..dbdb8d24591 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index eda82db8fa7..04ba8030961 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackageItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackageItemRequestBuilder.php index 2c60c9eda90..d2373a20931 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackageItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AccessPackagesIncompatibleWith\AccessPackagesIncompatibleWithRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AssignmentPolicies\AssignmentPoliciesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\Catalog\CatalogRequestBuilder; @@ -90,59 +89,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an accessPackage object. You cannot delete an access package if it has any accessPackageAssignment. This API is available in the following national cloud deployments. * @param AccessPackageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AccessPackageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an accessPackage object. This API is available in the following national cloud deployments. * @param AccessPackageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-get?view=graph-rest-1.0 Find more info here */ public function get(?AccessPackageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an existing accessPackage object to change one or more of its properties, such as the display name or description. This API is available in the following national cloud deployments. * @param AccessPackage $body The request body * @param AccessPackageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-update?view=graph-rest-1.0 Find more info here */ public function patch(AccessPackage $body, ?AccessPackageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -159,6 +149,7 @@ public function toDeleteRequestInformation(?AccessPackageItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -172,7 +163,6 @@ public function toGetRequestInformation(?AccessPackageItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -180,6 +170,7 @@ public function toGetRequestInformation(?AccessPackageItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -194,11 +185,11 @@ public function toPatchRequestInformation(AccessPackage $body, ?AccessPackageIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackagesIncompatibleWith/AccessPackagesIncompatibleWithRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackagesIncompatibleWith/AccessPackagesIncompatibleWithRequestBuilder.php index 491abf3bea5..1550127977a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackagesIncompatibleWith/AccessPackagesIncompatibleWithRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackagesIncompatibleWith/AccessPackagesIncompatibleWithRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AccessPackagesIncompatibleWith\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AccessPackagesIncompatibleWith\Item\AccessPackageItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of the accessPackage objects that have marked a specified accessPackage as incompatible. This API is available in the following national cloud deployments. * @param AccessPackagesIncompatibleWithRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-list-accesspackagesincompatiblewith?view=graph-rest-1.0 Find more info here */ public function get(?AccessPackagesIncompatibleWithRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?AccessPackagesIncompatibleWithRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?AccessPackagesIncompatibleWithRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackagesIncompatibleWith/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackagesIncompatibleWith/Count/CountRequestBuilder.php index fb247d34620..6a512d82abf 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackagesIncompatibleWith/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackagesIncompatibleWith/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackagesIncompatibleWith/Item/AccessPackageItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackagesIncompatibleWith/Item/AccessPackageItemRequestBuilder.php index b6f2b2cc0f2..e9b70477b19 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackagesIncompatibleWith/Item/AccessPackageItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AccessPackagesIncompatibleWith/Item/AccessPackageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The access packages that are incompatible with this package. Read-only. * @param AccessPackageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AccessPackageItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AccessPackageItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/AssignmentPoliciesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/AssignmentPoliciesRequestBuilder.php index d1edfdc9793..776647793fb 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/AssignmentPoliciesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/AssignmentPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AssignmentPolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AssignmentPolicies\Item\AccessPackageAssignmentPolicyItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageAssignmentPolicy; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param AssignmentPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AssignmentPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to assignmentPolicies for identityGovernance * @param AccessPackageAssignmentPolicy $body The request body * @param AssignmentPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageAssignmentPolicy $body, ?AssignmentPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AssignmentPoliciesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AssignmentPoliciesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageAssignmentPolicy $body, ?A $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Count/CountRequestBuilder.php index b88f093983c..58037ecb9d3 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/AccessPackage/AccessPackageRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/AccessPackage/AccessPackageRequestBuilder.php index e587ebaafba..d1ddd687889 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/AccessPackage/AccessPackageRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/AccessPackage/AccessPackageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Access package containing this policy. Read-only. Supports $expand. * @param AccessPackageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AccessPackageRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AccessPackageRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/AccessPackageAssignmentPolicyItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/AccessPackageAssignmentPolicyItemRequestBuilder.php index d73fa3f1f0b..5a0fd627fa5 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/AccessPackageAssignmentPolicyItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/AccessPackageAssignmentPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AssignmentPolicies\Item\AccessPackage\AccessPackageRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AssignmentPolicies\Item\Catalog\CatalogRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AssignmentPolicies\Item\CustomExtensionStageSettings\CustomExtensionStageSettingsRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignmentPolicies for identityGovernance * @param AccessPackageAssignmentPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageAssignmentPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageAssignmentPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageAssignmentPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignmentPolicies in identityGovernance * @param AccessPackageAssignmentPolicy $body The request body * @param AccessPackageAssignmentPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageAssignmentPolicy $body, ?AccessPackageAssignmentPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?AccessPackageAssignmentPolicyItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?AccessPackageAssignmentPolicyItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?AccessPackageAssignmentPolicyItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(AccessPackageAssignmentPolicy $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Catalog/CatalogRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Catalog/CatalogRequestBuilder.php index 21dfde9e040..edf0f2e6e58 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Catalog/CatalogRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Catalog/CatalogRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageCatalog; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Catalog of the access package containing this policy. Read-only. * @param CatalogRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CatalogRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CatalogRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CatalogRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/Count/CountRequestBuilder.php index f051d3fa31e..b2a45f7b7d8 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/CustomExtensionStageSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/CustomExtensionStageSettingsRequestBuilder.php index a1977c05ce1..df15013740f 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/CustomExtensionStageSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/CustomExtensionStageSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AssignmentPolicies\Item\CustomExtensionStageSettings\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AssignmentPolicies\Item\CustomExtensionStageSettings\Item\CustomExtensionStageSettingItemRequestBuilder; use Microsoft\Graph\Generated\Models\CustomExtensionStageSetting; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of stages when to execute one or more custom access package workflow extensions. Supports $expand. * @param CustomExtensionStageSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CustomExtensionStageSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSettingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSettingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to customExtensionStageSettings for identityGovernance * @param CustomExtensionStageSetting $body The request body * @param CustomExtensionStageSettingsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CustomExtensionStageSetting $body, ?CustomExtensionStageSettingsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSetting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSetting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?CustomExtensionStageSettingsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?CustomExtensionStageSettingsRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(CustomExtensionStageSetting $body, ?Cus $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtension/CustomExtensionRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtension/CustomExtensionRequestBuilder.php index 55f27483fa5..305ac156d31 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtension/CustomExtensionRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtension/CustomExtensionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CustomCalloutExtension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Indicates the custom workflow extension that will be executed at this stage. Nullable. Supports $expand. * @param CustomExtensionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CustomExtensionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CustomExtensionRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CustomExtensionRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtensionStageSettingItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtensionStageSettingItemRequestBuilder.php index ca896620f7e..67251113449 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtensionStageSettingItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtensionStageSettingItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AssignmentPolicies\Item\CustomExtensionStageSettings\Item\CustomExtension\CustomExtensionRequestBuilder; use Microsoft\Graph\Generated\Models\CustomExtensionStageSetting; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property customExtensionStageSettings for identityGovernance * @param CustomExtensionStageSettingItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CustomExtensionStageSettingItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of stages when to execute one or more custom access package workflow extensions. Supports $expand. * @param CustomExtensionStageSettingItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CustomExtensionStageSettingItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSetting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSetting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property customExtensionStageSettings in identityGovernance * @param CustomExtensionStageSetting $body The request body * @param CustomExtensionStageSettingItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(CustomExtensionStageSetting $body, ?CustomExtensionStageSettingItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSetting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSetting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?CustomExtensionStageSettingItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?CustomExtensionStageSettingItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?CustomExtensionStageSettingItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(CustomExtensionStageSetting $body, ?Cu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Questions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Questions/Count/CountRequestBuilder.php index 22642e9607f..6f4f87a386c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Questions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Questions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Questions/Item/AccessPackageQuestionItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Questions/Item/AccessPackageQuestionItemRequestBuilder.php index a51d182af30..40812fb4daa 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Questions/Item/AccessPackageQuestionItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Questions/Item/AccessPackageQuestionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageQuestion; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property questions for identityGovernance * @param AccessPackageQuestionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageQuestionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Questions that are posed to the requestor. * @param AccessPackageQuestionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageQuestionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property questions in identityGovernance * @param AccessPackageQuestion $body The request body * @param AccessPackageQuestionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageQuestion $body, ?AccessPackageQuestionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageQuestionItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageQuestionItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageQuestionItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageQuestion $body, ?AccessPa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Questions/QuestionsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Questions/QuestionsRequestBuilder.php index 30de914fcc4..94b6fcd23f3 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Questions/QuestionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/AssignmentPolicies/Item/Questions/QuestionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AssignmentPolicies\Item\Questions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\AssignmentPolicies\Item\Questions\Item\AccessPackageQuestionItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageQuestion; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Questions that are posed to the requestor. * @param QuestionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?QuestionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to questions for identityGovernance * @param AccessPackageQuestion $body The request body * @param QuestionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageQuestion $body, ?QuestionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?QuestionsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?QuestionsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageQuestion $body, ?Questions $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/Catalog/CatalogRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/Catalog/CatalogRequestBuilder.php index 19c63fd648f..f8bba3a0ff9 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/Catalog/CatalogRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/Catalog/CatalogRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageCatalog; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Required when creating the access package. Read-only. Nullable. * @param CatalogRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CatalogRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CatalogRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CatalogRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/GetApplicablePolicyRequirements/GetApplicablePolicyRequirementsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/GetApplicablePolicyRequirements/GetApplicablePolicyRequirementsRequestBuilder.php index 8489085d5ec..712ce5e4349 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/GetApplicablePolicyRequirements/GetApplicablePolicyRequirementsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/GetApplicablePolicyRequirements/GetApplicablePolicyRequirementsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,26 +30,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * In Azure AD entitlement management, this action retrieves a list of accessPackageAssignmentRequestRequirements objects that the currently signed-in user can use to create an accessPackageAssignmentRequest. Each requirement object corresponds to an access package assignment policy that the currently signed-in user is allowed to request an assignment for. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, this action retrieves a list of accessPackageAssignmentRequestRequirements objects that the currently signed-in user can use to create an accessPackageAssignmentRequest. Each requirement object corresponds to an access package assignment policy that the currently signed-in user is allowed to request an assignment for. This API is available in the following national cloud deployments. * @param GetApplicablePolicyRequirementsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-getapplicablepolicyrequirements?view=graph-rest-1.0 Find more info here */ public function post(?GetApplicablePolicyRequirementsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetApplicablePolicyRequirementsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetApplicablePolicyRequirementsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * In Azure AD entitlement management, this action retrieves a list of accessPackageAssignmentRequestRequirements objects that the currently signed-in user can use to create an accessPackageAssignmentRequest. Each requirement object corresponds to an access package assignment policy that the currently signed-in user is allowed to request an assignment for. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, this action retrieves a list of accessPackageAssignmentRequestRequirements objects that the currently signed-in user can use to create an accessPackageAssignmentRequest. Each requirement object corresponds to an access package assignment policy that the currently signed-in user is allowed to request an assignment for. This API is available in the following national cloud deployments. * @param GetApplicablePolicyRequirementsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -59,11 +55,11 @@ public function toPostRequestInformation(?GetApplicablePolicyRequirementsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/Count/CountRequestBuilder.php index 371ba241078..f6ee1b1491b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/IncompatibleAccessPackagesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/IncompatibleAccessPackagesRequestBuilder.php index 10475a678b1..ae9e51cb164 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/IncompatibleAccessPackagesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/IncompatibleAccessPackagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\IncompatibleAccessPackages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\IncompatibleAccessPackages\Item\AccessPackageItemRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\IncompatibleAccessPackages\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of the accessPackage objects that have been marked as incompatible on an accessPackage. This API is available in the following national cloud deployments. * @param IncompatibleAccessPackagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-list-incompatibleaccesspackages?view=graph-rest-1.0 Find more info here */ public function get(?IncompatibleAccessPackagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?IncompatibleAccessPackagesRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?IncompatibleAccessPackagesRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/Item/Ref/RefRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/Item/Ref/RefRequestBuilder.php index c8c8c184a10..f3e5ac49884 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an access package from the list of access packages that have been marked as incompatible on an accessPackage. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-delete-incompatibleaccesspackage?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/Ref/RefRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/Ref/RefRequestBuilder.php index bc77bc373ee..d522afa130e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/Ref/RefRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleAccessPackages/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of the accessPackage objects that have been marked as incompatible on an accessPackage. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-list-incompatibleaccesspackages?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add an accessPackage to the list of access packages that have been marked as incompatible on an accessPackage. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-post-incompatibleaccesspackage?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Count/CountRequestBuilder.php index afeb5820cc6..218d7084557 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/IncompatibleGroupsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/IncompatibleGroupsRequestBuilder.php index e7cbec20cf1..b544b3ecd84 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/IncompatibleGroupsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/IncompatibleGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\IncompatibleGroups\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\IncompatibleGroups\Item\GroupItemRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\IncompatibleGroups\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of the group objects that have been marked as incompatible on an accessPackage. This API is available in the following national cloud deployments. * @param IncompatibleGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-list-incompatiblegroups?view=graph-rest-1.0 Find more info here */ public function get(?IncompatibleGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?IncompatibleGroupsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?IncompatibleGroupsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Item/Ref/RefRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Item/Ref/RefRequestBuilder.php index ea7c62e7689..968f2120d61 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a group from the list of groups that have been marked as incompatible on an accessPackage. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-delete-incompatiblegroup?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php index c1b3f28d0e3..89a87b6fdc3 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 31abe708954..1472b57bf29 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\IncompatibleGroups\Item\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Ref/RefRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Ref/RefRequestBuilder.php index 1bf70cee40d..7bd35ea50af 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Ref/RefRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/IncompatibleGroups/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of the group objects that have been marked as incompatible on an accessPackage. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-list-incompatiblegroups?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a group to the list of groups that have been marked as incompatible on an accessPackage. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-post-incompatiblegroup?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Count/CountRequestBuilder.php index 918540e5b5a..279b561c557 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/AccessPackageResourceRoleScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/AccessPackageResourceRoleScopeItemRequestBuilder.php index 0d2d134ebd7..e9166be71aa 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/AccessPackageResourceRoleScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/AccessPackageResourceRoleScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\RoleRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\ScopeRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRoleScope; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a accessPackageResourceRoleScope from an accessPackage list of resource role scopes. This API is available in the following national cloud deployments. * @param AccessPackageResourceRoleScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-delete-resourcerolescopes?view=graph-rest-1.0 Find more info here */ public function delete(?AccessPackageResourceRoleScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The resource roles and scopes in this access package. * @param AccessPackageResourceRoleScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resourceRoleScopes in identityGovernance * @param AccessPackageResourceRoleScope $body The request body * @param AccessPackageResourceRoleScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRoleScope $body, ?AccessPackageResourceRoleScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleScopeItemRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleScopeItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleScopeItemReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(AccessPackageResourceRoleScope $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Environment/EnvironmentRequestBuilder.php index 48763483f9c..7a5b7a39405 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/ResourceRequestBuilder.php index 1621f5452cb..c3d13e64c8b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\Resource\Scopes\ScopesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Roles/Count/CountRequestBuilder.php index d32842063d5..03e3938bd14 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 38a3901d376..a4abc089ee6 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Roles/RolesRequestBuilder.php index 6da035e222f..7704807cd22 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Count/CountRequestBuilder.php index 8eeb8ac9c9b..6656a53c8eb 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index e08c50ff3a5..c0782de3fa4 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\Resource\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index 7d0b8f9e574..24cdb3ab94a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php index 54187a6dafa..b1e989e7f67 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\Resource\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\Resource\Scopes\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php index 6d41538bd5e..80d5105a8b6 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index fd1a8ac238a..1163e971acd 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php index 2df981cec94..5ceb4cb2b1b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\Resource\Scopes\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\Resource\Scopes\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/ScopesRequestBuilder.php index c20c311fc14..b07401a905d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/RoleRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/RoleRequestBuilder.php index 68a65cf7a21..c1e76485b40 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/RoleRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Role/RoleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Role\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property role for identityGovernance * @param RoleRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RoleRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get role from identityGovernance * @param RoleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property role in identityGovernance * @param AccessPackageResourceRole $body The request body * @param RoleRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?RoleRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?RoleRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?RoleRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?RoleRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Role $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Environment/EnvironmentRequestBuilder.php index 89e77c9e356..4d674dc43d6 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/ResourceRequestBuilder.php index 5b6030c733f..05e29be8188 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\Resource\Scopes\ScopesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Count/CountRequestBuilder.php index 515330d35ad..37e61b8e211 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 6812096e0fa..f28a349510c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\Resource\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index 53d8db9722e..deccccdf140 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/ResourceRequestBuilder.php index f25a7c39353..5243a4c7b4c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\Resource\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\Resource\Roles\Item\Resource\Scopes\ScopesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php index 2f3d972d26d..5dfb834143e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index b6143d7cd6f..6fbc01a650a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php index 7c3fb9d459a..659db0d6b98 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\Resource\Roles\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\Resource\Roles\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/RolesRequestBuilder.php index 9c94ec6b2e9..1a8e06b56e9 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Scopes/Count/CountRequestBuilder.php index 113cdf27240..65b38054018 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 6aa580a6524..178044eb5f9 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Scopes/ScopesRequestBuilder.php index c0d51f3b940..6e2160d999c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/ScopeRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/ScopeRequestBuilder.php index 504dd4f4bb4..bcad60f9d10 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/ScopeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/Item/Scope/ScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\Scope\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scope for identityGovernance * @param ScopeRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ScopeRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get scope from identityGovernance * @param ScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scope in identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopeRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?ScopeRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ScopeRequestBuilderDeleteRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ScopeRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ScopeRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Sco $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/ResourceRoleScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/ResourceRoleScopesRequestBuilder.php index dc008f8f74c..fb0a099689e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/ResourceRoleScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AccessPackages/Item/ResourceRoleScopes/ResourceRoleScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\Item\ResourceRoleScopes\Item\AccessPackageResourceRoleScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRoleScope; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The resource roles and scopes in this access package. * @param ResourceRoleScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRoleScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new accessPackageResourceRoleScope for adding a resource role to an access package. The access package resource, for a group, an app, or a SharePoint Online site, must already exist in the access package catalog, and the originId for the resource role retrieved from the list of the resource roles. Once you add the resource role scope to the access package, the user will receive this resource role through any current and future access package assignments. This API is available in the following national cloud deployments. * @param AccessPackageResourceRoleScope $body The request body * @param ResourceRoleScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackage-post-resourcerolescopes?view=graph-rest-1.0 Find more info here */ public function post(AccessPackageResourceRoleScope $body, ?ResourceRoleScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ResourceRoleScopesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ResourceRoleScopesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AccessPackageResourceRoleScope $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/AssignmentPoliciesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/AssignmentPoliciesRequestBuilder.php index 828acf74aad..598e1e444c4 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/AssignmentPoliciesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/AssignmentPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentPolicies\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentPolicies\Item\AccessPackageAssignmentPolicyItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageAssignmentPolicy; @@ -53,46 +52,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * In Azure AD entitlement management, retrieve a list of accessPackageAssignmentPolicy objects. If the delegated user is in a directory role, the resulting list includes all the assignment policies that the caller has access to read, across all catalogs and access packages. If the delegated user is an access package manager or catalog owner, they should instead retrieve the policies for the access packages they can read with list accessPackages by including $expand=accessPackageAssignmentPolicies as a query parameter. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve a list of accessPackageAssignmentPolicy objects. If the delegated user is in a directory role, the resulting list includes all the assignment policies that the caller has access to read, across all catalogs and access packages. If the delegated user is an access package manager or catalog owner, they should instead retrieve the policies for the access packages they can read with list accessPackages by including $expand=accessPackageAssignmentPolicies as a query parameter. This API is available in the following national cloud deployments. * @param AssignmentPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-list-assignmentpolicies?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * In Azure AD entitlement management, create a new accessPackageAssignmentPolicy object. The request will include a reference to the accessPackage that will contain this policy, which must already exist. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, create a new accessPackageAssignmentPolicy object. The request will include a reference to the accessPackage that will contain this policy, which must already exist. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentPolicy $body The request body * @param AssignmentPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-post-assignmentpolicies?view=graph-rest-1.0 Find more info here */ public function post(AccessPackageAssignmentPolicy $body, ?AssignmentPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * In Azure AD entitlement management, retrieve a list of accessPackageAssignmentPolicy objects. If the delegated user is in a directory role, the resulting list includes all the assignment policies that the caller has access to read, across all catalogs and access packages. If the delegated user is an access package manager or catalog owner, they should instead retrieve the policies for the access packages they can read with list accessPackages by including $expand=accessPackageAssignmentPolicies as a query parameter. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve a list of accessPackageAssignmentPolicy objects. If the delegated user is in a directory role, the resulting list includes all the assignment policies that the caller has access to read, across all catalogs and access packages. If the delegated user is an access package manager or catalog owner, they should instead retrieve the policies for the access packages they can read with list accessPackages by including $expand=accessPackageAssignmentPolicies as a query parameter. This API is available in the following national cloud deployments. * @param AssignmentPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AssignmentPoliciesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,11 +101,12 @@ public function toGetRequestInformation(?AssignmentPoliciesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * In Azure AD entitlement management, create a new accessPackageAssignmentPolicy object. The request will include a reference to the accessPackage that will contain this policy, which must already exist. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, create a new accessPackageAssignmentPolicy object. The request will include a reference to the accessPackage that will contain this policy, which must already exist. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentPolicy $body The request body * @param AssignmentPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -123,11 +116,11 @@ public function toPostRequestInformation(AccessPackageAssignmentPolicy $body, ?A $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/AssignmentPoliciesRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/AssignmentPoliciesRequestBuilderGetQueryParameters.php index 4095916e4ad..50d3cbde181 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/AssignmentPoliciesRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/AssignmentPoliciesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * In Azure AD entitlement management, retrieve a list of accessPackageAssignmentPolicy objects. If the delegated user is in a directory role, the resulting list includes all the assignment policies that the caller has access to read, across all catalogs and access packages. If the delegated user is an access package manager or catalog owner, they should instead retrieve the policies for the access packages they can read with list accessPackages by including $expand=accessPackageAssignmentPolicies as a query parameter. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve a list of accessPackageAssignmentPolicy objects. If the delegated user is in a directory role, the resulting list includes all the assignment policies that the caller has access to read, across all catalogs and access packages. If the delegated user is an access package manager or catalog owner, they should instead retrieve the policies for the access packages they can read with list accessPackages by including $expand=accessPackageAssignmentPolicies as a query parameter. This API is available in the following national cloud deployments. */ class AssignmentPoliciesRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Count/CountRequestBuilder.php index 39fa85162e7..06825044988 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/AccessPackage/AccessPackageRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/AccessPackage/AccessPackageRequestBuilder.php index 7a890cded70..2d2d619228b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/AccessPackage/AccessPackageRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/AccessPackage/AccessPackageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Access package containing this policy. Read-only. Supports $expand. * @param AccessPackageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AccessPackageRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AccessPackageRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/AccessPackageAssignmentPolicyItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/AccessPackageAssignmentPolicyItemRequestBuilder.php index 4b15d43d8e1..ce448fa63a4 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/AccessPackageAssignmentPolicyItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/AccessPackageAssignmentPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentPolicies\Item\AccessPackage\AccessPackageRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentPolicies\Item\Catalog\CatalogRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentPolicies\Item\CustomExtensionStageSettings\CustomExtensionStageSettingsRequestBuilder; @@ -64,64 +63,55 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * In Azure AD entitlement management, delete an accessPackageAssignmentPolicy. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, delete an accessPackageAssignmentPolicy. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignmentpolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AccessPackageAssignmentPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * In Azure AD entitlement management, retrieve the properties and relationships of an accessPackageAssignmentPolicy object. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve the properties and relationships of an accessPackageAssignmentPolicy object. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignmentpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?AccessPackageAssignmentPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignmentPolicies in identityGovernance * @param AccessPackageAssignmentPolicy $body The request body * @param AccessPackageAssignmentPolicyItemRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(AccessPackageAssignmentPolicy $body, ?AccessPackageAssignmentPolicyItemRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * In Azure AD entitlement management, delete an accessPackageAssignmentPolicy. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, delete an accessPackageAssignmentPolicy. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -134,11 +124,12 @@ public function toDeleteRequestInformation(?AccessPackageAssignmentPolicyItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * In Azure AD entitlement management, retrieve the properties and relationships of an accessPackageAssignmentPolicy object. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve the properties and relationships of an accessPackageAssignmentPolicy object. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -147,7 +138,6 @@ public function toGetRequestInformation(?AccessPackageAssignmentPolicyItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -155,6 +145,7 @@ public function toGetRequestInformation(?AccessPackageAssignmentPolicyItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -169,11 +160,11 @@ public function toPutRequestInformation(AccessPackageAssignmentPolicy $body, ?Ac $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/AccessPackageAssignmentPolicyItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/AccessPackageAssignmentPolicyItemRequestBuilderGetQueryParameters.php index 76c5a9f455c..a81b21092e0 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/AccessPackageAssignmentPolicyItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/AccessPackageAssignmentPolicyItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * In Azure AD entitlement management, retrieve the properties and relationships of an accessPackageAssignmentPolicy object. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve the properties and relationships of an accessPackageAssignmentPolicy object. This API is available in the following national cloud deployments. */ class AccessPackageAssignmentPolicyItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Catalog/CatalogRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Catalog/CatalogRequestBuilder.php index b26451398e9..6266920139d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Catalog/CatalogRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Catalog/CatalogRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageCatalog; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Catalog of the access package containing this policy. Read-only. * @param CatalogRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CatalogRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CatalogRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CatalogRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/Count/CountRequestBuilder.php index d64b18cb2a3..f59c04072e9 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/CustomExtensionStageSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/CustomExtensionStageSettingsRequestBuilder.php index 9a081d8805a..95530a82c5c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/CustomExtensionStageSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/CustomExtensionStageSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentPolicies\Item\CustomExtensionStageSettings\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentPolicies\Item\CustomExtensionStageSettings\Item\CustomExtensionStageSettingItemRequestBuilder; use Microsoft\Graph\Generated\Models\CustomExtensionStageSetting; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of stages when to execute one or more custom access package workflow extensions. Supports $expand. * @param CustomExtensionStageSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CustomExtensionStageSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSettingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSettingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to customExtensionStageSettings for identityGovernance * @param CustomExtensionStageSetting $body The request body * @param CustomExtensionStageSettingsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CustomExtensionStageSetting $body, ?CustomExtensionStageSettingsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSetting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSetting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?CustomExtensionStageSettingsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?CustomExtensionStageSettingsRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(CustomExtensionStageSetting $body, ?Cus $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtension/CustomExtensionRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtension/CustomExtensionRequestBuilder.php index 3f0c91a24c3..af11242af67 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtension/CustomExtensionRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtension/CustomExtensionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CustomCalloutExtension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Indicates the custom workflow extension that will be executed at this stage. Nullable. Supports $expand. * @param CustomExtensionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CustomExtensionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CustomExtensionRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CustomExtensionRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtensionStageSettingItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtensionStageSettingItemRequestBuilder.php index 87d033651a1..4f3d2c77ff8 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtensionStageSettingItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/CustomExtensionStageSettings/Item/CustomExtensionStageSettingItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentPolicies\Item\CustomExtensionStageSettings\Item\CustomExtension\CustomExtensionRequestBuilder; use Microsoft\Graph\Generated\Models\CustomExtensionStageSetting; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property customExtensionStageSettings for identityGovernance * @param CustomExtensionStageSettingItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CustomExtensionStageSettingItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of stages when to execute one or more custom access package workflow extensions. Supports $expand. * @param CustomExtensionStageSettingItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CustomExtensionStageSettingItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSetting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSetting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property customExtensionStageSettings in identityGovernance * @param CustomExtensionStageSetting $body The request body * @param CustomExtensionStageSettingItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(CustomExtensionStageSetting $body, ?CustomExtensionStageSettingItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSetting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomExtensionStageSetting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?CustomExtensionStageSettingItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?CustomExtensionStageSettingItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?CustomExtensionStageSettingItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(CustomExtensionStageSetting $body, ?Cu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Questions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Questions/Count/CountRequestBuilder.php index de99b709ddd..16b6923d6c2 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Questions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Questions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Questions/Item/AccessPackageQuestionItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Questions/Item/AccessPackageQuestionItemRequestBuilder.php index 38e555f676d..024a1578ab5 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Questions/Item/AccessPackageQuestionItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Questions/Item/AccessPackageQuestionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageQuestion; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property questions for identityGovernance * @param AccessPackageQuestionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageQuestionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Questions that are posed to the requestor. * @param AccessPackageQuestionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageQuestionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property questions in identityGovernance * @param AccessPackageQuestion $body The request body * @param AccessPackageQuestionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageQuestion $body, ?AccessPackageQuestionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageQuestionItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageQuestionItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageQuestionItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageQuestion $body, ?AccessPa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Questions/QuestionsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Questions/QuestionsRequestBuilder.php index 425021f81ac..f104b9e98f6 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Questions/QuestionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentPolicies/Item/Questions/QuestionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentPolicies\Item\Questions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentPolicies\Item\Questions\Item\AccessPackageQuestionItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageQuestion; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Questions that are posed to the requestor. * @param QuestionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?QuestionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to questions for identityGovernance * @param AccessPackageQuestion $body The request body * @param QuestionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageQuestion $body, ?QuestionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?QuestionsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?QuestionsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageQuestion $body, ?Questions $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/AssignmentRequestsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/AssignmentRequestsRequestBuilder.php index a70d00becaa..c8f2ad550d7 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/AssignmentRequestsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/AssignmentRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentRequests\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentRequests\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentRequests\Item\AccessPackageAssignmentRequestItemRequestBuilder; @@ -63,46 +62,40 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn } /** - * In Azure AD entitlement management, retrieve a list of accessPackageAssignmentRequest objects. The resulting list includes all the assignment requests, current and well as expired, that the caller has access to read, across all catalogs and access packages. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve a list of accessPackageAssignmentRequest objects. The resulting list includes all the assignment requests, current and well as expired, that the caller has access to read, across all catalogs and access packages. This API is available in the following national cloud deployments. * @param AssignmentRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-list-assignmentrequests?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * In Azure AD Entitlement Management, create a new accessPackageAssignmentRequest object. This operation is used to assign a user to an access package, update the assignment, or to remove an access package assignment. This API is available in the following national cloud deployments. + * In Microsoft Entra Entitlement Management, create a new accessPackageAssignmentRequest object. This operation is used to assign a user to an access package, update the assignment, or to remove an access package assignment. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentRequest $body The request body * @param AssignmentRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-post-assignmentrequests?view=graph-rest-1.0 Find more info here */ public function post(AccessPackageAssignmentRequest $body, ?AssignmentRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * In Azure AD entitlement management, retrieve a list of accessPackageAssignmentRequest objects. The resulting list includes all the assignment requests, current and well as expired, that the caller has access to read, across all catalogs and access packages. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve a list of accessPackageAssignmentRequest objects. The resulting list includes all the assignment requests, current and well as expired, that the caller has access to read, across all catalogs and access packages. This API is available in the following national cloud deployments. * @param AssignmentRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -111,7 +104,6 @@ public function toGetRequestInformation(?AssignmentRequestsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -119,11 +111,12 @@ public function toGetRequestInformation(?AssignmentRequestsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * In Azure AD Entitlement Management, create a new accessPackageAssignmentRequest object. This operation is used to assign a user to an access package, update the assignment, or to remove an access package assignment. This API is available in the following national cloud deployments. + * In Microsoft Entra Entitlement Management, create a new accessPackageAssignmentRequest object. This operation is used to assign a user to an access package, update the assignment, or to remove an access package assignment. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentRequest $body The request body * @param AssignmentRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -133,11 +126,11 @@ public function toPostRequestInformation(AccessPackageAssignmentRequest $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/AssignmentRequestsRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/AssignmentRequestsRequestBuilderGetQueryParameters.php index 44518898a7a..4766917bf87 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/AssignmentRequestsRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/AssignmentRequestsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * In Azure AD entitlement management, retrieve a list of accessPackageAssignmentRequest objects. The resulting list includes all the assignment requests, current and well as expired, that the caller has access to read, across all catalogs and access packages. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve a list of accessPackageAssignmentRequest objects. The resulting list includes all the assignment requests, current and well as expired, that the caller has access to read, across all catalogs and access packages. This API is available in the following national cloud deployments. */ class AssignmentRequestsRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Count/CountRequestBuilder.php index 3232aa3689d..5362c8c0ab7 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index f4f25742278..bcb61405e08 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/AccessPackage/AccessPackageRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/AccessPackage/AccessPackageRequestBuilder.php index f2af36cb53b..f385d1c611e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/AccessPackage/AccessPackageRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/AccessPackage/AccessPackageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The access package associated with the accessPackageAssignmentRequest. An access package defines the collections of resource roles and the policies for how one or more users can get access to those resources. Read-only. Nullable. Supports $expand. * @param AccessPackageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AccessPackageRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AccessPackageRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/AccessPackageAssignmentRequestItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/AccessPackageAssignmentRequestItemRequestBuilder.php index 859b2e5861e..5a891d7370c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/AccessPackageAssignmentRequestItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/AccessPackageAssignmentRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentRequests\Item\AccessPackage\AccessPackageRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentRequests\Item\Assignment\AssignmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentRequests\Item\Cancel\CancelRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an accessPackageAssignmentRequest object. This request can be made to remove a denied or completed request. You cannot delete an access package assignment request if it has any accessPackageAssignment objects. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignmentrequest-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AccessPackageAssignmentRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * In Azure AD entitlement management, retrieve the properties and relationships of an accessPackageAssignmentRequest object. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve the properties and relationships of an accessPackageAssignmentRequest object. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignmentrequest-get?view=graph-rest-1.0 Find more info here */ public function get(?AccessPackageAssignmentRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignmentRequests in identityGovernance * @param AccessPackageAssignmentRequest $body The request body * @param AccessPackageAssignmentRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageAssignmentRequest $body, ?AccessPackageAssignmentRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,11 +140,12 @@ public function toDeleteRequestInformation(?AccessPackageAssignmentRequestItemRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * In Azure AD entitlement management, retrieve the properties and relationships of an accessPackageAssignmentRequest object. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve the properties and relationships of an accessPackageAssignmentRequest object. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -163,7 +154,6 @@ public function toGetRequestInformation(?AccessPackageAssignmentRequestItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?AccessPackageAssignmentRequestItemReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(AccessPackageAssignmentRequest $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/AccessPackageAssignmentRequestItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/AccessPackageAssignmentRequestItemRequestBuilderGetQueryParameters.php index 1f35d36e60c..3379f765b31 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/AccessPackageAssignmentRequestItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/AccessPackageAssignmentRequestItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * In Azure AD entitlement management, retrieve the properties and relationships of an accessPackageAssignmentRequest object. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve the properties and relationships of an accessPackageAssignmentRequest object. This API is available in the following national cloud deployments. */ class AccessPackageAssignmentRequestItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Assignment/AssignmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Assignment/AssignmentRequestBuilder.php index cbf271c9857..beebcdb23b9 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Assignment/AssignmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Assignment/AssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * For a requestType of userAdd or adminAdd, this is an access package assignment requested to be created. For a requestType of userRemove, adminRemove or systemRemove, this has the id property of an existing assignment to be removed. Supports $expand. * @param AssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AssignmentRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AssignmentRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Cancel/CancelRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Cancel/CancelRequestBuilder.php index 97c55aae533..74cadc96189 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,26 +30,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * In Azure AD Entitlement Management, cancel accessPackageAssignmentRequest objects that are in a cancellable state: accepted, pendingApproval, pendingNotBefore, pendingApprovalEscalated. This API is available in the following national cloud deployments. + * In Microsoft Entra Entitlement Management, cancel accessPackageAssignmentRequest objects that are in a cancellable state: accepted, pendingApproval, pendingNotBefore, pendingApprovalEscalated. This API is available in the following national cloud deployments. * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignmentrequest-cancel?view=graph-rest-1.0 Find more info here */ public function post(?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * In Azure AD Entitlement Management, cancel accessPackageAssignmentRequest objects that are in a cancellable state: accepted, pendingApproval, pendingNotBefore, pendingApprovalEscalated. This API is available in the following national cloud deployments. + * In Microsoft Entra Entitlement Management, cancel accessPackageAssignmentRequest objects that are in a cancellable state: accepted, pendingApproval, pendingNotBefore, pendingApprovalEscalated. This API is available in the following national cloud deployments. * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CancelRequestBuilderPostRequestConfigu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Reprocess/ReprocessRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Reprocess/ReprocessRequestBuilder.php index 02721854c45..4897ebf498d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Reprocess/ReprocessRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Reprocess/ReprocessRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,26 +30,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * In Azure AD entitlement management, callers can automatically retry a user's request for access to an access package. It's performed on an accessPackageAssignmentRequest object whose requestState is in a DeliveryFailed or PartiallyDelivered state. You can only reprocess a request within 14 days from the time the original request was completed. For requests completed more than 14 days, you will need to ask the users to cancel the request(s) and make a new request in the MyAccess portal. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, callers can automatically retry a user's request for access to an access package. It's performed on an accessPackageAssignmentRequest object whose requestState is in a DeliveryFailed or PartiallyDelivered state. You can only reprocess a request within 14 days from the time the original request was completed. For requests completed more than 14 days, you will need to ask the users to cancel the request(s) and make a new request in the MyAccess portal. This API is available in the following national cloud deployments. * @param ReprocessRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignmentrequest-reprocess?view=graph-rest-1.0 Find more info here */ public function post(?ReprocessRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * In Azure AD entitlement management, callers can automatically retry a user's request for access to an access package. It's performed on an accessPackageAssignmentRequest object whose requestState is in a DeliveryFailed or PartiallyDelivered state. You can only reprocess a request within 14 days from the time the original request was completed. For requests completed more than 14 days, you will need to ask the users to cancel the request(s) and make a new request in the MyAccess portal. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, callers can automatically retry a user's request for access to an access package. It's performed on an accessPackageAssignmentRequest object whose requestState is in a DeliveryFailed or PartiallyDelivered state. You can only reprocess a request within 14 days from the time the original request was completed. For requests completed more than 14 days, you will need to ask the users to cancel the request(s) and make a new request in the MyAccess portal. This API is available in the following national cloud deployments. * @param ReprocessRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ReprocessRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Requestor/RequestorRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Requestor/RequestorRequestBuilder.php index 23c0cae4e10..3cbef5ac1f7 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Requestor/RequestorRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Requestor/RequestorRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageSubject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The subject who requested or, if a direct assignment, was assigned. Read-only. Nullable. Supports $expand. * @param RequestorRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RequestorRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageSubject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageSubject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RequestorRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RequestorRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Resume/ResumeRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Resume/ResumeRequestBuilder.php index 44728be2574..74362be69bf 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Resume/ResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/AssignmentRequests/Item/Resume/ResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * In Azure AD entitlement management, when an access package policy has been enabled to call out a custom extension and the request processing is waiting for the callback from the customer, the customer can initiate a resume action. It is performed on an accessPackageAssignmentRequest object whose requestStatus is in a WaitingForCallback state. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, when an access package policy has been enabled to call out a custom extension and the request processing is waiting for the callback from the customer, the customer can initiate a resume action. It is performed on an accessPackageAssignmentRequest object whose requestStatus is in a WaitingForCallback state. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param ResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignmentrequest-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?ResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * In Azure AD entitlement management, when an access package policy has been enabled to call out a custom extension and the request processing is waiting for the callback from the customer, the customer can initiate a resume action. It is performed on an accessPackageAssignmentRequest object whose requestStatus is in a WaitingForCallback state. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, when an access package policy has been enabled to call out a custom extension and the request processing is waiting for the callback from the customer, the customer can initiate a resume action. It is performed on an accessPackageAssignmentRequest object whose requestStatus is in a WaitingForCallback state. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param ResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?ResumeReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AdditionalAccess/AdditionalAccessRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AdditionalAccess/AdditionalAccessRequestBuilder.php index 6913c47626e..af535c598a3 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AdditionalAccess/AdditionalAccessRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AdditionalAccess/AdditionalAccessRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function additionalAccess * @param AdditionalAccessRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AdditionalAccessRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdditionalAccessGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdditionalAccessGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?AdditionalAccessRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?AdditionalAccessRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageId/AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageIdRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageId/AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageIdRequestBuilder.php index 4559c90154c..3eafeb70ebd 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageId/AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageIdRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageId/AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageIdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function additionalAccess * @param AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageIdRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageIdRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageIdGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageIdGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -63,7 +59,6 @@ public function toGetRequestInformation(?AdditionalAccessWithAccessPackageIdWith $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -71,6 +66,7 @@ public function toGetRequestInformation(?AdditionalAccessWithAccessPackageIdWith } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AssignmentsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AssignmentsRequestBuilder.php index 96d654787f0..78c95e8be63 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AssignmentsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Assignments\AdditionalAccess\AdditionalAccessRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Assignments\AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageId\AdditionalAccessWithAccessPackageIdWithIncompatibleAccessPackageIdRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Assignments\Count\CountRequestBuilder; @@ -82,45 +81,39 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn } /** - * In Azure AD entitlement management, retrieve a list of accessPackageAssignment objects. For directory-wide administrators, the resulting list includes all the assignments, current and well as expired, that the caller has access to read, across all catalogs and access packages. If the caller is on behalf of a delegated user who is assigned only to catalog-specific delegated administrative roles, the request must supply a filter to indicate a specific access package, such as: $filter=accessPackage/id eq 'a914b616-e04e-476b-aa37-91038f0b165b'. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve a list of accessPackageAssignment objects. For directory-wide administrators, the resulting list includes all the assignments, current and well as expired, that the caller has access to read, across all catalogs and access packages. If the caller is on behalf of a delegated user who is assigned only to catalog-specific delegated administrative roles, the request must supply a filter to indicate a specific access package, such as: $filter=accessPackage/id eq 'a914b616-e04e-476b-aa37-91038f0b165b'. This API is available in the following national cloud deployments. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-list-assignments?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to assignments for identityGovernance * @param AccessPackageAssignment $body The request body * @param AssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageAssignment $body, ?AssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * In Azure AD entitlement management, retrieve a list of accessPackageAssignment objects. For directory-wide administrators, the resulting list includes all the assignments, current and well as expired, that the caller has access to read, across all catalogs and access packages. If the caller is on behalf of a delegated user who is assigned only to catalog-specific delegated administrative roles, the request must supply a filter to indicate a specific access package, such as: $filter=accessPackage/id eq 'a914b616-e04e-476b-aa37-91038f0b165b'. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve a list of accessPackageAssignment objects. For directory-wide administrators, the resulting list includes all the assignments, current and well as expired, that the caller has access to read, across all catalogs and access packages. If the caller is on behalf of a delegated user who is assigned only to catalog-specific delegated administrative roles, the request must supply a filter to indicate a specific access package, such as: $filter=accessPackage/id eq 'a914b616-e04e-476b-aa37-91038f0b165b'. This API is available in the following national cloud deployments. * @param AssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -129,7 +122,6 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +129,7 @@ public function toGetRequestInformation(?AssignmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +144,11 @@ public function toPostRequestInformation(AccessPackageAssignment $body, ?Assignm $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AssignmentsRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AssignmentsRequestBuilderGetQueryParameters.php index 538d496d787..953bc21e8d7 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AssignmentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/AssignmentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * In Azure AD entitlement management, retrieve a list of accessPackageAssignment objects. For directory-wide administrators, the resulting list includes all the assignments, current and well as expired, that the caller has access to read, across all catalogs and access packages. If the caller is on behalf of a delegated user who is assigned only to catalog-specific delegated administrative roles, the request must supply a filter to indicate a specific access package, such as: $filter=accessPackage/id eq 'a914b616-e04e-476b-aa37-91038f0b165b'. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve a list of accessPackageAssignment objects. For directory-wide administrators, the resulting list includes all the assignments, current and well as expired, that the caller has access to read, across all catalogs and access packages. If the caller is on behalf of a delegated user who is assigned only to catalog-specific delegated administrative roles, the request must supply a filter to indicate a specific access package, such as: $filter=accessPackage/id eq 'a914b616-e04e-476b-aa37-91038f0b165b'. This API is available in the following national cloud deployments. */ class AssignmentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Count/CountRequestBuilder.php index 25ff0429baa..54542b29b30 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index cf3876aac1c..22a63e740fa 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AccessPackage/AccessPackageRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AccessPackage/AccessPackageRequestBuilder.php index 8bfda772b6d..97708f9ad43 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AccessPackage/AccessPackageRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AccessPackage/AccessPackageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $filter (eq) on the id property and $expand query parameters. * @param AccessPackageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AccessPackageRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AccessPackageRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AccessPackageAssignmentItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AccessPackageAssignmentItemRequestBuilder.php index db63ba8c075..f35a3159438 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AccessPackageAssignmentItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AccessPackageAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Assignments\Item\AccessPackage\AccessPackageRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Assignments\Item\AssignmentPolicy\AssignmentPolicyRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Assignments\Item\Reprocess\ReprocessRequestBuilder; @@ -66,57 +65,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignments for identityGovernance * @param AccessPackageAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * In Azure AD entitlement management, retrieve the properties and relationships of an accessPackageAssignment object. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve the properties and relationships of an accessPackageAssignment object. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?AccessPackageAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignments in identityGovernance * @param AccessPackageAssignment $body The request body * @param AccessPackageAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageAssignment $body, ?AccessPackageAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,11 +123,12 @@ public function toDeleteRequestInformation(?AccessPackageAssignmentItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * In Azure AD entitlement management, retrieve the properties and relationships of an accessPackageAssignment object. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve the properties and relationships of an accessPackageAssignment object. This API is available in the following national cloud deployments. * @param AccessPackageAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -146,7 +137,6 @@ public function toGetRequestInformation(?AccessPackageAssignmentItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -154,6 +144,7 @@ public function toGetRequestInformation(?AccessPackageAssignmentItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -168,11 +159,11 @@ public function toPatchRequestInformation(AccessPackageAssignment $body, ?Access $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AccessPackageAssignmentItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AccessPackageAssignmentItemRequestBuilderGetQueryParameters.php index f29c7c47e3b..8bdc3c8face 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AccessPackageAssignmentItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AccessPackageAssignmentItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * In Azure AD entitlement management, retrieve the properties and relationships of an accessPackageAssignment object. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, retrieve the properties and relationships of an accessPackageAssignment object. This API is available in the following national cloud deployments. */ class AccessPackageAssignmentItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AssignmentPolicy/AssignmentPolicyRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AssignmentPolicy/AssignmentPolicyRequestBuilder.php index 55c85bd6f14..b4d653f49fd 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AssignmentPolicy/AssignmentPolicyRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/AssignmentPolicy/AssignmentPolicyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageAssignmentPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Supports $filter (eq) on the id property and $expand query parameters. * @param AssignmentPolicyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AssignmentPolicyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageAssignmentPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AssignmentPolicyRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AssignmentPolicyRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/Reprocess/ReprocessRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/Reprocess/ReprocessRequestBuilder.php index 09858273493..1c45d360937 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/Reprocess/ReprocessRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/Reprocess/ReprocessRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,26 +30,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * In Azure AD entitlement management, callers can automatically reevaluate and enforce an accessPackageAssignment object of a user’s assignments for a specific access package. The state of the access package assignment must be Delivered for the administrator to reprocess the user's assignment. Only admins with the Access Package Assignment Manager role, or higher, in Azure AD entitlement management can perform this action. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, callers can automatically reevaluate and enforce an accessPackageAssignment object of a user’s assignments for a specific access package. The state of the access package assignment must be Delivered for the administrator to reprocess the user's assignment. Only admins with the Access Package Assignment Manager role, or higher, in Microsoft Entra entitlement management can perform this action. This API is available in the following national cloud deployments. * @param ReprocessRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignment-reprocess?view=graph-rest-1.0 Find more info here */ public function post(?ReprocessRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * In Azure AD entitlement management, callers can automatically reevaluate and enforce an accessPackageAssignment object of a user’s assignments for a specific access package. The state of the access package assignment must be Delivered for the administrator to reprocess the user's assignment. Only admins with the Access Package Assignment Manager role, or higher, in Azure AD entitlement management can perform this action. This API is available in the following national cloud deployments. + * In Microsoft Entra entitlement management, callers can automatically reevaluate and enforce an accessPackageAssignment object of a user’s assignments for a specific access package. The state of the access package assignment must be Delivered for the administrator to reprocess the user's assignment. Only admins with the Access Package Assignment Manager role, or higher, in Microsoft Entra entitlement management can perform this action. This API is available in the following national cloud deployments. * @param ReprocessRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ReprocessRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/Target/TargetRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/Target/TargetRequestBuilder.php index 3aef13fcb3f..9c5a553d816 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/Target/TargetRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Assignments/Item/Target/TargetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageSubject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The subject of the access package assignment. Read-only. Nullable. Supports $expand. Supports $filter (eq) on objectId. * @param TargetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TargetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageSubject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageSubject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TargetRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TargetRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/CatalogsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/CatalogsRequestBuilder.php index c17dea3dc0b..594aa61a33d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/CatalogsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/CatalogsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\AccessPackageCatalogItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageCatalog; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of accessPackageCatalog objects. This API is available in the following national cloud deployments. * @param CatalogsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-list-catalogs?view=graph-rest-1.0 Find more info here */ public function get(?CatalogsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new accessPackageCatalog object. This API is available in the following national cloud deployments. * @param AccessPackageCatalog $body The request body * @param CatalogsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-post-catalogs?view=graph-rest-1.0 Find more info here */ public function post(AccessPackageCatalog $body, ?CatalogsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CatalogsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CatalogsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AccessPackageCatalog $body, ?CatalogsRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Count/CountRequestBuilder.php index 4da36168d9f..65cbcb50c25 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackageCatalogItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackageCatalogItemRequestBuilder.php index 9df2683cac9..8f66da8592e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackageCatalogItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackageCatalogItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\AccessPackages\AccessPackagesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\CustomWorkflowExtensions\CustomWorkflowExtensionsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\ResourceRolesRequestBuilder; @@ -74,59 +73,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an accessPackageCatalog. This API is available in the following national cloud deployments. * @param AccessPackageCatalogItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackagecatalog-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AccessPackageCatalogItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an accessPackageCatalog object. This API is available in the following national cloud deployments. * @param AccessPackageCatalogItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackagecatalog-get?view=graph-rest-1.0 Find more info here */ public function get(?AccessPackageCatalogItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an existing accessPackageCatalog object to change one or more of its properties, such as the display name or description. This API is available in the following national cloud deployments. * @param AccessPackageCatalog $body The request body * @param AccessPackageCatalogItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackagecatalog-update?view=graph-rest-1.0 Find more info here */ public function patch(AccessPackageCatalog $body, ?AccessPackageCatalogItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -143,6 +133,7 @@ public function toDeleteRequestInformation(?AccessPackageCatalogItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -156,7 +147,6 @@ public function toGetRequestInformation(?AccessPackageCatalogItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -164,6 +154,7 @@ public function toGetRequestInformation(?AccessPackageCatalogItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -178,11 +169,11 @@ public function toPatchRequestInformation(AccessPackageCatalog $body, ?AccessPac $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackages/AccessPackagesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackages/AccessPackagesRequestBuilder.php index 2ff99685dd2..dcb1573a8f8 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackages/AccessPackagesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackages/AccessPackagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\AccessPackages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\AccessPackages\Item\AccessPackageItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The access packages in this catalog. Read-only. Nullable. * @param AccessPackagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?AccessPackagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?AccessPackagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackages/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackages/Count/CountRequestBuilder.php index e97a8346507..c0e5075b092 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackages/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackages/Item/AccessPackageItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackages/Item/AccessPackageItemRequestBuilder.php index 8635220e1e6..9642ac2129b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackages/Item/AccessPackageItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/AccessPackages/Item/AccessPackageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The access packages in this catalog. Read-only. Nullable. * @param AccessPackageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AccessPackageItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AccessPackageItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/CustomWorkflowExtensions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/CustomWorkflowExtensions/Count/CountRequestBuilder.php index ff71f12d0f8..1ba3c107b1f 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/CustomWorkflowExtensions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/CustomWorkflowExtensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/CustomWorkflowExtensions/CustomWorkflowExtensionsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/CustomWorkflowExtensions/CustomWorkflowExtensionsRequestBuilder.php index 58d778d061e..be018bc51a9 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/CustomWorkflowExtensions/CustomWorkflowExtensionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/CustomWorkflowExtensions/CustomWorkflowExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\CustomWorkflowExtensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\CustomWorkflowExtensions\Item\CustomCalloutExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\CustomCalloutExtension; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the accessPackageAssignmentRequestWorkflowExtension and accessPackageAssignmentWorkflowExtension objects and their properties. The resulting list includes all the customAccessPackageWorkflowExtension objects for the catalog that the caller has access to read. Each object includes an @odata.type property that indicates whether the object is an accessPackageAssignmentRequestWorkflowExtension or an accessPackageAssignmentWorkflowExtension. This API is available in the following national cloud deployments. * @param CustomWorkflowExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackagecatalog-list-accesspackagecustomworkflowextensions?view=graph-rest-1.0 Find more info here */ public function get(?CustomWorkflowExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new accessPackageAssignmentRequestWorkflowExtension or accessPackageAssignmentWorkflowExtension object and add it to an existing accessPackageCatalog object. You must explicitly provide an @odata.type property that indicates whether the object is an accessPackageAssignmentRequestWorkflowExtension or an accessPackageAssignmentWorkflowExtension. This API is available in the following national cloud deployments. * @param CustomCalloutExtension $body The request body * @param CustomWorkflowExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackagecatalog-post-accesspackagecustomworkflowextensions?view=graph-rest-1.0 Find more info here */ public function post(CustomCalloutExtension $body, ?CustomWorkflowExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CustomWorkflowExtensionsRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CustomWorkflowExtensionsRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(CustomCalloutExtension $body, ?CustomWo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/CustomWorkflowExtensions/Item/CustomCalloutExtensionItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/CustomWorkflowExtensions/Item/CustomCalloutExtensionItemRequestBuilder.php index 1d9bea2fe53..f262c8abc81 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/CustomWorkflowExtensions/Item/CustomCalloutExtensionItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/CustomWorkflowExtensions/Item/CustomCalloutExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CustomCalloutExtension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an accessPackageAssignmentRequestWorkflowExtension object. The custom workflow extension must first be removed from any associated policies before it can be deleted. Follow these steps to remove the custom workflow extension from any associated policies: This API is available in the following national cloud deployments. * @param CustomCalloutExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignmentrequestworkflowextension-delete?view=graph-rest-1.0 Find more info here */ public function delete(?CustomCalloutExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an accessPackageAssignmentRequestWorkflowExtension object. This API is available in the following national cloud deployments. * @param CustomCalloutExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignmentrequestworkflowextension-get?view=graph-rest-1.0 Find more info here */ public function get(?CustomCalloutExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an accessPackageAssignmentRequestWorkflowExtension object. * @param CustomCalloutExtension $body The request body * @param CustomCalloutExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignmentrequestworkflowextension-update?view=graph-rest-1.0 Find more info here */ public function patch(CustomCalloutExtension $body, ?CustomCalloutExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?CustomCalloutExtensionItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?CustomCalloutExtensionItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?CustomCalloutExtensionItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(CustomCalloutExtension $body, ?CustomC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Count/CountRequestBuilder.php index fa4d9e7b988..3f64c2aac90 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 6c1abcc4df1..a01b330bcd9 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resourceRoles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resourceRoles from identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resourceRoles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Environment/EnvironmentRequestBuilder.php index 1a6da3ed53d..399775f40a1 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/ResourceRequestBuilder.php index ff1629249b4..ee2e438b040 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\Resource\Scopes\ScopesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Roles/Count/CountRequestBuilder.php index 91c7796f64a..4237059cbbe 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index f0eea70e0bc..6c883509d1b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Roles/RolesRequestBuilder.php index adba9af758c..1e484bdd1fe 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Count/CountRequestBuilder.php index dce0994a564..d561ea67932 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index ab81597406d..9e1edb2f0d2 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\Resource\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index ee9e6933431..edfe2d94114 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php index dc68a6587a2..7b30a7ae974 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\Resource\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\Resource\Scopes\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php index d93aac3378a..700ea66f782 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index a51ccb91c96..1b45b8e8219 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php index 54da2680efd..0d5673c6b1d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\Resource\Scopes\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\Resource\Scopes\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/ScopesRequestBuilder.php index c596fddb944..1ad709c9d94 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/ResourceRolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/ResourceRolesRequestBuilder.php index 2240fc54fba..2cab270f69b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/ResourceRolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceRoles/ResourceRolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceRoles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of accessPackageResourceRole objects of an accessPackageResource in an accessPackageCatalog. The resource should have been added to the catalog by creating an accessPackageResourceRequest. This list of roles can then be used by the caller to select a role, which is needed when subsequently creating an accessPackageResourceRoleScope. This API is available in the following national cloud deployments. * @param ResourceRolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackagecatalog-list-resourceroles?view=graph-rest-1.0 Find more info here */ public function get(?ResourceRolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resourceRoles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param ResourceRolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?ResourceRolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ResourceRolesRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ResourceRolesRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Resou $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Count/CountRequestBuilder.php index 35f9d469b61..d7bc54c5f9d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 24dc90fdf18..fd5847b56fb 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resourceScopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resourceScopes from identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resourceScopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index 2e594c1b91b..86e3ddb08cc 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/ResourceRequestBuilder.php index 41f9fc8d0e8..a89467c8b44 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\Resource\Scopes\ScopesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Count/CountRequestBuilder.php index 22acf8313fa..f86b4e19b66 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index c68a2de7213..c3403c2333e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\Resource\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index f65372e576e..aec435d1ee5 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php index 31dd9d9afbc..3a9527296ba 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\Resource\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\Resource\Roles\Item\Resource\Scopes\ScopesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php index 13b23db637c..b2398d051cc 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 4c30602a747..74afda56c3e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php index c9d8193c771..c8e70e82ed7 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\Resource\Roles\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\Resource\Roles\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/RolesRequestBuilder.php index e5d8b85f2b8..c95d18286ad 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Scopes/Count/CountRequestBuilder.php index fa1feb13909..5c0c3f6aa78 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 8cbf78785c7..9f117add410 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Scopes/ScopesRequestBuilder.php index a2680d651f1..e02183576bf 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/ResourceScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/ResourceScopesRequestBuilder.php index 4e01e484bf7..befeeb2d38e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/ResourceScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/ResourceScopes/ResourceScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\ResourceScopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get resourceScopes from identityGovernance * @param ResourceScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resourceScopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ResourceScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ResourceScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResourceScopesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResourceScopesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Reso $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Count/CountRequestBuilder.php index 90b27815773..c49ab097a12 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/AccessPackageResourceItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/AccessPackageResourceItemRequestBuilder.php index 5e95c531935..42f65709eef 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/AccessPackageResourceItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/AccessPackageResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Scopes\ScopesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resources for identityGovernance * @param AccessPackageResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Access package resources in this catalog. * @param AccessPackageResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in identityGovernance * @param AccessPackageResource $body The request body * @param AccessPackageResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?AccessPackageResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?AccessPackageResourceItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?AccessPackageResourceItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?AccessPa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Environment/EnvironmentRequestBuilder.php index 6713321a0e7..e29cabe6c04 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Count/CountRequestBuilder.php index f8aa23c3296..923c5c7c455 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index d58fb10670c..7da065392ce 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index 4b495a8dac0..40c0a56f981 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php index be3f2a58cfc..9d8279e0e2f 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Roles\Item\Resource\Scopes\ScopesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php index 8a293f6c589..0af4a029d8f 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 476eff6317b..c7ff382c82a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Roles\Item\Resource\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index 5251a1621e3..12983e4ad90 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php index 49919725659..95a6f9d488c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Roles\Item\Resource\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php index 0d493a42b1f..b174c63a510 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Roles\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Roles\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/RolesRequestBuilder.php index ccc205dd1d1..c2949d40811 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Count/CountRequestBuilder.php index b0f33bbd388..2dc06597dca 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 335ed4e4f77..f4bfa923644 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index 2ac26d41d7a..208510346e3 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php index 74a7c4359ba..a9d21da6520 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Scopes\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php index 5a23c054446..19f9ebaad9b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 702d2b5b9a7..908e5469f5f 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Scopes\Item\Resource\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index d5846e1a258..e453ace6f34 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php index e1f05c20af1..d90a7d21896 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Scopes\Item\Resource\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php index 74887463e9c..4956a46b34c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Scopes\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Scopes\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/ScopesRequestBuilder.php index 52df26a4d76..af666e308a8 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/Item/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/ResourcesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/ResourcesRequestBuilder.php index 5f9ef7f9e6a..4c0294b6059 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Catalogs/Item/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Catalogs\Item\Resources\Item\AccessPackageResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of accessPackageResource objects in an accessPackageCatalog. This API is available in the following national cloud deployments. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackagecatalog-list-resources?view=graph-rest-1.0 Find more info here */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resources for identityGovernance * @param AccessPackageResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AccessPackageResource $body, ?Resources $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/ConnectedOrganizationsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/ConnectedOrganizationsRequestBuilder.php index fe63f889dd9..3365faa8776 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/ConnectedOrganizationsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/ConnectedOrganizationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ConnectedOrganizations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ConnectedOrganizations\Item\ConnectedOrganizationItemRequestBuilder; use Microsoft\Graph\Generated\Models\ConnectedOrganization; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of connectedOrganization objects. This API is available in the following national cloud deployments. * @param ConnectedOrganizationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-list-connectedorganizations?view=graph-rest-1.0 Find more info here */ public function get(?ConnectedOrganizationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConnectedOrganizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConnectedOrganizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new connectedOrganization object. This API is available in the following national cloud deployments. * @param ConnectedOrganization $body The request body * @param ConnectedOrganizationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-post-connectedorganizations?view=graph-rest-1.0 Find more info here */ public function post(ConnectedOrganization $body, ?ConnectedOrganizationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConnectedOrganization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConnectedOrganization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ConnectedOrganizationsRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ConnectedOrganizationsRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ConnectedOrganization $body, ?Connected $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Count/CountRequestBuilder.php index b054720edae..bfa0329d22c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ConnectedOrganizationItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ConnectedOrganizationItemRequestBuilder.php index 6de118d6d7c..b82a8c22d0a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ConnectedOrganizationItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ConnectedOrganizationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ConnectedOrganizations\Item\ExternalSponsors\ExternalSponsorsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ConnectedOrganizations\Item\InternalSponsors\InternalSponsorsRequestBuilder; use Microsoft\Graph\Generated\Models\ConnectedOrganization; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a connectedOrganization object. This API is available in the following national cloud deployments. * @param ConnectedOrganizationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/connectedorganization-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ConnectedOrganizationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a connectedOrganization object. This API is available in the following national cloud deployments. * @param ConnectedOrganizationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/connectedorganization-get?view=graph-rest-1.0 Find more info here */ public function get(?ConnectedOrganizationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConnectedOrganization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConnectedOrganization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a connectedOrganization object to change one or more of its properties. This API is available in the following national cloud deployments. * @param ConnectedOrganization $body The request body * @param ConnectedOrganizationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/connectedorganization-update?view=graph-rest-1.0 Find more info here */ public function patch(ConnectedOrganization $body, ?ConnectedOrganizationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConnectedOrganization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConnectedOrganization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?ConnectedOrganizationItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?ConnectedOrganizationItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?ConnectedOrganizationItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(ConnectedOrganization $body, ?Connecte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/Count/CountRequestBuilder.php index 7c1e898a500..c6a738b5ae8 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/ExternalSponsorsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/ExternalSponsorsRequestBuilder.php index ab55b9df24f..e2302347a88 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/ExternalSponsorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/ExternalSponsorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ConnectedOrganizations\Item\ExternalSponsors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ConnectedOrganizations\Item\ExternalSponsors\Item\DirectoryObjectItemRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ConnectedOrganizations\Item\ExternalSponsors\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of a connectedOrganization's external sponsors. The external sponsors are a set of users who can approve requests on behalf of other users from that connected organization. This API is available in the following national cloud deployments. * @param ExternalSponsorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/connectedorganization-list-externalsponsors?view=graph-rest-1.0 Find more info here */ public function get(?ExternalSponsorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?ExternalSponsorsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?ExternalSponsorsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/Item/Ref/RefRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/Item/Ref/RefRequestBuilder.php index 8d328e6cc2f..791cd3e0328 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a user or a group from the connected organization's external sponsors. The external sponsors are a set of users who can approve requests on behalf of other users from that connected organization. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/connectedorganization-delete-externalsponsors?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/Ref/RefRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/Ref/RefRequestBuilder.php index 2d570d82424..d77a64dbd69 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/Ref/RefRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/ExternalSponsors/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of a connectedOrganization's external sponsors. The external sponsors are a set of users who can approve requests on behalf of other users from that connected organization. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/connectedorganization-list-externalsponsors?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a user or a group to the connected organization's external sponsors. The external sponsors are a set of users who can approve requests on behalf of other users from that connected organization. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/connectedorganization-post-externalsponsors?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/Count/CountRequestBuilder.php index d340dddf31c..1173d4bd674 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/InternalSponsorsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/InternalSponsorsRequestBuilder.php index 5320ea1dc99..b386459bd14 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/InternalSponsorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/InternalSponsorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ConnectedOrganizations\Item\InternalSponsors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ConnectedOrganizations\Item\InternalSponsors\Item\DirectoryObjectItemRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ConnectedOrganizations\Item\InternalSponsors\Ref\RefRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of a connectedOrganization's internal sponsors. The internal sponsors are a set of users who can approve requests on behalf of other users from that connected organization. This API is available in the following national cloud deployments. * @param InternalSponsorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/connectedorganization-list-internalsponsors?view=graph-rest-1.0 Find more info here */ public function get(?InternalSponsorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?InternalSponsorsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?InternalSponsorsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/Item/Ref/RefRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/Item/Ref/RefRequestBuilder.php index 3ed75a30152..489f6952160 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a user or a group from the connected organization's internal sponsors. The internal sponsors are a set of users who can approve requests on behalf of other users from that connected organization. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/connectedorganization-delete-internalsponsors?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/Ref/RefRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/Ref/RefRequestBuilder.php index 89ac9cc1d2f..af773018dc0 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/Ref/RefRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ConnectedOrganizations/Item/InternalSponsors/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of a connectedOrganization's internal sponsors. The internal sponsors are a set of users who can approve requests on behalf of other users from that connected organization. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/connectedorganization-list-internalsponsors?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a user or a group to the connected organization's internal sponsors. The internal sponsors are a set of users who can approve requests on behalf of other users from that connected organization. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/connectedorganization-post-internalsponsors?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/EntitlementManagementRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/EntitlementManagementRequestBuilder.php index c3f469a02bc..4634970b1ed 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/EntitlementManagementRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/EntitlementManagementRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackageAssignmentApprovals\AccessPackageAssignmentApprovalsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AccessPackages\AccessPackagesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\AssignmentPolicies\AssignmentPoliciesRequestBuilder; @@ -130,56 +129,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property entitlementManagement for identityGovernance * @param EntitlementManagementRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EntitlementManagementRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entitlementManagement from identityGovernance * @param EntitlementManagementRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EntitlementManagementRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EntitlementManagement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EntitlementManagement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property entitlementManagement in identityGovernance * @param EntitlementManagement $body The request body * @param EntitlementManagementRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EntitlementManagement $body, ?EntitlementManagementRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EntitlementManagement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EntitlementManagement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -196,6 +186,7 @@ public function toDeleteRequestInformation(?EntitlementManagementRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -209,7 +200,6 @@ public function toGetRequestInformation(?EntitlementManagementRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -217,6 +207,7 @@ public function toGetRequestInformation(?EntitlementManagementRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -231,11 +222,11 @@ public function toPatchRequestInformation(EntitlementManagement $body, ?Entitlem $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Count/CountRequestBuilder.php index 17d3fb751f6..965fa7b771c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/AccessPackageResourceEnvironmentItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/AccessPackageResourceEnvironmentItemRequestBuilder.php index b74f29832ee..d88ad6d7845 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/AccessPackageResourceEnvironmentItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/AccessPackageResourceEnvironmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\ResourcesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resourceEnvironments for identityGovernance * @param AccessPackageResourceEnvironmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceEnvironmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A reference to the geolocation environments in which a resource is located. * @param AccessPackageResourceEnvironmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceEnvironmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resourceEnvironments in identityGovernance * @param AccessPackageResourceEnvironment $body The request body * @param AccessPackageResourceEnvironmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceEnvironment $body, ?AccessPackageResourceEnvironmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceEnvironmentItem $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceEnvironmentItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceEnvironmentItemReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceEnvironment $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Count/CountRequestBuilder.php index a8f2df07693..f9d307fe014 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/AccessPackageResourceItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/AccessPackageResourceItemRequestBuilder.php index 2e97b80aeef..815ff33b873 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/AccessPackageResourceItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/AccessPackageResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Scopes\ScopesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resources for identityGovernance * @param AccessPackageResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Required. * @param AccessPackageResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in identityGovernance * @param AccessPackageResource $body The request body * @param AccessPackageResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?AccessPackageResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?AccessPackageResourceItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?AccessPackageResourceItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?AccessPa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Environment/EnvironmentRequestBuilder.php index cd4569d1cc9..d82d8905a41 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Count/CountRequestBuilder.php index 3be5e974933..56a30fedca4 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 6ff5661a262..cf49521cb39 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index a3fe699b06d..1020ba30793 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php index 6ae25f96365..b9b8d13adb8 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Roles\Item\Resource\Scopes\ScopesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php index 88d252ad34e..76468d2a240 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 216aa909287..5bf4e3d69f3 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Roles\Item\Resource\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index c66be2659c1..bb18c14778d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php index c5ea4d1bf93..9f8e77dcbfb 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Roles\Item\Resource\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php index 386e52bd530..ce99e733fd6 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Roles\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Roles\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/RolesRequestBuilder.php index 4c0b71d07d2..5f40b191102 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Count/CountRequestBuilder.php index 31a8daf864a..56df35c1fd0 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index c6731ca033d..ac33209b14d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index 8d4237a04d5..31593bec7fd 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php index 353163f2731..28c9ce90941 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Scopes\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php index 988b2a74dfb..43a985ddee2 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index b74d12994b1..a3e2aaad11f 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Scopes\Item\Resource\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index 1ed7bff5095..f16f732333e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php index dc3964a0a44..79b22957dc7 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Scopes\Item\Resource\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php index 18de18fd0a8..9317bd4d8f5 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Scopes\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Scopes\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/ScopesRequestBuilder.php index 8831609a4c6..8ff076ad2cf 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/Item/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/ResourcesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/ResourcesRequestBuilder.php index 0b187cb9df4..3e868e21d06 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/Item/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\Resources\Item\AccessPackageResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Required. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resources for identityGovernance * @param AccessPackageResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResource $body, ?Resources $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/ResourceEnvironmentsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/ResourceEnvironmentsRequestBuilder.php index a9f7cf39c37..61039c92c20 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/ResourceEnvironmentsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceEnvironments/ResourceEnvironmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceEnvironments\Item\AccessPackageResourceEnvironmentItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of accessPackageResourceEnvironment objects and their properties. This API is available in the following national cloud deployments. * @param ResourceEnvironmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-list-resourceenvironments?view=graph-rest-1.0 Find more info here */ public function get(?ResourceEnvironmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resourceEnvironments for identityGovernance * @param AccessPackageResourceEnvironment $body The request body * @param ResourceEnvironmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceEnvironment $body, ?ResourceEnvironmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ResourceEnvironmentsRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ResourceEnvironmentsRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AccessPackageResourceEnvironment $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Count/CountRequestBuilder.php index 2e5f7894200..ff44c27ab45 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/AccessPackageResourceRequestItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/AccessPackageResourceRequestItemRequestBuilder.php index 1192673f0e8..70d73b43582 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/AccessPackageResourceRequestItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/AccessPackageResourceRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\CatalogRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRequest; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resourceRequests for identityGovernance * @param AccessPackageResourceRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents a request to add or remove a resource to or from a catalog respectively. * @param AccessPackageResourceRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resourceRequests in identityGovernance * @param AccessPackageResourceRequest $body The request body * @param AccessPackageResourceRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRequest $body, ?AccessPackageResourceRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRequestItemRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?AccessPackageResourceRequestItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?AccessPackageResourceRequestItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResourceRequest $body, ?A $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/AccessPackages/AccessPackagesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/AccessPackages/AccessPackagesRequestBuilder.php index 9f5dbaf0abb..3d68784909a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/AccessPackages/AccessPackagesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/AccessPackages/AccessPackagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\AccessPackages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\AccessPackages\Item\AccessPackageItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The access packages in this catalog. Read-only. Nullable. * @param AccessPackagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?AccessPackagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?AccessPackagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/AccessPackages/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/AccessPackages/Count/CountRequestBuilder.php index 39283d18657..9262775533c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/AccessPackages/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/AccessPackages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/AccessPackages/Item/AccessPackageItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/AccessPackages/Item/AccessPackageItemRequestBuilder.php index 69985f3931c..dff5a0e7757 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/AccessPackages/Item/AccessPackageItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/AccessPackages/Item/AccessPackageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The access packages in this catalog. Read-only. Nullable. * @param AccessPackageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AccessPackageItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AccessPackageItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CatalogRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CatalogRequestBuilder.php index 3800b196a9c..58ff201612d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CatalogRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CatalogRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\AccessPackages\AccessPackagesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\CustomWorkflowExtensions\CustomWorkflowExtensionsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\ResourceRolesRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property catalog for identityGovernance * @param CatalogRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CatalogRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get catalog from identityGovernance * @param CatalogRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CatalogRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property catalog in identityGovernance * @param AccessPackageCatalog $body The request body * @param CatalogRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageCatalog $body, ?CatalogRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageCatalog::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?CatalogRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?CatalogRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?CatalogRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(AccessPackageCatalog $body, ?CatalogRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CustomWorkflowExtensions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CustomWorkflowExtensions/Count/CountRequestBuilder.php index af5e99a221a..a107c66dfca 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CustomWorkflowExtensions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CustomWorkflowExtensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CustomWorkflowExtensions/CustomWorkflowExtensionsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CustomWorkflowExtensions/CustomWorkflowExtensionsRequestBuilder.php index 13b1d17840a..4ab1ae9fd39 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CustomWorkflowExtensions/CustomWorkflowExtensionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CustomWorkflowExtensions/CustomWorkflowExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\CustomWorkflowExtensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\CustomWorkflowExtensions\Item\CustomCalloutExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\CustomCalloutExtension; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the accessPackageAssignmentRequestWorkflowExtension and accessPackageAssignmentWorkflowExtension objects and their properties. The resulting list includes all the customAccessPackageWorkflowExtension objects for the catalog that the caller has access to read. Each object includes an @odata.type property that indicates whether the object is an accessPackageAssignmentRequestWorkflowExtension or an accessPackageAssignmentWorkflowExtension. This API is available in the following national cloud deployments. * @param CustomWorkflowExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackagecatalog-list-accesspackagecustomworkflowextensions?view=graph-rest-1.0 Find more info here */ public function get(?CustomWorkflowExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new accessPackageAssignmentRequestWorkflowExtension or accessPackageAssignmentWorkflowExtension object and add it to an existing accessPackageCatalog object. You must explicitly provide an @odata.type property that indicates whether the object is an accessPackageAssignmentRequestWorkflowExtension or an accessPackageAssignmentWorkflowExtension. This API is available in the following national cloud deployments. * @param CustomCalloutExtension $body The request body * @param CustomWorkflowExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackagecatalog-post-accesspackagecustomworkflowextensions?view=graph-rest-1.0 Find more info here */ public function post(CustomCalloutExtension $body, ?CustomWorkflowExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CustomWorkflowExtensionsRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CustomWorkflowExtensionsRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(CustomCalloutExtension $body, ?CustomWo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CustomWorkflowExtensions/Item/CustomCalloutExtensionItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CustomWorkflowExtensions/Item/CustomCalloutExtensionItemRequestBuilder.php index c5916246edf..61ec8eb46c3 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CustomWorkflowExtensions/Item/CustomCalloutExtensionItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/CustomWorkflowExtensions/Item/CustomCalloutExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CustomCalloutExtension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an accessPackageAssignmentRequestWorkflowExtension object. The custom workflow extension must first be removed from any associated policies before it can be deleted. Follow these steps to remove the custom workflow extension from any associated policies: This API is available in the following national cloud deployments. * @param CustomCalloutExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignmentrequestworkflowextension-delete?view=graph-rest-1.0 Find more info here */ public function delete(?CustomCalloutExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an accessPackageAssignmentRequestWorkflowExtension object. This API is available in the following national cloud deployments. * @param CustomCalloutExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignmentrequestworkflowextension-get?view=graph-rest-1.0 Find more info here */ public function get(?CustomCalloutExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an accessPackageAssignmentRequestWorkflowExtension object. * @param CustomCalloutExtension $body The request body * @param CustomCalloutExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackageassignmentrequestworkflowextension-update?view=graph-rest-1.0 Find more info here */ public function patch(CustomCalloutExtension $body, ?CustomCalloutExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomCalloutExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?CustomCalloutExtensionItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?CustomCalloutExtensionItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?CustomCalloutExtensionItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(CustomCalloutExtension $body, ?CustomC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Count/CountRequestBuilder.php index 9b26d25c9a8..688ed7ff573 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 0e3310e8b53..edc9d4838a4 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resourceRoles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resourceRoles from identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resourceRoles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Environment/EnvironmentRequestBuilder.php index 9e51bb9cb96..cd1c6f40948 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/ResourceRequestBuilder.php index 1c7b217e5ee..9fc10bae0e9 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\Resource\Scopes\ScopesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Roles/Count/CountRequestBuilder.php index 4885f56e04a..3ca41e5eab0 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 2771fb46942..d3ca5cac2f6 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Roles/RolesRequestBuilder.php index 8c3c4224706..4c41b1e7997 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Count/CountRequestBuilder.php index 93f8d65ed55..00d989c10a5 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index bb9e8425ecf..d5ac8c8e1be 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\Resource\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index 2c1072aa067..950fae11d94 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php index 2a17f8185ec..171ee745b8c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\Resource\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\Resource\Scopes\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php index c3f56cadad5..960c5ed7a8a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 5213d152437..55816af503b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php index 6549b4ac8c8..106999e488a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\Resource\Scopes\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\Resource\Scopes\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/ScopesRequestBuilder.php index ff497a56f1a..500512453a8 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/ResourceRolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/ResourceRolesRequestBuilder.php index d65759fd334..e33199f614a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/ResourceRolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceRoles/ResourceRolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceRoles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of accessPackageResourceRole objects of an accessPackageResource in an accessPackageCatalog. The resource should have been added to the catalog by creating an accessPackageResourceRequest. This list of roles can then be used by the caller to select a role, which is needed when subsequently creating an accessPackageResourceRoleScope. This API is available in the following national cloud deployments. * @param ResourceRolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackagecatalog-list-resourceroles?view=graph-rest-1.0 Find more info here */ public function get(?ResourceRolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resourceRoles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param ResourceRolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?ResourceRolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ResourceRolesRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ResourceRolesRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Resou $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Count/CountRequestBuilder.php index c09009f67b8..ac64c4b2e99 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 5fea37739a8..48bb0bf4661 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resourceScopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resourceScopes from identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resourceScopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index 59e9ec2b810..27fa4908ee1 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/ResourceRequestBuilder.php index c5dcbe381f2..1fc232a5acc 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\Resource\Scopes\ScopesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Count/CountRequestBuilder.php index 13787144f22..ee492e025a5 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 265be4d48d8..1d3147a2c9e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\Resource\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index 35539bd70b0..a807c6f65e4 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php index 7e77e533bfa..e625dc63056 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\Resource\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\Resource\Roles\Item\Resource\Scopes\ScopesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php index 9640345a860..087f58d20dc 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index b7c5fd9c665..35b6035b60a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php index 62bbc25f8d9..f37eedcc270 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\Resource\Roles\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\Resource\Roles\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/RolesRequestBuilder.php index afc53a11fcf..b06090d4b6f 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Scopes/Count/CountRequestBuilder.php index 8af3d290857..384e2dee2aa 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 921367214cc..1db857646e1 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Scopes/ScopesRequestBuilder.php index 2dd1368296e..605797da578 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/ResourceScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/ResourceScopesRequestBuilder.php index 1ddb293e453..386503cc4cc 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/ResourceScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/ResourceScopes/ResourceScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\ResourceScopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get resourceScopes from identityGovernance * @param ResourceScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resourceScopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ResourceScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ResourceScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResourceScopesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResourceScopesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Reso $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Count/CountRequestBuilder.php index 36f1477f3ae..f3ae2262f57 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/AccessPackageResourceItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/AccessPackageResourceItemRequestBuilder.php index a885dfd70c2..ad6fd852be2 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/AccessPackageResourceItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/AccessPackageResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Scopes\ScopesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resources for identityGovernance * @param AccessPackageResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Access package resources in this catalog. * @param AccessPackageResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in identityGovernance * @param AccessPackageResource $body The request body * @param AccessPackageResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?AccessPackageResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?AccessPackageResourceItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?AccessPackageResourceItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?AccessPa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Environment/EnvironmentRequestBuilder.php index 9e7fd33ce3e..06dfdc66ebe 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Count/CountRequestBuilder.php index cbce5dd9fd9..5ca08236b0c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index dea11287a0c..89a3ed23825 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index e84bbf9d218..207a8d27fb2 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php index f7101e476b5..7c87718b638 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Roles\Item\Resource\Scopes\ScopesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php index 83d237b63ec..86dc8f8009f 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index a715cc14e60..8bf3fa72f13 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Roles\Item\Resource\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index 5deb1639536..a93f2e22421 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php index 096eba3a271..b3cf41c457f 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Roles\Item\Resource\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php index 0d34462c302..8f2f1e745ba 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Roles\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Roles\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/RolesRequestBuilder.php index a0ebfd13703..62b430e3d1f 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Count/CountRequestBuilder.php index 60931c47045..2f8334b0595 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index c23f9380d2d..91434643a1d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index bb7380a854b..16e8b112dd2 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php index 51ce3a31bca..0b603e378f5 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Scopes\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php index 91dd8ef4d3c..03c58d504ac 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index d849199b546..68dae2c7aa1 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Scopes\Item\Resource\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index ee5cf25dae4..9739e3bf5ec 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php index af833c5c182..02bcf0bfa90 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Scopes\Item\Resource\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php index 43a47fc8ef6..e8cf097b63d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Scopes\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Scopes\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/ScopesRequestBuilder.php index dc1649817f6..1d9138b2246 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/Item/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/ResourcesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/ResourcesRequestBuilder.php index 64d8a9d9d71..f2c3e9fda62 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Catalog/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Catalog\Resources\Item\AccessPackageResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of accessPackageResource objects in an accessPackageCatalog. This API is available in the following national cloud deployments. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/accesspackagecatalog-list-resources?view=graph-rest-1.0 Find more info here */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resources for identityGovernance * @param AccessPackageResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AccessPackageResource $body, ?Resources $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Environment/EnvironmentRequestBuilder.php index d93b7d1bc98..1af92cf664b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/ResourceRequestBuilder.php index 41d45f276af..5c5e621d74a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Scopes\ScopesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Count/CountRequestBuilder.php index 8efc7819f44..6421ee4d864 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 51f5409eef6..42995971269 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index e2513ec04ee..7739e2222c0 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php index 8293e354aa3..31ba51cad04 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Roles\Item\Resource\Scopes\ScopesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php index 4934095f225..91a8419c3cf 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index dce2a1d9d15..ffa05edc55e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Roles\Item\Resource\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index 95a4dd28bce..5a74d12916d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php index 58f046ca381..a31f103e44b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Roles\Item\Resource\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php index 933771d5fea..4923a05d843 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Roles\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Roles\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/RolesRequestBuilder.php index eee262bee0b..b4dbdb1b7c9 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Count/CountRequestBuilder.php index 1895806783d..88db38d8ffa 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 80fc51fa0e2..5248c2160bf 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index 20cc57592a9..06d9c108cea 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php index 8a0b0367e20..8b907105f0e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Scopes\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php index 68b06257a0f..d9d9edf7789 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 45b079e2a70..6cef995da98 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Scopes\Item\Resource\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index 8abe6c821c2..131a055383e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php index dae86b53fe1..da499716f14 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Scopes\Item\Resource\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php index 7618272ce54..d1fc59f439d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Scopes\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Scopes\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/ScopesRequestBuilder.php index d44bf412769..dc207b60ac7 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/ResourceRequestsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/ResourceRequestsRequestBuilder.php index f621ed9570d..858daf528e5 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/ResourceRequestsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRequests/ResourceRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRequests\Item\AccessPackageResourceRequestItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRequest; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of accessPackageResourceRequest objects. This API is available in the following national cloud deployments. * @param ResourceRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-list-resourcerequests?view=graph-rest-1.0 Find more info here */ public function get(?ResourceRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create a new accessPackageResourceRequest object to request the addition of a resource to an access package catalog, update of a resource, or the removal of a resource from a catalog. A resource must be included in an access package catalog before a role of that resource can be added to an access package. To add an Azure AD group as a resource to a catalog, set the requestType to be adminAdd, and a resource representing the resource. The value of the originSystem property within the resource should be AadGroup and the value of the originId is the identifier of the group. To add an Azure AD application as a resource to a catalog, set the requestType to be adminAdd, and a resource representing the resource. The value of the originSystem property within the resource should be AadApplication and the value of the originId is the identifier of the servicePrincipal. To add a SharePoint Online site an as a resource to a catalog, set the requestType to be adminAdd, and a resource representing the resource. The value of the originSystem property within the resource should be SharePointOnline and the value of the originId is the URI of the site. To remove a resource from a catalog, set the requestType to be adminRemove, and the resource to contain the id of the resource object to be removed. The resource object can be retrieved using list resources. This API is available in the following national cloud deployments. + * Create a new accessPackageResourceRequest object to request the addition of a resource to an access package catalog, update of a resource, or the removal of a resource from a catalog. A resource must be included in an access package catalog before a role of that resource can be added to an access package. To add a Microsoft Entra group as a resource to a catalog, set the requestType to be adminAdd, and a resource representing the resource. The value of the originSystem property within the resource should be AadGroup and the value of the originId is the identifier of the group. To add a Microsoft Entra application as a resource to a catalog, set the requestType to be adminAdd, and a resource representing the resource. The value of the originSystem property within the resource should be AadApplication and the value of the originId is the identifier of the servicePrincipal. To add a SharePoint Online site an as a resource to a catalog, set the requestType to be adminAdd, and a resource representing the resource. The value of the originSystem property within the resource should be SharePointOnline and the value of the originId is the URI of the site. To remove a resource from a catalog, set the requestType to be adminRemove, and the resource to contain the id of the resource object to be removed. The resource object can be retrieved using list resources. This API is available in the following national cloud deployments. * @param AccessPackageResourceRequest $body The request body * @param ResourceRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagement-post-resourcerequests?view=graph-rest-1.0 Find more info here */ public function post(AccessPackageResourceRequest $body, ?ResourceRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ResourceRequestsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,11 +101,12 @@ public function toGetRequestInformation(?ResourceRequestsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create a new accessPackageResourceRequest object to request the addition of a resource to an access package catalog, update of a resource, or the removal of a resource from a catalog. A resource must be included in an access package catalog before a role of that resource can be added to an access package. To add an Azure AD group as a resource to a catalog, set the requestType to be adminAdd, and a resource representing the resource. The value of the originSystem property within the resource should be AadGroup and the value of the originId is the identifier of the group. To add an Azure AD application as a resource to a catalog, set the requestType to be adminAdd, and a resource representing the resource. The value of the originSystem property within the resource should be AadApplication and the value of the originId is the identifier of the servicePrincipal. To add a SharePoint Online site an as a resource to a catalog, set the requestType to be adminAdd, and a resource representing the resource. The value of the originSystem property within the resource should be SharePointOnline and the value of the originId is the URI of the site. To remove a resource from a catalog, set the requestType to be adminRemove, and the resource to contain the id of the resource object to be removed. The resource object can be retrieved using list resources. This API is available in the following national cloud deployments. + * Create a new accessPackageResourceRequest object to request the addition of a resource to an access package catalog, update of a resource, or the removal of a resource from a catalog. A resource must be included in an access package catalog before a role of that resource can be added to an access package. To add a Microsoft Entra group as a resource to a catalog, set the requestType to be adminAdd, and a resource representing the resource. The value of the originSystem property within the resource should be AadGroup and the value of the originId is the identifier of the group. To add a Microsoft Entra application as a resource to a catalog, set the requestType to be adminAdd, and a resource representing the resource. The value of the originSystem property within the resource should be AadApplication and the value of the originId is the identifier of the servicePrincipal. To add a SharePoint Online site an as a resource to a catalog, set the requestType to be adminAdd, and a resource representing the resource. The value of the originSystem property within the resource should be SharePointOnline and the value of the originId is the URI of the site. To remove a resource from a catalog, set the requestType to be adminRemove, and the resource to contain the id of the resource object to be removed. The resource object can be retrieved using list resources. This API is available in the following national cloud deployments. * @param AccessPackageResourceRequest $body The request body * @param ResourceRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -123,11 +116,11 @@ public function toPostRequestInformation(AccessPackageResourceRequest $body, ?Re $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Count/CountRequestBuilder.php index 4078780e1c1..7fdc845ac6f 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/AccessPackageResourceRoleScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/AccessPackageResourceRoleScopeItemRequestBuilder.php index b7545224cc5..94ae5d4920f 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/AccessPackageResourceRoleScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/AccessPackageResourceRoleScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\RoleRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\ScopeRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRoleScope; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resourceRoleScopes for identityGovernance * @param AccessPackageResourceRoleScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resourceRoleScopes from identityGovernance * @param AccessPackageResourceRoleScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resourceRoleScopes in identityGovernance * @param AccessPackageResourceRoleScope $body The request body * @param AccessPackageResourceRoleScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRoleScope $body, ?AccessPackageResourceRoleScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleScopeItemRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleScopeItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleScopeItemReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResourceRoleScope $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Environment/EnvironmentRequestBuilder.php index cd35240dc15..f631b8114d0 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/ResourceRequestBuilder.php index d3a744940be..71775aaac79 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\Resource\Scopes\ScopesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Roles/Count/CountRequestBuilder.php index 7a54e2e6e6a..a1df6a28ba9 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 09aa803015a..1b075b0a738 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Roles/RolesRequestBuilder.php index 6dc163eacb1..d6ac7d76716 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Count/CountRequestBuilder.php index 8fb223bdba4..85e9e3d30d3 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 418bdea401c..ba94403988b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\Resource\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index 00cd590c99a..ae1784a9473 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php index 508d3b06230..65e40e81d10 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\Resource\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\Resource\Scopes\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php index e3663a7f012..bf993babec1 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 02fa9c24c0a..69bb2f1a1cc 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php index ca17bcc1e75..34192176382 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\Resource\Scopes\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\Resource\Scopes\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/ScopesRequestBuilder.php index 30d16d14590..b2ab85951b8 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/RoleRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/RoleRequestBuilder.php index 30a354fb2d5..6890cbab98e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/RoleRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Role/RoleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Role\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property role for identityGovernance * @param RoleRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RoleRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get role from identityGovernance * @param RoleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property role in identityGovernance * @param AccessPackageResourceRole $body The request body * @param RoleRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?RoleRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?RoleRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?RoleRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?RoleRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Role $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Environment/EnvironmentRequestBuilder.php index c51a4e67ed4..c8dca4da464 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/ResourceRequestBuilder.php index 5d391ad3a57..cb117ce40c3 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\Resource\Scopes\ScopesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Count/CountRequestBuilder.php index 4edee192bae..e1af4ad985b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 2a9ffccd196..64b05c916b9 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\Resource\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index 2cc91d724a9..b7d56eff3cb 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/ResourceRequestBuilder.php index b351dabcc36..b60c84c1305 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\Resource\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\Resource\Roles\Item\Resource\Scopes\ScopesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php index d9b49b28730..3d4b7938312 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 1e7daef0295..7695c14694b 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php index 6383ae4f939..b0ef2072f4a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\Resource\Roles\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\Resource\Roles\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/RolesRequestBuilder.php index bc3e48332d7..37b926dfc07 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Scopes/Count/CountRequestBuilder.php index b018c10ba2a..3532c32b5a8 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index ead97da1c0b..37574a0f396 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Scopes/ScopesRequestBuilder.php index 4ba43797113..8b01627567a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/ScopeRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/ScopeRequestBuilder.php index 857efa24b8b..4dc2223b984 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/ScopeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/Item/Scope/ScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\Scope\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scope for identityGovernance * @param ScopeRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ScopeRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get scope from identityGovernance * @param ScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scope in identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopeRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?ScopeRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ScopeRequestBuilderDeleteRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ScopeRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ScopeRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Sco $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/ResourceRoleScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/ResourceRoleScopesRequestBuilder.php index 9f147b3080f..f06e07bfe68 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/ResourceRoleScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/ResourceRoleScopes/ResourceRoleScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\ResourceRoleScopes\Item\AccessPackageResourceRoleScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRoleScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get resourceRoleScopes from identityGovernance * @param ResourceRoleScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRoleScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resourceRoleScopes for identityGovernance * @param AccessPackageResourceRoleScope $body The request body * @param ResourceRoleScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRoleScope $body, ?ResourceRoleScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResourceRoleScopesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResourceRoleScopesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRoleScope $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Count/CountRequestBuilder.php index 0c3ab122d60..ba59f1a7788 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/AccessPackageResourceItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/AccessPackageResourceItemRequestBuilder.php index 100e51ec459..5e2a166ecdc 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/AccessPackageResourceItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/AccessPackageResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Scopes\ScopesRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resources for identityGovernance * @param AccessPackageResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The resources associated with the catalogs. * @param AccessPackageResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in identityGovernance * @param AccessPackageResource $body The request body * @param AccessPackageResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?AccessPackageResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?AccessPackageResourceItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?AccessPackageResourceItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?AccessPa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Environment/EnvironmentRequestBuilder.php index 83f900afc70..e7af896db93 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Count/CountRequestBuilder.php index d75fdaad304..46030a2c0d4 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index e264bbf78e4..8a427c4542a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index a5a6b0eb44e..8b2443fc4f2 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php index cc7afee0317..b539821bc21 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Roles\Item\Resource\Scopes\ScopesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php index a6d57dacf1c..468eedf8b8e 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 98c02a92452..7da0220ed7d 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Roles\Item\Resource\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index b98861c66ef..e4f4782c551 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php index 74978e47ede..fa9413c8aea 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Roles\Item\Resource\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php index 715ea486214..78bbe6cf272 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/Item/Resource/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Roles\Item\Resource\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Roles\Item\Resource\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/RolesRequestBuilder.php index ee5b02b9413..3b74c6d22ad 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Count/CountRequestBuilder.php index 820b91defab..a4de6d68937 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php index 75784785f0f..601268e1f6a 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/AccessPackageResourceScopeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Scopes\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopes for identityGovernance * @param AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceScopeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceScopeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopes in identityGovernance * @param AccessPackageResourceScope $body The request body * @param AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceScope $body, ?AccessPackageResourceScopeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceScopeItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceScopeItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceScope $body, ?Acc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php index 2a116e6b8ce..392527d6b8f 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php index a7637826ba7..43b26ecf980 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Scopes\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Scopes\Item\Resource\Roles\RolesRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php index e23d612556d..c1832146360 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php index 12c9e96f70e..ecd3506a7c3 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Item/AccessPackageResourceRoleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Scopes\Item\Resource\Roles\Item\Resource\ResourceRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roles for identityGovernance * @param AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AccessPackageResourceRoleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Supports $expand. * @param AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AccessPackageResourceRoleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roles in identityGovernance * @param AccessPackageResourceRole $body The request body * @param AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResourceRole $body, ?AccessPackageResourceRoleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AccessPackageResourceRoleItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AccessPackageResourceRoleItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResourceRole $body, ?Acce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php index a85c02ab700..b65e69f911c 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/Environment/EnvironmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AccessPackageResourceEnvironment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the environment information for the resource. This can be set using either the @odata.bind annotation or the environment's originId.Supports $expand. * @param EnvironmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EnvironmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceEnvironment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EnvironmentRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php index f2e2e79a65d..88c388571c7 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Scopes\Item\Resource\Roles\Item\Resource\Environment\EnvironmentRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resource for identityGovernance * @param ResourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resource from identityGovernance * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resource in identityGovernance * @param AccessPackageResource $body The request body * @param ResourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AccessPackageResource $body, ?ResourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ResourceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AccessPackageResource $body, ?Resource $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php index 3e5d106b033..35173975a00 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/Item/Resource/Roles/RolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Scopes\Item\Resource\Roles\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Scopes\Item\Resource\Roles\Item\AccessPackageResourceRoleItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceRole; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param RolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roles for identityGovernance * @param AccessPackageResourceRole $body The request body * @param RolesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceRole $body, ?RolesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RolesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceRole $body, ?Roles $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/ScopesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/ScopesRequestBuilder.php index 045cec063d5..e45cd79ee56 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/ScopesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/Item/Scopes/ScopesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Scopes\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\Scopes\Item\AccessPackageResourceScopeItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResourceScope; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only. Nullable. Supports $expand. * @param ScopesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScopeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopes for identityGovernance * @param AccessPackageResourceScope $body The request body * @param ScopesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResourceScope $body, ?ScopesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResourceScope $body, ?Scop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/ResourcesRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/ResourcesRequestBuilder.php index 649dd39f891..8d1f8dcce24 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\Resources\Item\AccessPackageResourceItemRequestBuilder; use Microsoft\Graph\Generated\Models\AccessPackageResource; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The resources associated with the catalogs. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resources for identityGovernance * @param AccessPackageResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AccessPackageResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AccessPackageResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AccessPackageResource $body, ?Resources $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/EntitlementManagement/Settings/SettingsRequestBuilder.php b/src/Generated/IdentityGovernance/EntitlementManagement/Settings/SettingsRequestBuilder.php index fb611bc60c6..64d57d5fcac 100644 --- a/src/Generated/IdentityGovernance/EntitlementManagement/Settings/SettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/EntitlementManagement/Settings/SettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EntitlementManagementSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property settings for identityGovernance * @param SettingsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SettingsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of an entitlementManagementSettings object. This API is available in the following national cloud deployments. * @param SettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagementsettings-get?view=graph-rest-1.0 Find more info here */ public function get(?SettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EntitlementManagementSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EntitlementManagementSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an existing entitlementManagementSettings object to change one or more of its properties. This API is available in the following national cloud deployments. * @param EntitlementManagementSettings $body The request body * @param SettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/entitlementmanagementsettings-update?view=graph-rest-1.0 Find more info here */ public function patch(EntitlementManagementSettings $body, ?SettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EntitlementManagementSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EntitlementManagementSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?SettingsRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?SettingsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?SettingsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(EntitlementManagementSettings $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/IdentityGovernanceRequestBuilder.php b/src/Generated/IdentityGovernance/IdentityGovernanceRequestBuilder.php index fa2b2f388bf..feb06558495 100644 --- a/src/Generated/IdentityGovernance/IdentityGovernanceRequestBuilder.php +++ b/src/Generated/IdentityGovernance/IdentityGovernanceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\AccessReviews\AccessReviewsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\AppConsent\AppConsentRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\EntitlementManagement\EntitlementManagementRequestBuilder; @@ -82,38 +81,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get identityGovernance * @param IdentityGovernanceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IdentityGovernanceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityGovernance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityGovernance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update identityGovernance * @param IdentityGovernance $body The request body * @param IdentityGovernanceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(IdentityGovernance $body, ?IdentityGovernanceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityGovernance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityGovernance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -126,7 +119,6 @@ public function toGetRequestInformation(?IdentityGovernanceRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -134,6 +126,7 @@ public function toGetRequestInformation(?IdentityGovernanceRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -148,11 +141,11 @@ public function toPatchRequestInformation(IdentityGovernance $body, ?IdentityGov $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Count/CountRequestBuilder.php index 612e18c3e14..1feb793a9a9 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/CustomTaskExtensionsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/CustomTaskExtensionsRequestBuilder.php index 2168d2fe842..55538a14ff4 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/CustomTaskExtensionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/CustomTaskExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\CustomTaskExtensions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\CustomTaskExtensions\Item\CustomTaskExtensionItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\CustomTaskExtension; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the customTaskExtension objects and their properties. This API is available in the following national cloud deployments. * @param CustomTaskExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-lifecycleworkflowscontainer-list-customtaskextensions?view=graph-rest-1.0 Find more info here */ public function get(?CustomTaskExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomTaskExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomTaskExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new customTaskExtension object. This API is available in the following national cloud deployments. * @param CustomTaskExtension $body The request body * @param CustomTaskExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-lifecycleworkflowscontainer-post-customtaskextensions?view=graph-rest-1.0 Find more info here */ public function post(CustomTaskExtension $body, ?CustomTaskExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomTaskExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomTaskExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CustomTaskExtensionsRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CustomTaskExtensionsRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(CustomTaskExtension $body, ?CustomTaskE $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/CreatedByRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/CreatedByRequestBuilder.php index 9801d642824..ee24eebe7c6 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/CreatedByRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/CreatedByRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\CustomTaskExtensions\Item\CreatedBy\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\CustomTaskExtensions\Item\CreatedBy\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user that created the custom task extension.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user that created the custom task extension.Supports $filter(eq, ne) and $expand. * @param CreatedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user that created the custom task extension.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user that created the custom task extension.Supports $filter(eq, ne) and $expand. * @param CreatedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/CreatedByRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/CreatedByRequestBuilderGetQueryParameters.php index e426044b106..000d4abae5e 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/CreatedByRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/CreatedByRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user that created the custom task extension.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user that created the custom task extension.Supports $filter(eq, ne) and $expand. */ class CreatedByRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php index 5533ad6f6aa..91799134c52 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 3a0a6cd7fa2..30fd2381f34 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 5c2928f231a..92552646eef 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\CustomTaskExtensions\Item\CreatedBy\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CustomTaskExtensionItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CustomTaskExtensionItemRequestBuilder.php index 777c77029af..98dc91052b7 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CustomTaskExtensionItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/CustomTaskExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\CustomTaskExtensions\Item\CreatedBy\CreatedByRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\CustomTaskExtensions\Item\LastModifiedBy\LastModifiedByRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\CustomTaskExtension; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a customTaskExtension object. A custom task extension can only be deleted if it is not referenced in any task objects in a lifecycle workflow. This API is available in the following national cloud deployments. * @param CustomTaskExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-customtaskextension-delete?view=graph-rest-1.0 Find more info here */ public function delete(?CustomTaskExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a customTaskExtension object. This API is available in the following national cloud deployments. * @param CustomTaskExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-customtaskextension-get?view=graph-rest-1.0 Find more info here */ public function get(?CustomTaskExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomTaskExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomTaskExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a customTaskExtension object. This API is available in the following national cloud deployments. * @param CustomTaskExtension $body The request body * @param CustomTaskExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-customtaskextension-update?view=graph-rest-1.0 Find more info here */ public function patch(CustomTaskExtension $body, ?CustomTaskExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CustomTaskExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CustomTaskExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?CustomTaskExtensionItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?CustomTaskExtensionItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?CustomTaskExtensionItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(CustomTaskExtension $body, ?CustomTask $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/LastModifiedByRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/LastModifiedByRequestBuilder.php index d1d696e1cc7..4be4bc5fd37 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/LastModifiedByRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/LastModifiedByRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\CustomTaskExtensions\Item\LastModifiedBy\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\CustomTaskExtensions\Item\LastModifiedBy\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user that modified the custom task extension last.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user that modified the custom task extension last.Supports $filter(eq, ne) and $expand. * @param LastModifiedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user that modified the custom task extension last.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user that modified the custom task extension last.Supports $filter(eq, ne) and $expand. * @param LastModifiedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php index 2891a2ed97b..76e5c9947c4 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user that modified the custom task extension last.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user that modified the custom task extension last.Supports $filter(eq, ne) and $expand. */ class LastModifiedByRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php index 705870a9e68..54fa7f75e52 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php index f620f8e3138..91bb8b75f97 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 471b8db9c95..e8096d2ea77 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/CustomTaskExtensions/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\CustomTaskExtensions\Item\LastModifiedBy\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/DeletedItemsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/DeletedItemsRequestBuilder.php index 2106c4f4338..0c0be8912e7 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/DeletedItemsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/DeletedItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\WorkflowsRequestBuilder; use Microsoft\Graph\Generated\Models\DeletedItemContainer; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,37 +41,31 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deletedItems for identityGovernance * @param DeletedItemsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeletedItemsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Deleted workflows in your lifecycle workflows instance. * @param DeletedItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeletedItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeletedItemContainer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeletedItemContainer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -89,6 +82,7 @@ public function toDeleteRequestInformation(?DeletedItemsRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -102,7 +96,6 @@ public function toGetRequestInformation(?DeletedItemsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -110,6 +103,7 @@ public function toGetRequestInformation(?DeletedItemsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Count/CountRequestBuilder.php index 7441ab9a2a8..dd3bb1aea3d 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/CreatedByRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/CreatedByRequestBuilder.php index f12453d4996..4e6f91766a3 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/CreatedByRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/CreatedByRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\CreatedBy\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\CreatedBy\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The user who created the workflow. * @param CreatedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php index c87884ede18..509380ad0c6 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 4f02cdd9397..58d37b41aaf 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index a0ab3316ac2..12034381bde 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\CreatedBy\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/Count/CountRequestBuilder.php index 80af708c78c..3ee28fea2e1 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilder.php index 5c40a119ebb..cf7b0aa8791 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\ExecutionScope\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\ExecutionScope\Item\UserProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\UserProcessingResultCollectionResponse; @@ -52,25 +51,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD identity that last modified the workflow object. + * The unique identifier of the Microsoft Entra identity that last modified the workflow object. * @param ExecutionScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExecutionScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD identity that last modified the workflow object. + * The unique identifier of the Microsoft Entra identity that last modified the workflow object. * @param ExecutionScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ExecutionScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ExecutionScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilderGetQueryParameters.php index feaa169eb66..174c2ac2320 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD identity that last modified the workflow object. + * The unique identifier of the Microsoft Entra identity that last modified the workflow object. */ class ExecutionScopeRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilder.php index 57750f082b1..836c818f7c4 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\UserProcessingResult; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,25 +31,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD identity that last modified the workflow object. + * The unique identifier of the Microsoft Entra identity that last modified the workflow object. * @param UserProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD identity that last modified the workflow object. + * The unique identifier of the Microsoft Entra identity that last modified the workflow object. * @param UserProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -59,7 +55,6 @@ public function toGetRequestInformation(?UserProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?UserProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilderGetQueryParameters.php index d7385d4c894..4c85f091a6d 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD identity that last modified the workflow object. + * The unique identifier of the Microsoft Entra identity that last modified the workflow object. */ class UserProcessingResultItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilder.php index 8ff76741728..a1929ff1562 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\LastModifiedBy\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\LastModifiedBy\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure Active Directory identity that last modified the workflow. + * The unique identifier of the Microsoft Entra identity that last modified the workflow. * @param LastModifiedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure Active Directory identity that last modified the workflow. + * The unique identifier of the Microsoft Entra identity that last modified the workflow. * @param LastModifiedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php index 2542fcb41cf..91723cfc980 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure Active Directory identity that last modified the workflow. + * The unique identifier of the Microsoft Entra identity that last modified the workflow. */ class LastModifiedByRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php index 9fb840374f3..76444b14a4b 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 23fb0e68c5c..09ca4ad7eea 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index f3f5dd88982..65537ef8082 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\LastModifiedBy\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/MicrosoftGraphIdentityGovernanceActivate/MicrosoftGraphIdentityGovernanceActivateRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/MicrosoftGraphIdentityGovernanceActivate/MicrosoftGraphIdentityGovernanceActivateRequestBuilder.php index d8ff95855ef..c6c2b467f9a 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/MicrosoftGraphIdentityGovernanceActivate/MicrosoftGraphIdentityGovernanceActivateRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/MicrosoftGraphIdentityGovernanceActivate/MicrosoftGraphIdentityGovernanceActivateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Run a workflow object on-demand. You can run any workflow on-demand, including scheduled workflows. Workflows created from the 'Real-time employee termination' template are run on-demand only. When you run a workflow on demand, the tasks are executed regardless of whether the user state matches the scope and trigger execution conditions. This API is available in the following national cloud deployments. * @param ActivatePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceActivateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-activate?view=graph-rest-1.0 Find more info here */ public function post(ActivatePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceActivateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ActivatePostRequestBody $body, ?Microso $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/MicrosoftGraphIdentityGovernanceCreateNewVersion/MicrosoftGraphIdentityGovernanceCreateNewVersionRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/MicrosoftGraphIdentityGovernanceCreateNewVersion/MicrosoftGraphIdentityGovernanceCreateNewVersionRequestBuilder.php index 892d1f83a2d..5b2ec696b26 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/MicrosoftGraphIdentityGovernanceCreateNewVersion/MicrosoftGraphIdentityGovernanceCreateNewVersionRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/MicrosoftGraphIdentityGovernanceCreateNewVersion/MicrosoftGraphIdentityGovernanceCreateNewVersionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Workflow; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a new version of the workflow object. This API is available in the following national cloud deployments. * @param CreateNewVersionPostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceCreateNewVersionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-createnewversion?view=graph-rest-1.0 Find more info here */ public function post(CreateNewVersionPostRequestBody $body, ?MicrosoftGraphIdentityGovernanceCreateNewVersionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateNewVersionPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/MicrosoftGraphIdentityGovernanceRestore/MicrosoftGraphIdentityGovernanceRestoreRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/MicrosoftGraphIdentityGovernanceRestore/MicrosoftGraphIdentityGovernanceRestoreRequestBuilder.php index 500083b09b2..23ad1364794 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/MicrosoftGraphIdentityGovernanceRestore/MicrosoftGraphIdentityGovernanceRestoreRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/MicrosoftGraphIdentityGovernanceRestore/MicrosoftGraphIdentityGovernanceRestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Workflow; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,26 +31,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Restore a workflow that has been deleted. You can only restore a workflow that was deleted within the last 30 days before Azure AD automatically permanently deletes it. This API is available in the following national cloud deployments. + * Restore a workflow that has been deleted. You can only restore a workflow that was deleted within the last 30 days before Microsoft Entra ID automatically permanently deletes it. This API is available in the following national cloud deployments. * @param MicrosoftGraphIdentityGovernanceRestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-restore?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphIdentityGovernanceRestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Restore a workflow that has been deleted. You can only restore a workflow that was deleted within the last 30 days before Azure AD automatically permanently deletes it. This API is available in the following national cloud deployments. + * Restore a workflow that has been deleted. You can only restore a workflow that was deleted within the last 30 days before Microsoft Entra ID automatically permanently deletes it. This API is available in the following national cloud deployments. * @param MicrosoftGraphIdentityGovernanceRestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -60,11 +56,11 @@ public function toPostRequestInformation(?MicrosoftGraphIdentityGovernanceRestor $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Count/CountRequestBuilder.php index ae08195c876..7e2f8a4f8de 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/RunItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/RunItemRequestBuilder.php index 4c4c87ef110..721dbbf51b2 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/RunItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/RunItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\TaskProcessingResults\TaskProcessingResultsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\UserProcessingResultsRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\Run; @@ -50,20 +49,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a run object. This API is available in the following national cloud deployments. * @param RunItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-run-get?view=graph-rest-1.0 Find more info here */ public function get(?RunItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Run::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Run::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -76,7 +72,6 @@ public function toGetRequestInformation(?RunItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -84,6 +79,7 @@ public function toGetRequestInformation(?RunItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Count/CountRequestBuilder.php index 7670e4a6b6d..d1389670a3f 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php index 878fa4f52d7..cdaa969fe7f 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resume a task processing result that's inProgress. In the default case an Azure Logic Apps system-assigned managed identity calls this API. For more information, see: Lifecycle Workflows extensibility approach. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskprocessingresult-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index a56aa3724bf..5a9f9f89e3d 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 9cea5cc7f9f..5a8b69245b0 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 39b42a225f9..ccb1cdac2d4 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php index 85aacfee9c9..94287bbca90 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\TaskProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php index b047ac081c1..abee3fc9c55 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. */ class SubjectRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php index f74893bb829..9ee121c0a46 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related workflow task * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php index b234474de4b..8b875f1a709 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\TaskProcessingResults\Item\MicrosoftGraphIdentityGovernanceResume\MicrosoftGraphIdentityGovernanceResumeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\TaskProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\TaskProcessingResults\Item\Task\TaskRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related taskProcessingResults. * @param TaskProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php index b0b8dba18c0..175bf732010 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\TaskProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\TaskProcessingResults\Item\TaskProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskProcessingResultCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the taskProcessingResult resources for a run. This API is available in the following national cloud deployments. * @param TaskProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-run-list-taskprocessingresults?view=graph-rest-1.0 Find more info here */ public function get(?TaskProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Count/CountRequestBuilder.php index ae6fed8f9a1..b6ce9f4debc 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index f4a718ef919..10ef17444dc 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 91f0e59c21f..10b6ff8f81a 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 2ba0c41eddf..32ab6117474 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php index b28f2e5614a..3101c075d82 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The unique identifier of the AAD user targeted for the taskProcessingResult.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php index a6141075612..d23cffbb458 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php index 4ce44f6df07..38df6cdc5cd 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resume a task processing result that's inProgress. In the default case an Azure Logic Apps system-assigned managed identity calls this API. For more information, see: Lifecycle Workflows extensibility approach. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskprocessingresult-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index b05f96aa163..5bcd46f27cc 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index b6b7f9a0cec..9d81bc36ef4 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 6b0eaedd7be..ef9600f3fec 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php index 63ac6b6c508..315210fd942 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php index 093332eda32..eab2663fed2 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. */ class SubjectRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php index c2b045bd36c..8ae8ed207bf 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related workflow task * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php index faa4a04f13c..70728a6b9cd 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\MicrosoftGraphIdentityGovernanceResume\MicrosoftGraphIdentityGovernanceResumeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Task\TaskRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The associated individual task execution. * @param TaskProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php index e4911d4baba..24a815d81b9 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\TaskProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskProcessingResultCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the task processing result from a userProcessingResult either directly or through a run. This API is available in the following national cloud deployments. * @param TaskProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-userprocessingresult-list-taskprocessingresults?view=graph-rest-1.0 Find more info here */ public function get(?TaskProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php index 3749dce7649..56b16782e92 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\TaskProcessingResultsRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\UserProcessingResult; @@ -50,20 +49,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the user processing result of a user processing result of a run. This API is available in the following national cloud deployments. * @param UserProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-userprocessingresult-get?view=graph-rest-1.0 Find more info here */ public function get(?UserProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -76,7 +72,6 @@ public function toGetRequestInformation(?UserProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -84,6 +79,7 @@ public function toGetRequestInformation(?UserProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php index 32f8de18509..c802547511e 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\UserSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function summary * @param MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,11 +61,11 @@ public function toGetRequestInformation(?MicrosoftGraphIdentityGovernanceSummary $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php index c7cf8d67b91..cbaba7fe411 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\Item\UserProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\UserProcessingResults\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder; @@ -56,20 +55,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get user processing results of a workflow run object. This API is available in the following national cloud deployments. * @param UserProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-run-list-userprocessingresults?view=graph-rest-1.0 Find more info here */ public function get(?UserProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -92,7 +88,6 @@ public function toGetRequestInformation(?UserProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -100,6 +95,7 @@ public function toGetRequestInformation(?UserProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php index e6545aabade..dccff270e47 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\RunSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function summary * @param MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RunSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RunSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,11 +61,11 @@ public function toGetRequestInformation(?MicrosoftGraphIdentityGovernanceSummary $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/RunsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/RunsRequestBuilder.php index bd3ba21f265..6904c7ba87d 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/RunsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Runs/RunsRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\Item\RunItemRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Runs\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder; @@ -56,20 +55,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the run objects and their properties for a lifecycle workflow. This API is available in the following national cloud deployments. * @param RunsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-list-runs?view=graph-rest-1.0 Find more info here */ public function get(?RunsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RunCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RunCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -92,7 +88,6 @@ public function toGetRequestInformation(?RunsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -100,6 +95,7 @@ public function toGetRequestInformation(?RunsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Count/CountRequestBuilder.php index 95452a59a79..24442528e8d 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/Task/TaskRequestBuilder.php index 3e7b56d7689..4584b7d0355 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related lifecycle workflow task.Supports $filter(eq, ne) and $expand. * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskDefinition/TaskDefinitionRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskDefinition/TaskDefinitionRequestBuilder.php index 955c58b0f44..667186b3e4f 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskDefinition/TaskDefinitionRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskDefinition/TaskDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The taskDefinition associated with the related lifecycle workflow task.Supports $filter(eq, ne) and $expand. * @param TaskDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Count/CountRequestBuilder.php index 9deb9b02e5f..bab95f49d27 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php index 47c111eaf5a..964b90c1067 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resume a task processing result that's inProgress. In the default case an Azure Logic Apps system-assigned managed identity calls this API. For more information, see: Lifecycle Workflows extensibility approach. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskprocessingresult-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index d4ec966f526..ac6b7c73237 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 135eae389b6..689157a045c 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 96f77ad382c..c9aad072041 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php index 134cac73778..b3609226ac6 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php index cb794596275..a50068062fa 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. */ class SubjectRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php index 68afabde8d8..0db8187aaf6 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related workflow task * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php index 6ea96f9549b..3be0613724b 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\MicrosoftGraphIdentityGovernanceResume\MicrosoftGraphIdentityGovernanceResumeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\Task\TaskRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related lifecycle workflow taskProcessingResults. * @param TaskProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php index b8c11ffc102..854227e9339 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\Item\TaskProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\TaskProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskProcessingResultCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the task processing result resources from the taskReport. This API is available in the following national cloud deployments. * @param TaskProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskreport-list-taskprocessingresults?view=graph-rest-1.0 Find more info here */ public function get(?TaskProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskReportItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskReportItemRequestBuilder.php index a94a57b33b3..6026e65adea 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskReportItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/Item/TaskReportItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\Item\Task\TaskRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\Item\TaskDefinition\TaskDefinitionRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\Item\TaskProcessingResults\TaskProcessingResultsRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents the aggregation of task execution data for tasks within a workflow object. * @param TaskReportItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskReportItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskReport::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskReport::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskReportItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskReportItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php index 07a688ec506..9157e622e76 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskReportSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function summary * @param MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskReportSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskReportSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,11 +61,11 @@ public function toGetRequestInformation(?MicrosoftGraphIdentityGovernanceSummary $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/TaskReportsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/TaskReportsRequestBuilder.php index d4cf439c24b..bcf532aecba 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/TaskReportsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/TaskReports/TaskReportsRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\Item\TaskReportItemRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\TaskReports\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder; @@ -56,20 +55,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the taskReport objects and their properties. This API is available in the following national cloud deployments. * @param TaskReportsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-list-taskreports?view=graph-rest-1.0 Find more info here */ public function get(?TaskReportsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskReportCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskReportCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -92,7 +88,6 @@ public function toGetRequestInformation(?TaskReportsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -100,6 +95,7 @@ public function toGetRequestInformation(?TaskReportsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Count/CountRequestBuilder.php index 8c65a2516fb..3ebb7bbd9c9 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskItemRequestBuilder.php index 6432796142d..edffbc1da1d 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Tasks\Item\TaskProcessingResults\TaskProcessingResultsRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for identityGovernance * @param TaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The tasks in the workflow. * @param TaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in identityGovernance * @param Task $body The request body * @param TaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Task $body, ?TaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?TaskItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?TaskItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?TaskItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Task $body, ?TaskItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php index 8592342df8c..38d670f25a9 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php index 2c13030abad..115772be93a 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resume a task processing result that's inProgress. In the default case an Azure Logic Apps system-assigned managed identity calls this API. For more information, see: Lifecycle Workflows extensibility approach. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskprocessingresult-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index 24c8526a9bf..5bed5cde391 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index f4062264530..e69027b5aa8 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index afbbeeb1edb..173345881d8 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php index 47f51e9ee4a..defc3ab3416 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php index 91f0af498b3..1ae27a97f27 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. */ class SubjectRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php index eb8d2ce09d6..09509fc6ab3 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related workflow task * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php index aef9e32b3a8..57ca65f2f08 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\MicrosoftGraphIdentityGovernanceResume\MicrosoftGraphIdentityGovernanceResumeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\Task\TaskRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The result of processing the task. * @param TaskProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php index bc69dc6a915..a19a40f81a1 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Tasks\Item\TaskProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\TaskProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskProcessingResultCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The result of processing the task. * @param TaskProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/TasksRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/TasksRequestBuilder.php index b81c8ac04a8..c70e1cb0a33 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Tasks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Tasks\Item\TaskItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The tasks in the workflow. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for identityGovernance * @param Task $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Task $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Task $body, ?TasksRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Count/CountRequestBuilder.php index 96f71ed0713..053790fb454 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index 03bf2bbb98d..73256049598 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index b7e0bdb3079..1c2e2346c6d 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index a68857b842e..a126544e2be 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php index 91ef269c112..0aac0671923 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The unique identifier of the AAD user targeted for the taskProcessingResult.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php index 4ec46f9731d..7e25b56524f 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php index b44398d3da3..2a6d65da46b 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resume a task processing result that's inProgress. In the default case an Azure Logic Apps system-assigned managed identity calls this API. For more information, see: Lifecycle Workflows extensibility approach. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskprocessingresult-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index 13ad73ae1c8..d66060a7789 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 71ad10aa573..6d4e48f062a 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 79bb4666d49..1aef0a0b3da 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php index 81d06ea8c32..ac43f1ebdc8 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php index ac4bd6001d6..05d174bafd0 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. */ class SubjectRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php index 30bb8f62a4f..f0b816b0e9e 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related workflow task * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php index ea0fdbb18d7..1016e772cd1 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\MicrosoftGraphIdentityGovernanceResume\MicrosoftGraphIdentityGovernanceResumeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Task\TaskRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The associated individual task execution. * @param TaskProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php index 053620ea4aa..44b6dee33f3 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\TaskProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskProcessingResultCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the task processing result from a userProcessingResult either directly or through a run. This API is available in the following national cloud deployments. * @param TaskProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-userprocessingresult-list-taskprocessingresults?view=graph-rest-1.0 Find more info here */ public function get(?TaskProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php index e168279b1aa..edb12c111af 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\TaskProcessingResultsRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\UserProcessingResult; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Per-user workflow execution results. * @param UserProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?UserProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?UserProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php index 09d31bae2b0..7b868b89b94 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\UserSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function summary * @param MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,11 +61,11 @@ public function toGetRequestInformation(?MicrosoftGraphIdentityGovernanceSummary $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php index 6c4ec19189a..6e8f2fa70c4 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\Item\UserProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\UserProcessingResults\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder; @@ -56,20 +55,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the userProcessingResult resources for a workflow. This API is available in the following national cloud deployments. * @param UserProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-list-userprocessingresults?view=graph-rest-1.0 Find more info here */ public function get(?UserProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -92,7 +88,6 @@ public function toGetRequestInformation(?UserProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -100,6 +95,7 @@ public function toGetRequestInformation(?UserProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Count/CountRequestBuilder.php index a2d2c1a7455..d9d238c9159 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/CreatedByRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/CreatedByRequestBuilder.php index cd85a9cf00e..00a98daafad 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/CreatedByRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/CreatedByRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\CreatedBy\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\CreatedBy\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The user who created the workflow. * @param CreatedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php index 1ac14b478c1..0aaa755e416 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 49b9b4e2119..0a04274c28d 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 5333835b122..56c69ebf0b5 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\CreatedBy\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilder.php index dc2b41ee040..4958c57e9f9 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\LastModifiedBy\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\LastModifiedBy\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure Active Directory identity that last modified the workflow. + * The unique identifier of the Microsoft Entra identity that last modified the workflow. * @param LastModifiedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure Active Directory identity that last modified the workflow. + * The unique identifier of the Microsoft Entra identity that last modified the workflow. * @param LastModifiedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php index b58d6ca1c59..733d915d0bd 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure Active Directory identity that last modified the workflow. + * The unique identifier of the Microsoft Entra identity that last modified the workflow. */ class LastModifiedByRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php index 038af4475b8..71688773951 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php index a37cebbe640..dc2a794ef83 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 6bdabb02064..f032d582a5c 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\LastModifiedBy\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Count/CountRequestBuilder.php index 5b532bb5366..9e3e8b463c5 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskItemRequestBuilder.php index d3b0b0117d7..36626209b82 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\TaskProcessingResultsRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for identityGovernance * @param TaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The tasks in the workflow. * @param TaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in identityGovernance * @param Task $body The request body * @param TaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Task $body, ?TaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?TaskItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?TaskItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?TaskItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Task $body, ?TaskItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php index a0b9a484d77..1c5f392d946 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php index 523c46ea1e2..69a92dce02e 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resume a task processing result that's inProgress. In the default case an Azure Logic Apps system-assigned managed identity calls this API. For more information, see: Lifecycle Workflows extensibility approach. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskprocessingresult-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index ba9a3ca8cf3..01374c372a6 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 9fc826ad540..b311779adb1 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 571e5ff8ebc..fe0c69192d2 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php index 8a09d8f175c..b633571f981 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php index a60ae7d42f5..4dafa362155 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. */ class SubjectRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php index 2f18505b7a5..0ab1ea022df 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related workflow task * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php index db2208c7e86..6eaa36aff7e 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\MicrosoftGraphIdentityGovernanceResume\MicrosoftGraphIdentityGovernanceResumeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\Task\TaskRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The result of processing the task. * @param TaskProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php index e834295dd34..c43fb9a71c3 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\TaskProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskProcessingResultCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The result of processing the task. * @param TaskProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/TasksRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/TasksRequestBuilder.php index fb37e92df8c..880ddc584f5 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\Tasks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\Tasks\Item\TaskItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The tasks in the workflow. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for identityGovernance * @param Task $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Task $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Task $body, ?TasksRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/WorkflowVersionVersionNumberItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/WorkflowVersionVersionNumberItemRequestBuilder.php index 72e317bb9e5..40687e70c87 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/WorkflowVersionVersionNumberItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/Item/WorkflowVersionVersionNumberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\CreatedBy\CreatedByRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\LastModifiedBy\LastModifiedByRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\Tasks\TasksRequestBuilder; @@ -58,20 +57,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a workflowVersion object. This API is available in the following national cloud deployments. * @param WorkflowVersionVersionNumberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflowversion-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkflowVersionVersionNumberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkflowVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkflowVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,7 +80,6 @@ public function toGetRequestInformation(?WorkflowVersionVersionNumberItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -92,6 +87,7 @@ public function toGetRequestInformation(?WorkflowVersionVersionNumberItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/VersionsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/VersionsRequestBuilder.php index 9a479d54920..65d65dfaae2 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/VersionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/Versions/VersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\Versions\Item\WorkflowVersionVersionNumberItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\WorkflowVersionCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the workflowVersion objects and their properties. This API is available in the following national cloud deployments. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-list-versions?view=graph-rest-1.0 Find more info here */ public function get(?VersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkflowVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkflowVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/WorkflowItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/WorkflowItemRequestBuilder.php index 9ab629e5e09..fe8c8a4bdfe 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/WorkflowItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/Item/WorkflowItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\CreatedBy\CreatedByRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\ExecutionScope\ExecutionScopeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\LastModifiedBy\LastModifiedByRequestBuilder; @@ -122,39 +121,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a workflow object. This API is available in the following national cloud deployments. * @param WorkflowItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-deletedItemcontainer-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WorkflowItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a deleted workflow object. This API is available in the following national cloud deployments. * @param WorkflowItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-deleteditemcontainer-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkflowItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -171,6 +164,7 @@ public function toDeleteRequestInformation(?WorkflowItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -184,7 +178,6 @@ public function toGetRequestInformation(?WorkflowItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -192,6 +185,7 @@ public function toGetRequestInformation(?WorkflowItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/WorkflowsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/WorkflowsRequestBuilder.php index b1b7f20d0b2..4c2b5e46729 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/WorkflowsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/DeletedItems/Workflows/WorkflowsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\Workflows\Item\WorkflowItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\WorkflowCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the deleted workflow objects and their properties. This API is available in the following national cloud deployments. * @param WorkflowsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-lifecycleworkflowscontainer-list-deleteditems?view=graph-rest-1.0 Find more info here */ public function get(?WorkflowsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkflowCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkflowCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?WorkflowsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?WorkflowsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/LifecycleWorkflowsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/LifecycleWorkflowsRequestBuilder.php index ed504e66768..7898ac016a8 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/LifecycleWorkflowsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/LifecycleWorkflowsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\CustomTaskExtensions\CustomTaskExtensionsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\DeletedItems\DeletedItemsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Settings\SettingsRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property lifecycleWorkflows for identityGovernance * @param LifecycleWorkflowsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LifecycleWorkflowsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get lifecycleWorkflows from identityGovernance * @param LifecycleWorkflowsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LifecycleWorkflowsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LifecycleWorkflowsContainer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LifecycleWorkflowsContainer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property lifecycleWorkflows in identityGovernance * @param LifecycleWorkflowsContainer $body The request body * @param LifecycleWorkflowsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(LifecycleWorkflowsContainer $body, ?LifecycleWorkflowsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LifecycleWorkflowsContainer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LifecycleWorkflowsContainer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?LifecycleWorkflowsRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?LifecycleWorkflowsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?LifecycleWorkflowsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(LifecycleWorkflowsContainer $body, ?Li $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Settings/SettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Settings/SettingsRequestBuilder.php index 0a93310485c..d5b9e9b6d3e 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Settings/SettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Settings/SettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\LifecycleManagementSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,40 +33,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a lifecycleManagementSettings object. This API is available in the following national cloud deployments. * @param SettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-lifecyclemanagementsettings-get?view=graph-rest-1.0 Find more info here */ public function get(?SettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LifecycleManagementSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LifecycleManagementSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a lifecycleManagementSettings object. This API is available in the following national cloud deployments. * @param LifecycleManagementSettings $body The request body * @param SettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-lifecyclemanagementsettings-update?view=graph-rest-1.0 Find more info here */ public function patch(LifecycleManagementSettings $body, ?SettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LifecycleManagementSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LifecycleManagementSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +73,6 @@ public function toGetRequestInformation(?SettingsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +80,7 @@ public function toGetRequestInformation(?SettingsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -102,11 +95,11 @@ public function toPatchRequestInformation(LifecycleManagementSettings $body, ?Se $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/TaskDefinitions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/TaskDefinitions/Count/CountRequestBuilder.php index 662290badee..dfd4db35ba6 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/TaskDefinitions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/TaskDefinitions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/TaskDefinitions/Item/TaskDefinitionItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/TaskDefinitions/Item/TaskDefinitionItemRequestBuilder.php index c73e192cc65..86043bcdab7 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/TaskDefinitions/Item/TaskDefinitionItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/TaskDefinitions/Item/TaskDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the details of a built-in workflow task. This API is available in the following national cloud deployments. * @param TaskDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskdefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?TaskDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?TaskDefinitionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?TaskDefinitionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/TaskDefinitions/TaskDefinitionsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/TaskDefinitions/TaskDefinitionsRequestBuilder.php index 59fd10e5e16..849c1b8e244 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/TaskDefinitions/TaskDefinitionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/TaskDefinitions/TaskDefinitionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\TaskDefinitions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\TaskDefinitions\Item\TaskDefinitionItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskDefinitionCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the taskDefinition objects and their properties. This API is available in the following national cloud deployments. * @param TaskDefinitionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-lifecycleworkflowscontainer-list-taskdefinitions?view=graph-rest-1.0 Find more info here */ public function get(?TaskDefinitionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?TaskDefinitionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?TaskDefinitionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Count/CountRequestBuilder.php index 4c441e427e3..2a66ebd18a3 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Count/CountRequestBuilder.php index 18fd142571f..4628f825559 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskItemRequestBuilder.php index 788e688bd41..f184b429f00 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Item\Tasks\Item\TaskProcessingResults\TaskProcessingResultsRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents the configured tasks to execute and their execution sequence within a workflow. This relationship is expanded by default. * @param TaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?TaskItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?TaskItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php index c498ecf6dbd..0feb84a28ce 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php index 25a12bf42a3..75fee7ff7bc 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resume a task processing result that's inProgress. In the default case an Azure Logic Apps system-assigned managed identity calls this API. For more information, see: Lifecycle Workflows extensibility approach. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskprocessingresult-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index 7ad445cce71..d8f449ebaf4 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index fa009fc60dc..bc98d4c5ed7 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index b9e89a02ed1..b6cd9efbd13 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Item\Tasks\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php index e4bca51116c..e4f151cd8f2 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Item\Tasks\Item\TaskProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Item\Tasks\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php index 59b7de823bd..0248722603b 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. */ class SubjectRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php index 987d5047eee..eb8cc342675 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related workflow task * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php index 87fe8b92ec5..f0db86ff178 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Item\Tasks\Item\TaskProcessingResults\Item\MicrosoftGraphIdentityGovernanceResume\MicrosoftGraphIdentityGovernanceResumeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Item\Tasks\Item\TaskProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Item\Tasks\Item\TaskProcessingResults\Item\Task\TaskRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The result of processing the task. * @param TaskProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php index e1bf3b0366d..2808ab245b8 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Item\Tasks\Item\TaskProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Item\Tasks\Item\TaskProcessingResults\Item\TaskProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskProcessingResultCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The result of processing the task. * @param TaskProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/TasksRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/TasksRequestBuilder.php index 665546ea642..6c3d6dd06f4 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Item\Tasks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Item\Tasks\Item\TaskItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents the configured tasks to execute and their execution sequence within a workflow. This relationship is expanded by default. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/WorkflowTemplateItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/WorkflowTemplateItemRequestBuilder.php index 68865ed95f2..e5ef7b02c20 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/WorkflowTemplateItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/Item/WorkflowTemplateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Item\Tasks\TasksRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\WorkflowTemplate; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,20 +41,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a workflowTemplate object. This API is available in the following national cloud deployments. * @param WorkflowTemplateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflowtemplate-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkflowTemplateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkflowTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkflowTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -68,7 +64,6 @@ public function toGetRequestInformation(?WorkflowTemplateItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -76,6 +71,7 @@ public function toGetRequestInformation(?WorkflowTemplateItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/WorkflowTemplatesRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/WorkflowTemplatesRequestBuilder.php index 91dae916463..d3ead643735 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/WorkflowTemplatesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/WorkflowTemplates/WorkflowTemplatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\WorkflowTemplates\Item\WorkflowTemplateItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\WorkflowTemplateCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the workflowTemplate objects and their properties. This API is available in the following national cloud deployments. * @param WorkflowTemplatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-lifecycleworkflowscontainer-list-workflowtemplates?view=graph-rest-1.0 Find more info here */ public function get(?WorkflowTemplatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkflowTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkflowTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?WorkflowTemplatesRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?WorkflowTemplatesRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Count/CountRequestBuilder.php index 4c6c58543bb..7f3f2009ec3 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/CreatedByRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/CreatedByRequestBuilder.php index a8fc7ecf5ad..3ef094b122f 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/CreatedByRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/CreatedByRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\CreatedBy\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\CreatedBy\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The user who created the workflow. * @param CreatedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php index 0e967c454ae..ff9ce6bdc6c 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php index fc36516c752..96f9a02deb0 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 9894c743382..24ec5b44fc9 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\CreatedBy\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/Count/CountRequestBuilder.php index c97eb54dfcf..04e20eaa4df 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilder.php index 4471f39d99e..0b11c7d9f34 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\ExecutionScope\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\ExecutionScope\Item\UserProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\UserProcessingResultCollectionResponse; @@ -52,25 +51,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD identity that last modified the workflow object. + * The unique identifier of the Microsoft Entra identity that last modified the workflow object. * @param ExecutionScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExecutionScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD identity that last modified the workflow object. + * The unique identifier of the Microsoft Entra identity that last modified the workflow object. * @param ExecutionScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ExecutionScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ExecutionScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilderGetQueryParameters.php index 1c29e8e4255..2787e8076f6 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/ExecutionScopeRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD identity that last modified the workflow object. + * The unique identifier of the Microsoft Entra identity that last modified the workflow object. */ class ExecutionScopeRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilder.php index d4dff507967..960c6892f95 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\UserProcessingResult; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,25 +31,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD identity that last modified the workflow object. + * The unique identifier of the Microsoft Entra identity that last modified the workflow object. * @param UserProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD identity that last modified the workflow object. + * The unique identifier of the Microsoft Entra identity that last modified the workflow object. * @param UserProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -59,7 +55,6 @@ public function toGetRequestInformation(?UserProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?UserProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilderGetQueryParameters.php index 63d7dde2fc6..05ee253a717 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/ExecutionScope/Item/UserProcessingResultItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD identity that last modified the workflow object. + * The unique identifier of the Microsoft Entra identity that last modified the workflow object. */ class UserProcessingResultItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilder.php index 5859fa23de4..60ae62a1cac 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\LastModifiedBy\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\LastModifiedBy\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure Active Directory identity that last modified the workflow. + * The unique identifier of the Microsoft Entra identity that last modified the workflow. * @param LastModifiedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure Active Directory identity that last modified the workflow. + * The unique identifier of the Microsoft Entra identity that last modified the workflow. * @param LastModifiedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php index 6d8d9455fa5..55fa23e7f3b 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure Active Directory identity that last modified the workflow. + * The unique identifier of the Microsoft Entra identity that last modified the workflow. */ class LastModifiedByRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php index 60275971065..51d04d97b04 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php index b564aa1316f..b1714e69357 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 9855631b99a..29de297f30d 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\LastModifiedBy\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/MicrosoftGraphIdentityGovernanceActivate/MicrosoftGraphIdentityGovernanceActivateRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/MicrosoftGraphIdentityGovernanceActivate/MicrosoftGraphIdentityGovernanceActivateRequestBuilder.php index 888b7ab14c6..ffefbdff0a1 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/MicrosoftGraphIdentityGovernanceActivate/MicrosoftGraphIdentityGovernanceActivateRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/MicrosoftGraphIdentityGovernanceActivate/MicrosoftGraphIdentityGovernanceActivateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Run a workflow object on-demand. You can run any workflow on-demand, including scheduled workflows. Workflows created from the 'Real-time employee termination' template are run on-demand only. When you run a workflow on demand, the tasks are executed regardless of whether the user state matches the scope and trigger execution conditions. This API is available in the following national cloud deployments. * @param ActivatePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceActivateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-activate?view=graph-rest-1.0 Find more info here */ public function post(ActivatePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceActivateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ActivatePostRequestBody $body, ?Microso $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/MicrosoftGraphIdentityGovernanceCreateNewVersion/MicrosoftGraphIdentityGovernanceCreateNewVersionRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/MicrosoftGraphIdentityGovernanceCreateNewVersion/MicrosoftGraphIdentityGovernanceCreateNewVersionRequestBuilder.php index ac9241834d1..621fa15de6c 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/MicrosoftGraphIdentityGovernanceCreateNewVersion/MicrosoftGraphIdentityGovernanceCreateNewVersionRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/MicrosoftGraphIdentityGovernanceCreateNewVersion/MicrosoftGraphIdentityGovernanceCreateNewVersionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Workflow; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a new version of the workflow object. This API is available in the following national cloud deployments. * @param CreateNewVersionPostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceCreateNewVersionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-createnewversion?view=graph-rest-1.0 Find more info here */ public function post(CreateNewVersionPostRequestBody $body, ?MicrosoftGraphIdentityGovernanceCreateNewVersionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateNewVersionPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/MicrosoftGraphIdentityGovernanceRestore/MicrosoftGraphIdentityGovernanceRestoreRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/MicrosoftGraphIdentityGovernanceRestore/MicrosoftGraphIdentityGovernanceRestoreRequestBuilder.php index f8e4d3435a5..83177056f3c 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/MicrosoftGraphIdentityGovernanceRestore/MicrosoftGraphIdentityGovernanceRestoreRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/MicrosoftGraphIdentityGovernanceRestore/MicrosoftGraphIdentityGovernanceRestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Workflow; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,26 +31,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Restore a workflow that has been deleted. You can only restore a workflow that was deleted within the last 30 days before Azure AD automatically permanently deletes it. This API is available in the following national cloud deployments. + * Restore a workflow that has been deleted. You can only restore a workflow that was deleted within the last 30 days before Microsoft Entra ID automatically permanently deletes it. This API is available in the following national cloud deployments. * @param MicrosoftGraphIdentityGovernanceRestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-restore?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphIdentityGovernanceRestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Restore a workflow that has been deleted. You can only restore a workflow that was deleted within the last 30 days before Azure AD automatically permanently deletes it. This API is available in the following national cloud deployments. + * Restore a workflow that has been deleted. You can only restore a workflow that was deleted within the last 30 days before Microsoft Entra ID automatically permanently deletes it. This API is available in the following national cloud deployments. * @param MicrosoftGraphIdentityGovernanceRestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -60,11 +56,11 @@ public function toPostRequestInformation(?MicrosoftGraphIdentityGovernanceRestor $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Count/CountRequestBuilder.php index 3b9f03180df..9e92df57fac 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/RunItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/RunItemRequestBuilder.php index 71e4ed070ce..6e3e080ce09 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/RunItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/RunItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\TaskProcessingResults\TaskProcessingResultsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\UserProcessingResultsRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\Run; @@ -50,20 +49,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a run object. This API is available in the following national cloud deployments. * @param RunItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-run-get?view=graph-rest-1.0 Find more info here */ public function get(?RunItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Run::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Run::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -76,7 +72,6 @@ public function toGetRequestInformation(?RunItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -84,6 +79,7 @@ public function toGetRequestInformation(?RunItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Count/CountRequestBuilder.php index c4ba0a598a9..6dd19222f2e 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php index 14c9d39415e..6588d9797cb 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resume a task processing result that's inProgress. In the default case an Azure Logic Apps system-assigned managed identity calls this API. For more information, see: Lifecycle Workflows extensibility approach. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskprocessingresult-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index f653e26a04d..d54ea8d7efc 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 443c649fe41..65ed1781ea3 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 72dbb54a53a..757bf42702f 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php index 10949195960..d24081a25fa 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\TaskProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php index 84c560565d0..72501460179 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. */ class SubjectRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php index 765accae634..a925d4f751c 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related workflow task * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php index 867f0bc64d1..833c667b7bb 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\TaskProcessingResults\Item\MicrosoftGraphIdentityGovernanceResume\MicrosoftGraphIdentityGovernanceResumeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\TaskProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\TaskProcessingResults\Item\Task\TaskRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related taskProcessingResults. * @param TaskProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php index 5298ed1892f..316ba8e1df1 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\TaskProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\TaskProcessingResults\Item\TaskProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskProcessingResultCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the taskProcessingResult resources for a run. This API is available in the following national cloud deployments. * @param TaskProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-run-list-taskprocessingresults?view=graph-rest-1.0 Find more info here */ public function get(?TaskProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Count/CountRequestBuilder.php index 794e7f02326..ca727932ada 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index 2015ee8095a..40a00b38e16 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index e1f5c9c31dd..26fa96ed98e 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 06e9f344ea9..428d903817d 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php index 59d558e3cf9..4d789fd1e53 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The unique identifier of the AAD user targeted for the taskProcessingResult.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php index 78579852c99..ba0923c0ae9 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php index b9beac50b59..eef2b0aaddf 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resume a task processing result that's inProgress. In the default case an Azure Logic Apps system-assigned managed identity calls this API. For more information, see: Lifecycle Workflows extensibility approach. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskprocessingresult-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index 9a55ff5096a..61ce727ff3e 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 47d69138bc6..06933c3e433 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 99ca2c2378e..d243502925b 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php index 788df4d74e6..e698d5ef466 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php index 226c92279ef..ed459b917cc 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. */ class SubjectRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php index 60ed02f0c5b..b9d4cedcbc1 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related workflow task * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php index e066e24fcdc..f2704cb15b6 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\MicrosoftGraphIdentityGovernanceResume\MicrosoftGraphIdentityGovernanceResumeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Task\TaskRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The associated individual task execution. * @param TaskProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php index 31c191c4737..6948e560444 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\Item\TaskProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskProcessingResultCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the task processing result from a userProcessingResult either directly or through a run. This API is available in the following national cloud deployments. * @param TaskProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-userprocessingresult-list-taskprocessingresults?view=graph-rest-1.0 Find more info here */ public function get(?TaskProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php index 04fb4557ede..af80aa3720f 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\TaskProcessingResults\TaskProcessingResultsRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\UserProcessingResult; @@ -50,20 +49,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the user processing result of a user processing result of a run. This API is available in the following national cloud deployments. * @param UserProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-userprocessingresult-get?view=graph-rest-1.0 Find more info here */ public function get(?UserProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -76,7 +72,6 @@ public function toGetRequestInformation(?UserProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -84,6 +79,7 @@ public function toGetRequestInformation(?UserProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php index 4ee375c4035..721b9466af0 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\UserSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function summary * @param MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,11 +61,11 @@ public function toGetRequestInformation(?MicrosoftGraphIdentityGovernanceSummary $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php index be6b9dc462a..be6f0f3c30a 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\Item\UserProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\UserProcessingResults\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder; @@ -56,20 +55,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get user processing results of a workflow run object. This API is available in the following national cloud deployments. * @param UserProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-run-list-userprocessingresults?view=graph-rest-1.0 Find more info here */ public function get(?UserProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -92,7 +88,6 @@ public function toGetRequestInformation(?UserProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -100,6 +95,7 @@ public function toGetRequestInformation(?UserProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php index a5a54b9a4d3..f497df63a44 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\RunSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function summary * @param MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RunSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RunSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,11 +61,11 @@ public function toGetRequestInformation(?MicrosoftGraphIdentityGovernanceSummary $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/RunsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/RunsRequestBuilder.php index a540ad4ba4f..635c0bab1b9 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/RunsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Runs/RunsRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\Item\RunItemRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Runs\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder; @@ -56,20 +55,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the run objects and their properties for a lifecycle workflow. This API is available in the following national cloud deployments. * @param RunsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-list-runs?view=graph-rest-1.0 Find more info here */ public function get(?RunsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RunCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RunCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -92,7 +88,6 @@ public function toGetRequestInformation(?RunsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -100,6 +95,7 @@ public function toGetRequestInformation(?RunsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Count/CountRequestBuilder.php index 26fbca8be4a..9b87a50dbd4 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/Task/TaskRequestBuilder.php index 7741968c365..8600c49b7c0 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related lifecycle workflow task.Supports $filter(eq, ne) and $expand. * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskDefinition/TaskDefinitionRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskDefinition/TaskDefinitionRequestBuilder.php index f9db42e1165..065a6f65c90 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskDefinition/TaskDefinitionRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskDefinition/TaskDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The taskDefinition associated with the related lifecycle workflow task.Supports $filter(eq, ne) and $expand. * @param TaskDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Count/CountRequestBuilder.php index 42e37c1d343..514f57ab486 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php index 84787067aa5..3484761d0b3 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resume a task processing result that's inProgress. In the default case an Azure Logic Apps system-assigned managed identity calls this API. For more information, see: Lifecycle Workflows extensibility approach. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskprocessingresult-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index 55e49a5888b..529fec79324 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 0d7c6339ef9..27458c086f8 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 0589f0ce74e..445368743b0 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php index 54111231b16..3a2d0a8b42b 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php index ca14631e37c..0b01d1d1705 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. */ class SubjectRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php index 62cfb23da13..b0cfac3c78e 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related workflow task * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php index b1004707f72..cd528038109 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\MicrosoftGraphIdentityGovernanceResume\MicrosoftGraphIdentityGovernanceResumeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\Task\TaskRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related lifecycle workflow taskProcessingResults. * @param TaskProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php index 107c7801b1d..dd70398a84b 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\Item\TaskProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\Item\TaskProcessingResults\Item\TaskProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskProcessingResultCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the task processing result resources from the taskReport. This API is available in the following national cloud deployments. * @param TaskProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskreport-list-taskprocessingresults?view=graph-rest-1.0 Find more info here */ public function get(?TaskProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskReportItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskReportItemRequestBuilder.php index cb26856ae91..fe294c6b536 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskReportItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/Item/TaskReportItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\Item\Task\TaskRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\Item\TaskDefinition\TaskDefinitionRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\Item\TaskProcessingResults\TaskProcessingResultsRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents the aggregation of task execution data for tasks within a workflow object. * @param TaskReportItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskReportItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskReport::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskReport::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskReportItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskReportItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php index c27695d1874..c70fff4259c 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskReportSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function summary * @param MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskReportSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskReportSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,11 +61,11 @@ public function toGetRequestInformation(?MicrosoftGraphIdentityGovernanceSummary $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/TaskReportsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/TaskReportsRequestBuilder.php index ffe1a07ecef..4d76c584c1b 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/TaskReportsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/TaskReports/TaskReportsRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\Item\TaskReportItemRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\TaskReports\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder; @@ -56,20 +55,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the taskReport objects and their properties. This API is available in the following national cloud deployments. * @param TaskReportsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-list-taskreports?view=graph-rest-1.0 Find more info here */ public function get(?TaskReportsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskReportCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskReportCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -92,7 +88,6 @@ public function toGetRequestInformation(?TaskReportsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -100,6 +95,7 @@ public function toGetRequestInformation(?TaskReportsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Count/CountRequestBuilder.php index 7245d8d3dc7..0a386c175b1 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskItemRequestBuilder.php index e446df273bf..8cbd2d44e30 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Tasks\Item\TaskProcessingResults\TaskProcessingResultsRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for identityGovernance * @param TaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The tasks in the workflow. * @param TaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in identityGovernance * @param Task $body The request body * @param TaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Task $body, ?TaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?TaskItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?TaskItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?TaskItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Task $body, ?TaskItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php index bb7cff268a4..3203ce9bce6 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php index caecd5ca5ae..6ededfc87fd 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resume a task processing result that's inProgress. In the default case an Azure Logic Apps system-assigned managed identity calls this API. For more information, see: Lifecycle Workflows extensibility approach. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskprocessingresult-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index f4182bc0476..cf60bd38b8a 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index f5b55a6fe29..b6bb17093c1 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index a0e3b6aaabd..ca6ec7fae31 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php index fe1bf094b1c..1eb4bc20ffa 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php index 0899a490c1f..fa1d2acf1bf 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. */ class SubjectRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php index e5eb965386f..5bc33ad1950 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related workflow task * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php index e92823fb26a..251ee541fae 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\MicrosoftGraphIdentityGovernanceResume\MicrosoftGraphIdentityGovernanceResumeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\Task\TaskRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The result of processing the task. * @param TaskProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php index 25488e19cf3..b790f5e9312 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Tasks\Item\TaskProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Tasks\Item\TaskProcessingResults\Item\TaskProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskProcessingResultCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The result of processing the task. * @param TaskProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/TasksRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/TasksRequestBuilder.php index 226b78a7f99..87e79c04d76 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Tasks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Tasks\Item\TaskItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The tasks in the workflow. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for identityGovernance * @param Task $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Task $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Task $body, ?TasksRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Count/CountRequestBuilder.php index d7c1fefece6..d11f826d4cf 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index 9b945efa521..99a8ae09e65 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 418e54d708e..54edbc25ffc 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 4292d5a59e0..432d8050a66 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php index d309fc14b82..c68687ce182 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The unique identifier of the AAD user targeted for the taskProcessingResult.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php index e97781fa6de..398a4065ce3 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php index 3275575d4d3..996dbefdc3f 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resume a task processing result that's inProgress. In the default case an Azure Logic Apps system-assigned managed identity calls this API. For more information, see: Lifecycle Workflows extensibility approach. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskprocessingresult-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index 1b8c2a62b59..4816553bbe1 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index d8670613c2e..562cb004587 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 6728e9bc014..5c2eff71eef 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php index 660f8633732..33b8afd0f32 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php index af3764cf196..1193fe98393 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. */ class SubjectRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php index ad01486c0a7..9daeb4d75e0 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related workflow task * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php index 98b22135dc2..a618ccfeadf 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\MicrosoftGraphIdentityGovernanceResume\MicrosoftGraphIdentityGovernanceResumeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\Task\TaskRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The associated individual task execution. * @param TaskProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php index 27ec6a8ea4e..8bf50d7fdb3 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\Item\TaskProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskProcessingResultCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the task processing result from a userProcessingResult either directly or through a run. This API is available in the following national cloud deployments. * @param TaskProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-userprocessingresult-list-taskprocessingresults?view=graph-rest-1.0 Find more info here */ public function get(?TaskProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php index f78997c8ce7..b9d3976499a 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/Item/UserProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\TaskProcessingResults\TaskProcessingResultsRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\UserProcessingResult; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Per-user workflow execution results. * @param UserProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?UserProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?UserProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php index cb6bff758de..a8f5dec325c 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime/MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\UserSummary; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function summary * @param MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,11 +61,11 @@ public function toGetRequestInformation(?MicrosoftGraphIdentityGovernanceSummary $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php index 89465db49ae..ce8eaa598fc 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/UserProcessingResults/UserProcessingResultsRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\Item\UserProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\UserProcessingResults\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTime\MicrosoftGraphIdentityGovernanceSummaryWithStartDateTimeWithEndDateTimeRequestBuilder; @@ -56,20 +55,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the userProcessingResult resources for a workflow. This API is available in the following national cloud deployments. * @param UserProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-list-userprocessingresults?view=graph-rest-1.0 Find more info here */ public function get(?UserProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -92,7 +88,6 @@ public function toGetRequestInformation(?UserProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -100,6 +95,7 @@ public function toGetRequestInformation(?UserProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Count/CountRequestBuilder.php index eb6b34d1ca9..28cdc157bb7 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/CreatedByRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/CreatedByRequestBuilder.php index 01c3257d1a4..2b1c5b98618 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/CreatedByRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/CreatedByRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\CreatedBy\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\CreatedBy\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The user who created the workflow. * @param CreatedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php index c484c927194..d56f6c22cc2 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php index d3ee44c1637..c0520a01718 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 833bd1172b9..430eae96c59 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/CreatedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\CreatedBy\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilder.php index 9985c47fc06..3251b46968f 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\LastModifiedBy\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\LastModifiedBy\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure Active Directory identity that last modified the workflow. + * The unique identifier of the Microsoft Entra identity that last modified the workflow. * @param LastModifiedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure Active Directory identity that last modified the workflow. + * The unique identifier of the Microsoft Entra identity that last modified the workflow. * @param LastModifiedByRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php index fc6076f4097..9b4e88d590f 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/LastModifiedByRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure Active Directory identity that last modified the workflow. + * The unique identifier of the Microsoft Entra identity that last modified the workflow. */ class LastModifiedByRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php index 53d64833d29..ec6b716883d 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php index a5155e34d93..b0e5573a89c 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 11779a89296..7588555e66b 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/LastModifiedBy/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\LastModifiedBy\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Count/CountRequestBuilder.php index c63d73a4556..8dd2ebf09bb 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskItemRequestBuilder.php index 32f0b9db9bb..efe225f57bf 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\TaskProcessingResultsRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for identityGovernance * @param TaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The tasks in the workflow. * @param TaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in identityGovernance * @param Task $body The request body * @param TaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Task $body, ?TaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?TaskItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?TaskItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?TaskItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Task $body, ?TaskItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php index 934e5761ca4..55db41d783c 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php index 912fa4fd47b..56b4514e49b 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/MicrosoftGraphIdentityGovernanceResume/MicrosoftGraphIdentityGovernanceResumeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Resume a task processing result that's inProgress. In the default case an Azure Logic Apps system-assigned managed identity calls this API. For more information, see: Lifecycle Workflows extensibility approach. This API is available in the following national cloud deployments. * @param ResumePostRequestBody $body The request body * @param MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-taskprocessingresult-resume?view=graph-rest-1.0 Find more info here */ public function post(ResumePostRequestBody $body, ?MicrosoftGraphIdentityGovernanceResumeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ResumePostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php index 87d6de64fe7..825ebe7e377 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 3ed771278cb..751406be32d 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 1aa1a83caa4..9b25ad42e8c 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php index 5e54db1ac5a..074179d8ccf 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\Subject\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\Subject\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -48,25 +47,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. * @param SubjectRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -75,7 +71,6 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?SubjectRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php index b7272739217..6f21967501c 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Subject/SubjectRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The unique identifier of the Azure AD user targeted for the task execution.Supports $filter(eq, ne) and $expand. + * The unique identifier of the Microsoft Entra user targeted for the task execution.Supports $filter(eq, ne) and $expand. */ class SubjectRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php index 8e96a3090e9..69694ae8297 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/Task/TaskRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The related workflow task * @param TaskRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TaskRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php index c5d95bcd091..a6044a6cecf 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/Item/TaskProcessingResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\MicrosoftGraphIdentityGovernanceResume\MicrosoftGraphIdentityGovernanceResumeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\Subject\SubjectRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\Task\TaskRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The result of processing the task. * @param TaskProcessingResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?TaskProcessingResultItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php index 9686e1922fe..5c4875f6803 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/Item/TaskProcessingResults/TaskProcessingResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\Tasks\Item\TaskProcessingResults\Item\TaskProcessingResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\TaskProcessingResultCollectionResponse; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The result of processing the task. * @param TaskProcessingResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TaskProcessingResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskProcessingResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?TaskProcessingResultsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/TasksRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/TasksRequestBuilder.php index 6ac80d118a1..9bfa804b3e8 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\Tasks\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\Tasks\Item\TaskItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\Task; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The tasks in the workflow. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for identityGovernance * @param Task $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Task $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Task::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Task $body, ?TasksRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/WorkflowVersionVersionNumberItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/WorkflowVersionVersionNumberItemRequestBuilder.php index dc3679db6c2..c858711b34b 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/WorkflowVersionVersionNumberItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/Item/WorkflowVersionVersionNumberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\CreatedBy\CreatedByRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\LastModifiedBy\LastModifiedByRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\Tasks\TasksRequestBuilder; @@ -58,20 +57,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a workflowVersion object. This API is available in the following national cloud deployments. * @param WorkflowVersionVersionNumberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflowversion-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkflowVersionVersionNumberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkflowVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkflowVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,7 +80,6 @@ public function toGetRequestInformation(?WorkflowVersionVersionNumberItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -92,6 +87,7 @@ public function toGetRequestInformation(?WorkflowVersionVersionNumberItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/VersionsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/VersionsRequestBuilder.php index a28a2519949..7d366f39b7f 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/VersionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/Versions/VersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\Versions\Item\WorkflowVersionVersionNumberItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\WorkflowVersionCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the workflowVersion objects and their properties. This API is available in the following national cloud deployments. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-list-versions?view=graph-rest-1.0 Find more info here */ public function get(?VersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkflowVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkflowVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/WorkflowItemRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/WorkflowItemRequestBuilder.php index d5bda3ef29c..2a904613b58 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/WorkflowItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/Item/WorkflowItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\CreatedBy\CreatedByRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\ExecutionScope\ExecutionScopeRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\LastModifiedBy\LastModifiedByRequestBuilder; @@ -122,59 +121,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a workflow object and its associated tasks, taskProcessingResults and versions. You can restore a deleted workflow and its associated objects within 30 days of deletion. This API is available in the following national cloud deployments. * @param WorkflowItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WorkflowItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a workflow object. This API is available in the following national cloud deployments. * @param WorkflowItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkflowItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a workflow object. Only the properties listed in the request body table can be updated. To update any other workflow properties, see workflow: createNewVersion. This API is available in the following national cloud deployments. * @param Workflow $body The request body * @param WorkflowItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-workflow-update?view=graph-rest-1.0 Find more info here */ public function patch(Workflow $body, ?WorkflowItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -191,6 +181,7 @@ public function toDeleteRequestInformation(?WorkflowItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -204,7 +195,6 @@ public function toGetRequestInformation(?WorkflowItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -212,6 +202,7 @@ public function toGetRequestInformation(?WorkflowItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -226,11 +217,11 @@ public function toPatchRequestInformation(Workflow $body, ?WorkflowItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/WorkflowsRequestBuilder.php b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/WorkflowsRequestBuilder.php index 65647f0aa7b..25479007dca 100644 --- a/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/WorkflowsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/LifecycleWorkflows/Workflows/WorkflowsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\LifecycleWorkflows\Workflows\Item\WorkflowItemRequestBuilder; use Microsoft\Graph\Generated\Models\IdentityGovernance\Workflow; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of workflow resources that are associated with lifecycle workflows. This API is available in the following national cloud deployments. * @param WorkflowsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-lifecycleworkflowscontainer-list-workflows?view=graph-rest-1.0 Find more info here */ public function get(?WorkflowsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkflowCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkflowCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new workflow object. You can create up to 50 workflows in a tenant. This API is available in the following national cloud deployments. * @param Workflow $body The request body * @param WorkflowsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitygovernance-lifecycleworkflowscontainer-post-workflows?view=graph-rest-1.0 Find more info here */ public function post(Workflow $body, ?WorkflowsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Workflow::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?WorkflowsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?WorkflowsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Workflow $body, ?WorkflowsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/AssignmentApprovalsRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/AssignmentApprovalsRequestBuilder.php index e23b6036660..4116d0d0f80 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/AssignmentApprovalsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/AssignmentApprovalsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentApprovals\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentApprovals\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentApprovals\Item\ApprovalItemRequestBuilder; @@ -65,38 +64,32 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Get assignmentApprovals from identityGovernance * @param AssignmentApprovalsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AssignmentApprovalsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to assignmentApprovals for identityGovernance * @param Approval $body The request body * @param AssignmentApprovalsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Approval $body, ?AssignmentApprovalsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AssignmentApprovalsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AssignmentApprovalsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Approval $body, ?AssignmentApprovalsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Count/CountRequestBuilder.php index 9b013e5c5db..030f7f36a5f 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 41667014cac..ca69d3dd2b5 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/ApprovalItemRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/ApprovalItemRequestBuilder.php index da01d28a357..88fc3937ba9 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/ApprovalItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/ApprovalItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentApprovals\Item\Stages\StagesRequestBuilder; use Microsoft\Graph\Generated\Models\Approval; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignmentApprovals for identityGovernance * @param ApprovalItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ApprovalItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get assignmentApprovals from identityGovernance * @param ApprovalItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ApprovalItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignmentApprovals in identityGovernance * @param Approval $body The request body * @param ApprovalItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Approval $body, ?ApprovalItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Approval::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ApprovalItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ApprovalItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ApprovalItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Approval $body, ?ApprovalItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/Count/CountRequestBuilder.php index af52f99c395..1bc7ff8fd02 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/Item/ApprovalStageItemRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/Item/ApprovalStageItemRequestBuilder.php index 8d680211846..616e2b2c767 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/Item/ApprovalStageItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/Item/ApprovalStageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ApprovalStage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property stages for identityGovernance * @param ApprovalStageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ApprovalStageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of an approvalStage object. An approval stage is contained within an approval object. This API is available in the following national cloud deployments. * @param ApprovalStageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/approvalstage-get?view=graph-rest-1.0 Find more info here */ public function get(?ApprovalStageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Approve or deny an approvalStage object in an approval. This API is available in the following national cloud deployments. * @param ApprovalStage $body The request body * @param ApprovalStageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/approvalstage-update?view=graph-rest-1.0 Find more info here */ public function patch(ApprovalStage $body, ?ApprovalStageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ApprovalStageItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ApprovalStageItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ApprovalStageItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(ApprovalStage $body, ?ApprovalStageIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/StagesRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/StagesRequestBuilder.php index 02af3cda557..dd4cbb41b42 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/StagesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/StagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentApprovals\Item\Stages\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentApprovals\Item\Stages\Item\ApprovalStageItemRequestBuilder; use Microsoft\Graph\Generated\Models\ApprovalStage; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. * @param StagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/approval-list-stages?view=graph-rest-1.0 Find more info here */ public function get(?StagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to stages for identityGovernance * @param ApprovalStage $body The request body * @param StagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApprovalStage $body, ?StagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApprovalStage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. * @param StagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?StagesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?StagesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ApprovalStage $body, ?StagesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/StagesRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/StagesRequestBuilderGetQueryParameters.php index 129e4af9a4c..ee117f54638 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/StagesRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentApprovals/Item/Stages/StagesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Azure AD entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. + * List the approvalStage objects associated with an approval. This API request is made by an approver in the following scenarios: In Microsoft Entra entitlement management, providing the identifier of the access package assignment request.In PIM for groups, providing the identifier of the assignment schedule request. This API is available in the following national cloud deployments. */ class StagesRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/AssignmentScheduleInstancesRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/AssignmentScheduleInstancesRequestBuilder.php index 9cb8888745e..939dea3d7e0 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/AssignmentScheduleInstancesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/AssignmentScheduleInstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleInstances\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleInstances\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleInstances\Item\PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilder; @@ -63,45 +62,39 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn } /** - * Get a list of the privilegedAccessGroupAssignmentScheduleInstance objects and their properties. + * Get a list of the privilegedAccessGroupAssignmentScheduleInstance objects and their properties. This API is available in the following national cloud deployments. * @param AssignmentScheduleInstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroup-list-assignmentscheduleinstances?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentScheduleInstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to assignmentScheduleInstances for identityGovernance * @param PrivilegedAccessGroupAssignmentScheduleInstance $body The request body * @param AssignmentScheduleInstancesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrivilegedAccessGroupAssignmentScheduleInstance $body, ?AssignmentScheduleInstancesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get a list of the privilegedAccessGroupAssignmentScheduleInstance objects and their properties. + * Get a list of the privilegedAccessGroupAssignmentScheduleInstance objects and their properties. This API is available in the following national cloud deployments. * @param AssignmentScheduleInstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -110,7 +103,6 @@ public function toGetRequestInformation(?AssignmentScheduleInstancesRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?AssignmentScheduleInstancesRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(PrivilegedAccessGroupAssignmentSchedule $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/AssignmentScheduleInstancesRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/AssignmentScheduleInstancesRequestBuilderGetQueryParameters.php index d10ee550065..6d57cfd59b3 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/AssignmentScheduleInstancesRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/AssignmentScheduleInstancesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get a list of the privilegedAccessGroupAssignmentScheduleInstance objects and their properties. + * Get a list of the privilegedAccessGroupAssignmentScheduleInstance objects and their properties. This API is available in the following national cloud deployments. */ class AssignmentScheduleInstancesRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Count/CountRequestBuilder.php index ad3983bd9e1..4547ef75d7a 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 2fc51b3ca55..4c977d85b88 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php index 40cd1dc48de..2768243c2ab 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrivilegedAccessGroupEligibilityScheduleInstance; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * When the request activates a membership or ownership in PIM for groups, this object represents the eligibility request for the group. Otherwise, it is null. * @param ActivatedUsingRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivatedUsingRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Group/GroupRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Group/GroupRequestBuilder.php index d9b2422401f..bb6157db297 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Group/GroupRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Group/GroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleInstances\Item\Group\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * References the group that is the scope of the membership or ownership assignment through PIM for groups. Supports $expand. * @param GroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 3f04ad7b3ce..a350a2c8a96 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 37ec71687f5..ee8915a7286 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleInstances\Item\Group\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Principal/PrincipalRequestBuilder.php index 10f02fb1ef0..74e6349ff19 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * References the principal that's in the scope of the membership or ownership assignment request through the group that's governed by PIM. Supports $expand. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilder.php index 5f87a68c7c3..3a04801b651 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleInstances\Item\ActivatedUsing\ActivatedUsingRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleInstances\Item\Group\GroupRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleInstances\Item\Principal\PrincipalRequestBuilder; @@ -58,57 +57,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignmentScheduleInstances for identityGovernance * @param PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read the properties and relationships of a privilegedAccessGroupAssignmentScheduleInstance object. + * Read the properties and relationships of a privilegedAccessGroupAssignmentScheduleInstance object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroupassignmentscheduleinstance-get?view=graph-rest-1.0 Find more info here */ public function get(?PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignmentScheduleInstances in identityGovernance * @param PrivilegedAccessGroupAssignmentScheduleInstance $body The request body * @param PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrivilegedAccessGroupAssignmentScheduleInstance $body, ?PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -125,11 +115,12 @@ public function toDeleteRequestInformation(?PrivilegedAccessGroupAssignmentSched $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read the properties and relationships of a privilegedAccessGroupAssignmentScheduleInstance object. + * Read the properties and relationships of a privilegedAccessGroupAssignmentScheduleInstance object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -138,7 +129,6 @@ public function toGetRequestInformation(?PrivilegedAccessGroupAssignmentSchedule $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -146,6 +136,7 @@ public function toGetRequestInformation(?PrivilegedAccessGroupAssignmentSchedule } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -160,11 +151,11 @@ public function toPatchRequestInformation(PrivilegedAccessGroupAssignmentSchedul $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilderGetQueryParameters.php index 6e1bf3c69f7..fea6b694cfe 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleInstances/Item/PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read the properties and relationships of a privilegedAccessGroupAssignmentScheduleInstance object. + * Read the properties and relationships of a privilegedAccessGroupAssignmentScheduleInstance object. This API is available in the following national cloud deployments. */ class PrivilegedAccessGroupAssignmentScheduleInstanceItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/AssignmentScheduleRequestsRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/AssignmentScheduleRequestsRequestBuilder.php index b480befe966..50b54e7b639 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/AssignmentScheduleRequestsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/AssignmentScheduleRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleRequests\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleRequests\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleRequests\Item\PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilder; @@ -63,46 +62,40 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn } /** - * Get a list of the privilegedAccessGroupAssignmentScheduleRequest objects and their properties. + * Get a list of the privilegedAccessGroupAssignmentScheduleRequest objects and their properties. This API is available in the following national cloud deployments. * @param AssignmentScheduleRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroup-list-assignmentschedulerequests?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentScheduleRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create a new privilegedAccessGroupAssignmentScheduleRequest object. + * Create a new privilegedAccessGroupAssignmentScheduleRequest object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupAssignmentScheduleRequest $body The request body * @param AssignmentScheduleRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroup-post-assignmentschedulerequests?view=graph-rest-1.0 Find more info here */ public function post(PrivilegedAccessGroupAssignmentScheduleRequest $body, ?AssignmentScheduleRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get a list of the privilegedAccessGroupAssignmentScheduleRequest objects and their properties. + * Get a list of the privilegedAccessGroupAssignmentScheduleRequest objects and their properties. This API is available in the following national cloud deployments. * @param AssignmentScheduleRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -111,7 +104,6 @@ public function toGetRequestInformation(?AssignmentScheduleRequestsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -119,11 +111,12 @@ public function toGetRequestInformation(?AssignmentScheduleRequestsRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create a new privilegedAccessGroupAssignmentScheduleRequest object. + * Create a new privilegedAccessGroupAssignmentScheduleRequest object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupAssignmentScheduleRequest $body The request body * @param AssignmentScheduleRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -133,11 +126,11 @@ public function toPostRequestInformation(PrivilegedAccessGroupAssignmentSchedule $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/AssignmentScheduleRequestsRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/AssignmentScheduleRequestsRequestBuilderGetQueryParameters.php index 86b30789377..66199364cb0 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/AssignmentScheduleRequestsRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/AssignmentScheduleRequestsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get a list of the privilegedAccessGroupAssignmentScheduleRequest objects and their properties. + * Get a list of the privilegedAccessGroupAssignmentScheduleRequest objects and their properties. This API is available in the following national cloud deployments. */ class AssignmentScheduleRequestsRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Count/CountRequestBuilder.php index 137e6319294..d608c6cd1d9 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 5b60482f490..94b58020749 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php index 20a7e7d1ff7..3d4c358308f 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrivilegedAccessGroupEligibilitySchedule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * When the request activates a membership or ownership assignment in PIM for groups, this object represents the eligibility policy for the group. Otherwise, it is null. Supports $expand. * @param ActivatedUsingRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivatedUsingRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Cancel/CancelRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Cancel/CancelRequestBuilder.php index 52a8bf231ca..8bc7858a953 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,26 +30,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Cancel an access assignment request to a group whose membership and ownership are governed by PIM. + * Cancel an access assignment request to a group whose membership and ownership are governed by PIM. This API is available in the following national cloud deployments. * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroupassignmentschedulerequest-cancel?view=graph-rest-1.0 Find more info here */ public function post(?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Cancel an access assignment request to a group whose membership and ownership are governed by PIM. + * Cancel an access assignment request to a group whose membership and ownership are governed by PIM. This API is available in the following national cloud deployments. * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CancelRequestBuilderPostRequestConfigu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Group/GroupRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Group/GroupRequestBuilder.php index 71cffb80bc0..dc17ead6bf9 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Group/GroupRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Group/GroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleRequests\Item\Group\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * References the group that is the scope of the membership or ownership assignment request through PIM for groups. Supports $expand. * @param GroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php index a08304a0274..8f75e4784e3 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 7e5fcbf6b79..1d795847cdb 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleRequests\Item\Group\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Principal/PrincipalRequestBuilder.php index de28c66052c..a25b9849822 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * References the principal that's in the scope of this membership or ownership assignment request through the group that's governed by PIM. Supports $expand. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilder.php index 553ffd4d13c..e68f29c74ee 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleRequests\Item\ActivatedUsing\ActivatedUsingRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleRequests\Item\Cancel\CancelRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleRequests\Item\Group\GroupRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignmentScheduleRequests for identityGovernance * @param PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read the properties and relationships of a privilegedAccessGroupAssignmentScheduleRequest object. + * Read the properties and relationships of a privilegedAccessGroupAssignmentScheduleRequest object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroupassignmentschedulerequest-get?view=graph-rest-1.0 Find more info here */ public function get(?PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignmentScheduleRequests in identityGovernance * @param PrivilegedAccessGroupAssignmentScheduleRequest $body The request body * @param PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrivilegedAccessGroupAssignmentScheduleRequest $body, ?PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,11 +131,12 @@ public function toDeleteRequestInformation(?PrivilegedAccessGroupAssignmentSched $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read the properties and relationships of a privilegedAccessGroupAssignmentScheduleRequest object. + * Read the properties and relationships of a privilegedAccessGroupAssignmentScheduleRequest object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -154,7 +145,6 @@ public function toGetRequestInformation(?PrivilegedAccessGroupAssignmentSchedule $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?PrivilegedAccessGroupAssignmentSchedule } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(PrivilegedAccessGroupAssignmentSchedul $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilderGetQueryParameters.php index 40e873e2b94..e9e406e4927 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read the properties and relationships of a privilegedAccessGroupAssignmentScheduleRequest object. + * Read the properties and relationships of a privilegedAccessGroupAssignmentScheduleRequest object. This API is available in the following national cloud deployments. */ class PrivilegedAccessGroupAssignmentScheduleRequestItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php index 5bd1d961960..60883fd3656 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrivilegedAccessGroupEligibilitySchedule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Schedule created by this request. Supports $expand. * @param TargetScheduleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TargetScheduleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TargetScheduleRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TargetScheduleRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/AssignmentSchedulesRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/AssignmentSchedulesRequestBuilder.php index 3574daf7be5..4a312bf534c 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/AssignmentSchedulesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/AssignmentSchedulesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentSchedules\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentSchedules\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentSchedules\Item\PrivilegedAccessGroupAssignmentScheduleItemRequestBuilder; @@ -63,45 +62,39 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn } /** - * Get a list of the privilegedAccessGroupAssignmentSchedule objects and their properties. + * Get a list of the privilegedAccessGroupAssignmentSchedule objects and their properties. This API is available in the following national cloud deployments. * @param AssignmentSchedulesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroup-list-assignmentschedules?view=graph-rest-1.0 Find more info here */ public function get(?AssignmentSchedulesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentScheduleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to assignmentSchedules for identityGovernance * @param PrivilegedAccessGroupAssignmentSchedule $body The request body * @param AssignmentSchedulesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrivilegedAccessGroupAssignmentSchedule $body, ?AssignmentSchedulesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get a list of the privilegedAccessGroupAssignmentSchedule objects and their properties. + * Get a list of the privilegedAccessGroupAssignmentSchedule objects and their properties. This API is available in the following national cloud deployments. * @param AssignmentSchedulesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -110,7 +103,6 @@ public function toGetRequestInformation(?AssignmentSchedulesRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?AssignmentSchedulesRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(PrivilegedAccessGroupAssignmentSchedule $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/AssignmentSchedulesRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/AssignmentSchedulesRequestBuilderGetQueryParameters.php index acb2ab64676..5467f7af90f 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/AssignmentSchedulesRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/AssignmentSchedulesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get a list of the privilegedAccessGroupAssignmentSchedule objects and their properties. + * Get a list of the privilegedAccessGroupAssignmentSchedule objects and their properties. This API is available in the following national cloud deployments. */ class AssignmentSchedulesRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Count/CountRequestBuilder.php index 5ad172ad372..c9bf9729eaf 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 6702d9b28b4..b0baa6b8481 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php index b84219f2de7..4f2f7cbba62 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrivilegedAccessGroupEligibilitySchedule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * When the request activates an ownership or membership assignment in PIM for groups, this object represents the eligibility relationship. Otherwise, it is null. Supports $expand. * @param ActivatedUsingRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivatedUsingRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Group/GroupRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Group/GroupRequestBuilder.php index 135db12d619..173e34de7fc 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Group/GroupRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Group/GroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentSchedules\Item\Group\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * References the group that is the scope of the membership or ownership assignment through PIM for groups. Supports $expand. * @param GroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 56f3139a611..51dbe899221 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index cd5adf55ad1..1c8474dd391 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentSchedules\Item\Group\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Principal/PrincipalRequestBuilder.php index 571aec004ce..68988750c79 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * References the principal that's in the scope of this membership or ownership assignment request to the group that's governed by PIM. Supports $expand. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/PrivilegedAccessGroupAssignmentScheduleItemRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/PrivilegedAccessGroupAssignmentScheduleItemRequestBuilder.php index b2503714815..8677d55c091 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/PrivilegedAccessGroupAssignmentScheduleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/PrivilegedAccessGroupAssignmentScheduleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentSchedules\Item\ActivatedUsing\ActivatedUsingRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentSchedules\Item\Group\GroupRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentSchedules\Item\Principal\PrincipalRequestBuilder; @@ -58,57 +57,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignmentSchedules for identityGovernance * @param PrivilegedAccessGroupAssignmentScheduleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrivilegedAccessGroupAssignmentScheduleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read the properties and relationships of a privilegedAccessGroupAssignmentSchedule object. + * Read the properties and relationships of a privilegedAccessGroupAssignmentSchedule object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupAssignmentScheduleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroupassignmentschedule-get?view=graph-rest-1.0 Find more info here */ public function get(?PrivilegedAccessGroupAssignmentScheduleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignmentSchedules in identityGovernance * @param PrivilegedAccessGroupAssignmentSchedule $body The request body * @param PrivilegedAccessGroupAssignmentScheduleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrivilegedAccessGroupAssignmentSchedule $body, ?PrivilegedAccessGroupAssignmentScheduleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -125,11 +115,12 @@ public function toDeleteRequestInformation(?PrivilegedAccessGroupAssignmentSched $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read the properties and relationships of a privilegedAccessGroupAssignmentSchedule object. + * Read the properties and relationships of a privilegedAccessGroupAssignmentSchedule object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupAssignmentScheduleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -138,7 +129,6 @@ public function toGetRequestInformation(?PrivilegedAccessGroupAssignmentSchedule $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -146,6 +136,7 @@ public function toGetRequestInformation(?PrivilegedAccessGroupAssignmentSchedule } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -160,11 +151,11 @@ public function toPatchRequestInformation(PrivilegedAccessGroupAssignmentSchedul $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/PrivilegedAccessGroupAssignmentScheduleItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/PrivilegedAccessGroupAssignmentScheduleItemRequestBuilderGetQueryParameters.php index 464286126c5..8cac0509635 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/PrivilegedAccessGroupAssignmentScheduleItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/AssignmentSchedules/Item/PrivilegedAccessGroupAssignmentScheduleItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read the properties and relationships of a privilegedAccessGroupAssignmentSchedule object. + * Read the properties and relationships of a privilegedAccessGroupAssignmentSchedule object. This API is available in the following national cloud deployments. */ class PrivilegedAccessGroupAssignmentScheduleItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Count/CountRequestBuilder.php index aabed7c7e51..a5069d3f367 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/EligibilityScheduleInstancesRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/EligibilityScheduleInstancesRequestBuilder.php index 80302aff8c8..952f042b615 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/EligibilityScheduleInstancesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/EligibilityScheduleInstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleInstances\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleInstances\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleInstances\Item\PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilder; @@ -63,45 +62,39 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn } /** - * Get a list of the privilegedAccessGroupEligibilityScheduleInstance objects and their properties. + * Get a list of the privilegedAccessGroupEligibilityScheduleInstance objects and their properties. This API is available in the following national cloud deployments. * @param EligibilityScheduleInstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroup-list-eligibilityscheduleinstances?view=graph-rest-1.0 Find more info here */ public function get(?EligibilityScheduleInstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to eligibilityScheduleInstances for identityGovernance * @param PrivilegedAccessGroupEligibilityScheduleInstance $body The request body * @param EligibilityScheduleInstancesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrivilegedAccessGroupEligibilityScheduleInstance $body, ?EligibilityScheduleInstancesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get a list of the privilegedAccessGroupEligibilityScheduleInstance objects and their properties. + * Get a list of the privilegedAccessGroupEligibilityScheduleInstance objects and their properties. This API is available in the following national cloud deployments. * @param EligibilityScheduleInstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -110,7 +103,6 @@ public function toGetRequestInformation(?EligibilityScheduleInstancesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?EligibilityScheduleInstancesRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(PrivilegedAccessGroupEligibilitySchedul $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/EligibilityScheduleInstancesRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/EligibilityScheduleInstancesRequestBuilderGetQueryParameters.php index f7a3ca37691..7750dcb0a16 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/EligibilityScheduleInstancesRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/EligibilityScheduleInstancesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get a list of the privilegedAccessGroupEligibilityScheduleInstance objects and their properties. + * Get a list of the privilegedAccessGroupEligibilityScheduleInstance objects and their properties. This API is available in the following national cloud deployments. */ class EligibilityScheduleInstancesRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 7eeef48d8bb..66b69d9ccf0 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Group/GroupRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Group/GroupRequestBuilder.php index 016635b031e..94b94e6f0f1 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Group/GroupRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Group/GroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleInstances\Item\Group\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * References the group that is the scope of the membership or ownership eligibility through PIM for groups. Supports $expand. * @param GroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 7933b7f7140..6bc40688d70 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 5aba0a77a41..0c4b914342c 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleInstances\Item\Group\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Principal/PrincipalRequestBuilder.php index 98f0290eff1..e7802521ed4 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * References the principal that's in the scope of the membership or ownership eligibility request through the group that's governed by PIM. Supports $expand. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilder.php index 7eb6904b99f..2c4b2dea8d5 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleInstances\Item\Group\GroupRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleInstances\Item\Principal\PrincipalRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property eligibilityScheduleInstances for identityGovernance * @param PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read the properties and relationships of a privilegedAccessGroupEligibilityScheduleInstance object. + * Read the properties and relationships of a privilegedAccessGroupEligibilityScheduleInstance object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroupeligibilityscheduleinstance-get?view=graph-rest-1.0 Find more info here */ public function get(?PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property eligibilityScheduleInstances in identityGovernance * @param PrivilegedAccessGroupEligibilityScheduleInstance $body The request body * @param PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrivilegedAccessGroupEligibilityScheduleInstance $body, ?PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,11 +107,12 @@ public function toDeleteRequestInformation(?PrivilegedAccessGroupEligibilitySche $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read the properties and relationships of a privilegedAccessGroupEligibilityScheduleInstance object. + * Read the properties and relationships of a privilegedAccessGroupEligibilityScheduleInstance object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -130,7 +121,6 @@ public function toGetRequestInformation(?PrivilegedAccessGroupEligibilitySchedul $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?PrivilegedAccessGroupEligibilitySchedul } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(PrivilegedAccessGroupEligibilitySchedu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilderGetQueryParameters.php index d1452ee0e40..5226da1bd98 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleInstances/Item/PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read the properties and relationships of a privilegedAccessGroupEligibilityScheduleInstance object. + * Read the properties and relationships of a privilegedAccessGroupEligibilityScheduleInstance object. This API is available in the following national cloud deployments. */ class PrivilegedAccessGroupEligibilityScheduleInstanceItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Count/CountRequestBuilder.php index 19c043e454f..1820fe638b6 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/EligibilityScheduleRequestsRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/EligibilityScheduleRequestsRequestBuilder.php index 6ce87f799b1..bf3edb9da1a 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/EligibilityScheduleRequestsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/EligibilityScheduleRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleRequests\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleRequests\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleRequests\Item\PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilder; @@ -63,46 +62,40 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn } /** - * Get a list of the privilegedAccessGroupEligibilityScheduleRequest objects and their properties. + * Get a list of the privilegedAccessGroupEligibilityScheduleRequest objects and their properties. This API is available in the following national cloud deployments. * @param EligibilityScheduleRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroup-list-eligibilityschedulerequests?view=graph-rest-1.0 Find more info here */ public function get(?EligibilityScheduleRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create a new privilegedAccessGroupEligibilityScheduleRequest object. + * Create a new privilegedAccessGroupEligibilityScheduleRequest object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupEligibilityScheduleRequest $body The request body * @param EligibilityScheduleRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroup-post-eligibilityschedulerequests?view=graph-rest-1.0 Find more info here */ public function post(PrivilegedAccessGroupEligibilityScheduleRequest $body, ?EligibilityScheduleRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get a list of the privilegedAccessGroupEligibilityScheduleRequest objects and their properties. + * Get a list of the privilegedAccessGroupEligibilityScheduleRequest objects and their properties. This API is available in the following national cloud deployments. * @param EligibilityScheduleRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -111,7 +104,6 @@ public function toGetRequestInformation(?EligibilityScheduleRequestsRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -119,11 +111,12 @@ public function toGetRequestInformation(?EligibilityScheduleRequestsRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create a new privilegedAccessGroupEligibilityScheduleRequest object. + * Create a new privilegedAccessGroupEligibilityScheduleRequest object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupEligibilityScheduleRequest $body The request body * @param EligibilityScheduleRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -133,11 +126,11 @@ public function toPostRequestInformation(PrivilegedAccessGroupEligibilitySchedul $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/EligibilityScheduleRequestsRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/EligibilityScheduleRequestsRequestBuilderGetQueryParameters.php index 132e9b7eb1a..f2a05ed9262 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/EligibilityScheduleRequestsRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/EligibilityScheduleRequestsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get a list of the privilegedAccessGroupEligibilityScheduleRequest objects and their properties. + * Get a list of the privilegedAccessGroupEligibilityScheduleRequest objects and their properties. This API is available in the following national cloud deployments. */ class EligibilityScheduleRequestsRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 7f277b5a012..98e70460636 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Cancel/CancelRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Cancel/CancelRequestBuilder.php index fc43567b3e0..1edaddc3b0a 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,26 +30,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Cancel an eligibility assignment request to a group whose membership and ownership are governed by PIM. + * Cancel an eligibility assignment request to a group whose membership and ownership are governed by PIM. This API is available in the following national cloud deployments. * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroupeligibilityschedulerequest-cancel?view=graph-rest-1.0 Find more info here */ public function post(?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Cancel an eligibility assignment request to a group whose membership and ownership are governed by PIM. + * Cancel an eligibility assignment request to a group whose membership and ownership are governed by PIM. This API is available in the following national cloud deployments. * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CancelRequestBuilderPostRequestConfigu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Group/GroupRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Group/GroupRequestBuilder.php index 372ae743de6..15345f32384 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Group/GroupRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Group/GroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleRequests\Item\Group\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * References the group that is the scope of the membership or ownership eligibility request through PIM for groups. Supports $expand. * @param GroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 189327d2426..44c52431e40 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 6197ff034ce..d34a2d54b35 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleRequests\Item\Group\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Principal/PrincipalRequestBuilder.php index f2775605059..cc5c1f55796 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * References the principal that's in the scope of the membership or ownership eligibility request through the group that's governed by PIM. Supports $expand. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilder.php index 9690d8c1836..6f1333b663e 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleRequests\Item\Cancel\CancelRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleRequests\Item\Group\GroupRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilityScheduleRequests\Item\Principal\PrincipalRequestBuilder; @@ -66,57 +65,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property eligibilityScheduleRequests for identityGovernance * @param PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read the properties and relationships of a privilegedAccessGroupEligibilityScheduleRequest object. + * Read the properties and relationships of a privilegedAccessGroupEligibilityScheduleRequest object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroupeligibilityschedulerequest-get?view=graph-rest-1.0 Find more info here */ public function get(?PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property eligibilityScheduleRequests in identityGovernance * @param PrivilegedAccessGroupEligibilityScheduleRequest $body The request body * @param PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrivilegedAccessGroupEligibilityScheduleRequest $body, ?PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,11 +123,12 @@ public function toDeleteRequestInformation(?PrivilegedAccessGroupEligibilitySche $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read the properties and relationships of a privilegedAccessGroupEligibilityScheduleRequest object. + * Read the properties and relationships of a privilegedAccessGroupEligibilityScheduleRequest object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -146,7 +137,6 @@ public function toGetRequestInformation(?PrivilegedAccessGroupEligibilitySchedul $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -154,6 +144,7 @@ public function toGetRequestInformation(?PrivilegedAccessGroupEligibilitySchedul } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -168,11 +159,11 @@ public function toPatchRequestInformation(PrivilegedAccessGroupEligibilitySchedu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilderGetQueryParameters.php index 34d44ed13c3..579b9dd07d3 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read the properties and relationships of a privilegedAccessGroupEligibilityScheduleRequest object. + * Read the properties and relationships of a privilegedAccessGroupEligibilityScheduleRequest object. This API is available in the following national cloud deployments. */ class PrivilegedAccessGroupEligibilityScheduleRequestItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php index 76b331507a3..d9b4f255a06 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilityScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrivilegedAccessGroupEligibilitySchedule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Schedule created by this request. * @param TargetScheduleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TargetScheduleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TargetScheduleRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TargetScheduleRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Count/CountRequestBuilder.php index 47a0a863042..e3a6e789b6f 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/EligibilitySchedulesRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/EligibilitySchedulesRequestBuilder.php index ea0b06d9ab5..f875b07857c 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/EligibilitySchedulesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/EligibilitySchedulesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilitySchedules\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilitySchedules\FilterByCurrentUserWithOn\FilterByCurrentUserWithOnRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilitySchedules\Item\PrivilegedAccessGroupEligibilityScheduleItemRequestBuilder; @@ -63,45 +62,39 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn } /** - * Get a list of the privilegedAccessGroupEligibilitySchedule objects and their properties. + * Get a list of the privilegedAccessGroupEligibilitySchedule objects and their properties. This API is available in the following national cloud deployments. * @param EligibilitySchedulesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroup-list-eligibilityschedules?view=graph-rest-1.0 Find more info here */ public function get(?EligibilitySchedulesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilityScheduleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to eligibilitySchedules for identityGovernance * @param PrivilegedAccessGroupEligibilitySchedule $body The request body * @param EligibilitySchedulesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrivilegedAccessGroupEligibilitySchedule $body, ?EligibilitySchedulesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get a list of the privilegedAccessGroupEligibilitySchedule objects and their properties. + * Get a list of the privilegedAccessGroupEligibilitySchedule objects and their properties. This API is available in the following national cloud deployments. * @param EligibilitySchedulesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -110,7 +103,6 @@ public function toGetRequestInformation(?EligibilitySchedulesRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?EligibilitySchedulesRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(PrivilegedAccessGroupEligibilitySchedul $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/EligibilitySchedulesRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/EligibilitySchedulesRequestBuilderGetQueryParameters.php index dcd2a907260..0fb93d59f5c 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/EligibilitySchedulesRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/EligibilitySchedulesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get a list of the privilegedAccessGroupEligibilitySchedule objects and their properties. + * Get a list of the privilegedAccessGroupEligibilitySchedule objects and their properties. This API is available in the following national cloud deployments. */ class EligibilitySchedulesRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 614ec1c41c0..84b0a6a5897 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Group/GroupRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Group/GroupRequestBuilder.php index 32179e354e5..95d5d5dcbc1 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Group/GroupRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Group/GroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilitySchedules\Item\Group\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * References the group that is the scope of the membership or ownership eligibility through PIM for groups. Supports $expand. * @param GroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php index dc6c3a362f0..3f833d74091 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index c5aa1cb73e0..01c5aa1eb4f 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilitySchedules\Item\Group\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Principal/PrincipalRequestBuilder.php index d94cdf72111..00257a42adf 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * References the principal that's in the scope of this membership or ownership eligibility request to the group that's governed by PIM. Supports $expand. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/PrivilegedAccessGroupEligibilityScheduleItemRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/PrivilegedAccessGroupEligibilityScheduleItemRequestBuilder.php index 13fa52e1b1a..7fb3890512c 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/PrivilegedAccessGroupEligibilityScheduleItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/PrivilegedAccessGroupEligibilityScheduleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilitySchedules\Item\Group\GroupRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\EligibilitySchedules\Item\Principal\PrincipalRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property eligibilitySchedules for identityGovernance * @param PrivilegedAccessGroupEligibilityScheduleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrivilegedAccessGroupEligibilityScheduleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read the properties and relationships of a privilegedAccessGroupEligibilitySchedule object. + * Read the properties and relationships of a privilegedAccessGroupEligibilitySchedule object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupEligibilityScheduleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/privilegedaccessgroupeligibilityschedule-get?view=graph-rest-1.0 Find more info here */ public function get(?PrivilegedAccessGroupEligibilityScheduleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property eligibilitySchedules in identityGovernance * @param PrivilegedAccessGroupEligibilitySchedule $body The request body * @param PrivilegedAccessGroupEligibilityScheduleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrivilegedAccessGroupEligibilitySchedule $body, ?PrivilegedAccessGroupEligibilityScheduleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroupEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,11 +107,12 @@ public function toDeleteRequestInformation(?PrivilegedAccessGroupEligibilitySche $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read the properties and relationships of a privilegedAccessGroupEligibilitySchedule object. + * Read the properties and relationships of a privilegedAccessGroupEligibilitySchedule object. This API is available in the following national cloud deployments. * @param PrivilegedAccessGroupEligibilityScheduleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -130,7 +121,6 @@ public function toGetRequestInformation(?PrivilegedAccessGroupEligibilitySchedul $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?PrivilegedAccessGroupEligibilitySchedul } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(PrivilegedAccessGroupEligibilitySchedu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/PrivilegedAccessGroupEligibilityScheduleItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/PrivilegedAccessGroupEligibilityScheduleItemRequestBuilderGetQueryParameters.php index 3f0b6d6f2cc..b4e7249afac 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/PrivilegedAccessGroupEligibilityScheduleItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/EligibilitySchedules/Item/PrivilegedAccessGroupEligibilityScheduleItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read the properties and relationships of a privilegedAccessGroupEligibilitySchedule object. + * Read the properties and relationships of a privilegedAccessGroupEligibilitySchedule object. This API is available in the following national cloud deployments. */ class PrivilegedAccessGroupEligibilityScheduleItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/GroupRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/GroupRequestBuilder.php index 8216d0dff3c..adb818fb909 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/Group/GroupRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/Group/GroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentApprovals\AssignmentApprovalsRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleInstances\AssignmentScheduleInstancesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\AssignmentScheduleRequests\AssignmentScheduleRequestsRequestBuilder; @@ -90,56 +89,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property group for identityGovernance * @param GroupRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?GroupRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A group that's governed through Privileged Identity Management (PIM). * @param GroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property group in identityGovernance * @param PrivilegedAccessGroup $body The request body * @param GroupRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrivilegedAccessGroup $body, ?GroupRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -156,6 +146,7 @@ public function toDeleteRequestInformation(?GroupRequestBuilderDeleteRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -169,7 +160,6 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -177,6 +167,7 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -191,11 +182,11 @@ public function toPatchRequestInformation(PrivilegedAccessGroup $body, ?GroupReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/PrivilegedAccess/PrivilegedAccessRequestBuilder.php b/src/Generated/IdentityGovernance/PrivilegedAccess/PrivilegedAccessRequestBuilder.php index 5f7f7e535b7..96f525af03d 100644 --- a/src/Generated/IdentityGovernance/PrivilegedAccess/PrivilegedAccessRequestBuilder.php +++ b/src/Generated/IdentityGovernance/PrivilegedAccess/PrivilegedAccessRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\PrivilegedAccess\Group\GroupRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrivilegedAccessRoot; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property privilegedAccess for identityGovernance * @param PrivilegedAccessRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrivilegedAccessRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get privilegedAccess from identityGovernance * @param PrivilegedAccessRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrivilegedAccessRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property privilegedAccess in identityGovernance * @param PrivilegedAccessRoot $body The request body * @param PrivilegedAccessRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrivilegedAccessRoot $body, ?PrivilegedAccessRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrivilegedAccessRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?PrivilegedAccessRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?PrivilegedAccessRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?PrivilegedAccessRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(PrivilegedAccessRoot $body, ?Privilege $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/AgreementAcceptances/AgreementAcceptancesRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/AgreementAcceptances/AgreementAcceptancesRequestBuilder.php index 7d3abd7af29..78a4c73997b 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/AgreementAcceptances/AgreementAcceptancesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/AgreementAcceptances/AgreementAcceptancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\AgreementAcceptances\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\AgreementAcceptances\Item\AgreementAcceptanceItemRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementAcceptance; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents the current status of a user's response to a company's customizable terms of use agreement. * @param AgreementAcceptancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementAcceptancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to agreementAcceptances for identityGovernance * @param AgreementAcceptance $body The request body * @param AgreementAcceptancesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AgreementAcceptance $body, ?AgreementAcceptancesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AgreementAcceptancesRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AgreementAcceptancesRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AgreementAcceptance $body, ?AgreementAc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/AgreementAcceptances/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/AgreementAcceptances/Count/CountRequestBuilder.php index dcfc6897e1b..5ecdf989d40 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/AgreementAcceptances/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/AgreementAcceptances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/AgreementAcceptances/Item/AgreementAcceptanceItemRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/AgreementAcceptances/Item/AgreementAcceptanceItemRequestBuilder.php index f745d13bed1..217616750f4 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/AgreementAcceptances/Item/AgreementAcceptanceItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/AgreementAcceptances/Item/AgreementAcceptanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AgreementAcceptance; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property agreementAcceptances for identityGovernance * @param AgreementAcceptanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AgreementAcceptanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the current status of a user's response to a company's customizable terms of use agreement. * @param AgreementAcceptanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementAcceptanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property agreementAcceptances in identityGovernance * @param AgreementAcceptance $body The request body * @param AgreementAcceptanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementAcceptance $body, ?AgreementAcceptanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AgreementAcceptanceItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AgreementAcceptanceItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AgreementAcceptanceItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AgreementAcceptance $body, ?AgreementA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/AgreementsRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/AgreementsRequestBuilder.php index cf9a245345b..f9f387b7798 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/AgreementsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/AgreementsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\AgreementItemRequestBuilder; use Microsoft\Graph\Generated\Models\Agreement; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of agreement objects. This API is available in the following national cloud deployments. * @param AgreementsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termsofusecontainer-list-agreements?view=graph-rest-1.0 Find more info here */ public function get(?AgreementsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new agreement object. This API is available in the following national cloud deployments. * @param Agreement $body The request body * @param AgreementsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termsofusecontainer-post-agreements?view=graph-rest-1.0 Find more info here */ public function post(Agreement $body, ?AgreementsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Agreement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Agreement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AgreementsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AgreementsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Agreement $body, ?AgreementsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Count/CountRequestBuilder.php index e44df2a8135..eb544e3ceed 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Acceptances/AcceptancesRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Acceptances/AcceptancesRequestBuilder.php index 3496a2f9f23..1a85e6c1e29 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Acceptances/AcceptancesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Acceptances/AcceptancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\Acceptances\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\Acceptances\Item\AgreementAcceptanceItemRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementAcceptance; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the details about the acceptance records for a specific agreement. This API is available in the following national cloud deployments. * @param AcceptancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/agreement-list-acceptances?view=graph-rest-1.0 Find more info here */ public function get(?AcceptancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to acceptances for identityGovernance * @param AgreementAcceptance $body The request body * @param AcceptancesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AgreementAcceptance $body, ?AcceptancesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?AcceptancesRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?AcceptancesRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AgreementAcceptance $body, ?Acceptances $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Acceptances/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Acceptances/Count/CountRequestBuilder.php index dd342539d95..60d4490ed84 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Acceptances/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Acceptances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Acceptances/Item/AgreementAcceptanceItemRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Acceptances/Item/AgreementAcceptanceItemRequestBuilder.php index c15ec78875e..3d00059497d 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Acceptances/Item/AgreementAcceptanceItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Acceptances/Item/AgreementAcceptanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AgreementAcceptance; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property acceptances for identityGovernance * @param AgreementAcceptanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AgreementAcceptanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Information about acceptances of this agreement. * @param AgreementAcceptanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementAcceptanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property acceptances in identityGovernance * @param AgreementAcceptance $body The request body * @param AgreementAcceptanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementAcceptance $body, ?AgreementAcceptanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AgreementAcceptanceItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AgreementAcceptanceItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AgreementAcceptanceItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AgreementAcceptance $body, ?AgreementA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/AgreementItemRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/AgreementItemRequestBuilder.php index fb50e18ab2c..90746d0770d 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/AgreementItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/AgreementItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\Acceptances\AcceptancesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\File\FileRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\Files\FilesRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an agreement object. This API is available in the following national cloud deployments. * @param AgreementItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/agreement-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AgreementItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Retrieve all files related to an agreement. This includes the default file and all localized files. This API is available in the following national cloud deployments. + * Retrieve the properties and relationships of an agreement object. This API is available in the following national cloud deployments. * @param AgreementItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/agreement-list-files?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/agreement-get?view=graph-rest-1.0 Find more info here */ public function get(?AgreementItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Agreement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Agreement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an agreement object. This API is available in the following national cloud deployments. * @param Agreement $body The request body * @param AgreementItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/agreement-update?view=graph-rest-1.0 Find more info here */ public function patch(Agreement $body, ?AgreementItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Agreement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Agreement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,11 +117,12 @@ public function toDeleteRequestInformation(?AgreementItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Retrieve all files related to an agreement. This includes the default file and all localized files. This API is available in the following national cloud deployments. + * Retrieve the properties and relationships of an agreement object. This API is available in the following national cloud deployments. * @param AgreementItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -140,7 +131,6 @@ public function toGetRequestInformation(?AgreementItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?AgreementItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(Agreement $body, ?AgreementItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/AgreementItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/AgreementItemRequestBuilderGetQueryParameters.php index edc5a48c2ae..e8a00d52a36 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/AgreementItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/AgreementItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve all files related to an agreement. This includes the default file and all localized files. This API is available in the following national cloud deployments. + * Retrieve the properties and relationships of an agreement object. This API is available in the following national cloud deployments. */ class AgreementItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/FileRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/FileRequestBuilder.php index 3083476cc59..2215dea8de0 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/FileRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/FileRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\File\Localizations\LocalizationsRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFile; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property file for identityGovernance * @param FileRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FileRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the details of an agreement file, including the language and version information. The default file can have multiple versions, each with its own language, that can be retrieved by specifying the Accept-Language header. This API is available in the following national cloud deployments. * @param FileRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/agreementfile-get?view=graph-rest-1.0 Find more info here */ public function get(?FileRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property file in identityGovernance * @param AgreementFile $body The request body * @param FileRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementFile $body, ?FileRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?FileRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?FileRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?FileRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(AgreementFile $body, ?FileRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Count/CountRequestBuilder.php index 34bb24267b0..8aec6c142ba 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/AgreementFileLocalizationItemRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/AgreementFileLocalizationItemRequestBuilder.php index e5a4d55b880..3f75e19a75b 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/AgreementFileLocalizationItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/AgreementFileLocalizationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\File\Localizations\Item\Versions\VersionsRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFileLocalization; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property localizations for identityGovernance * @param AgreementFileLocalizationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AgreementFileLocalizationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The localized version of the terms of use agreement files attached to the agreement. * @param AgreementFileLocalizationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementFileLocalizationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property localizations in identityGovernance * @param AgreementFileLocalization $body The request body * @param AgreementFileLocalizationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementFileLocalization $body, ?AgreementFileLocalizationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AgreementFileLocalizationItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AgreementFileLocalizationItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AgreementFileLocalizationItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AgreementFileLocalization $body, ?Agre $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/Count/CountRequestBuilder.php index 8acf0210714..d0778bd6043 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php index 006ae79c177..07e8de74197 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AgreementFileVersion; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property versions for identityGovernance * @param AgreementFileVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AgreementFileVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param AgreementFileVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementFileVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property versions in identityGovernance * @param AgreementFileVersion $body The request body * @param AgreementFileVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementFileVersion $body, ?AgreementFileVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,11 +90,12 @@ public function toDeleteRequestInformation(?AgreementFileVersionItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param AgreementFileVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AgreementFileVersionItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AgreementFileVersionItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AgreementFileVersion $body, ?Agreement $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php index e226d0a7c0b..e2d84631a00 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. */ class AgreementFileVersionItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilder.php index 3007eb11a80..a0f465181e4 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\File\Localizations\Item\Versions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\File\Localizations\Item\Versions\Item\AgreementFileVersionItemRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFileVersion; @@ -53,44 +52,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?VersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to versions for identityGovernance * @param AgreementFileVersion $body The request body * @param VersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AgreementFileVersion $body, ?VersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +92,6 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AgreementFileVersion $body, ?VersionsRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilderGetQueryParameters.php index 2a2870a0f71..3ef202eeb6d 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/Item/Versions/VersionsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. */ class VersionsRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/LocalizationsRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/LocalizationsRequestBuilder.php index c48b731dfc4..4a84395c41f 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/LocalizationsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/File/Localizations/LocalizationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\File\Localizations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\File\Localizations\Item\AgreementFileLocalizationItemRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFileLocalization; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the default and localized agreement files. This API is available in the following national cloud deployments. * @param LocalizationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/agreementfile-list-localizations?view=graph-rest-1.0 Find more info here */ public function get(?LocalizationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to localizations for identityGovernance * @param AgreementFileLocalization $body The request body * @param LocalizationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AgreementFileLocalization $body, ?LocalizationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?LocalizationsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?LocalizationsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AgreementFileLocalization $body, ?Local $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Count/CountRequestBuilder.php index ac610ca6fc6..5c0f4b12795 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/FilesRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/FilesRequestBuilder.php index f1dfa8f32e0..870408d2a92 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/FilesRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/FilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\Files\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\Files\Item\AgreementFileLocalizationItemRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFileLocalization; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * PDFs linked to this agreement. This property is in the process of being deprecated. Use the file property instead. Supports $expand. * @param FilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new localized agreement file. This API is available in the following national cloud deployments. * @param AgreementFileLocalization $body The request body * @param FilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/agreement-post-files?view=graph-rest-1.0 Find more info here */ public function post(AgreementFileLocalization $body, ?FilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?FilesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AgreementFileLocalization $body, ?Files $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/AgreementFileLocalizationItemRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/AgreementFileLocalizationItemRequestBuilder.php index 34ce4b6f42f..9841ea688a8 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/AgreementFileLocalizationItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/AgreementFileLocalizationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\Files\Item\Versions\VersionsRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFileLocalization; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property files for identityGovernance * @param AgreementFileLocalizationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AgreementFileLocalizationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * PDFs linked to this agreement. This property is in the process of being deprecated. Use the file property instead. Supports $expand. * @param AgreementFileLocalizationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementFileLocalizationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property files in identityGovernance * @param AgreementFileLocalization $body The request body * @param AgreementFileLocalizationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementFileLocalization $body, ?AgreementFileLocalizationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AgreementFileLocalizationItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AgreementFileLocalizationItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AgreementFileLocalizationItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AgreementFileLocalization $body, ?Agre $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/Count/CountRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/Count/CountRequestBuilder.php index 995563fe6da..e11c7b2255b 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php index 1ac1df7ebb7..433a8732a4d 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AgreementFileVersion; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property versions for identityGovernance * @param AgreementFileVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AgreementFileVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param AgreementFileVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementFileVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property versions in identityGovernance * @param AgreementFileVersion $body The request body * @param AgreementFileVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AgreementFileVersion $body, ?AgreementFileVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,11 +90,12 @@ public function toDeleteRequestInformation(?AgreementFileVersionItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param AgreementFileVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AgreementFileVersionItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AgreementFileVersionItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AgreementFileVersion $body, ?Agreement $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php index 25f085b6d8e..34cabad29d7 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/Item/AgreementFileVersionItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. */ class AgreementFileVersionItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/VersionsRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/VersionsRequestBuilder.php index 498f4b1276c..a4261ca2e14 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/VersionsRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/VersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\Files\Item\Versions\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\Item\Files\Item\Versions\Item\AgreementFileVersionItemRequestBuilder; use Microsoft\Graph\Generated\Models\AgreementFileVersion; @@ -53,44 +52,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?VersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to versions for identityGovernance * @param AgreementFileVersion $body The request body * @param VersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AgreementFileVersion $body, ?VersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementFileVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +92,6 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AgreementFileVersion $body, ?VersionsRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/VersionsRequestBuilderGetQueryParameters.php b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/VersionsRequestBuilderGetQueryParameters.php index 462587a84c8..1084e9dd293 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/VersionsRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/Agreements/Item/Files/Item/Versions/VersionsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. */ class VersionsRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityGovernance/TermsOfUse/TermsOfUseRequestBuilder.php b/src/Generated/IdentityGovernance/TermsOfUse/TermsOfUseRequestBuilder.php index b6b902337c2..59d9e9a119c 100644 --- a/src/Generated/IdentityGovernance/TermsOfUse/TermsOfUseRequestBuilder.php +++ b/src/Generated/IdentityGovernance/TermsOfUse/TermsOfUseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\AgreementAcceptances\AgreementAcceptancesRequestBuilder; use Microsoft\Graph\Generated\IdentityGovernance\TermsOfUse\Agreements\AgreementsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property termsOfUse for identityGovernance * @param TermsOfUseRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermsOfUseRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get termsOfUse from identityGovernance * @param TermsOfUseRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsOfUseRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsOfUseContainer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsOfUseContainer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property termsOfUse in identityGovernance * @param TermsOfUseContainer $body The request body * @param TermsOfUseRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TermsOfUseContainer $body, ?TermsOfUseRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermsOfUseContainer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermsOfUseContainer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermsOfUseRequestBuilderDeleteReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermsOfUseRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermsOfUseRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(TermsOfUseContainer $body, ?TermsOfUse $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/IdentityProtectionRequestBuilder.php b/src/Generated/IdentityProtection/IdentityProtectionRequestBuilder.php index e6357feb214..534b11cb9fe 100644 --- a/src/Generated/IdentityProtection/IdentityProtectionRequestBuilder.php +++ b/src/Generated/IdentityProtection/IdentityProtectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityProtection\RiskDetections\RiskDetectionsRequestBuilder; use Microsoft\Graph\Generated\IdentityProtection\RiskyServicePrincipals\RiskyServicePrincipalsRequestBuilder; use Microsoft\Graph\Generated\IdentityProtection\RiskyUsers\RiskyUsersRequestBuilder; @@ -66,38 +65,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get identityProtection * @param IdentityProtectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IdentityProtectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProtectionRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProtectionRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update identityProtection * @param IdentityProtectionRoot $body The request body * @param IdentityProtectionRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(IdentityProtectionRoot $body, ?IdentityProtectionRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProtectionRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProtectionRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?IdentityProtectionRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?IdentityProtectionRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPatchRequestInformation(IdentityProtectionRoot $body, ?Identit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskDetections/Count/CountRequestBuilder.php b/src/Generated/IdentityProtection/RiskDetections/Count/CountRequestBuilder.php index b1b2caba44b..46bf2053879 100644 --- a/src/Generated/IdentityProtection/RiskDetections/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskDetections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskDetections/Item/RiskDetectionItemRequestBuilder.php b/src/Generated/IdentityProtection/RiskDetections/Item/RiskDetectionItemRequestBuilder.php index 3adf6029710..7334381125d 100644 --- a/src/Generated/IdentityProtection/RiskDetections/Item/RiskDetectionItemRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskDetections/Item/RiskDetectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RiskDetection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property riskDetections for identityProtection * @param RiskDetectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RiskDetectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a riskDetection object. This API is available in the following national cloud deployments. * @param RiskDetectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/riskdetection-get?view=graph-rest-1.0 Find more info here */ public function get(?RiskDetectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskDetection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskDetection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property riskDetections in identityProtection * @param RiskDetection $body The request body * @param RiskDetectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RiskDetection $body, ?RiskDetectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskDetection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskDetection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?RiskDetectionItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?RiskDetectionItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?RiskDetectionItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(RiskDetection $body, ?RiskDetectionIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskDetections/RiskDetectionsRequestBuilder.php b/src/Generated/IdentityProtection/RiskDetections/RiskDetectionsRequestBuilder.php index ae8e08eb89a..d9be8575518 100644 --- a/src/Generated/IdentityProtection/RiskDetections/RiskDetectionsRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskDetections/RiskDetectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityProtection\RiskDetections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityProtection\RiskDetections\Item\RiskDetectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the riskDetection objects and their properties. This API is available in the following national cloud deployments. * @param RiskDetectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/riskdetection-list?view=graph-rest-1.0 Find more info here */ public function get(?RiskDetectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskDetectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskDetectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to riskDetections for identityProtection * @param RiskDetection $body The request body * @param RiskDetectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RiskDetection $body, ?RiskDetectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskDetection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskDetection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RiskDetectionsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RiskDetectionsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(RiskDetection $body, ?RiskDetectionsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyServicePrincipals/ConfirmCompromised/ConfirmCompromisedRequestBuilder.php b/src/Generated/IdentityProtection/RiskyServicePrincipals/ConfirmCompromised/ConfirmCompromisedRequestBuilder.php index daf47d2843c..96badb59a1b 100644 --- a/src/Generated/IdentityProtection/RiskyServicePrincipals/ConfirmCompromised/ConfirmCompromisedRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyServicePrincipals/ConfirmCompromised/ConfirmCompromisedRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Confirm one or more riskyServicePrincipal objects as compromised. This action sets the targeted service principal account's risk level to high. This API is available in the following national cloud deployments. * @param ConfirmCompromisedPostRequestBody $body The request body * @param ConfirmCompromisedRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/riskyserviceprincipal-confirmcompromised?view=graph-rest-1.0 Find more info here */ public function post(ConfirmCompromisedPostRequestBody $body, ?ConfirmCompromisedRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ConfirmCompromisedPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyServicePrincipals/Count/CountRequestBuilder.php b/src/Generated/IdentityProtection/RiskyServicePrincipals/Count/CountRequestBuilder.php index 94ecb8a52e1..d2242f1e23a 100644 --- a/src/Generated/IdentityProtection/RiskyServicePrincipals/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyServicePrincipals/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyServicePrincipals/Dismiss/DismissRequestBuilder.php b/src/Generated/IdentityProtection/RiskyServicePrincipals/Dismiss/DismissRequestBuilder.php index 95a82729533..72c44fca5c4 100644 --- a/src/Generated/IdentityProtection/RiskyServicePrincipals/Dismiss/DismissRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyServicePrincipals/Dismiss/DismissRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Dismiss the risk of one or more riskyServicePrincipal objects. This action sets the targeted service principal account's risk level to none. You can dismiss up to 60 service principal accounts in one request. This API is available in the following national cloud deployments. * @param DismissPostRequestBody $body The request body * @param DismissRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/riskyserviceprincipal-dismiss?view=graph-rest-1.0 Find more info here */ public function post(DismissPostRequestBody $body, ?DismissRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DismissPostRequestBody $body, ?DismissR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/Count/CountRequestBuilder.php b/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/Count/CountRequestBuilder.php index 2451a4eae0e..83138e40d92 100644 --- a/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/HistoryRequestBuilder.php b/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/HistoryRequestBuilder.php index 933c202cfe8..66b500e2f24 100644 --- a/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/HistoryRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/HistoryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityProtection\RiskyServicePrincipals\Item\History\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityProtection\RiskyServicePrincipals\Item\History\Item\RiskyServicePrincipalHistoryItemItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the risk history of a riskyServicePrincipal object. This API is available in the following national cloud deployments. * @param HistoryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/riskyserviceprincipal-list-history?view=graph-rest-1.0 Find more info here */ public function get(?HistoryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipalHistoryItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipalHistoryItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to history for identityProtection * @param RiskyServicePrincipalHistoryItem $body The request body * @param HistoryRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RiskyServicePrincipalHistoryItem $body, ?HistoryRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipalHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipalHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HistoryRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HistoryRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(RiskyServicePrincipalHistoryItem $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/Item/RiskyServicePrincipalHistoryItemItemRequestBuilder.php b/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/Item/RiskyServicePrincipalHistoryItemItemRequestBuilder.php index f4136684839..b9ab1a7db8b 100644 --- a/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/Item/RiskyServicePrincipalHistoryItemItemRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/Item/RiskyServicePrincipalHistoryItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RiskyServicePrincipalHistoryItem; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property history for identityProtection * @param RiskyServicePrincipalHistoryItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RiskyServicePrincipalHistoryItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Represents the risk history of Azure AD service principals. + * Represents the risk history of Microsoft Entra service principals. * @param RiskyServicePrincipalHistoryItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RiskyServicePrincipalHistoryItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipalHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipalHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property history in identityProtection * @param RiskyServicePrincipalHistoryItem $body The request body * @param RiskyServicePrincipalHistoryItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RiskyServicePrincipalHistoryItem $body, ?RiskyServicePrincipalHistoryItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipalHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipalHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,11 +90,12 @@ public function toDeleteRequestInformation(?RiskyServicePrincipalHistoryItemItem $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Represents the risk history of Azure AD service principals. + * Represents the risk history of Microsoft Entra service principals. * @param RiskyServicePrincipalHistoryItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -113,7 +104,6 @@ public function toGetRequestInformation(?RiskyServicePrincipalHistoryItemItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?RiskyServicePrincipalHistoryItemItemReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(RiskyServicePrincipalHistoryItem $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/Item/RiskyServicePrincipalHistoryItemItemRequestBuilderGetQueryParameters.php b/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/Item/RiskyServicePrincipalHistoryItemItemRequestBuilderGetQueryParameters.php index 61204cc016b..ae938ae829b 100644 --- a/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/Item/RiskyServicePrincipalHistoryItemItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/History/Item/RiskyServicePrincipalHistoryItemItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Represents the risk history of Azure AD service principals. + * Represents the risk history of Microsoft Entra service principals. */ class RiskyServicePrincipalHistoryItemItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/RiskyServicePrincipalItemRequestBuilder.php b/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/RiskyServicePrincipalItemRequestBuilder.php index f53f156ee74..5416ae459f3 100644 --- a/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/RiskyServicePrincipalItemRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyServicePrincipals/Item/RiskyServicePrincipalItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityProtection\RiskyServicePrincipals\Item\History\HistoryRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RiskyServicePrincipal; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property riskyServicePrincipals for identityProtection * @param RiskyServicePrincipalItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RiskyServicePrincipalItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a riskyServicePrincipal object. This API is available in the following national cloud deployments. * @param RiskyServicePrincipalItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/riskyserviceprincipal-get?view=graph-rest-1.0 Find more info here */ public function get(?RiskyServicePrincipalItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property riskyServicePrincipals in identityProtection * @param RiskyServicePrincipal $body The request body * @param RiskyServicePrincipalItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RiskyServicePrincipal $body, ?RiskyServicePrincipalItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?RiskyServicePrincipalItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?RiskyServicePrincipalItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?RiskyServicePrincipalItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(RiskyServicePrincipal $body, ?RiskySer $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyServicePrincipals/RiskyServicePrincipalsRequestBuilder.php b/src/Generated/IdentityProtection/RiskyServicePrincipals/RiskyServicePrincipalsRequestBuilder.php index 2488bcc08f6..76906a4a5fc 100644 --- a/src/Generated/IdentityProtection/RiskyServicePrincipals/RiskyServicePrincipalsRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyServicePrincipals/RiskyServicePrincipalsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityProtection\RiskyServicePrincipals\ConfirmCompromised\ConfirmCompromisedRequestBuilder; use Microsoft\Graph\Generated\IdentityProtection\RiskyServicePrincipals\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityProtection\RiskyServicePrincipals\Dismiss\DismissRequestBuilder; @@ -71,39 +70,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of riskyServicePrincipal objects. This API is available in the following national cloud deployments. * @param RiskyServicePrincipalsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityprotectionroot-list-riskyserviceprincipals?view=graph-rest-1.0 Find more info here */ public function get(?RiskyServicePrincipalsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to riskyServicePrincipals for identityProtection * @param RiskyServicePrincipal $body The request body * @param RiskyServicePrincipalsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RiskyServicePrincipal $body, ?RiskyServicePrincipalsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,7 +109,6 @@ public function toGetRequestInformation(?RiskyServicePrincipalsRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +116,7 @@ public function toGetRequestInformation(?RiskyServicePrincipalsRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +131,11 @@ public function toPostRequestInformation(RiskyServicePrincipal $body, ?RiskyServ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyUsers/ConfirmCompromised/ConfirmCompromisedRequestBuilder.php b/src/Generated/IdentityProtection/RiskyUsers/ConfirmCompromised/ConfirmCompromisedRequestBuilder.php index 22c717ff299..c5aab5217fb 100644 --- a/src/Generated/IdentityProtection/RiskyUsers/ConfirmCompromised/ConfirmCompromisedRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyUsers/ConfirmCompromised/ConfirmCompromisedRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Confirm one or more riskyUser objects as compromised. This action sets the targeted user's risk level to high. This API is available in the following national cloud deployments. * @param ConfirmCompromisedPostRequestBody $body The request body * @param ConfirmCompromisedRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/riskyuser-confirmcompromised?view=graph-rest-1.0 Find more info here */ public function post(ConfirmCompromisedPostRequestBody $body, ?ConfirmCompromisedRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ConfirmCompromisedPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyUsers/Count/CountRequestBuilder.php b/src/Generated/IdentityProtection/RiskyUsers/Count/CountRequestBuilder.php index 95546b380cc..e0043f2cb3d 100644 --- a/src/Generated/IdentityProtection/RiskyUsers/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyUsers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyUsers/Dismiss/DismissRequestBuilder.php b/src/Generated/IdentityProtection/RiskyUsers/Dismiss/DismissRequestBuilder.php index dfc908a82a2..91d99f4b9b3 100644 --- a/src/Generated/IdentityProtection/RiskyUsers/Dismiss/DismissRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyUsers/Dismiss/DismissRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Dismiss the risk of one or more riskyUser objects. This action sets the targeted user's risk level to none. This API is available in the following national cloud deployments. * @param DismissPostRequestBody $body The request body * @param DismissRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/riskyuser-dismiss?view=graph-rest-1.0 Find more info here */ public function post(DismissPostRequestBody $body, ?DismissRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DismissPostRequestBody $body, ?DismissR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyUsers/Item/History/Count/CountRequestBuilder.php b/src/Generated/IdentityProtection/RiskyUsers/Item/History/Count/CountRequestBuilder.php index 2a8330b7fbe..fc41263726b 100644 --- a/src/Generated/IdentityProtection/RiskyUsers/Item/History/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyUsers/Item/History/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyUsers/Item/History/HistoryRequestBuilder.php b/src/Generated/IdentityProtection/RiskyUsers/Item/History/HistoryRequestBuilder.php index 7d4e4e5d41b..568b81eab5f 100644 --- a/src/Generated/IdentityProtection/RiskyUsers/Item/History/HistoryRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyUsers/Item/History/HistoryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityProtection\RiskyUsers\Item\History\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityProtection\RiskyUsers\Item\History\Item\RiskyUserHistoryItemItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a riskyUserHistoryItem object. This API is available in the following national cloud deployments. * @param HistoryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/riskyuser-get-riskyuserhistoryitem?view=graph-rest-1.0 Find more info here */ public function get(?HistoryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyUserHistoryItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyUserHistoryItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to history for identityProtection * @param RiskyUserHistoryItem $body The request body * @param HistoryRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RiskyUserHistoryItem $body, ?HistoryRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyUserHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyUserHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HistoryRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HistoryRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(RiskyUserHistoryItem $body, ?HistoryReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyUsers/Item/History/Item/RiskyUserHistoryItemItemRequestBuilder.php b/src/Generated/IdentityProtection/RiskyUsers/Item/History/Item/RiskyUserHistoryItemItemRequestBuilder.php index 92dcca9ab08..273f1579c5b 100644 --- a/src/Generated/IdentityProtection/RiskyUsers/Item/History/Item/RiskyUserHistoryItemItemRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyUsers/Item/History/Item/RiskyUserHistoryItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RiskyUserHistoryItem; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property history for identityProtection * @param RiskyUserHistoryItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RiskyUserHistoryItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The activity related to user risk level change * @param RiskyUserHistoryItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RiskyUserHistoryItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyUserHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyUserHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property history in identityProtection * @param RiskyUserHistoryItem $body The request body * @param RiskyUserHistoryItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RiskyUserHistoryItem $body, ?RiskyUserHistoryItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyUserHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyUserHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?RiskyUserHistoryItemItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?RiskyUserHistoryItemItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?RiskyUserHistoryItemItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(RiskyUserHistoryItem $body, ?RiskyUser $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyUsers/Item/RiskyUserItemRequestBuilder.php b/src/Generated/IdentityProtection/RiskyUsers/Item/RiskyUserItemRequestBuilder.php index cf5ddf7e9c1..400ed933d78 100644 --- a/src/Generated/IdentityProtection/RiskyUsers/Item/RiskyUserItemRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyUsers/Item/RiskyUserItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityProtection\RiskyUsers\Item\History\HistoryRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RiskyUser; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property riskyUsers for identityProtection * @param RiskyUserItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RiskyUserItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a riskyUser object. This API is available in the following national cloud deployments. * @param RiskyUserItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/riskyuser-get?view=graph-rest-1.0 Find more info here */ public function get(?RiskyUserItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property riskyUsers in identityProtection * @param RiskyUser $body The request body * @param RiskyUserItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RiskyUser $body, ?RiskyUserItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?RiskyUserItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?RiskyUserItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?RiskyUserItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(RiskyUser $body, ?RiskyUserItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/RiskyUsers/RiskyUsersRequestBuilder.php b/src/Generated/IdentityProtection/RiskyUsers/RiskyUsersRequestBuilder.php index 16b040297d4..bc54bd09776 100644 --- a/src/Generated/IdentityProtection/RiskyUsers/RiskyUsersRequestBuilder.php +++ b/src/Generated/IdentityProtection/RiskyUsers/RiskyUsersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityProtection\RiskyUsers\ConfirmCompromised\ConfirmCompromisedRequestBuilder; use Microsoft\Graph\Generated\IdentityProtection\RiskyUsers\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityProtection\RiskyUsers\Dismiss\DismissRequestBuilder; @@ -71,39 +70,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the riskyUser objects and their properties. This API is available in the following national cloud deployments. * @param RiskyUsersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/riskyuser-list?view=graph-rest-1.0 Find more info here */ public function get(?RiskyUsersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to riskyUsers for identityProtection * @param RiskyUser $body The request body * @param RiskyUsersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RiskyUser $body, ?RiskyUsersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RiskyUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RiskyUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,7 +109,6 @@ public function toGetRequestInformation(?RiskyUsersRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +116,7 @@ public function toGetRequestInformation(?RiskyUsersRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +131,11 @@ public function toPostRequestInformation(RiskyUser $body, ?RiskyUsersRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/ServicePrincipalRiskDetections/Count/CountRequestBuilder.php b/src/Generated/IdentityProtection/ServicePrincipalRiskDetections/Count/CountRequestBuilder.php index 422a6c5eb10..52382217f05 100644 --- a/src/Generated/IdentityProtection/ServicePrincipalRiskDetections/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityProtection/ServicePrincipalRiskDetections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/ServicePrincipalRiskDetections/Item/ServicePrincipalRiskDetectionItemRequestBuilder.php b/src/Generated/IdentityProtection/ServicePrincipalRiskDetections/Item/ServicePrincipalRiskDetectionItemRequestBuilder.php index 9134713b752..8e7f71005c6 100644 --- a/src/Generated/IdentityProtection/ServicePrincipalRiskDetections/Item/ServicePrincipalRiskDetectionItemRequestBuilder.php +++ b/src/Generated/IdentityProtection/ServicePrincipalRiskDetections/Item/ServicePrincipalRiskDetectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalRiskDetection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property servicePrincipalRiskDetections for identityProtection * @param ServicePrincipalRiskDetectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ServicePrincipalRiskDetectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a servicePrincipalRiskDetection object. This API is available in the following national cloud deployments. * @param ServicePrincipalRiskDetectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipalriskdetection-get?view=graph-rest-1.0 Find more info here */ public function get(?ServicePrincipalRiskDetectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalRiskDetection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalRiskDetection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property servicePrincipalRiskDetections in identityProtection * @param ServicePrincipalRiskDetection $body The request body * @param ServicePrincipalRiskDetectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ServicePrincipalRiskDetection $body, ?ServicePrincipalRiskDetectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalRiskDetection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalRiskDetection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ServicePrincipalRiskDetectionItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ServicePrincipalRiskDetectionItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ServicePrincipalRiskDetectionItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(ServicePrincipalRiskDetection $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProtection/ServicePrincipalRiskDetections/ServicePrincipalRiskDetectionsRequestBuilder.php b/src/Generated/IdentityProtection/ServicePrincipalRiskDetections/ServicePrincipalRiskDetectionsRequestBuilder.php index 992460b3b37..af2ecaf6dbe 100644 --- a/src/Generated/IdentityProtection/ServicePrincipalRiskDetections/ServicePrincipalRiskDetectionsRequestBuilder.php +++ b/src/Generated/IdentityProtection/ServicePrincipalRiskDetections/ServicePrincipalRiskDetectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityProtection\ServicePrincipalRiskDetections\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityProtection\ServicePrincipalRiskDetections\Item\ServicePrincipalRiskDetectionItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties of a collection of servicePrincipalRiskDetection objects. This API is available in the following national cloud deployments. * @param ServicePrincipalRiskDetectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityprotectionroot-list-serviceprincipalriskdetections?view=graph-rest-1.0 Find more info here */ public function get(?ServicePrincipalRiskDetectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalRiskDetectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalRiskDetectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to servicePrincipalRiskDetections for identityProtection * @param ServicePrincipalRiskDetection $body The request body * @param ServicePrincipalRiskDetectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ServicePrincipalRiskDetection $body, ?ServicePrincipalRiskDetectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalRiskDetection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalRiskDetection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ServicePrincipalRiskDetectionsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ServicePrincipalRiskDetectionsRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ServicePrincipalRiskDetection $body, ?S $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProviders/AvailableProviderTypes/AvailableProviderTypesRequestBuilder.php b/src/Generated/IdentityProviders/AvailableProviderTypes/AvailableProviderTypesRequestBuilder.php index 00ed791ab67..6323bfd2bea 100644 --- a/src/Generated/IdentityProviders/AvailableProviderTypes/AvailableProviderTypesRequestBuilder.php +++ b/src/Generated/IdentityProviders/AvailableProviderTypes/AvailableProviderTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function availableProviderTypes * @param AvailableProviderTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AvailableProviderTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AvailableProviderTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AvailableProviderTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?AvailableProviderTypesRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?AvailableProviderTypesRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/IdentityProviders/Count/CountRequestBuilder.php b/src/Generated/IdentityProviders/Count/CountRequestBuilder.php index c995badc3e2..eb2582c3f3f 100644 --- a/src/Generated/IdentityProviders/Count/CountRequestBuilder.php +++ b/src/Generated/IdentityProviders/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/IdentityProviders/IdentityProvidersRequestBuilder.php b/src/Generated/IdentityProviders/IdentityProvidersRequestBuilder.php index 552ff061e3b..f7f74d35d61 100644 --- a/src/Generated/IdentityProviders/IdentityProvidersRequestBuilder.php +++ b/src/Generated/IdentityProviders/IdentityProvidersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\IdentityProviders\AvailableProviderTypes\AvailableProviderTypesRequestBuilder; use Microsoft\Graph\Generated\IdentityProviders\Count\CountRequestBuilder; use Microsoft\Graph\Generated\IdentityProviders\Item\IdentityProviderItemRequestBuilder; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve all identityProviders in the directory. This API is available in the following national cloud deployments. * @param IdentityProvidersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityprovider-list?view=graph-rest-1.0 Find more info here */ public function get(?IdentityProvidersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProviderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new identityProvider by specifying display name, identityProvider type, client ID, and client secret. This API is available in the following national cloud deployments. * @param IdentityProvider $body The request body * @param IdentityProvidersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityprovider-post-identityproviders?view=graph-rest-1.0 Find more info here */ public function post(IdentityProvider $body, ?IdentityProvidersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProvider::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProvider::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?IdentityProvidersRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?IdentityProvidersRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(IdentityProvider $body, ?IdentityProvid $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/IdentityProviders/Item/IdentityProviderItemRequestBuilder.php b/src/Generated/IdentityProviders/Item/IdentityProviderItemRequestBuilder.php index b2ab3b8bf8c..5821cfa1b15 100644 --- a/src/Generated/IdentityProviders/Item/IdentityProviderItemRequestBuilder.php +++ b/src/Generated/IdentityProviders/Item/IdentityProviderItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentityProvider; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an existing identityProvider. This API is available in the following national cloud deployments. * @param IdentityProviderItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityprovider-delete?view=graph-rest-1.0 Find more info here */ public function delete(?IdentityProviderItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of an existing identityProvider. This API is available in the following national cloud deployments. * @param IdentityProviderItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityprovider-get?view=graph-rest-1.0 Find more info here */ public function get(?IdentityProviderItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProvider::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProvider::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update properties in an existing identityProvider. This API is available in the following national cloud deployments. * @param IdentityProvider $body The request body * @param IdentityProviderItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identityprovider-update?view=graph-rest-1.0 Find more info here */ public function patch(IdentityProvider $body, ?IdentityProviderItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentityProvider::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentityProvider::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?IdentityProviderItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?IdentityProviderItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?IdentityProviderItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(IdentityProvider $body, ?IdentityProvi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/InformationProtection/Bitlocker/BitlockerRequestBuilder.php b/src/Generated/InformationProtection/Bitlocker/BitlockerRequestBuilder.php index 40347a47400..13144dc1919 100644 --- a/src/Generated/InformationProtection/Bitlocker/BitlockerRequestBuilder.php +++ b/src/Generated/InformationProtection/Bitlocker/BitlockerRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\InformationProtection\Bitlocker\RecoveryKeys\RecoveryKeysRequestBuilder; use Microsoft\Graph\Generated\Models\Bitlocker; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get bitlocker from informationProtection * @param BitlockerRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BitlockerRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Bitlocker::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Bitlocker::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?BitlockerRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?BitlockerRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/Count/CountRequestBuilder.php b/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/Count/CountRequestBuilder.php index 4a1d6f63164..0df6ba89f44 100644 --- a/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/Count/CountRequestBuilder.php +++ b/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/Item/BitlockerRecoveryKeyItemRequestBuilder.php b/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/Item/BitlockerRecoveryKeyItemRequestBuilder.php index bf6affd8fd9..eda10c15500 100644 --- a/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/Item/BitlockerRecoveryKeyItemRequestBuilder.php +++ b/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/Item/BitlockerRecoveryKeyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BitlockerRecoveryKey; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,26 +31,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the properties and relationships of a bitlockerRecoveryKey object. By default, this operation doesn't return the key property that represents the actual recovery key. To include the key property in the response, use the $select OData query parameter. Including the $select query parameter triggers an Azure AD audit of the operation and generates an audit log. For more information on audit logs for bitlocker recovery keys, see the KeyManagement category filter of Azure AD audit logs. This API is available in the following national cloud deployments. + * Retrieve the properties and relationships of a bitlockerRecoveryKey object. By default, this operation doesn't return the key property that represents the actual recovery key. To include the key property in the response, use the $select OData query parameter. Including the $select query parameter triggers a Microsoft Entra audit of the operation and generates an audit log. For more information on audit logs for bitlocker recovery keys, see the KeyManagement category filter of Microsoft Entra audit logs. This API is available in the following national cloud deployments. * @param BitlockerRecoveryKeyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bitlockerrecoverykey-get?view=graph-rest-1.0 Find more info here */ public function get(?BitlockerRecoveryKeyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BitlockerRecoveryKey::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BitlockerRecoveryKey::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the properties and relationships of a bitlockerRecoveryKey object. By default, this operation doesn't return the key property that represents the actual recovery key. To include the key property in the response, use the $select OData query parameter. Including the $select query parameter triggers an Azure AD audit of the operation and generates an audit log. For more information on audit logs for bitlocker recovery keys, see the KeyManagement category filter of Azure AD audit logs. This API is available in the following national cloud deployments. + * Retrieve the properties and relationships of a bitlockerRecoveryKey object. By default, this operation doesn't return the key property that represents the actual recovery key. To include the key property in the response, use the $select OData query parameter. Including the $select query parameter triggers a Microsoft Entra audit of the operation and generates an audit log. For more information on audit logs for bitlocker recovery keys, see the KeyManagement category filter of Microsoft Entra audit logs. This API is available in the following national cloud deployments. * @param BitlockerRecoveryKeyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -60,7 +56,6 @@ public function toGetRequestInformation(?BitlockerRecoveryKeyItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?BitlockerRecoveryKeyItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/Item/BitlockerRecoveryKeyItemRequestBuilderGetQueryParameters.php b/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/Item/BitlockerRecoveryKeyItemRequestBuilderGetQueryParameters.php index a91c12b13c1..196c4ae5c13 100644 --- a/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/Item/BitlockerRecoveryKeyItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/Item/BitlockerRecoveryKeyItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the properties and relationships of a bitlockerRecoveryKey object. By default, this operation doesn't return the key property that represents the actual recovery key. To include the key property in the response, use the $select OData query parameter. Including the $select query parameter triggers an Azure AD audit of the operation and generates an audit log. For more information on audit logs for bitlocker recovery keys, see the KeyManagement category filter of Azure AD audit logs. This API is available in the following national cloud deployments. + * Retrieve the properties and relationships of a bitlockerRecoveryKey object. By default, this operation doesn't return the key property that represents the actual recovery key. To include the key property in the response, use the $select OData query parameter. Including the $select query parameter triggers a Microsoft Entra audit of the operation and generates an audit log. For more information on audit logs for bitlocker recovery keys, see the KeyManagement category filter of Microsoft Entra audit logs. This API is available in the following national cloud deployments. */ class BitlockerRecoveryKeyItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/RecoveryKeysRequestBuilder.php b/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/RecoveryKeysRequestBuilder.php index 4a6746e0140..2e444857fa6 100644 --- a/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/RecoveryKeysRequestBuilder.php +++ b/src/Generated/InformationProtection/Bitlocker/RecoveryKeys/RecoveryKeysRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\InformationProtection\Bitlocker\RecoveryKeys\Count\CountRequestBuilder; use Microsoft\Graph\Generated\InformationProtection\Bitlocker\RecoveryKeys\Item\BitlockerRecoveryKeyItemRequestBuilder; use Microsoft\Graph\Generated\Models\BitlockerRecoveryKeyCollectionResponse; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the bitlockerRecoveryKey objects and their properties. This operation does not return the key property. For information about how to read the key property, see Get bitlockerRecoveryKey. This API is available in the following national cloud deployments. * @param RecoveryKeysRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bitlocker-list-recoverykeys?view=graph-rest-1.0 Find more info here */ public function get(?RecoveryKeysRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BitlockerRecoveryKeyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BitlockerRecoveryKeyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?RecoveryKeysRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?RecoveryKeysRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/InformationProtection/InformationProtectionRequestBuilder.php b/src/Generated/InformationProtection/InformationProtectionRequestBuilder.php index 967ae85c38c..7fcb82ce6c3 100644 --- a/src/Generated/InformationProtection/InformationProtectionRequestBuilder.php +++ b/src/Generated/InformationProtection/InformationProtectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\InformationProtection\Bitlocker\BitlockerRequestBuilder; use Microsoft\Graph\Generated\InformationProtection\ThreatAssessmentRequests\ThreatAssessmentRequestsRequestBuilder; use Microsoft\Graph\Generated\Models\InformationProtection; @@ -50,38 +49,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get informationProtection * @param InformationProtectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InformationProtectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InformationProtection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InformationProtection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update informationProtection * @param InformationProtection $body The request body * @param InformationProtectionRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(InformationProtection $body, ?InformationProtectionRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InformationProtection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InformationProtection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -94,7 +87,6 @@ public function toGetRequestInformation(?InformationProtectionRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -102,6 +94,7 @@ public function toGetRequestInformation(?InformationProtectionRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -116,11 +109,11 @@ public function toPatchRequestInformation(InformationProtection $body, ?Informat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/InformationProtection/ThreatAssessmentRequests/Count/CountRequestBuilder.php b/src/Generated/InformationProtection/ThreatAssessmentRequests/Count/CountRequestBuilder.php index ac9698e4ad1..10ade38a6bf 100644 --- a/src/Generated/InformationProtection/ThreatAssessmentRequests/Count/CountRequestBuilder.php +++ b/src/Generated/InformationProtection/ThreatAssessmentRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/Results/Count/CountRequestBuilder.php b/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/Results/Count/CountRequestBuilder.php index b8c97bdbd56..ed4f5bc6239 100644 --- a/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/Results/Count/CountRequestBuilder.php +++ b/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/Results/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/Results/Item/ThreatAssessmentResultItemRequestBuilder.php b/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/Results/Item/ThreatAssessmentResultItemRequestBuilder.php index a230103cf05..8a4ef765021 100644 --- a/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/Results/Item/ThreatAssessmentResultItemRequestBuilder.php +++ b/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/Results/Item/ThreatAssessmentResultItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ThreatAssessmentResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property results for informationProtection * @param ThreatAssessmentResultItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ThreatAssessmentResultItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of threat assessment results. Read-only. By default, a GET /threatAssessmentRequests/{id} does not return this property unless you apply $expand on it. * @param ThreatAssessmentResultItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ThreatAssessmentResultItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property results in informationProtection * @param ThreatAssessmentResult $body The request body * @param ThreatAssessmentResultItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ThreatAssessmentResult $body, ?ThreatAssessmentResultItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ThreatAssessmentResultItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ThreatAssessmentResultItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ThreatAssessmentResultItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ThreatAssessmentResult $body, ?ThreatA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/Results/ResultsRequestBuilder.php b/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/Results/ResultsRequestBuilder.php index b5dd7f50d96..3cb5ae53083 100644 --- a/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/Results/ResultsRequestBuilder.php +++ b/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/Results/ResultsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\InformationProtection\ThreatAssessmentRequests\Item\Results\Count\CountRequestBuilder; use Microsoft\Graph\Generated\InformationProtection\ThreatAssessmentRequests\Item\Results\Item\ThreatAssessmentResultItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A collection of threat assessment results. Read-only. By default, a GET /threatAssessmentRequests/{id} does not return this property unless you apply $expand on it. * @param ResultsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResultsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentResultCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to results for informationProtection * @param ThreatAssessmentResult $body The request body * @param ResultsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ThreatAssessmentResult $body, ?ResultsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResultsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResultsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ThreatAssessmentResult $body, ?ResultsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/ThreatAssessmentRequestItemRequestBuilder.php b/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/ThreatAssessmentRequestItemRequestBuilder.php index 785c29ac6ff..d947151c1ec 100644 --- a/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/ThreatAssessmentRequestItemRequestBuilder.php +++ b/src/Generated/InformationProtection/ThreatAssessmentRequests/Item/ThreatAssessmentRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\InformationProtection\ThreatAssessmentRequests\Item\Results\ResultsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ThreatAssessmentRequest; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property threatAssessmentRequests for informationProtection * @param ThreatAssessmentRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ThreatAssessmentRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a specified threatAssessmentRequest object. A threat assessment request can be one of the following types: This API is available in the following national cloud deployments. * @param ThreatAssessmentRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/threatassessmentrequest-get?view=graph-rest-1.0 Find more info here */ public function get(?ThreatAssessmentRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property threatAssessmentRequests in informationProtection * @param ThreatAssessmentRequest $body The request body * @param ThreatAssessmentRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ThreatAssessmentRequest $body, ?ThreatAssessmentRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ThreatAssessmentRequestItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ThreatAssessmentRequestItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ThreatAssessmentRequestItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ThreatAssessmentRequest $body, ?Threat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/InformationProtection/ThreatAssessmentRequests/ThreatAssessmentRequestsRequestBuilder.php b/src/Generated/InformationProtection/ThreatAssessmentRequests/ThreatAssessmentRequestsRequestBuilder.php index 3b17922fc77..19e63a09b41 100644 --- a/src/Generated/InformationProtection/ThreatAssessmentRequests/ThreatAssessmentRequestsRequestBuilder.php +++ b/src/Generated/InformationProtection/ThreatAssessmentRequests/ThreatAssessmentRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\InformationProtection\ThreatAssessmentRequests\Count\CountRequestBuilder; use Microsoft\Graph\Generated\InformationProtection\ThreatAssessmentRequests\Item\ThreatAssessmentRequestItemRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of threatAssessmentRequest objects. A threat assessment request can be one of the following types: This API is available in the following national cloud deployments. * @param ThreatAssessmentRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/informationprotection-list-threatassessmentrequests?view=graph-rest-1.0 Find more info here */ public function get(?ThreatAssessmentRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new threat assessment request. A threat assessment request can be one of the following types: This API is available in the following national cloud deployments. * @param ThreatAssessmentRequest $body The request body * @param ThreatAssessmentRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/informationprotection-post-threatassessmentrequests?view=graph-rest-1.0 Find more info here */ public function post(ThreatAssessmentRequest $body, ?ThreatAssessmentRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThreatAssessmentRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ThreatAssessmentRequestsRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ThreatAssessmentRequestsRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ThreatAssessmentRequest $body, ?ThreatA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Invitations/Count/CountRequestBuilder.php b/src/Generated/Invitations/Count/CountRequestBuilder.php index f45b998339d..d3fc4994f17 100644 --- a/src/Generated/Invitations/Count/CountRequestBuilder.php +++ b/src/Generated/Invitations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Invitations/InvitationsRequestBuilder.php b/src/Generated/Invitations/InvitationsRequestBuilder.php index 8f2e962ce81..6aa633d873d 100644 --- a/src/Generated/Invitations/InvitationsRequestBuilder.php +++ b/src/Generated/Invitations/InvitationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Invitations\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Invitations\Item\InvitationItemRequestBuilder; use Microsoft\Graph\Generated\Models\Invitation; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from invitations * @param InvitationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InvitationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InvitationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InvitationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new invitation. Invitation adds an external user to the organization. When creating a new invitation, you have several options available: This API is available in the following national cloud deployments. * @param Invitation $body The request body * @param InvitationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/invitation-post?view=graph-rest-1.0 Find more info here */ public function post(Invitation $body, ?InvitationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Invitation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Invitation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?InvitationsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?InvitationsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Invitation $body, ?InvitationsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Invitations/Item/InvitationItemRequestBuilder.php b/src/Generated/Invitations/Item/InvitationItemRequestBuilder.php index 8eb0af1b0eb..4ccfd3c2a6f 100644 --- a/src/Generated/Invitations/Item/InvitationItemRequestBuilder.php +++ b/src/Generated/Invitations/Item/InvitationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Invitations\Item\InvitedUser\InvitedUserRequestBuilder; use Microsoft\Graph\Generated\Models\Invitation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from invitations * @param InvitationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?InvitationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entity from invitations by key * @param InvitationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InvitationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Invitation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Invitation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in invitations * @param Invitation $body The request body * @param InvitationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Invitation $body, ?InvitationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Invitation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Invitation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?InvitationItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?InvitationItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?InvitationItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Invitation $body, ?InvitationItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Invitations/Item/InvitedUser/InvitedUserRequestBuilder.php b/src/Generated/Invitations/Item/InvitedUser/InvitedUserRequestBuilder.php index 13926c3727a..a64dc1d8001 100644 --- a/src/Generated/Invitations/Item/InvitedUser/InvitedUserRequestBuilder.php +++ b/src/Generated/Invitations/Item/InvitedUser/InvitedUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Invitations\Item\InvitedUser\MailboxSettings\MailboxSettingsRequestBuilder; use Microsoft\Graph\Generated\Invitations\Item\InvitedUser\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The user created as part of the invitation creation. Read-Only * @param InvitedUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InvitedUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?InvitedUserRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?InvitedUserRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Invitations/Item/InvitedUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Invitations/Item/InvitedUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 75f9f0c4288..44c0d9be18d 100644 --- a/src/Generated/Invitations/Item/InvitedUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Invitations/Item/InvitedUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Invitations/Item/InvitedUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Invitations/Item/InvitedUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index d06c8f7aa29..0d3cb23d07c 100644 --- a/src/Generated/Invitations/Item/InvitedUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Invitations/Item/InvitedUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Invitations/Item/InvitedUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Invitations/Item/InvitedUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index c463fd1defe..0f46ad349fb 100644 --- a/src/Generated/Invitations/Item/InvitedUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Invitations/Item/InvitedUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Invitations\Item\InvitedUser\ServiceProvisioningErrors\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Models/AadUserConversationMember.php b/src/Generated/Models/AadUserConversationMember.php index caf431a9cf6..b62edb67559 100644 --- a/src/Generated/Models/AadUserConversationMember.php +++ b/src/Generated/Models/AadUserConversationMember.php @@ -52,7 +52,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the tenantId property value. TenantId which the Azure AD user belongs to. + * Gets the tenantId property value. TenantId which the Microsoft Entra user belongs to. * @return string|null */ public function getTenantId(): ?string { @@ -108,7 +108,7 @@ public function setEmail(?string $value): void { } /** - * Sets the tenantId property value. TenantId which the Azure AD user belongs to. + * Sets the tenantId property value. TenantId which the Microsoft Entra user belongs to. * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { diff --git a/src/Generated/Models/AadUserNotificationRecipient.php b/src/Generated/Models/AadUserNotificationRecipient.php index f1e7c50f688..bf3f1fdb1c7 100644 --- a/src/Generated/Models/AadUserNotificationRecipient.php +++ b/src/Generated/Models/AadUserNotificationRecipient.php @@ -37,7 +37,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the userId property value. Azure AD user identifier. Use the List users method to get this ID. + * Gets the userId property value. Microsoft Entra user identifier. Use the List users method to get this ID. * @return string|null */ public function getUserId(): ?string { @@ -58,7 +58,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the userId property value. Azure AD user identifier. Use the List users method to get this ID. + * Sets the userId property value. Microsoft Entra user identifier. Use the List users method to get this ID. * @param string|null $value Value to set for the userId property. */ public function setUserId(?string $value): void { diff --git a/src/Generated/Models/AccessPackageResource.php b/src/Generated/Models/AccessPackageResource.php index 9f6d20af99c..7c747dc3226 100644 --- a/src/Generated/Models/AccessPackageResource.php +++ b/src/Generated/Models/AccessPackageResource.php @@ -106,7 +106,7 @@ public function getModifiedDateTime(): ?DateTime { } /** - * Gets the originId property value. The unique identifier of the resource in the origin system. In the case of an Azure AD group, this is the identifier of the group. + * Gets the originId property value. The unique identifier of the resource in the origin system. In the case of a Microsoft Entra group, this is the identifier of the group. * @return string|null */ public function getOriginId(): ?string { @@ -215,7 +215,7 @@ public function setModifiedDateTime(?DateTime $value): void { } /** - * Sets the originId property value. The unique identifier of the resource in the origin system. In the case of an Azure AD group, this is the identifier of the group. + * Sets the originId property value. The unique identifier of the resource in the origin system. In the case of a Microsoft Entra group, this is the identifier of the group. * @param string|null $value Value to set for the originId property. */ public function setOriginId(?string $value): void { diff --git a/src/Generated/Models/AccessPackageResourceEnvironment.php b/src/Generated/Models/AccessPackageResourceEnvironment.php index f6edb394461..5c80657a3a8 100644 --- a/src/Generated/Models/AccessPackageResourceEnvironment.php +++ b/src/Generated/Models/AccessPackageResourceEnvironment.php @@ -81,7 +81,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the isDefaultEnvironment property value. Determines whether this is default environment or not. It is set to true for all static origin systems, such as Azure AD groups and Azure AD Applications. + * Gets the isDefaultEnvironment property value. Determines whether this is default environment or not. It is set to true for all static origin systems, such as Microsoft Entra groups and Microsoft Entra Applications. * @return bool|null */ public function getIsDefaultEnvironment(): ?bool { @@ -183,7 +183,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the isDefaultEnvironment property value. Determines whether this is default environment or not. It is set to true for all static origin systems, such as Azure AD groups and Azure AD Applications. + * Sets the isDefaultEnvironment property value. Determines whether this is default environment or not. It is set to true for all static origin systems, such as Microsoft Entra groups and Microsoft Entra Applications. * @param bool|null $value Value to set for the isDefaultEnvironment property. */ public function setIsDefaultEnvironment(?bool $value): void { diff --git a/src/Generated/Models/AccessReviewScheduleSettings.php b/src/Generated/Models/AccessReviewScheduleSettings.php index fcc80bace43..3bd24ba8a90 100644 --- a/src/Generated/Models/AccessReviewScheduleSettings.php +++ b/src/Generated/Models/AccessReviewScheduleSettings.php @@ -206,7 +206,7 @@ public function getRecommendationInsightSettings(): ?array { } /** - * Gets the recommendationLookBackDuration property value. Optional field. Indicates the period of inactivity (with respect to the start date of the review instance) that recommendations will be configured from. The recommendation will be to deny if the user is inactive during the look-back duration. For reviews of groups and Azure AD roles, any duration is accepted. For reviews of applications, 30 days is the maximum duration. If not specified, the duration is 30 days. NOTE: If the stageSettings of the accessReviewScheduleDefinition object is defined, its recommendationLookBackDuration setting will be used instead of the value of this property. + * Gets the recommendationLookBackDuration property value. Optional field. Indicates the period of inactivity (with respect to the start date of the review instance) that recommendations will be configured from. The recommendation will be to deny if the user is inactive during the look-back duration. For reviews of groups and Microsoft Entra roles, any duration is accepted. For reviews of applications, 30 days is the maximum duration. If not specified, the duration is 30 days. NOTE: If the stageSettings of the accessReviewScheduleDefinition object is defined, its recommendationLookBackDuration setting will be used instead of the value of this property. * @return DateInterval|null */ public function getRecommendationLookBackDuration(): ?DateInterval { @@ -372,7 +372,7 @@ public function setRecommendationInsightSettings(?array $value): void { } /** - * Sets the recommendationLookBackDuration property value. Optional field. Indicates the period of inactivity (with respect to the start date of the review instance) that recommendations will be configured from. The recommendation will be to deny if the user is inactive during the look-back duration. For reviews of groups and Azure AD roles, any duration is accepted. For reviews of applications, 30 days is the maximum duration. If not specified, the duration is 30 days. NOTE: If the stageSettings of the accessReviewScheduleDefinition object is defined, its recommendationLookBackDuration setting will be used instead of the value of this property. + * Sets the recommendationLookBackDuration property value. Optional field. Indicates the period of inactivity (with respect to the start date of the review instance) that recommendations will be configured from. The recommendation will be to deny if the user is inactive during the look-back duration. For reviews of groups and Microsoft Entra roles, any duration is accepted. For reviews of applications, 30 days is the maximum duration. If not specified, the duration is 30 days. NOTE: If the stageSettings of the accessReviewScheduleDefinition object is defined, its recommendationLookBackDuration setting will be used instead of the value of this property. * @param DateInterval|null $value Value to set for the recommendationLookBackDuration property. */ public function setRecommendationLookBackDuration(?DateInterval $value): void { diff --git a/src/Generated/Models/AccessReviewStageSettings.php b/src/Generated/Models/AccessReviewStageSettings.php index d386a5ae5f5..bef3a129e89 100644 --- a/src/Generated/Models/AccessReviewStageSettings.php +++ b/src/Generated/Models/AccessReviewStageSettings.php @@ -97,7 +97,7 @@ public function getDurationInDays(): ?int { } /** - * Gets the fallbackReviewers property value. If provided, the fallback reviewers are asked to complete a review if the primary reviewers don't exist. For example, if managers are selected as reviewers and a principal under review doesn't have a manager in Azure AD, the fallback reviewers are asked to review that principal. NOTE: The value of this property overrides the corresponding setting on the accessReviewScheduleDefinition object. + * Gets the fallbackReviewers property value. If provided, the fallback reviewers are asked to complete a review if the primary reviewers don't exist. For example, if managers are selected as reviewers and a principal under review doesn't have a manager in Microsoft Entra ID, the fallback reviewers are asked to review that principal. NOTE: The value of this property overrides the corresponding setting on the accessReviewScheduleDefinition object. * @return array|null */ public function getFallbackReviewers(): ?array { @@ -265,7 +265,7 @@ public function setDurationInDays(?int $value): void { } /** - * Sets the fallbackReviewers property value. If provided, the fallback reviewers are asked to complete a review if the primary reviewers don't exist. For example, if managers are selected as reviewers and a principal under review doesn't have a manager in Azure AD, the fallback reviewers are asked to review that principal. NOTE: The value of this property overrides the corresponding setting on the accessReviewScheduleDefinition object. + * Sets the fallbackReviewers property value. If provided, the fallback reviewers are asked to complete a review if the primary reviewers don't exist. For example, if managers are selected as reviewers and a principal under review doesn't have a manager in Microsoft Entra ID, the fallback reviewers are asked to review that principal. NOTE: The value of this property overrides the corresponding setting on the accessReviewScheduleDefinition object. * @param array|null $value Value to set for the fallbackReviewers property. */ public function setFallbackReviewers(?array $value): void { diff --git a/src/Generated/Models/AccountTargetContent.php b/src/Generated/Models/AccountTargetContent.php index dc22740d4aa..49b2b6eb1a5 100644 --- a/src/Generated/Models/AccountTargetContent.php +++ b/src/Generated/Models/AccountTargetContent.php @@ -88,7 +88,7 @@ public function getOdataType(): ?string { } /** - * Gets the type property value. The type property + * Gets the type property value. The type of account target content. Possible values are: unknown, includeAll, addressBook, unknownFutureValue. * @return AccountTargetContentType|null */ public function getType(): ?AccountTargetContentType { @@ -134,7 +134,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the type property value. The type property + * Sets the type property value. The type of account target content. Possible values are: unknown, includeAll, addressBook, unknownFutureValue. * @param AccountTargetContentType|null $value Value to set for the type property. */ public function setType(?AccountTargetContentType $value): void { diff --git a/src/Generated/Models/AddressBookAccountTargetContent.php b/src/Generated/Models/AddressBookAccountTargetContent.php index dd53776a443..5e889f262d2 100644 --- a/src/Generated/Models/AddressBookAccountTargetContent.php +++ b/src/Generated/Models/AddressBookAccountTargetContent.php @@ -27,7 +27,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Addre } /** - * Gets the accountTargetEmails property value. The accountTargetEmails property + * Gets the accountTargetEmails property value. List of user emails targeted for an attack simulation training campaign. * @return array|null */ public function getAccountTargetEmails(): ?array { @@ -68,7 +68,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the accountTargetEmails property value. The accountTargetEmails property + * Sets the accountTargetEmails property value. List of user emails targeted for an attack simulation training campaign. * @param array|null $value Value to set for the accountTargetEmails property. */ public function setAccountTargetEmails(?array $value): void { diff --git a/src/Generated/Models/Agreement.php b/src/Generated/Models/Agreement.php index 0da36e212e4..639a143fefc 100644 --- a/src/Generated/Models/Agreement.php +++ b/src/Generated/Models/Agreement.php @@ -97,7 +97,7 @@ public function getFiles(): ?array { } /** - * Gets the isPerDeviceAcceptanceRequired property value. Indicates whether end users are required to accept this agreement on every device that they access it from. The end user is required to register their device in Azure AD, if they haven't already done so. Supports $filter (eq). + * Gets the isPerDeviceAcceptanceRequired property value. Indicates whether end users are required to accept this agreement on every device that they access it from. The end user is required to register their device in Microsoft Entra ID, if they haven't already done so. Supports $filter (eq). * @return bool|null */ public function getIsPerDeviceAcceptanceRequired(): ?bool { @@ -193,7 +193,7 @@ public function setFiles(?array $value): void { } /** - * Sets the isPerDeviceAcceptanceRequired property value. Indicates whether end users are required to accept this agreement on every device that they access it from. The end user is required to register their device in Azure AD, if they haven't already done so. Supports $filter (eq). + * Sets the isPerDeviceAcceptanceRequired property value. Indicates whether end users are required to accept this agreement on every device that they access it from. The end user is required to register their device in Microsoft Entra ID, if they haven't already done so. Supports $filter (eq). * @param bool|null $value Value to set for the isPerDeviceAcceptanceRequired property. */ public function setIsPerDeviceAcceptanceRequired(?bool $value): void { diff --git a/src/Generated/Models/AgreementFileLocalization.php b/src/Generated/Models/AgreementFileLocalization.php index b1c902ab480..509fcdc1190 100644 --- a/src/Generated/Models/AgreementFileLocalization.php +++ b/src/Generated/Models/AgreementFileLocalization.php @@ -37,7 +37,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the versions property value. Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Gets the versions property value. Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @return array|null */ public function getVersions(): ?array { @@ -60,7 +60,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the versions property value. Read-only. Customized versions of the terms of use agreement in the Azure AD tenant. + * Sets the versions property value. Read-only. Customized versions of the terms of use agreement in the Microsoft Entra tenant. * @param array|null $value Value to set for the versions property. */ public function setVersions(?array $value): void { diff --git a/src/Generated/Models/Alert.php b/src/Generated/Models/Alert.php index 155badddc88..f67609a40a2 100644 --- a/src/Generated/Models/Alert.php +++ b/src/Generated/Models/Alert.php @@ -77,7 +77,7 @@ public function getAzureSubscriptionId(): ?string { } /** - * Gets the azureTenantId property value. Azure Active Directory tenant ID. Required. + * Gets the azureTenantId property value. Microsoft Entra tenant ID. Required. * @return string|null */ public function getAzureTenantId(): ?string { @@ -709,7 +709,7 @@ public function setAzureSubscriptionId(?string $value): void { } /** - * Sets the azureTenantId property value. Azure Active Directory tenant ID. Required. + * Sets the azureTenantId property value. Microsoft Entra tenant ID. Required. * @param string|null $value Value to set for the azureTenantId property. */ public function setAzureTenantId(?string $value): void { diff --git a/src/Generated/Models/ApiApplication.php b/src/Generated/Models/ApiApplication.php index ce3f8dd74f7..eab760c9e11 100644 --- a/src/Generated/Models/ApiApplication.php +++ b/src/Generated/Models/ApiApplication.php @@ -92,7 +92,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the knownClientApplications property value. Used for bundling consent if you have a solution that contains two parts: a client app and a custom web API app. If you set the appID of the client app to this value, the user only consents once to the client app. Azure AD knows that consenting to the client means implicitly consenting to the web API and automatically provisions service principals for both APIs at the same time. Both the client and the web API app must be registered in the same tenant. + * Gets the knownClientApplications property value. Used for bundling consent if you have a solution that contains two parts: a client app and a custom web API app. If you set the appID of the client app to this value, the user only consents once to the client app. Microsoft Entra ID knows that consenting to the client means implicitly consenting to the web API and automatically provisions service principals for both APIs at the same time. Both the client and the web API app must be registered in the same tenant. * @return array|null */ public function getKnownClientApplications(): ?array { @@ -196,7 +196,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the knownClientApplications property value. Used for bundling consent if you have a solution that contains two parts: a client app and a custom web API app. If you set the appID of the client app to this value, the user only consents once to the client app. Azure AD knows that consenting to the client means implicitly consenting to the web API and automatically provisions service principals for both APIs at the same time. Both the client and the web API app must be registered in the same tenant. + * Sets the knownClientApplications property value. Used for bundling consent if you have a solution that contains two parts: a client app and a custom web API app. If you set the appID of the client app to this value, the user only consents once to the client app. Microsoft Entra ID knows that consenting to the client means implicitly consenting to the web API and automatically provisions service principals for both APIs at the same time. Both the client and the web API app must be registered in the same tenant. * @param array|null $value Value to set for the knownClientApplications property. */ public function setKnownClientApplications(?array $value): void { diff --git a/src/Generated/Models/AppIdentity.php b/src/Generated/Models/AppIdentity.php index 0e1ff490cc3..d5fc8a6f5fa 100644 --- a/src/Generated/Models/AppIdentity.php +++ b/src/Generated/Models/AppIdentity.php @@ -48,7 +48,7 @@ public function getAdditionalData(): ?array { } /** - * Gets the appId property value. Refers to the Unique GUID representing Application Id in the Azure Active Directory. + * Gets the appId property value. Refers to the unique ID representing application in Microsoft Entra ID. * @return string|null */ public function getAppId(): ?string { @@ -107,7 +107,7 @@ public function getOdataType(): ?string { } /** - * Gets the servicePrincipalId property value. Refers to the Unique GUID indicating Service Principal Id in Azure Active Directory for the corresponding App. + * Gets the servicePrincipalId property value. Refers to the unique ID for the service principal in Microsoft Entra ID. * @return string|null */ public function getServicePrincipalId(): ?string { @@ -152,7 +152,7 @@ public function setAdditionalData(?array $value): void { } /** - * Sets the appId property value. Refers to the Unique GUID representing Application Id in the Azure Active Directory. + * Sets the appId property value. Refers to the unique ID representing application in Microsoft Entra ID. * @param string|null $value Value to set for the appId property. */ public function setAppId(?string $value): void { @@ -184,7 +184,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the servicePrincipalId property value. Refers to the Unique GUID indicating Service Principal Id in Azure Active Directory for the corresponding App. + * Sets the servicePrincipalId property value. Refers to the unique ID for the service principal in Microsoft Entra ID. * @param string|null $value Value to set for the servicePrincipalId property. */ public function setServicePrincipalId(?string $value): void { diff --git a/src/Generated/Models/Application.php b/src/Generated/Models/Application.php index 9b86f74df94..556dd230532 100644 --- a/src/Generated/Models/Application.php +++ b/src/Generated/Models/Application.php @@ -55,7 +55,7 @@ public function getApi(): ?ApiApplication { } /** - * Gets the appId property value. The unique identifier for the application that is assigned to an application by Azure AD. Not nullable. Read-only. Alternate key. Supports $filter (eq). + * Gets the appId property value. The unique identifier for the application that is assigned to an application by Microsoft Entra ID. Not nullable. Read-only. Alternate key. Supports $filter (eq). * @return string|null */ public function getAppId(): ?string { @@ -288,7 +288,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the groupMembershipClaims property value. Configures the groups claim issued in a user or OAuth 2.0 access token that the application expects. To set this attribute, use one of the following valid string values: None, SecurityGroup (for security groups and Azure AD roles), All (this gets all of the security groups, distribution groups, and Azure AD directory roles that the signed-in user is a member of). + * Gets the groupMembershipClaims property value. Configures the groups claim issued in a user or OAuth 2.0 access token that the application expects. To set this attribute, use one of the following valid string values: None, SecurityGroup (for security groups and Microsoft Entra roles), All (this gets all of the security groups, distribution groups, and Microsoft Entra directory roles that the signed-in user is a member of). * @return string|null */ public function getGroupMembershipClaims(): ?string { @@ -314,7 +314,7 @@ public function getHomeRealmDiscoveryPolicies(): ?array { } /** - * Gets the identifierUris property value. Also known as App ID URI, this value is set when an application is used as a resource app. The identifierUris acts as the prefix for the scopes you'll reference in your API's code, and it must be globally unique. You can use the default value provided, which is in the form api://, or specify a more readable URI like https://contoso.com/api. For more information on valid identifierUris patterns and best practices, see Azure AD application registration security best practices. Not nullable. Supports $filter (eq, ne, ge, le, startsWith). + * Gets the identifierUris property value. Also known as App ID URI, this value is set when an application is used as a resource app. The identifierUris acts as the prefix for the scopes you'll reference in your API's code, and it must be globally unique. You can use the default value provided, which is in the form api://, or specify a more readable URI like https://contoso.com/api. For more information on valid identifierUris patterns and best practices, see Microsoft Entra application registration security best practices. Not nullable. Supports $filter (eq, ne, ge, le, startsWith). * @return array|null */ public function getIdentifierUris(): ?array { @@ -328,7 +328,7 @@ public function getIdentifierUris(): ?array { } /** - * Gets the info property value. Basic profile information of the application such as app's marketing, support, terms of service and privacy statement URLs. The terms of service and privacy statement are surfaced to users through the user consent experience. For more info, see How to: Add Terms of service and privacy statement for registered Azure AD apps. Supports $filter (eq, ne, not, ge, le, and eq on null values). + * Gets the info property value. Basic profile information of the application such as app's marketing, support, terms of service and privacy statement URLs. The terms of service and privacy statement are surfaced to users through the user consent experience. For more info, see How to: Add Terms of service and privacy statement for registered Microsoft Entra apps. Supports $filter (eq, ne, not, ge, le, and eq on null values). * @return InformationalUrl|null */ public function getInfo(): ?InformationalUrl { @@ -352,7 +352,7 @@ public function getIsDeviceOnlyAuthSupported(): ?bool { } /** - * Gets the isFallbackPublicClient property value. Specifies the fallback application type as public client, such as an installed application running on a mobile device. The default value is false which means the fallback application type is confidential client such as a web app. There are certain scenarios where Azure AD cannot determine the client application type. For example, the ROPC flow where it is configured without specifying a redirect URI. In those cases Azure AD interprets the application type based on the value of this property. + * Gets the isFallbackPublicClient property value. Specifies the fallback application type as public client, such as an installed application running on a mobile device. The default value is false which means the fallback application type is confidential client such as a web app. There are certain scenarios where Microsoft Entra ID cannot determine the client application type. For example, the ROPC flow where it is configured without specifying a redirect URI. In those cases Microsoft Entra ID interprets the application type based on the value of this property. * @return bool|null */ public function getIsFallbackPublicClient(): ?bool { @@ -414,7 +414,7 @@ public function getOauth2RequirePostResponse(): ?bool { } /** - * Gets the optionalClaims property value. Application developers can configure optional claims in their Azure AD applications to specify the claims that are sent to their application by the Microsoft security token service. For more information, see How to: Provide optional claims to your app. + * Gets the optionalClaims property value. Application developers can configure optional claims in their Microsoft Entra applications to specify the claims that are sent to their application by the Microsoft security token service. For more information, see How to: Provide optional claims to your app. * @return OptionalClaims|null */ public function getOptionalClaims(): ?OptionalClaims { @@ -490,7 +490,7 @@ public function getPublisherDomain(): ?string { } /** - * Gets the requestSignatureVerification property value. Specifies whether this application requires Azure AD to verify the signed authentication requests. + * Gets the requestSignatureVerification property value. Specifies whether this application requires Microsoft Entra ID to verify the signed authentication requests. * @return RequestSignatureVerification|null */ public function getRequestSignatureVerification(): ?RequestSignatureVerification { @@ -576,7 +576,7 @@ public function getSpa(): ?SpaApplication { } /** - * Gets the synchronization property value. Represents the capability for Azure Active Directory (Azure AD) identity synchronization through the Microsoft Graph API. + * Gets the synchronization property value. Represents the capability for Microsoft Entra identity synchronization through the Microsoft Graph API. * @return Synchronization|null */ public function getSynchronization(): ?Synchronization { @@ -602,7 +602,7 @@ public function getTags(): ?array { } /** - * Gets the tokenEncryptionKeyId property value. Specifies the keyId of a public key from the keyCredentials collection. When configured, Azure AD encrypts all the tokens it emits by using the key this property points to. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signed-in user. + * Gets the tokenEncryptionKeyId property value. Specifies the keyId of a public key from the keyCredentials collection. When configured, Microsoft Entra ID encrypts all the tokens it emits by using the key this property points to. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signed-in user. * @return string|null */ public function getTokenEncryptionKeyId(): ?string { @@ -735,7 +735,7 @@ public function setApi(?ApiApplication $value): void { } /** - * Sets the appId property value. The unique identifier for the application that is assigned to an application by Azure AD. Not nullable. Read-only. Alternate key. Supports $filter (eq). + * Sets the appId property value. The unique identifier for the application that is assigned to an application by Microsoft Entra ID. Not nullable. Read-only. Alternate key. Supports $filter (eq). * @param string|null $value Value to set for the appId property. */ public function setAppId(?string $value): void { @@ -839,7 +839,7 @@ public function setFederatedIdentityCredentials(?array $value): void { } /** - * Sets the groupMembershipClaims property value. Configures the groups claim issued in a user or OAuth 2.0 access token that the application expects. To set this attribute, use one of the following valid string values: None, SecurityGroup (for security groups and Azure AD roles), All (this gets all of the security groups, distribution groups, and Azure AD directory roles that the signed-in user is a member of). + * Sets the groupMembershipClaims property value. Configures the groups claim issued in a user or OAuth 2.0 access token that the application expects. To set this attribute, use one of the following valid string values: None, SecurityGroup (for security groups and Microsoft Entra roles), All (this gets all of the security groups, distribution groups, and Microsoft Entra directory roles that the signed-in user is a member of). * @param string|null $value Value to set for the groupMembershipClaims property. */ public function setGroupMembershipClaims(?string $value): void { @@ -855,7 +855,7 @@ public function setHomeRealmDiscoveryPolicies(?array $value): void { } /** - * Sets the identifierUris property value. Also known as App ID URI, this value is set when an application is used as a resource app. The identifierUris acts as the prefix for the scopes you'll reference in your API's code, and it must be globally unique. You can use the default value provided, which is in the form api://, or specify a more readable URI like https://contoso.com/api. For more information on valid identifierUris patterns and best practices, see Azure AD application registration security best practices. Not nullable. Supports $filter (eq, ne, ge, le, startsWith). + * Sets the identifierUris property value. Also known as App ID URI, this value is set when an application is used as a resource app. The identifierUris acts as the prefix for the scopes you'll reference in your API's code, and it must be globally unique. You can use the default value provided, which is in the form api://, or specify a more readable URI like https://contoso.com/api. For more information on valid identifierUris patterns and best practices, see Microsoft Entra application registration security best practices. Not nullable. Supports $filter (eq, ne, ge, le, startsWith). * @param array|null $value Value to set for the identifierUris property. */ public function setIdentifierUris(?array $value): void { @@ -863,7 +863,7 @@ public function setIdentifierUris(?array $value): void { } /** - * Sets the info property value. Basic profile information of the application such as app's marketing, support, terms of service and privacy statement URLs. The terms of service and privacy statement are surfaced to users through the user consent experience. For more info, see How to: Add Terms of service and privacy statement for registered Azure AD apps. Supports $filter (eq, ne, not, ge, le, and eq on null values). + * Sets the info property value. Basic profile information of the application such as app's marketing, support, terms of service and privacy statement URLs. The terms of service and privacy statement are surfaced to users through the user consent experience. For more info, see How to: Add Terms of service and privacy statement for registered Microsoft Entra apps. Supports $filter (eq, ne, not, ge, le, and eq on null values). * @param InformationalUrl|null $value Value to set for the info property. */ public function setInfo(?InformationalUrl $value): void { @@ -879,7 +879,7 @@ public function setIsDeviceOnlyAuthSupported(?bool $value): void { } /** - * Sets the isFallbackPublicClient property value. Specifies the fallback application type as public client, such as an installed application running on a mobile device. The default value is false which means the fallback application type is confidential client such as a web app. There are certain scenarios where Azure AD cannot determine the client application type. For example, the ROPC flow where it is configured without specifying a redirect URI. In those cases Azure AD interprets the application type based on the value of this property. + * Sets the isFallbackPublicClient property value. Specifies the fallback application type as public client, such as an installed application running on a mobile device. The default value is false which means the fallback application type is confidential client such as a web app. There are certain scenarios where Microsoft Entra ID cannot determine the client application type. For example, the ROPC flow where it is configured without specifying a redirect URI. In those cases Microsoft Entra ID interprets the application type based on the value of this property. * @param bool|null $value Value to set for the isFallbackPublicClient property. */ public function setIsFallbackPublicClient(?bool $value): void { @@ -919,7 +919,7 @@ public function setOauth2RequirePostResponse(?bool $value): void { } /** - * Sets the optionalClaims property value. Application developers can configure optional claims in their Azure AD applications to specify the claims that are sent to their application by the Microsoft security token service. For more information, see How to: Provide optional claims to your app. + * Sets the optionalClaims property value. Application developers can configure optional claims in their Microsoft Entra applications to specify the claims that are sent to their application by the Microsoft security token service. For more information, see How to: Provide optional claims to your app. * @param OptionalClaims|null $value Value to set for the optionalClaims property. */ public function setOptionalClaims(?OptionalClaims $value): void { @@ -967,7 +967,7 @@ public function setPublisherDomain(?string $value): void { } /** - * Sets the requestSignatureVerification property value. Specifies whether this application requires Azure AD to verify the signed authentication requests. + * Sets the requestSignatureVerification property value. Specifies whether this application requires Microsoft Entra ID to verify the signed authentication requests. * @param RequestSignatureVerification|null $value Value to set for the requestSignatureVerification property. */ public function setRequestSignatureVerification(?RequestSignatureVerification $value): void { @@ -1023,7 +1023,7 @@ public function setSpa(?SpaApplication $value): void { } /** - * Sets the synchronization property value. Represents the capability for Azure Active Directory (Azure AD) identity synchronization through the Microsoft Graph API. + * Sets the synchronization property value. Represents the capability for Microsoft Entra identity synchronization through the Microsoft Graph API. * @param Synchronization|null $value Value to set for the synchronization property. */ public function setSynchronization(?Synchronization $value): void { @@ -1039,7 +1039,7 @@ public function setTags(?array $value): void { } /** - * Sets the tokenEncryptionKeyId property value. Specifies the keyId of a public key from the keyCredentials collection. When configured, Azure AD encrypts all the tokens it emits by using the key this property points to. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signed-in user. + * Sets the tokenEncryptionKeyId property value. Specifies the keyId of a public key from the keyCredentials collection. When configured, Microsoft Entra ID encrypts all the tokens it emits by using the key this property points to. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signed-in user. * @param string|null $value Value to set for the tokenEncryptionKeyId property. */ public function setTokenEncryptionKeyId(?string $value): void { diff --git a/src/Generated/Models/AttackSimulationOperation.php b/src/Generated/Models/AttackSimulationOperation.php index 0e943f2510d..0ef3c0252d6 100644 --- a/src/Generated/Models/AttackSimulationOperation.php +++ b/src/Generated/Models/AttackSimulationOperation.php @@ -38,7 +38,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the percentageCompleted property value. The percentageCompleted property + * Gets the percentageCompleted property value. Percentage of completion of the respective operation. * @return int|null */ public function getPercentageCompleted(): ?int { @@ -50,7 +50,7 @@ public function getPercentageCompleted(): ?int { } /** - * Gets the tenantId property value. The tenantId property + * Gets the tenantId property value. Tenant identifier. * @return string|null */ public function getTenantId(): ?string { @@ -62,7 +62,7 @@ public function getTenantId(): ?string { } /** - * Gets the type property value. The type property + * Gets the type property value. The attack simulation operation type. Possible values are: createSimulation, updateSimulation, unknownFutureValue. * @return AttackSimulationOperationType|null */ public function getType(): ?AttackSimulationOperationType { @@ -85,7 +85,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the percentageCompleted property value. The percentageCompleted property + * Sets the percentageCompleted property value. Percentage of completion of the respective operation. * @param int|null $value Value to set for the percentageCompleted property. */ public function setPercentageCompleted(?int $value): void { @@ -93,7 +93,7 @@ public function setPercentageCompleted(?int $value): void { } /** - * Sets the tenantId property value. The tenantId property + * Sets the tenantId property value. Tenant identifier. * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { @@ -101,7 +101,7 @@ public function setTenantId(?string $value): void { } /** - * Sets the type property value. The type property + * Sets the type property value. The attack simulation operation type. Possible values are: createSimulation, updateSimulation, unknownFutureValue. * @param AttackSimulationOperationType|null $value Value to set for the type property. */ public function setType(?AttackSimulationOperationType $value): void { diff --git a/src/Generated/Models/AttackSimulationRoot.php b/src/Generated/Models/AttackSimulationRoot.php index 8263513d7f2..4bd2e2e1720 100644 --- a/src/Generated/Models/AttackSimulationRoot.php +++ b/src/Generated/Models/AttackSimulationRoot.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Attac } /** - * Gets the endUserNotifications property value. The endUserNotifications property + * Gets the endUserNotifications property value. Represents an end user's notification for an attack simulation training. * @return array|null */ public function getEndUserNotifications(): ?array { @@ -58,7 +58,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the landingPages property value. The landingPages property + * Gets the landingPages property value. Represents an attack simulation training landing page. * @return array|null */ public function getLandingPages(): ?array { @@ -72,7 +72,7 @@ public function getLandingPages(): ?array { } /** - * Gets the loginPages property value. The loginPages property + * Gets the loginPages property value. Represents an attack simulation training login page. * @return array|null */ public function getLoginPages(): ?array { @@ -86,7 +86,7 @@ public function getLoginPages(): ?array { } /** - * Gets the operations property value. The operations property + * Gets the operations property value. Represents an attack simulation training operation. * @return array|null */ public function getOperations(): ?array { @@ -100,7 +100,7 @@ public function getOperations(): ?array { } /** - * Gets the payloads property value. The payloads property + * Gets the payloads property value. Represents an attack simulation training campaign payload in a tenant. * @return array|null */ public function getPayloads(): ?array { @@ -142,7 +142,7 @@ public function getSimulations(): ?array { } /** - * Gets the trainings property value. The trainings property + * Gets the trainings property value. Represents details about attack simulation trainings. * @return array|null */ public function getTrainings(): ?array { @@ -172,7 +172,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the endUserNotifications property value. The endUserNotifications property + * Sets the endUserNotifications property value. Represents an end user's notification for an attack simulation training. * @param array|null $value Value to set for the endUserNotifications property. */ public function setEndUserNotifications(?array $value): void { @@ -180,7 +180,7 @@ public function setEndUserNotifications(?array $value): void { } /** - * Sets the landingPages property value. The landingPages property + * Sets the landingPages property value. Represents an attack simulation training landing page. * @param array|null $value Value to set for the landingPages property. */ public function setLandingPages(?array $value): void { @@ -188,7 +188,7 @@ public function setLandingPages(?array $value): void { } /** - * Sets the loginPages property value. The loginPages property + * Sets the loginPages property value. Represents an attack simulation training login page. * @param array|null $value Value to set for the loginPages property. */ public function setLoginPages(?array $value): void { @@ -196,7 +196,7 @@ public function setLoginPages(?array $value): void { } /** - * Sets the operations property value. The operations property + * Sets the operations property value. Represents an attack simulation training operation. * @param array|null $value Value to set for the operations property. */ public function setOperations(?array $value): void { @@ -204,7 +204,7 @@ public function setOperations(?array $value): void { } /** - * Sets the payloads property value. The payloads property + * Sets the payloads property value. Represents an attack simulation training campaign payload in a tenant. * @param array|null $value Value to set for the payloads property. */ public function setPayloads(?array $value): void { @@ -228,7 +228,7 @@ public function setSimulations(?array $value): void { } /** - * Sets the trainings property value. The trainings property + * Sets the trainings property value. Represents details about attack simulation trainings. * @param array|null $value Value to set for the trainings property. */ public function setTrainings(?array $value): void { diff --git a/src/Generated/Models/AttackSimulationUser.php b/src/Generated/Models/AttackSimulationUser.php index 1e92dccb769..3d87df194d6 100644 --- a/src/Generated/Models/AttackSimulationUser.php +++ b/src/Generated/Models/AttackSimulationUser.php @@ -106,7 +106,7 @@ public function getOdataType(): ?string { } /** - * Gets the userId property value. This is the id property value of the user resource that represents the user in the Azure Active Directory tenant. + * Gets the userId property value. This is the id property value of the user resource that represents the user in the Microsoft Entra tenant. * @return string|null */ public function getUserId(): ?string { @@ -170,7 +170,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the userId property value. This is the id property value of the user resource that represents the user in the Azure Active Directory tenant. + * Sets the userId property value. This is the id property value of the user resource that represents the user in the Microsoft Entra tenant. * @param string|null $value Value to set for the userId property. */ public function setUserId(?string $value): void { diff --git a/src/Generated/Models/AuthenticationMethodFeatureConfiguration.php b/src/Generated/Models/AuthenticationMethodFeatureConfiguration.php index b868cfd510b..eb56203bf2a 100644 --- a/src/Generated/Models/AuthenticationMethodFeatureConfiguration.php +++ b/src/Generated/Models/AuthenticationMethodFeatureConfiguration.php @@ -106,7 +106,7 @@ public function getOdataType(): ?string { } /** - * Gets the state property value. Enable or disable the feature. Possible values are: default, enabled, disabled, unknownFutureValue. The default value is used when the configuration hasn't been explicitly set and uses the default behavior of Azure AD for the setting. The default value is disabled. + * Gets the state property value. Enable or disable the feature. Possible values are: default, enabled, disabled, unknownFutureValue. The default value is used when the configuration hasn't been explicitly set and uses the default behavior of Microsoft Entra ID for the setting. The default value is disabled. * @return AdvancedConfigState|null */ public function getState(): ?AdvancedConfigState { @@ -170,7 +170,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the state property value. Enable or disable the feature. Possible values are: default, enabled, disabled, unknownFutureValue. The default value is used when the configuration hasn't been explicitly set and uses the default behavior of Azure AD for the setting. The default value is disabled. + * Sets the state property value. Enable or disable the feature. Possible values are: default, enabled, disabled, unknownFutureValue. The default value is used when the configuration hasn't been explicitly set and uses the default behavior of Microsoft Entra ID for the setting. The default value is disabled. * @param AdvancedConfigState|null $value Value to set for the state property. */ public function setState(?AdvancedConfigState $value): void { diff --git a/src/Generated/Models/AuthenticationMethodsRegistrationCampaignIncludeTarget.php b/src/Generated/Models/AuthenticationMethodsRegistrationCampaignIncludeTarget.php index 2a165f72680..92d3fd7e0a6 100644 --- a/src/Generated/Models/AuthenticationMethodsRegistrationCampaignIncludeTarget.php +++ b/src/Generated/Models/AuthenticationMethodsRegistrationCampaignIncludeTarget.php @@ -70,7 +70,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the id property value. The object identifier of an Azure Active Directory user or group. + * Gets the id property value. The object identifier of a Microsoft Entra user or group. * @return string|null */ public function getId(): ?string { @@ -146,7 +146,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the id property value. The object identifier of an Azure Active Directory user or group. + * Sets the id property value. The object identifier of a Microsoft Entra user or group. * @param string|null $value Value to set for the id property. */ public function setId(?string $value): void { diff --git a/src/Generated/Models/AuthorizationPolicy.php b/src/Generated/Models/AuthorizationPolicy.php index baa03b13e55..ebd83ced422 100644 --- a/src/Generated/Models/AuthorizationPolicy.php +++ b/src/Generated/Models/AuthorizationPolicy.php @@ -38,7 +38,7 @@ public function getAllowedToSignUpEmailBasedSubscriptions(): ?bool { } /** - * Gets the allowedToUseSSPR property value. Indicates whether users can use the Self-Serve Password Reset feature on the tenant. + * Gets the allowedToUseSSPR property value. Indicates whether users can use the Self-Service Password Reset feature on the tenant. * @return bool|null */ public function getAllowedToUseSSPR(): ?bool { @@ -86,7 +86,7 @@ public function getAllowUserConsentForRiskyApps(): ?bool { } /** - * Gets the blockMsolPowerShell property value. To disable the use of MSOL PowerShell, set this property to true. This also disables user-based access to the legacy service endpoint used by MSOL PowerShell. This doesn't affect Azure Active Directory Connect or Microsoft Graph. + * Gets the blockMsolPowerShell property value. To disable the use of MSOL PowerShell, set this property to true. This also disables user-based access to the legacy service endpoint used by MSOL PowerShell. This doesn't affect Microsoft Entra Connect or Microsoft Graph. * @return bool|null */ public function getBlockMsolPowerShell(): ?bool { @@ -164,7 +164,7 @@ public function setAllowedToSignUpEmailBasedSubscriptions(?bool $value): void { } /** - * Sets the allowedToUseSSPR property value. Indicates whether users can use the Self-Serve Password Reset feature on the tenant. + * Sets the allowedToUseSSPR property value. Indicates whether users can use the Self-Service Password Reset feature on the tenant. * @param bool|null $value Value to set for the allowedToUseSSPR property. */ public function setAllowedToUseSSPR(?bool $value): void { @@ -196,7 +196,7 @@ public function setAllowUserConsentForRiskyApps(?bool $value): void { } /** - * Sets the blockMsolPowerShell property value. To disable the use of MSOL PowerShell, set this property to true. This also disables user-based access to the legacy service endpoint used by MSOL PowerShell. This doesn't affect Azure Active Directory Connect or Microsoft Graph. + * Sets the blockMsolPowerShell property value. To disable the use of MSOL PowerShell, set this property to true. This also disables user-based access to the legacy service endpoint used by MSOL PowerShell. This doesn't affect Microsoft Entra Connect or Microsoft Graph. * @param bool|null $value Value to set for the blockMsolPowerShell property. */ public function setBlockMsolPowerShell(?bool $value): void { diff --git a/src/Generated/Models/AzureActiveDirectoryTenant.php b/src/Generated/Models/AzureActiveDirectoryTenant.php index 3de5e4cc76d..68e7b365318 100644 --- a/src/Generated/Models/AzureActiveDirectoryTenant.php +++ b/src/Generated/Models/AzureActiveDirectoryTenant.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Azure } /** - * Gets the displayName property value. The name of the Azure Active Directory tenant. Read only. + * Gets the displayName property value. The name of the Microsoft Entra tenant. Read only. * @return string|null */ public function getDisplayName(): ?string { @@ -50,7 +50,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the tenantId property value. The ID of the Azure Active Directory tenant. Read only. + * Gets the tenantId property value. The ID of the Microsoft Entra tenant. Read only. * @return string|null */ public function getTenantId(): ?string { @@ -72,7 +72,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the displayName property value. The name of the Azure Active Directory tenant. Read only. + * Sets the displayName property value. The name of the Microsoft Entra tenant. Read only. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -80,7 +80,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the tenantId property value. The ID of the Azure Active Directory tenant. Read only. + * Sets the tenantId property value. The ID of the Microsoft Entra tenant. Read only. * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { diff --git a/src/Generated/Models/AzureCommunicationServicesUserIdentity.php b/src/Generated/Models/AzureCommunicationServicesUserIdentity.php new file mode 100644 index 00000000000..aa3b4ed98df --- /dev/null +++ b/src/Generated/Models/AzureCommunicationServicesUserIdentity.php @@ -0,0 +1,68 @@ +setOdataType('#microsoft.graph.azureCommunicationServicesUserIdentity'); + } + + /** + * Creates a new instance of the appropriate class based on discriminator value + * @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object + * @return AzureCommunicationServicesUserIdentity + */ + public static function createFromDiscriminatorValue(ParseNode $parseNode): AzureCommunicationServicesUserIdentity { + return new AzureCommunicationServicesUserIdentity(); + } + + /** + * Gets the azureCommunicationServicesResourceId property value. The azureCommunicationServicesResourceId property + * @return string|null + */ + public function getAzureCommunicationServicesResourceId(): ?string { + $val = $this->getBackingStore()->get('azureCommunicationServicesResourceId'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'azureCommunicationServicesResourceId'"); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'azureCommunicationServicesResourceId' => fn(ParseNode $n) => $o->setAzureCommunicationServicesResourceId($n->getStringValue()), + ]); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeStringValue('azureCommunicationServicesResourceId', $this->getAzureCommunicationServicesResourceId()); + } + + /** + * Sets the azureCommunicationServicesResourceId property value. The azureCommunicationServicesResourceId property + * @param string|null $value Value to set for the azureCommunicationServicesResourceId property. + */ + public function setAzureCommunicationServicesResourceId(?string $value): void { + $this->getBackingStore()->set('azureCommunicationServicesResourceId', $value); + } + +} diff --git a/src/Generated/Models/BaseEndUserNotification.php b/src/Generated/Models/BaseEndUserNotification.php index b6decbb57f4..5de04a81d2e 100644 --- a/src/Generated/Models/BaseEndUserNotification.php +++ b/src/Generated/Models/BaseEndUserNotification.php @@ -65,7 +65,7 @@ public function getBackingStore(): BackingStore { } /** - * Gets the defaultLanguage property value. The defaultLanguage property + * Gets the defaultLanguage property value. The default language for the end user notification. * @return string|null */ public function getDefaultLanguage(): ?string { @@ -141,7 +141,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the defaultLanguage property value. The defaultLanguage property + * Sets the defaultLanguage property value. The default language for the end user notification. * @param string|null $value Value to set for the defaultLanguage property. */ public function setDefaultLanguage(?string $value): void { diff --git a/src/Generated/Models/BitlockerRecoveryKey.php b/src/Generated/Models/BitlockerRecoveryKey.php index 3bd32fcf404..ba39c7fdd84 100644 --- a/src/Generated/Models/BitlockerRecoveryKey.php +++ b/src/Generated/Models/BitlockerRecoveryKey.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Bitlo } /** - * Gets the createdDateTime property value. The date and time when the key was originally backed up to Azure Active Directory. Not nullable. + * Gets the createdDateTime property value. The date and time when the key was originally backed up to Microsoft Entra ID. Not nullable. * @return DateTime|null */ public function getCreatedDateTime(): ?DateTime { @@ -100,7 +100,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the createdDateTime property value. The date and time when the key was originally backed up to Azure Active Directory. Not nullable. + * Sets the createdDateTime property value. The date and time when the key was originally backed up to Microsoft Entra ID. Not nullable. * @param DateTime|null $value Value to set for the createdDateTime property. */ public function setCreatedDateTime(?DateTime $value): void { diff --git a/src/Generated/Models/CallRecords/ClientUserAgent.php b/src/Generated/Models/CallRecords/ClientUserAgent.php index f817a673894..064a56b6481 100644 --- a/src/Generated/Models/CallRecords/ClientUserAgent.php +++ b/src/Generated/Models/CallRecords/ClientUserAgent.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Clien } /** - * Gets the azureADAppId property value. The unique identifier of the Azure AD application used by this endpoint. + * Gets the azureADAppId property value. The unique identifier of the Microsoft Entra application used by this endpoint. * @return string|null */ public function getAzureADAppId(): ?string { @@ -100,7 +100,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the azureADAppId property value. The unique identifier of the Azure AD application used by this endpoint. + * Sets the azureADAppId property value. The unique identifier of the Microsoft Entra application used by this endpoint. * @param string|null $value Value to set for the azureADAppId property. */ public function setAzureADAppId(?string $value): void { diff --git a/src/Generated/Models/CallRecords/DirectRoutingLogRow.php b/src/Generated/Models/CallRecords/DirectRoutingLogRow.php index 20a96a86913..3c5449dc840 100644 --- a/src/Generated/Models/CallRecords/DirectRoutingLogRow.php +++ b/src/Generated/Models/CallRecords/DirectRoutingLogRow.php @@ -57,7 +57,7 @@ public function getBackingStore(): BackingStore { } /** - * Gets the calleeNumber property value. Number of the user or bot who received the call. E.164 format, but may include other data. + * Gets the calleeNumber property value. Number of the user or bot who received the call. E.164 format, but might include other data. * @return string|null */ public function getCalleeNumber(): ?string { @@ -69,7 +69,7 @@ public function getCalleeNumber(): ?string { } /** - * Gets the callEndSubReason property value. In addition to the SIP codes, Microsoft has own subcodes that indicate the specific issue. + * Gets the callEndSubReason property value. In addition to the SIP codes, Microsoft has subcodes that indicate the specific issue. * @return int|null */ public function getCallEndSubReason(): ?int { @@ -81,7 +81,7 @@ public function getCallEndSubReason(): ?int { } /** - * Gets the callerNumber property value. Number of the user or bot who made the call. E.164 format, but may include other data. + * Gets the callerNumber property value. Number of the user or bot who made the call. E.164 format, but might include other data. * @return string|null */ public function getCallerNumber(): ?string { @@ -185,7 +185,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the finalSipCode property value. The code with which the call ended, see RFC 3261. + * Gets the finalSipCode property value. The code with which the call ended. For more information, see RFC 3261. * @return int|null */ public function getFinalSipCode(): ?int { @@ -233,7 +233,7 @@ public function getInviteDateTime(): ?DateTime { } /** - * Gets the mediaBypassEnabled property value. Indicates if the trunk was enabled for media bypass or not. + * Gets the mediaBypassEnabled property value. Indicates whether the trunk was enabled for media bypass. * @return bool|null */ public function getMediaBypassEnabled(): ?bool { @@ -245,7 +245,7 @@ public function getMediaBypassEnabled(): ?bool { } /** - * Gets the mediaPathLocation property value. The datacenter used for media path in nonbypass call. + * Gets the mediaPathLocation property value. The datacenter used for media path in a nonbypass call. * @return string|null */ public function getMediaPathLocation(): ?string { @@ -281,7 +281,7 @@ public function getSignalingLocation(): ?string { } /** - * Gets the startDateTime property value. Call start time.For failed and unanswered calls, this can be equal to invite or failure time. + * Gets the startDateTime property value. Call start time.For failed and unanswered calls, this can be equal to the invite or failure time. * @return DateTime|null */ public function getStartDateTime(): ?DateTime { @@ -329,7 +329,7 @@ public function getUserDisplayName(): ?string { } /** - * Gets the userId property value. Calling user's ID in Graph. This and other user info will be null/empty for bot call types. GUID. + * Gets the userId property value. Calling user's ID in Microsoft Graph. This and other user information is null/empty for bot call types. GUID. * @return string|null */ public function getUserId(): ?string { @@ -341,7 +341,7 @@ public function getUserId(): ?string { } /** - * Gets the userPrincipalName property value. UserPrincipalName (sign-in name) in Azure Active Directory. This is usually the same as user's SIP Address, and can be same as user's e-mail address. + * Gets the userPrincipalName property value. UserPrincipalName (sign-in name) in Microsoft Entra ID. This is usually the same as the user's SIP Address, and can be the same as the user's email address. * @return string|null */ public function getUserPrincipalName(): ?string { @@ -399,7 +399,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the calleeNumber property value. Number of the user or bot who received the call. E.164 format, but may include other data. + * Sets the calleeNumber property value. Number of the user or bot who received the call. E.164 format, but might include other data. * @param string|null $value Value to set for the calleeNumber property. */ public function setCalleeNumber(?string $value): void { @@ -407,7 +407,7 @@ public function setCalleeNumber(?string $value): void { } /** - * Sets the callEndSubReason property value. In addition to the SIP codes, Microsoft has own subcodes that indicate the specific issue. + * Sets the callEndSubReason property value. In addition to the SIP codes, Microsoft has subcodes that indicate the specific issue. * @param int|null $value Value to set for the callEndSubReason property. */ public function setCallEndSubReason(?int $value): void { @@ -415,7 +415,7 @@ public function setCallEndSubReason(?int $value): void { } /** - * Sets the callerNumber property value. Number of the user or bot who made the call. E.164 format, but may include other data. + * Sets the callerNumber property value. Number of the user or bot who made the call. E.164 format, but might include other data. * @param string|null $value Value to set for the callerNumber property. */ public function setCallerNumber(?string $value): void { @@ -463,7 +463,7 @@ public function setFailureDateTime(?DateTime $value): void { } /** - * Sets the finalSipCode property value. The code with which the call ended, see RFC 3261. + * Sets the finalSipCode property value. The code with which the call ended. For more information, see RFC 3261. * @param int|null $value Value to set for the finalSipCode property. */ public function setFinalSipCode(?int $value): void { @@ -495,7 +495,7 @@ public function setInviteDateTime(?DateTime $value): void { } /** - * Sets the mediaBypassEnabled property value. Indicates if the trunk was enabled for media bypass or not. + * Sets the mediaBypassEnabled property value. Indicates whether the trunk was enabled for media bypass. * @param bool|null $value Value to set for the mediaBypassEnabled property. */ public function setMediaBypassEnabled(?bool $value): void { @@ -503,7 +503,7 @@ public function setMediaBypassEnabled(?bool $value): void { } /** - * Sets the mediaPathLocation property value. The datacenter used for media path in nonbypass call. + * Sets the mediaPathLocation property value. The datacenter used for media path in a nonbypass call. * @param string|null $value Value to set for the mediaPathLocation property. */ public function setMediaPathLocation(?string $value): void { @@ -527,7 +527,7 @@ public function setSignalingLocation(?string $value): void { } /** - * Sets the startDateTime property value. Call start time.For failed and unanswered calls, this can be equal to invite or failure time. + * Sets the startDateTime property value. Call start time.For failed and unanswered calls, this can be equal to the invite or failure time. * @param DateTime|null $value Value to set for the startDateTime property. */ public function setStartDateTime(?DateTime $value): void { @@ -559,7 +559,7 @@ public function setUserDisplayName(?string $value): void { } /** - * Sets the userId property value. Calling user's ID in Graph. This and other user info will be null/empty for bot call types. GUID. + * Sets the userId property value. Calling user's ID in Microsoft Graph. This and other user information is null/empty for bot call types. GUID. * @param string|null $value Value to set for the userId property. */ public function setUserId(?string $value): void { @@ -567,7 +567,7 @@ public function setUserId(?string $value): void { } /** - * Sets the userPrincipalName property value. UserPrincipalName (sign-in name) in Azure Active Directory. This is usually the same as user's SIP Address, and can be same as user's e-mail address. + * Sets the userPrincipalName property value. UserPrincipalName (sign-in name) in Microsoft Entra ID. This is usually the same as the user's SIP Address, and can be the same as the user's email address. * @param string|null $value Value to set for the userPrincipalName property. */ public function setUserPrincipalName(?string $value): void { diff --git a/src/Generated/Models/CallRecords/PstnCallLogRow.php b/src/Generated/Models/CallRecords/PstnCallLogRow.php index 74686b2093e..d7e6060473a 100644 --- a/src/Generated/Models/CallRecords/PstnCallLogRow.php +++ b/src/Generated/Models/CallRecords/PstnCallLogRow.php @@ -57,7 +57,7 @@ public function getBackingStore(): BackingStore { } /** - * Gets the callDurationSource property value. The source of the call duration data. If the call uses a third-party telecommunications operator via the Operator Connect Program, the operator may provide their own call duration data. In this case, the property value is operator. Otherwise, the value is microsoft. + * Gets the callDurationSource property value. The source of the call duration data. If the call uses a third-party telecommunications operator via the Operator Connect Program, the operator can provide their own call duration data. In this case, the property value is operator. Otherwise, the value is microsoft. * @return PstnCallDurationSource|null */ public function getCallDurationSource(): ?PstnCallDurationSource { @@ -105,7 +105,7 @@ public function getCallId(): ?string { } /** - * Gets the callType property value. Whether the call was a PSTN outbound or inbound call and the type of call such as a call placed by a user or an audio conference. + * Gets the callType property value. Indicates whether the call was a PSTN outbound or inbound call and the type of call, such as a call placed by a user or an audio conference. * @return string|null */ public function getCallType(): ?string { @@ -165,7 +165,7 @@ public function getCurrency(): ?string { } /** - * Gets the destinationContext property value. Whether the call was domestic (within a country or region) or international (outside a country or region) based on the user's location. + * Gets the destinationContext property value. Whether the call was domestic (within a country or region) or international (outside a country or region), based on the user's location. * @return string|null */ public function getDestinationContext(): ?string { @@ -295,7 +295,7 @@ public function getOdataType(): ?string { } /** - * Gets the operator property value. The telecommunications operator which provided PSTN services for this call. This may be Microsoft, or it may be a third-party operator via the Operator Connect Program. + * Gets the operator property value. The telecommunications operator which provided PSTN services for this call. This might be Microsoft, or it might be a third-party operator via the Operator Connect Program. * @return string|null */ public function getOperator(): ?string { @@ -355,7 +355,7 @@ public function getUserDisplayName(): ?string { } /** - * Gets the userId property value. Calling user's ID in Graph. GUID. This and other user info will be null/empty for bot call types (ucapin, ucapout). + * Gets the userId property value. Calling user's ID in Microsoft Graph. GUID. This and other user info will be null/empty for bot call types (ucapin, ucapout). * @return string|null */ public function getUserId(): ?string { @@ -367,7 +367,7 @@ public function getUserId(): ?string { } /** - * Gets the userPrincipalName property value. The user principal name (sign-in name) in Azure Active Directory. This is usually the same as the user's SIP address, and can be same as the user's e-mail address. + * Gets the userPrincipalName property value. The user principal name (sign-in name) in Microsoft Entra ID. This is usually the same as the user's SIP address, and can be the same as the user's email address. * @return string|null */ public function getUserPrincipalName(): ?string { @@ -427,7 +427,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the callDurationSource property value. The source of the call duration data. If the call uses a third-party telecommunications operator via the Operator Connect Program, the operator may provide their own call duration data. In this case, the property value is operator. Otherwise, the value is microsoft. + * Sets the callDurationSource property value. The source of the call duration data. If the call uses a third-party telecommunications operator via the Operator Connect Program, the operator can provide their own call duration data. In this case, the property value is operator. Otherwise, the value is microsoft. * @param PstnCallDurationSource|null $value Value to set for the callDurationSource property. */ public function setCallDurationSource(?PstnCallDurationSource $value): void { @@ -459,7 +459,7 @@ public function setCallId(?string $value): void { } /** - * Sets the callType property value. Whether the call was a PSTN outbound or inbound call and the type of call such as a call placed by a user or an audio conference. + * Sets the callType property value. Indicates whether the call was a PSTN outbound or inbound call and the type of call, such as a call placed by a user or an audio conference. * @param string|null $value Value to set for the callType property. */ public function setCallType(?string $value): void { @@ -499,7 +499,7 @@ public function setCurrency(?string $value): void { } /** - * Sets the destinationContext property value. Whether the call was domestic (within a country or region) or international (outside a country or region) based on the user's location. + * Sets the destinationContext property value. Whether the call was domestic (within a country or region) or international (outside a country or region), based on the user's location. * @param string|null $value Value to set for the destinationContext property. */ public function setDestinationContext(?string $value): void { @@ -563,7 +563,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the operator property value. The telecommunications operator which provided PSTN services for this call. This may be Microsoft, or it may be a third-party operator via the Operator Connect Program. + * Sets the operator property value. The telecommunications operator which provided PSTN services for this call. This might be Microsoft, or it might be a third-party operator via the Operator Connect Program. * @param string|null $value Value to set for the operator property. */ public function setOperator(?string $value): void { @@ -603,7 +603,7 @@ public function setUserDisplayName(?string $value): void { } /** - * Sets the userId property value. Calling user's ID in Graph. GUID. This and other user info will be null/empty for bot call types (ucapin, ucapout). + * Sets the userId property value. Calling user's ID in Microsoft Graph. GUID. This and other user info will be null/empty for bot call types (ucapin, ucapout). * @param string|null $value Value to set for the userId property. */ public function setUserId(?string $value): void { @@ -611,7 +611,7 @@ public function setUserId(?string $value): void { } /** - * Sets the userPrincipalName property value. The user principal name (sign-in name) in Azure Active Directory. This is usually the same as the user's SIP address, and can be same as the user's e-mail address. + * Sets the userPrincipalName property value. The user principal name (sign-in name) in Microsoft Entra ID. This is usually the same as the user's SIP address, and can be the same as the user's email address. * @param string|null $value Value to set for the userPrincipalName property. */ public function setUserPrincipalName(?string $value): void { diff --git a/src/Generated/Models/Channel.php b/src/Generated/Models/Channel.php index 72898e789b4..9cadcb757ab 100644 --- a/src/Generated/Models/Channel.php +++ b/src/Generated/Models/Channel.php @@ -91,6 +91,7 @@ public function getFieldDeserializers(): array { 'membershipType' => fn(ParseNode $n) => $o->setMembershipType($n->getEnumValue(ChannelMembershipType::class)), 'messages' => fn(ParseNode $n) => $o->setMessages($n->getCollectionOfObjectValues([ChatMessage::class, 'createFromDiscriminatorValue'])), 'sharedWithTeams' => fn(ParseNode $n) => $o->setSharedWithTeams($n->getCollectionOfObjectValues([SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'])), + 'summary' => fn(ParseNode $n) => $o->setSummary($n->getObjectValue([ChannelSummary::class, 'createFromDiscriminatorValue'])), 'tabs' => fn(ParseNode $n) => $o->setTabs($n->getCollectionOfObjectValues([TeamsTab::class, 'createFromDiscriminatorValue'])), 'tenantId' => fn(ParseNode $n) => $o->setTenantId($n->getStringValue()), 'webUrl' => fn(ParseNode $n) => $o->setWebUrl($n->getStringValue()), @@ -175,6 +176,18 @@ public function getSharedWithTeams(): ?array { throw new \UnexpectedValueException("Invalid type found in backing store for 'sharedWithTeams'"); } + /** + * Gets the summary property value. Contains summary information about the channel, including number of owners, members, guests, and an indicator for members from other tenants. The summary property will only be returned if it is specified in the $select clause of the Get channel method. + * @return ChannelSummary|null + */ + public function getSummary(): ?ChannelSummary { + $val = $this->getBackingStore()->get('summary'); + if (is_null($val) || $val instanceof ChannelSummary) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'summary'"); + } + /** * Gets the tabs property value. A collection of all the tabs in the channel. A navigation property. * @return array|null @@ -190,7 +203,7 @@ public function getTabs(): ?array { } /** - * Gets the tenantId property value. The ID of the Azure Active Directory tenant. + * Gets the tenantId property value. The ID of the Microsoft Entra tenant. * @return string|null */ public function getTenantId(): ?string { @@ -229,6 +242,7 @@ public function serialize(SerializationWriter $writer): void { $writer->writeEnumValue('membershipType', $this->getMembershipType()); $writer->writeCollectionOfObjectValues('messages', $this->getMessages()); $writer->writeCollectionOfObjectValues('sharedWithTeams', $this->getSharedWithTeams()); + $writer->writeObjectValue('summary', $this->getSummary()); $writer->writeCollectionOfObjectValues('tabs', $this->getTabs()); $writer->writeStringValue('tenantId', $this->getTenantId()); $writer->writeStringValue('webUrl', $this->getWebUrl()); @@ -314,6 +328,14 @@ public function setSharedWithTeams(?array $value): void { $this->getBackingStore()->set('sharedWithTeams', $value); } + /** + * Sets the summary property value. Contains summary information about the channel, including number of owners, members, guests, and an indicator for members from other tenants. The summary property will only be returned if it is specified in the $select clause of the Get channel method. + * @param ChannelSummary|null $value Value to set for the summary property. + */ + public function setSummary(?ChannelSummary $value): void { + $this->getBackingStore()->set('summary', $value); + } + /** * Sets the tabs property value. A collection of all the tabs in the channel. A navigation property. * @param array|null $value Value to set for the tabs property. @@ -323,7 +345,7 @@ public function setTabs(?array $value): void { } /** - * Sets the tenantId property value. The ID of the Azure Active Directory tenant. + * Sets the tenantId property value. The ID of the Microsoft Entra tenant. * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { diff --git a/src/Generated/Models/ChannelSummary.php b/src/Generated/Models/ChannelSummary.php new file mode 100644 index 00000000000..5e10d4bd51b --- /dev/null +++ b/src/Generated/Models/ChannelSummary.php @@ -0,0 +1,202 @@ +backingStore = BackingStoreFactorySingleton::getInstance()->createBackingStore(); + $this->setAdditionalData([]); + } + + /** + * Creates a new instance of the appropriate class based on discriminator value + * @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object + * @return ChannelSummary + */ + public static function createFromDiscriminatorValue(ParseNode $parseNode): ChannelSummary { + return new ChannelSummary(); + } + + /** + * Gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + * @return array|null + */ + public function getAdditionalData(): ?array { + $val = $this->getBackingStore()->get('additionalData'); + if (is_null($val) || is_array($val)) { + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'additionalData'"); + } + + /** + * Gets the BackingStore property value. Stores model information. + * @return BackingStore + */ + public function getBackingStore(): BackingStore { + return $this->backingStore; + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return [ + 'guestsCount' => fn(ParseNode $n) => $o->setGuestsCount($n->getIntegerValue()), + 'hasMembersFromOtherTenants' => fn(ParseNode $n) => $o->setHasMembersFromOtherTenants($n->getBooleanValue()), + 'membersCount' => fn(ParseNode $n) => $o->setMembersCount($n->getIntegerValue()), + '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()), + 'ownersCount' => fn(ParseNode $n) => $o->setOwnersCount($n->getIntegerValue()), + ]; + } + + /** + * Gets the guestsCount property value. Count of guests in a channel. + * @return int|null + */ + public function getGuestsCount(): ?int { + $val = $this->getBackingStore()->get('guestsCount'); + if (is_null($val) || is_int($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'guestsCount'"); + } + + /** + * Gets the hasMembersFromOtherTenants property value. Indicates whether external members are included on the channel. + * @return bool|null + */ + public function getHasMembersFromOtherTenants(): ?bool { + $val = $this->getBackingStore()->get('hasMembersFromOtherTenants'); + if (is_null($val) || is_bool($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'hasMembersFromOtherTenants'"); + } + + /** + * Gets the membersCount property value. Count of members in a channel. + * @return int|null + */ + public function getMembersCount(): ?int { + $val = $this->getBackingStore()->get('membersCount'); + if (is_null($val) || is_int($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'membersCount'"); + } + + /** + * Gets the @odata.type property value. The OdataType property + * @return string|null + */ + public function getOdataType(): ?string { + $val = $this->getBackingStore()->get('odataType'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'odataType'"); + } + + /** + * Gets the ownersCount property value. Count of owners in a channel. + * @return int|null + */ + public function getOwnersCount(): ?int { + $val = $this->getBackingStore()->get('ownersCount'); + if (is_null($val) || is_int($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'ownersCount'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + $writer->writeIntegerValue('guestsCount', $this->getGuestsCount()); + $writer->writeBooleanValue('hasMembersFromOtherTenants', $this->getHasMembersFromOtherTenants()); + $writer->writeIntegerValue('membersCount', $this->getMembersCount()); + $writer->writeStringValue('@odata.type', $this->getOdataType()); + $writer->writeIntegerValue('ownersCount', $this->getOwnersCount()); + $writer->writeAdditionalData($this->getAdditionalData()); + } + + /** + * Sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + * @param array $value Value to set for the AdditionalData property. + */ + public function setAdditionalData(?array $value): void { + $this->getBackingStore()->set('additionalData', $value); + } + + /** + * Sets the BackingStore property value. Stores model information. + * @param BackingStore $value Value to set for the BackingStore property. + */ + public function setBackingStore(BackingStore $value): void { + $this->backingStore = $value; + } + + /** + * Sets the guestsCount property value. Count of guests in a channel. + * @param int|null $value Value to set for the guestsCount property. + */ + public function setGuestsCount(?int $value): void { + $this->getBackingStore()->set('guestsCount', $value); + } + + /** + * Sets the hasMembersFromOtherTenants property value. Indicates whether external members are included on the channel. + * @param bool|null $value Value to set for the hasMembersFromOtherTenants property. + */ + public function setHasMembersFromOtherTenants(?bool $value): void { + $this->getBackingStore()->set('hasMembersFromOtherTenants', $value); + } + + /** + * Sets the membersCount property value. Count of members in a channel. + * @param int|null $value Value to set for the membersCount property. + */ + public function setMembersCount(?int $value): void { + $this->getBackingStore()->set('membersCount', $value); + } + + /** + * Sets the @odata.type property value. The OdataType property + * @param string|null $value Value to set for the @odata.type property. + */ + public function setOdataType(?string $value): void { + $this->getBackingStore()->set('odataType', $value); + } + + /** + * Sets the ownersCount property value. Count of owners in a channel. + * @param int|null $value Value to set for the ownersCount property. + */ + public function setOwnersCount(?int $value): void { + $this->getBackingStore()->set('ownersCount', $value); + } + +} diff --git a/src/Generated/Models/CoachmarkLocation.php b/src/Generated/Models/CoachmarkLocation.php index 2bc12b90048..ea5c07108aa 100644 --- a/src/Generated/Models/CoachmarkLocation.php +++ b/src/Generated/Models/CoachmarkLocation.php @@ -70,7 +70,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the length property value. The length property + * Gets the length property value. Length of coachmark. * @return int|null */ public function getLength(): ?int { @@ -94,7 +94,7 @@ public function getOdataType(): ?string { } /** - * Gets the offset property value. The offset property + * Gets the offset property value. Offset of coachmark. * @return int|null */ public function getOffset(): ?int { @@ -106,7 +106,7 @@ public function getOffset(): ?int { } /** - * Gets the type property value. The type property + * Gets the type property value. Type of coachmark location. The possible values are: unknown, fromEmail, subject, externalTag, displayName, messageBody, unknownFutureValue. * @return CoachmarkLocationType|null */ public function getType(): ?CoachmarkLocationType { @@ -146,7 +146,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the length property value. The length property + * Sets the length property value. Length of coachmark. * @param int|null $value Value to set for the length property. */ public function setLength(?int $value): void { @@ -162,7 +162,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the offset property value. The offset property + * Sets the offset property value. Offset of coachmark. * @param int|null $value Value to set for the offset property. */ public function setOffset(?int $value): void { @@ -170,7 +170,7 @@ public function setOffset(?int $value): void { } /** - * Sets the type property value. The type property + * Sets the type property value. Type of coachmark location. The possible values are: unknown, fromEmail, subject, externalTag, displayName, messageBody, unknownFutureValue. * @param CoachmarkLocationType|null $value Value to set for the type property. */ public function setType(?CoachmarkLocationType $value): void { diff --git a/src/Generated/Models/CommunicationsApplicationIdentity.php b/src/Generated/Models/CommunicationsApplicationIdentity.php new file mode 100644 index 00000000000..1c879074ef4 --- /dev/null +++ b/src/Generated/Models/CommunicationsApplicationIdentity.php @@ -0,0 +1,90 @@ +setOdataType('#microsoft.graph.communicationsApplicationIdentity'); + } + + /** + * Creates a new instance of the appropriate class based on discriminator value + * @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object + * @return CommunicationsApplicationIdentity + */ + public static function createFromDiscriminatorValue(ParseNode $parseNode): CommunicationsApplicationIdentity { + return new CommunicationsApplicationIdentity(); + } + + /** + * Gets the applicationType property value. The applicationType property + * @return string|null + */ + public function getApplicationType(): ?string { + $val = $this->getBackingStore()->get('applicationType'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'applicationType'"); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'applicationType' => fn(ParseNode $n) => $o->setApplicationType($n->getStringValue()), + 'hidden' => fn(ParseNode $n) => $o->setHidden($n->getBooleanValue()), + ]); + } + + /** + * Gets the hidden property value. The hidden property + * @return bool|null + */ + public function getHidden(): ?bool { + $val = $this->getBackingStore()->get('hidden'); + if (is_null($val) || is_bool($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'hidden'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeStringValue('applicationType', $this->getApplicationType()); + $writer->writeBooleanValue('hidden', $this->getHidden()); + } + + /** + * Sets the applicationType property value. The applicationType property + * @param string|null $value Value to set for the applicationType property. + */ + public function setApplicationType(?string $value): void { + $this->getBackingStore()->set('applicationType', $value); + } + + /** + * Sets the hidden property value. The hidden property + * @param bool|null $value Value to set for the hidden property. + */ + public function setHidden(?bool $value): void { + $this->getBackingStore()->set('hidden', $value); + } + +} diff --git a/src/Generated/Models/CommunicationsApplicationInstanceIdentity.php b/src/Generated/Models/CommunicationsApplicationInstanceIdentity.php new file mode 100644 index 00000000000..e39d4149ab0 --- /dev/null +++ b/src/Generated/Models/CommunicationsApplicationInstanceIdentity.php @@ -0,0 +1,90 @@ +setOdataType('#microsoft.graph.communicationsApplicationInstanceIdentity'); + } + + /** + * Creates a new instance of the appropriate class based on discriminator value + * @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object + * @return CommunicationsApplicationInstanceIdentity + */ + public static function createFromDiscriminatorValue(ParseNode $parseNode): CommunicationsApplicationInstanceIdentity { + return new CommunicationsApplicationInstanceIdentity(); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'hidden' => fn(ParseNode $n) => $o->setHidden($n->getBooleanValue()), + 'tenantId' => fn(ParseNode $n) => $o->setTenantId($n->getStringValue()), + ]); + } + + /** + * Gets the hidden property value. The hidden property + * @return bool|null + */ + public function getHidden(): ?bool { + $val = $this->getBackingStore()->get('hidden'); + if (is_null($val) || is_bool($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'hidden'"); + } + + /** + * Gets the tenantId property value. The tenantId property + * @return string|null + */ + public function getTenantId(): ?string { + $val = $this->getBackingStore()->get('tenantId'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'tenantId'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeBooleanValue('hidden', $this->getHidden()); + $writer->writeStringValue('tenantId', $this->getTenantId()); + } + + /** + * Sets the hidden property value. The hidden property + * @param bool|null $value Value to set for the hidden property. + */ + public function setHidden(?bool $value): void { + $this->getBackingStore()->set('hidden', $value); + } + + /** + * Sets the tenantId property value. The tenantId property + * @param string|null $value Value to set for the tenantId property. + */ + public function setTenantId(?string $value): void { + $this->getBackingStore()->set('tenantId', $value); + } + +} diff --git a/src/Generated/Models/CommunicationsEncryptedIdentity.php b/src/Generated/Models/CommunicationsEncryptedIdentity.php new file mode 100644 index 00000000000..15e9119e705 --- /dev/null +++ b/src/Generated/Models/CommunicationsEncryptedIdentity.php @@ -0,0 +1,46 @@ +setOdataType('#microsoft.graph.communicationsEncryptedIdentity'); + } + + /** + * Creates a new instance of the appropriate class based on discriminator value + * @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object + * @return CommunicationsEncryptedIdentity + */ + public static function createFromDiscriminatorValue(ParseNode $parseNode): CommunicationsEncryptedIdentity { + return new CommunicationsEncryptedIdentity(); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + ]); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + } + +} diff --git a/src/Generated/Models/CommunicationsGuestIdentity.php b/src/Generated/Models/CommunicationsGuestIdentity.php new file mode 100644 index 00000000000..e756d00b4fa --- /dev/null +++ b/src/Generated/Models/CommunicationsGuestIdentity.php @@ -0,0 +1,46 @@ +setOdataType('#microsoft.graph.communicationsGuestIdentity'); + } + + /** + * Creates a new instance of the appropriate class based on discriminator value + * @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object + * @return CommunicationsGuestIdentity + */ + public static function createFromDiscriminatorValue(ParseNode $parseNode): CommunicationsGuestIdentity { + return new CommunicationsGuestIdentity(); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + ]); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + } + +} diff --git a/src/Generated/Models/CommunicationsIdentitySet.php b/src/Generated/Models/CommunicationsIdentitySet.php new file mode 100644 index 00000000000..81aa961a1de --- /dev/null +++ b/src/Generated/Models/CommunicationsIdentitySet.php @@ -0,0 +1,222 @@ +setOdataType('#microsoft.graph.communicationsIdentitySet'); + } + + /** + * Creates a new instance of the appropriate class based on discriminator value + * @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object + * @return CommunicationsIdentitySet + */ + public static function createFromDiscriminatorValue(ParseNode $parseNode): CommunicationsIdentitySet { + return new CommunicationsIdentitySet(); + } + + /** + * Gets the applicationInstance property value. The applicationInstance property + * @return Identity|null + */ + public function getApplicationInstance(): ?Identity { + $val = $this->getBackingStore()->get('applicationInstance'); + if (is_null($val) || $val instanceof Identity) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'applicationInstance'"); + } + + /** + * Gets the assertedIdentity property value. The assertedIdentity property + * @return Identity|null + */ + public function getAssertedIdentity(): ?Identity { + $val = $this->getBackingStore()->get('assertedIdentity'); + if (is_null($val) || $val instanceof Identity) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'assertedIdentity'"); + } + + /** + * Gets the azureCommunicationServicesUser property value. The azureCommunicationServicesUser property + * @return Identity|null + */ + public function getAzureCommunicationServicesUser(): ?Identity { + $val = $this->getBackingStore()->get('azureCommunicationServicesUser'); + if (is_null($val) || $val instanceof Identity) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'azureCommunicationServicesUser'"); + } + + /** + * Gets the encrypted property value. The encrypted property + * @return Identity|null + */ + public function getEncrypted(): ?Identity { + $val = $this->getBackingStore()->get('encrypted'); + if (is_null($val) || $val instanceof Identity) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'encrypted'"); + } + + /** + * Gets the endpointType property value. The endpointType property + * @return EndpointType|null + */ + public function getEndpointType(): ?EndpointType { + $val = $this->getBackingStore()->get('endpointType'); + if (is_null($val) || $val instanceof EndpointType) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'endpointType'"); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'applicationInstance' => fn(ParseNode $n) => $o->setApplicationInstance($n->getObjectValue([Identity::class, 'createFromDiscriminatorValue'])), + 'assertedIdentity' => fn(ParseNode $n) => $o->setAssertedIdentity($n->getObjectValue([Identity::class, 'createFromDiscriminatorValue'])), + 'azureCommunicationServicesUser' => fn(ParseNode $n) => $o->setAzureCommunicationServicesUser($n->getObjectValue([Identity::class, 'createFromDiscriminatorValue'])), + 'encrypted' => fn(ParseNode $n) => $o->setEncrypted($n->getObjectValue([Identity::class, 'createFromDiscriminatorValue'])), + 'endpointType' => fn(ParseNode $n) => $o->setEndpointType($n->getEnumValue(EndpointType::class)), + 'guest' => fn(ParseNode $n) => $o->setGuest($n->getObjectValue([Identity::class, 'createFromDiscriminatorValue'])), + 'onPremises' => fn(ParseNode $n) => $o->setOnPremises($n->getObjectValue([Identity::class, 'createFromDiscriminatorValue'])), + 'phone' => fn(ParseNode $n) => $o->setPhone($n->getObjectValue([Identity::class, 'createFromDiscriminatorValue'])), + ]); + } + + /** + * Gets the guest property value. The guest property + * @return Identity|null + */ + public function getGuest(): ?Identity { + $val = $this->getBackingStore()->get('guest'); + if (is_null($val) || $val instanceof Identity) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'guest'"); + } + + /** + * Gets the onPremises property value. The onPremises property + * @return Identity|null + */ + public function getOnPremises(): ?Identity { + $val = $this->getBackingStore()->get('onPremises'); + if (is_null($val) || $val instanceof Identity) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'onPremises'"); + } + + /** + * Gets the phone property value. The phone property + * @return Identity|null + */ + public function getPhone(): ?Identity { + $val = $this->getBackingStore()->get('phone'); + if (is_null($val) || $val instanceof Identity) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'phone'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeObjectValue('applicationInstance', $this->getApplicationInstance()); + $writer->writeObjectValue('assertedIdentity', $this->getAssertedIdentity()); + $writer->writeObjectValue('azureCommunicationServicesUser', $this->getAzureCommunicationServicesUser()); + $writer->writeObjectValue('encrypted', $this->getEncrypted()); + $writer->writeEnumValue('endpointType', $this->getEndpointType()); + $writer->writeObjectValue('guest', $this->getGuest()); + $writer->writeObjectValue('onPremises', $this->getOnPremises()); + $writer->writeObjectValue('phone', $this->getPhone()); + } + + /** + * Sets the applicationInstance property value. The applicationInstance property + * @param Identity|null $value Value to set for the applicationInstance property. + */ + public function setApplicationInstance(?Identity $value): void { + $this->getBackingStore()->set('applicationInstance', $value); + } + + /** + * Sets the assertedIdentity property value. The assertedIdentity property + * @param Identity|null $value Value to set for the assertedIdentity property. + */ + public function setAssertedIdentity(?Identity $value): void { + $this->getBackingStore()->set('assertedIdentity', $value); + } + + /** + * Sets the azureCommunicationServicesUser property value. The azureCommunicationServicesUser property + * @param Identity|null $value Value to set for the azureCommunicationServicesUser property. + */ + public function setAzureCommunicationServicesUser(?Identity $value): void { + $this->getBackingStore()->set('azureCommunicationServicesUser', $value); + } + + /** + * Sets the encrypted property value. The encrypted property + * @param Identity|null $value Value to set for the encrypted property. + */ + public function setEncrypted(?Identity $value): void { + $this->getBackingStore()->set('encrypted', $value); + } + + /** + * Sets the endpointType property value. The endpointType property + * @param EndpointType|null $value Value to set for the endpointType property. + */ + public function setEndpointType(?EndpointType $value): void { + $this->getBackingStore()->set('endpointType', $value); + } + + /** + * Sets the guest property value. The guest property + * @param Identity|null $value Value to set for the guest property. + */ + public function setGuest(?Identity $value): void { + $this->getBackingStore()->set('guest', $value); + } + + /** + * Sets the onPremises property value. The onPremises property + * @param Identity|null $value Value to set for the onPremises property. + */ + public function setOnPremises(?Identity $value): void { + $this->getBackingStore()->set('onPremises', $value); + } + + /** + * Sets the phone property value. The phone property + * @param Identity|null $value Value to set for the phone property. + */ + public function setPhone(?Identity $value): void { + $this->getBackingStore()->set('phone', $value); + } + +} diff --git a/src/Generated/Models/CommunicationsPhoneIdentity.php b/src/Generated/Models/CommunicationsPhoneIdentity.php new file mode 100644 index 00000000000..7885d198b0b --- /dev/null +++ b/src/Generated/Models/CommunicationsPhoneIdentity.php @@ -0,0 +1,46 @@ +setOdataType('#microsoft.graph.communicationsPhoneIdentity'); + } + + /** + * Creates a new instance of the appropriate class based on discriminator value + * @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object + * @return CommunicationsPhoneIdentity + */ + public static function createFromDiscriminatorValue(ParseNode $parseNode): CommunicationsPhoneIdentity { + return new CommunicationsPhoneIdentity(); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + ]); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + } + +} diff --git a/src/Generated/Models/CommunicationsUserIdentity.php b/src/Generated/Models/CommunicationsUserIdentity.php new file mode 100644 index 00000000000..24d2186ba56 --- /dev/null +++ b/src/Generated/Models/CommunicationsUserIdentity.php @@ -0,0 +1,68 @@ +setOdataType('#microsoft.graph.communicationsUserIdentity'); + } + + /** + * Creates a new instance of the appropriate class based on discriminator value + * @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object + * @return CommunicationsUserIdentity + */ + public static function createFromDiscriminatorValue(ParseNode $parseNode): CommunicationsUserIdentity { + return new CommunicationsUserIdentity(); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'tenantId' => fn(ParseNode $n) => $o->setTenantId($n->getStringValue()), + ]); + } + + /** + * Gets the tenantId property value. The tenantId property + * @return string|null + */ + public function getTenantId(): ?string { + $val = $this->getBackingStore()->get('tenantId'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'tenantId'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeStringValue('tenantId', $this->getTenantId()); + } + + /** + * Sets the tenantId property value. The tenantId property + * @param string|null $value Value to set for the tenantId property. + */ + public function setTenantId(?string $value): void { + $this->getBackingStore()->set('tenantId', $value); + } + +} diff --git a/src/Generated/Models/ConditionalAccessFilter.php b/src/Generated/Models/ConditionalAccessFilter.php index 7033b059025..f7b8a0d7043 100644 --- a/src/Generated/Models/ConditionalAccessFilter.php +++ b/src/Generated/Models/ConditionalAccessFilter.php @@ -93,7 +93,7 @@ public function getOdataType(): ?string { } /** - * Gets the rule property value. Rule syntax is similar to that used for membership rules for groups in Azure Active Directory (Azure AD). For details, see rules with multiple expressions + * Gets the rule property value. Rule syntax is similar to that used for membership rules for groups in Microsoft Entra ID. For details, see rules with multiple expressions * @return string|null */ public function getRule(): ?string { @@ -148,7 +148,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the rule property value. Rule syntax is similar to that used for membership rules for groups in Azure Active Directory (Azure AD). For details, see rules with multiple expressions + * Sets the rule property value. Rule syntax is similar to that used for membership rules for groups in Microsoft Entra ID. For details, see rules with multiple expressions * @param string|null $value Value to set for the rule property. */ public function setRule(?string $value): void { diff --git a/src/Generated/Models/ConditionalAccessSessionControls.php b/src/Generated/Models/ConditionalAccessSessionControls.php index db698275ff6..e1542e4a689 100644 --- a/src/Generated/Models/ConditionalAccessSessionControls.php +++ b/src/Generated/Models/ConditionalAccessSessionControls.php @@ -80,7 +80,7 @@ public function getCloudAppSecurity(): ?CloudAppSecuritySessionControl { } /** - * Gets the disableResilienceDefaults property value. Session control that determines whether it is acceptable for Azure AD to extend existing sessions based on information collected prior to an outage or not. + * Gets the disableResilienceDefaults property value. Session control that determines whether it is acceptable for Microsoft Entra ID to extend existing sessions based on information collected prior to an outage or not. * @return bool|null */ public function getDisableResilienceDefaults(): ?bool { @@ -190,7 +190,7 @@ public function setCloudAppSecurity(?CloudAppSecuritySessionControl $value): voi } /** - * Sets the disableResilienceDefaults property value. Session control that determines whether it is acceptable for Azure AD to extend existing sessions based on information collected prior to an outage or not. + * Sets the disableResilienceDefaults property value. Session control that determines whether it is acceptable for Microsoft Entra ID to extend existing sessions based on information collected prior to an outage or not. * @param bool|null $value Value to set for the disableResilienceDefaults property. */ public function setDisableResilienceDefaults(?bool $value): void { diff --git a/src/Generated/Models/CrossCloudAzureActiveDirectoryTenant.php b/src/Generated/Models/CrossCloudAzureActiveDirectoryTenant.php index 6aaab5749ee..02c982d696e 100644 --- a/src/Generated/Models/CrossCloudAzureActiveDirectoryTenant.php +++ b/src/Generated/Models/CrossCloudAzureActiveDirectoryTenant.php @@ -38,7 +38,7 @@ public function getCloudInstance(): ?string { } /** - * Gets the displayName property value. The name of the Azure Active Directory tenant. Read only. + * Gets the displayName property value. The name of the Microsoft Entra tenant. Read only. * @return string|null */ public function getDisplayName(): ?string { @@ -63,7 +63,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the tenantId property value. The ID of the Azure Active Directory tenant. Read only. + * Gets the tenantId property value. The ID of the Microsoft Entra tenant. Read only. * @return string|null */ public function getTenantId(): ?string { @@ -94,7 +94,7 @@ public function setCloudInstance(?string $value): void { } /** - * Sets the displayName property value. The name of the Azure Active Directory tenant. Read only. + * Sets the displayName property value. The name of the Microsoft Entra tenant. Read only. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -102,7 +102,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the tenantId property value. The ID of the Azure Active Directory tenant. Read only. + * Sets the tenantId property value. The ID of the Microsoft Entra tenant. Read only. * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { diff --git a/src/Generated/Models/CrossTenantAccessPolicy.php b/src/Generated/Models/CrossTenantAccessPolicy.php index 355d284c848..6f79aa17e1e 100644 --- a/src/Generated/Models/CrossTenantAccessPolicy.php +++ b/src/Generated/Models/CrossTenantAccessPolicy.php @@ -41,7 +41,7 @@ public function getAllowedCloudEndpoints(): ?array { } /** - * Gets the default property value. Defines the default configuration for how your organization interacts with external Azure Active Directory organizations. + * Gets the default property value. Defines the default configuration for how your organization interacts with external Microsoft Entra organizations. * @return CrossTenantAccessPolicyConfigurationDefault|null */ public function getEscapedDefault(): ?CrossTenantAccessPolicyConfigurationDefault { @@ -73,7 +73,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the partners property value. Defines partner-specific configurations for external Azure Active Directory organizations. + * Gets the partners property value. Defines partner-specific configurations for external Microsoft Entra organizations. * @return array|null */ public function getPartners(): ?array { @@ -106,7 +106,7 @@ public function setAllowedCloudEndpoints(?array $value): void { } /** - * Sets the default property value. Defines the default configuration for how your organization interacts with external Azure Active Directory organizations. + * Sets the default property value. Defines the default configuration for how your organization interacts with external Microsoft Entra organizations. * @param CrossTenantAccessPolicyConfigurationDefault|null $value Value to set for the default property. */ public function setEscapedDefault(?CrossTenantAccessPolicyConfigurationDefault $value): void { @@ -114,7 +114,7 @@ public function setEscapedDefault(?CrossTenantAccessPolicyConfigurationDefault $ } /** - * Sets the partners property value. Defines partner-specific configurations for external Azure Active Directory organizations. + * Sets the partners property value. Defines partner-specific configurations for external Microsoft Entra organizations. * @param array|null $value Value to set for the partners property. */ public function setPartners(?array $value): void { diff --git a/src/Generated/Models/CrossTenantAccessPolicyConfigurationDefault.php b/src/Generated/Models/CrossTenantAccessPolicyConfigurationDefault.php index c93a88255ea..0017856e308 100644 --- a/src/Generated/Models/CrossTenantAccessPolicyConfigurationDefault.php +++ b/src/Generated/Models/CrossTenantAccessPolicyConfigurationDefault.php @@ -37,7 +37,7 @@ public function getAutomaticUserConsentSettings(): ?InboundOutboundPolicyConfigu } /** - * Gets the b2bCollaborationInbound property value. Defines your default configuration for users from other organizations accessing your resources via Azure AD B2B collaboration. + * Gets the b2bCollaborationInbound property value. Defines your default configuration for users from other organizations accessing your resources via Microsoft Entra B2B collaboration. * @return CrossTenantAccessPolicyB2BSetting|null */ public function getB2bCollaborationInbound(): ?CrossTenantAccessPolicyB2BSetting { @@ -49,7 +49,7 @@ public function getB2bCollaborationInbound(): ?CrossTenantAccessPolicyB2BSetting } /** - * Gets the b2bCollaborationOutbound property value. Defines your default configuration for users in your organization going outbound to access resources in another organization via Azure AD B2B collaboration. + * Gets the b2bCollaborationOutbound property value. Defines your default configuration for users in your organization going outbound to access resources in another organization via Microsoft Entra B2B collaboration. * @return CrossTenantAccessPolicyB2BSetting|null */ public function getB2bCollaborationOutbound(): ?CrossTenantAccessPolicyB2BSetting { @@ -61,7 +61,7 @@ public function getB2bCollaborationOutbound(): ?CrossTenantAccessPolicyB2BSettin } /** - * Gets the b2bDirectConnectInbound property value. Defines your default configuration for users from other organizations accessing your resources via Azure AD B2B direct connect. + * Gets the b2bDirectConnectInbound property value. Defines your default configuration for users from other organizations accessing your resources via Microsoft Entra B2B direct connect. * @return CrossTenantAccessPolicyB2BSetting|null */ public function getB2bDirectConnectInbound(): ?CrossTenantAccessPolicyB2BSetting { @@ -73,7 +73,7 @@ public function getB2bDirectConnectInbound(): ?CrossTenantAccessPolicyB2BSetting } /** - * Gets the b2bDirectConnectOutbound property value. Defines your default configuration for users in your organization going outbound to access resources in another organization via Azure AD B2B direct connect. + * Gets the b2bDirectConnectOutbound property value. Defines your default configuration for users in your organization going outbound to access resources in another organization via Microsoft Entra B2B direct connect. * @return CrossTenantAccessPolicyB2BSetting|null */ public function getB2bDirectConnectOutbound(): ?CrossTenantAccessPolicyB2BSetting { @@ -102,7 +102,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the inboundTrust property value. Determines the default configuration for trusting other Conditional Access claims from external Azure AD organizations. + * Gets the inboundTrust property value. Determines the default configuration for trusting other Conditional Access claims from external Microsoft Entra organizations. * @return CrossTenantAccessPolicyInboundTrust|null */ public function getInboundTrust(): ?CrossTenantAccessPolicyInboundTrust { @@ -149,7 +149,7 @@ public function setAutomaticUserConsentSettings(?InboundOutboundPolicyConfigurat } /** - * Sets the b2bCollaborationInbound property value. Defines your default configuration for users from other organizations accessing your resources via Azure AD B2B collaboration. + * Sets the b2bCollaborationInbound property value. Defines your default configuration for users from other organizations accessing your resources via Microsoft Entra B2B collaboration. * @param CrossTenantAccessPolicyB2BSetting|null $value Value to set for the b2bCollaborationInbound property. */ public function setB2bCollaborationInbound(?CrossTenantAccessPolicyB2BSetting $value): void { @@ -157,7 +157,7 @@ public function setB2bCollaborationInbound(?CrossTenantAccessPolicyB2BSetting $v } /** - * Sets the b2bCollaborationOutbound property value. Defines your default configuration for users in your organization going outbound to access resources in another organization via Azure AD B2B collaboration. + * Sets the b2bCollaborationOutbound property value. Defines your default configuration for users in your organization going outbound to access resources in another organization via Microsoft Entra B2B collaboration. * @param CrossTenantAccessPolicyB2BSetting|null $value Value to set for the b2bCollaborationOutbound property. */ public function setB2bCollaborationOutbound(?CrossTenantAccessPolicyB2BSetting $value): void { @@ -165,7 +165,7 @@ public function setB2bCollaborationOutbound(?CrossTenantAccessPolicyB2BSetting $ } /** - * Sets the b2bDirectConnectInbound property value. Defines your default configuration for users from other organizations accessing your resources via Azure AD B2B direct connect. + * Sets the b2bDirectConnectInbound property value. Defines your default configuration for users from other organizations accessing your resources via Microsoft Entra B2B direct connect. * @param CrossTenantAccessPolicyB2BSetting|null $value Value to set for the b2bDirectConnectInbound property. */ public function setB2bDirectConnectInbound(?CrossTenantAccessPolicyB2BSetting $value): void { @@ -173,7 +173,7 @@ public function setB2bDirectConnectInbound(?CrossTenantAccessPolicyB2BSetting $v } /** - * Sets the b2bDirectConnectOutbound property value. Defines your default configuration for users in your organization going outbound to access resources in another organization via Azure AD B2B direct connect. + * Sets the b2bDirectConnectOutbound property value. Defines your default configuration for users in your organization going outbound to access resources in another organization via Microsoft Entra B2B direct connect. * @param CrossTenantAccessPolicyB2BSetting|null $value Value to set for the b2bDirectConnectOutbound property. */ public function setB2bDirectConnectOutbound(?CrossTenantAccessPolicyB2BSetting $value): void { @@ -181,7 +181,7 @@ public function setB2bDirectConnectOutbound(?CrossTenantAccessPolicyB2BSetting $ } /** - * Sets the inboundTrust property value. Determines the default configuration for trusting other Conditional Access claims from external Azure AD organizations. + * Sets the inboundTrust property value. Determines the default configuration for trusting other Conditional Access claims from external Microsoft Entra organizations. * @param CrossTenantAccessPolicyInboundTrust|null $value Value to set for the inboundTrust property. */ public function setInboundTrust(?CrossTenantAccessPolicyInboundTrust $value): void { diff --git a/src/Generated/Models/CrossTenantAccessPolicyConfigurationPartner.php b/src/Generated/Models/CrossTenantAccessPolicyConfigurationPartner.php index 7af9d58f927..43d60c86792 100644 --- a/src/Generated/Models/CrossTenantAccessPolicyConfigurationPartner.php +++ b/src/Generated/Models/CrossTenantAccessPolicyConfigurationPartner.php @@ -60,7 +60,7 @@ public function getAutomaticUserConsentSettings(): ?InboundOutboundPolicyConfigu } /** - * Gets the b2bCollaborationInbound property value. Defines your partner-specific configuration for users from other organizations accessing your resources via Azure AD B2B collaboration. + * Gets the b2bCollaborationInbound property value. Defines your partner-specific configuration for users from other organizations accessing your resources via Microsoft Entra B2B collaboration. * @return CrossTenantAccessPolicyB2BSetting|null */ public function getB2bCollaborationInbound(): ?CrossTenantAccessPolicyB2BSetting { @@ -72,7 +72,7 @@ public function getB2bCollaborationInbound(): ?CrossTenantAccessPolicyB2BSetting } /** - * Gets the b2bCollaborationOutbound property value. Defines your partner-specific configuration for users in your organization going outbound to access resources in another organization via Azure AD B2B collaboration. + * Gets the b2bCollaborationOutbound property value. Defines your partner-specific configuration for users in your organization going outbound to access resources in another organization via Microsoft Entra B2B collaboration. * @return CrossTenantAccessPolicyB2BSetting|null */ public function getB2bCollaborationOutbound(): ?CrossTenantAccessPolicyB2BSetting { @@ -96,7 +96,7 @@ public function getB2bDirectConnectInbound(): ?CrossTenantAccessPolicyB2BSetting } /** - * Gets the b2bDirectConnectOutbound property value. Defines your partner-specific configuration for users in your organization going outbound to access resources in another organization via Azure AD B2B direct connect. + * Gets the b2bDirectConnectOutbound property value. Defines your partner-specific configuration for users in your organization going outbound to access resources in another organization via Microsoft Entra B2B direct connect. * @return CrossTenantAccessPolicyB2BSetting|null */ public function getB2bDirectConnectOutbound(): ?CrossTenantAccessPolicyB2BSetting { @@ -148,7 +148,7 @@ public function getIdentitySynchronization(): ?CrossTenantIdentitySyncPolicyPart } /** - * Gets the inboundTrust property value. Determines the partner-specific configuration for trusting other Conditional Access claims from external Azure AD organizations. + * Gets the inboundTrust property value. Determines the partner-specific configuration for trusting other Conditional Access claims from external Microsoft Entra organizations. * @return CrossTenantAccessPolicyInboundTrust|null */ public function getInboundTrust(): ?CrossTenantAccessPolicyInboundTrust { @@ -184,7 +184,7 @@ public function getOdataType(): ?string { } /** - * Gets the tenantId property value. The tenant identifier for the partner Azure AD organization. Read-only. Key. + * Gets the tenantId property value. The tenant identifier for the partner Microsoft Entra organization. Read-only. Key. * @return string|null */ public function getTenantId(): ?string { @@ -230,7 +230,7 @@ public function setAutomaticUserConsentSettings(?InboundOutboundPolicyConfigurat } /** - * Sets the b2bCollaborationInbound property value. Defines your partner-specific configuration for users from other organizations accessing your resources via Azure AD B2B collaboration. + * Sets the b2bCollaborationInbound property value. Defines your partner-specific configuration for users from other organizations accessing your resources via Microsoft Entra B2B collaboration. * @param CrossTenantAccessPolicyB2BSetting|null $value Value to set for the b2bCollaborationInbound property. */ public function setB2bCollaborationInbound(?CrossTenantAccessPolicyB2BSetting $value): void { @@ -238,7 +238,7 @@ public function setB2bCollaborationInbound(?CrossTenantAccessPolicyB2BSetting $v } /** - * Sets the b2bCollaborationOutbound property value. Defines your partner-specific configuration for users in your organization going outbound to access resources in another organization via Azure AD B2B collaboration. + * Sets the b2bCollaborationOutbound property value. Defines your partner-specific configuration for users in your organization going outbound to access resources in another organization via Microsoft Entra B2B collaboration. * @param CrossTenantAccessPolicyB2BSetting|null $value Value to set for the b2bCollaborationOutbound property. */ public function setB2bCollaborationOutbound(?CrossTenantAccessPolicyB2BSetting $value): void { @@ -254,7 +254,7 @@ public function setB2bDirectConnectInbound(?CrossTenantAccessPolicyB2BSetting $v } /** - * Sets the b2bDirectConnectOutbound property value. Defines your partner-specific configuration for users in your organization going outbound to access resources in another organization via Azure AD B2B direct connect. + * Sets the b2bDirectConnectOutbound property value. Defines your partner-specific configuration for users in your organization going outbound to access resources in another organization via Microsoft Entra B2B direct connect. * @param CrossTenantAccessPolicyB2BSetting|null $value Value to set for the b2bDirectConnectOutbound property. */ public function setB2bDirectConnectOutbound(?CrossTenantAccessPolicyB2BSetting $value): void { @@ -278,7 +278,7 @@ public function setIdentitySynchronization(?CrossTenantIdentitySyncPolicyPartner } /** - * Sets the inboundTrust property value. Determines the partner-specific configuration for trusting other Conditional Access claims from external Azure AD organizations. + * Sets the inboundTrust property value. Determines the partner-specific configuration for trusting other Conditional Access claims from external Microsoft Entra organizations. * @param CrossTenantAccessPolicyInboundTrust|null $value Value to set for the inboundTrust property. */ public function setInboundTrust(?CrossTenantAccessPolicyInboundTrust $value): void { @@ -302,7 +302,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the tenantId property value. The tenant identifier for the partner Azure AD organization. Read-only. Key. + * Sets the tenantId property value. The tenant identifier for the partner Microsoft Entra organization. Read-only. Key. * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { diff --git a/src/Generated/Models/CrossTenantAccessPolicyInboundTrust.php b/src/Generated/Models/CrossTenantAccessPolicyInboundTrust.php index 12f70d6310f..b3b1e770575 100644 --- a/src/Generated/Models/CrossTenantAccessPolicyInboundTrust.php +++ b/src/Generated/Models/CrossTenantAccessPolicyInboundTrust.php @@ -70,7 +70,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the isCompliantDeviceAccepted property value. Specifies whether compliant devices from external Azure AD organizations are trusted. + * Gets the isCompliantDeviceAccepted property value. Specifies whether compliant devices from external Microsoft Entra organizations are trusted. * @return bool|null */ public function getIsCompliantDeviceAccepted(): ?bool { @@ -82,7 +82,7 @@ public function getIsCompliantDeviceAccepted(): ?bool { } /** - * Gets the isHybridAzureADJoinedDeviceAccepted property value. Specifies whether hybrid Azure AD joined devices from external Azure AD organizations are trusted. + * Gets the isHybridAzureADJoinedDeviceAccepted property value. Specifies whether Microsoft Entra hybrid joined devices from external Microsoft Entra organizations are trusted. * @return bool|null */ public function getIsHybridAzureADJoinedDeviceAccepted(): ?bool { @@ -94,7 +94,7 @@ public function getIsHybridAzureADJoinedDeviceAccepted(): ?bool { } /** - * Gets the isMfaAccepted property value. Specifies whether MFA from external Azure AD organizations is trusted. + * Gets the isMfaAccepted property value. Specifies whether MFA from external Microsoft Entra organizations is trusted. * @return bool|null */ public function getIsMfaAccepted(): ?bool { @@ -146,7 +146,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the isCompliantDeviceAccepted property value. Specifies whether compliant devices from external Azure AD organizations are trusted. + * Sets the isCompliantDeviceAccepted property value. Specifies whether compliant devices from external Microsoft Entra organizations are trusted. * @param bool|null $value Value to set for the isCompliantDeviceAccepted property. */ public function setIsCompliantDeviceAccepted(?bool $value): void { @@ -154,7 +154,7 @@ public function setIsCompliantDeviceAccepted(?bool $value): void { } /** - * Sets the isHybridAzureADJoinedDeviceAccepted property value. Specifies whether hybrid Azure AD joined devices from external Azure AD organizations are trusted. + * Sets the isHybridAzureADJoinedDeviceAccepted property value. Specifies whether Microsoft Entra hybrid joined devices from external Microsoft Entra organizations are trusted. * @param bool|null $value Value to set for the isHybridAzureADJoinedDeviceAccepted property. */ public function setIsHybridAzureADJoinedDeviceAccepted(?bool $value): void { @@ -162,7 +162,7 @@ public function setIsHybridAzureADJoinedDeviceAccepted(?bool $value): void { } /** - * Sets the isMfaAccepted property value. Specifies whether MFA from external Azure AD organizations is trusted. + * Sets the isMfaAccepted property value. Specifies whether MFA from external Microsoft Entra organizations is trusted. * @param bool|null $value Value to set for the isMfaAccepted property. */ public function setIsMfaAccepted(?bool $value): void { diff --git a/src/Generated/Models/CrossTenantIdentitySyncPolicyPartner.php b/src/Generated/Models/CrossTenantIdentitySyncPolicyPartner.php index db16b362466..43b63af9ba5 100644 --- a/src/Generated/Models/CrossTenantIdentitySyncPolicyPartner.php +++ b/src/Generated/Models/CrossTenantIdentitySyncPolicyPartner.php @@ -56,7 +56,7 @@ public function getBackingStore(): BackingStore { } /** - * Gets the displayName property value. Display name for the cross-tenant user synchronization policy. Use the name of the partner Azure AD (Azure Active Directory) tenant to easily identify the policy. Optional. + * Gets the displayName property value. Display name for the cross-tenant user synchronization policy. Use the name of the partner Microsoft Entra tenant to easily identify the policy. Optional. * @return string|null */ public function getDisplayName(): ?string { @@ -94,7 +94,7 @@ public function getOdataType(): ?string { } /** - * Gets the tenantId property value. Tenant identifier for the partner Azure AD organization. Read-only. + * Gets the tenantId property value. Tenant identifier for the partner Microsoft Entra organization. Read-only. * @return string|null */ public function getTenantId(): ?string { @@ -146,7 +146,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the displayName property value. Display name for the cross-tenant user synchronization policy. Use the name of the partner Azure AD (Azure Active Directory) tenant to easily identify the policy. Optional. + * Sets the displayName property value. Display name for the cross-tenant user synchronization policy. Use the name of the partner Microsoft Entra tenant to easily identify the policy. Optional. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -162,7 +162,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the tenantId property value. Tenant identifier for the partner Azure AD organization. Read-only. + * Sets the tenantId property value. Tenant identifier for the partner Microsoft Entra organization. Read-only. * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { diff --git a/src/Generated/Models/CustomCalloutExtension.php b/src/Generated/Models/CustomCalloutExtension.php index 83895ee1991..8c3e1cdd8f2 100644 --- a/src/Generated/Models/CustomCalloutExtension.php +++ b/src/Generated/Models/CustomCalloutExtension.php @@ -47,7 +47,7 @@ public function getAuthenticationConfiguration(): ?CustomExtensionAuthentication } /** - * Gets the clientConfiguration property value. HTTP connection settings that define how long Azure AD can wait for a connection to a logic app, how many times you can retry a timed-out connection and the exception scenarios when retries are allowed. + * Gets the clientConfiguration property value. HTTP connection settings that define how long Microsoft Entra ID can wait for a connection to a logic app, how many times you can retry a timed-out connection and the exception scenarios when retries are allowed. * @return CustomExtensionClientConfiguration|null */ public function getClientConfiguration(): ?CustomExtensionClientConfiguration { @@ -131,7 +131,7 @@ public function setAuthenticationConfiguration(?CustomExtensionAuthenticationCon } /** - * Sets the clientConfiguration property value. HTTP connection settings that define how long Azure AD can wait for a connection to a logic app, how many times you can retry a timed-out connection and the exception scenarios when retries are allowed. + * Sets the clientConfiguration property value. HTTP connection settings that define how long Microsoft Entra ID can wait for a connection to a logic app, how many times you can retry a timed-out connection and the exception scenarios when retries are allowed. * @param CustomExtensionClientConfiguration|null $value Value to set for the clientConfiguration property. */ public function setClientConfiguration(?CustomExtensionClientConfiguration $value): void { diff --git a/src/Generated/Models/CustomExtensionCallbackConfiguration.php b/src/Generated/Models/CustomExtensionCallbackConfiguration.php index ca8bbd6a079..e35d7c9d954 100644 --- a/src/Generated/Models/CustomExtensionCallbackConfiguration.php +++ b/src/Generated/Models/CustomExtensionCallbackConfiguration.php @@ -89,7 +89,7 @@ public function getOdataType(): ?string { } /** - * Gets the timeoutDuration property value. The maximum duration in ISO 8601 format that Azure AD will wait for a resume action for the callout it sent to the logic app. The valid range for custom extensions in lifecycle workflows is five minutes to three hours. The valid range for custom extensions in entitlement management is between 5 minutes and 14 days. For example, PT3H refers to three hours, P3D refers to three days, PT10M refers to ten minutes. + * Gets the timeoutDuration property value. The maximum duration in ISO 8601 format that Microsoft Entra ID will wait for a resume action for the callout it sent to the logic app. The valid range for custom extensions in lifecycle workflows is five minutes to three hours. The valid range for custom extensions in entitlement management is between 5 minutes and 14 days. For example, PT3H refers to three hours, P3D refers to three days, PT10M refers to ten minutes. * @return DateInterval|null */ public function getTimeoutDuration(): ?DateInterval { @@ -135,7 +135,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the timeoutDuration property value. The maximum duration in ISO 8601 format that Azure AD will wait for a resume action for the callout it sent to the logic app. The valid range for custom extensions in lifecycle workflows is five minutes to three hours. The valid range for custom extensions in entitlement management is between 5 minutes and 14 days. For example, PT3H refers to three hours, P3D refers to three days, PT10M refers to ten minutes. + * Sets the timeoutDuration property value. The maximum duration in ISO 8601 format that Microsoft Entra ID will wait for a resume action for the callout it sent to the logic app. The valid range for custom extensions in lifecycle workflows is five minutes to three hours. The valid range for custom extensions in entitlement management is between 5 minutes and 14 days. For example, PT3H refers to three hours, P3D refers to three days, PT10M refers to ten minutes. * @param DateInterval|null $value Value to set for the timeoutDuration property. */ public function setTimeoutDuration(?DateInterval $value): void { diff --git a/src/Generated/Models/CustomExtensionClientConfiguration.php b/src/Generated/Models/CustomExtensionClientConfiguration.php index 43830a25f07..e65622d33c3 100644 --- a/src/Generated/Models/CustomExtensionClientConfiguration.php +++ b/src/Generated/Models/CustomExtensionClientConfiguration.php @@ -80,7 +80,7 @@ public function getOdataType(): ?string { } /** - * Gets the timeoutInMilliseconds property value. The max duration in milliseconds that Azure AD waits for a response from the external app before it shuts down the connection. The valid range is between 200 and 2000 milliseconds. Default duration is 1000. + * Gets the timeoutInMilliseconds property value. The max duration in milliseconds that Microsoft Entra ID waits for a response from the external app before it shuts down the connection. The valid range is between 200 and 2000 milliseconds. Default duration is 1000. * @return int|null */ public function getTimeoutInMilliseconds(): ?int { @@ -126,7 +126,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the timeoutInMilliseconds property value. The max duration in milliseconds that Azure AD waits for a response from the external app before it shuts down the connection. The valid range is between 200 and 2000 milliseconds. Default duration is 1000. + * Sets the timeoutInMilliseconds property value. The max duration in milliseconds that Microsoft Entra ID waits for a response from the external app before it shuts down the connection. The valid range is between 200 and 2000 milliseconds. Default duration is 1000. * @param int|null $value Value to set for the timeoutInMilliseconds property. */ public function setTimeoutInMilliseconds(?int $value): void { diff --git a/src/Generated/Models/CustomTrainingSetting.php b/src/Generated/Models/CustomTrainingSetting.php index 3bbd6f10744..95115021050 100644 --- a/src/Generated/Models/CustomTrainingSetting.php +++ b/src/Generated/Models/CustomTrainingSetting.php @@ -27,7 +27,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Custo } /** - * Gets the assignedTo property value. The assignedTo property + * Gets the assignedTo property value. A user collection that specifies to whom the training should be assigned. Possible values are: none, allUsers, clickedPayload, compromised, reportedPhish, readButNotClicked, didNothing, unknownFutureValue. * @return array|null */ public function getAssignedTo(): ?array { @@ -41,7 +41,7 @@ public function getAssignedTo(): ?array { } /** - * Gets the description property value. The description property + * Gets the description property value. The description of the custom training setting. * @return string|null */ public function getDescription(): ?string { @@ -53,7 +53,7 @@ public function getDescription(): ?string { } /** - * Gets the displayName property value. The displayName property + * Gets the displayName property value. The display name of the custom training setting. * @return string|null */ public function getDisplayName(): ?string { @@ -65,7 +65,7 @@ public function getDisplayName(): ?string { } /** - * Gets the durationInMinutes property value. The durationInMinutes property + * Gets the durationInMinutes property value. Training duration. * @return int|null */ public function getDurationInMinutes(): ?int { @@ -92,7 +92,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the url property value. The url property + * Gets the url property value. The training URL. * @return string|null */ public function getUrl(): ?string { @@ -117,7 +117,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the assignedTo property value. The assignedTo property + * Sets the assignedTo property value. A user collection that specifies to whom the training should be assigned. Possible values are: none, allUsers, clickedPayload, compromised, reportedPhish, readButNotClicked, didNothing, unknownFutureValue. * @param array|null $value Value to set for the assignedTo property. */ public function setAssignedTo(?array $value): void { @@ -125,7 +125,7 @@ public function setAssignedTo(?array $value): void { } /** - * Sets the description property value. The description property + * Sets the description property value. The description of the custom training setting. * @param string|null $value Value to set for the description property. */ public function setDescription(?string $value): void { @@ -133,7 +133,7 @@ public function setDescription(?string $value): void { } /** - * Sets the displayName property value. The displayName property + * Sets the displayName property value. The display name of the custom training setting. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -141,7 +141,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the durationInMinutes property value. The durationInMinutes property + * Sets the durationInMinutes property value. Training duration. * @param int|null $value Value to set for the durationInMinutes property. */ public function setDurationInMinutes(?int $value): void { @@ -149,7 +149,7 @@ public function setDurationInMinutes(?int $value): void { } /** - * Sets the url property value. The url property + * Sets the url property value. The training URL. * @param string|null $value Value to set for the url property. */ public function setUrl(?string $value): void { diff --git a/src/Generated/Models/DelegatedAdminAccessContainer.php b/src/Generated/Models/DelegatedAdminAccessContainer.php index 8c718f303ce..5f84f144531 100644 --- a/src/Generated/Models/DelegatedAdminAccessContainer.php +++ b/src/Generated/Models/DelegatedAdminAccessContainer.php @@ -35,7 +35,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Deleg } /** - * Gets the accessContainerId property value. The identifier of the access container (for example, a security group). For 'securityGroup' access containers, this must be a valid ID of an Azure AD security group in the Microsoft partner's tenant. + * Gets the accessContainerId property value. The identifier of the access container (for example, a security group). For 'securityGroup' access containers, this must be a valid ID of a Microsoft Entra security group in the Microsoft partner's tenant. * @return string|null */ public function getAccessContainerId(): ?string { @@ -116,7 +116,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the accessContainerId property value. The identifier of the access container (for example, a security group). For 'securityGroup' access containers, this must be a valid ID of an Azure AD security group in the Microsoft partner's tenant. + * Sets the accessContainerId property value. The identifier of the access container (for example, a security group). For 'securityGroup' access containers, this must be a valid ID of a Microsoft Entra security group in the Microsoft partner's tenant. * @param string|null $value Value to set for the accessContainerId property. */ public function setAccessContainerId(?string $value): void { diff --git a/src/Generated/Models/DelegatedAdminCustomer.php b/src/Generated/Models/DelegatedAdminCustomer.php index c834907e062..e51a1a923f9 100644 --- a/src/Generated/Models/DelegatedAdminCustomer.php +++ b/src/Generated/Models/DelegatedAdminCustomer.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Deleg } /** - * Gets the displayName property value. The Azure AD display name of the customer tenant. Read-only. Supports $orderby. + * Gets the displayName property value. The Microsoft Entra ID display name of the customer tenant. Read-only. Supports $orderby. * @return string|null */ public function getDisplayName(): ?string { @@ -65,7 +65,7 @@ public function getServiceManagementDetails(): ?array { } /** - * Gets the tenantId property value. The Azure AD-assigned tenant ID of the customer. Read-only. + * Gets the tenantId property value. The Microsoft Entra ID-assigned tenant ID of the customer. Read-only. * @return string|null */ public function getTenantId(): ?string { @@ -88,7 +88,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the displayName property value. The Azure AD display name of the customer tenant. Read-only. Supports $orderby. + * Sets the displayName property value. The Microsoft Entra ID display name of the customer tenant. Read-only. Supports $orderby. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -104,7 +104,7 @@ public function setServiceManagementDetails(?array $value): void { } /** - * Sets the tenantId property value. The Azure AD-assigned tenant ID of the customer. Read-only. + * Sets the tenantId property value. The Microsoft Entra ID-assigned tenant ID of the customer. Read-only. * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { diff --git a/src/Generated/Models/DelegatedAdminRelationship.php b/src/Generated/Models/DelegatedAdminRelationship.php index a9894a84cf6..dc0fc27f6f3 100644 --- a/src/Generated/Models/DelegatedAdminRelationship.php +++ b/src/Generated/Models/DelegatedAdminRelationship.php @@ -72,6 +72,18 @@ public function getActivatedDateTime(): ?DateTime { throw new \UnexpectedValueException("Invalid type found in backing store for 'activatedDateTime'"); } + /** + * Gets the autoExtendDuration property value. The duration by which the validity of the relationship is automatically extended, denoted in ISO 8601 format. Supported values are: P0D, PT0S, P180D. The default value is PT0S. PT0S indicates that the relationship expires when the endDateTime is reached and it isn't automatically extended. + * @return DateInterval|null + */ + public function getAutoExtendDuration(): ?DateInterval { + $val = $this->getBackingStore()->get('autoExtendDuration'); + if (is_null($val) || $val instanceof DateInterval) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'autoExtendDuration'"); + } + /** * Gets the createdDateTime property value. The date and time in ISO 8601 format and in UTC time when the relationship was created. Read-only. * @return DateTime|null @@ -142,6 +154,7 @@ public function getFieldDeserializers(): array { 'accessAssignments' => fn(ParseNode $n) => $o->setAccessAssignments($n->getCollectionOfObjectValues([DelegatedAdminAccessAssignment::class, 'createFromDiscriminatorValue'])), 'accessDetails' => fn(ParseNode $n) => $o->setAccessDetails($n->getObjectValue([DelegatedAdminAccessDetails::class, 'createFromDiscriminatorValue'])), 'activatedDateTime' => fn(ParseNode $n) => $o->setActivatedDateTime($n->getDateTimeValue()), + 'autoExtendDuration' => fn(ParseNode $n) => $o->setAutoExtendDuration($n->getDateIntervalValue()), 'createdDateTime' => fn(ParseNode $n) => $o->setCreatedDateTime($n->getDateTimeValue()), 'customer' => fn(ParseNode $n) => $o->setCustomer($n->getObjectValue([DelegatedAdminRelationshipCustomerParticipant::class, 'createFromDiscriminatorValue'])), 'displayName' => fn(ParseNode $n) => $o->setDisplayName($n->getStringValue()), @@ -215,6 +228,7 @@ public function serialize(SerializationWriter $writer): void { $writer->writeCollectionOfObjectValues('accessAssignments', $this->getAccessAssignments()); $writer->writeObjectValue('accessDetails', $this->getAccessDetails()); $writer->writeDateTimeValue('activatedDateTime', $this->getActivatedDateTime()); + $writer->writeDateIntervalValue('autoExtendDuration', $this->getAutoExtendDuration()); $writer->writeDateTimeValue('createdDateTime', $this->getCreatedDateTime()); $writer->writeObjectValue('customer', $this->getCustomer()); $writer->writeStringValue('displayName', $this->getDisplayName()); @@ -250,6 +264,14 @@ public function setActivatedDateTime(?DateTime $value): void { $this->getBackingStore()->set('activatedDateTime', $value); } + /** + * Sets the autoExtendDuration property value. The duration by which the validity of the relationship is automatically extended, denoted in ISO 8601 format. Supported values are: P0D, PT0S, P180D. The default value is PT0S. PT0S indicates that the relationship expires when the endDateTime is reached and it isn't automatically extended. + * @param DateInterval|null $value Value to set for the autoExtendDuration property. + */ + public function setAutoExtendDuration(?DateInterval $value): void { + $this->getBackingStore()->set('autoExtendDuration', $value); + } + /** * Sets the createdDateTime property value. The date and time in ISO 8601 format and in UTC time when the relationship was created. Read-only. * @param DateTime|null $value Value to set for the createdDateTime property. diff --git a/src/Generated/Models/DelegatedAdminRelationshipCustomerParticipant.php b/src/Generated/Models/DelegatedAdminRelationshipCustomerParticipant.php index 9694fab5e2e..b4e5429b9f5 100644 --- a/src/Generated/Models/DelegatedAdminRelationshipCustomerParticipant.php +++ b/src/Generated/Models/DelegatedAdminRelationshipCustomerParticipant.php @@ -56,7 +56,7 @@ public function getBackingStore(): BackingStore { } /** - * Gets the displayName property value. The display name of the customer tenant as set by Azure AD. Read-only + * Gets the displayName property value. The display name of the customer tenant as set by Microsoft Entra ID. Read-only * @return string|null */ public function getDisplayName(): ?string { @@ -93,7 +93,7 @@ public function getOdataType(): ?string { } /** - * Gets the tenantId property value. The Azure AD-assigned tenant ID of the customer tenant. + * Gets the tenantId property value. The Microsoft Entra ID-assigned tenant ID of the customer tenant. * @return string|null */ public function getTenantId(): ?string { @@ -132,7 +132,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the displayName property value. The display name of the customer tenant as set by Azure AD. Read-only + * Sets the displayName property value. The display name of the customer tenant as set by Microsoft Entra ID. Read-only * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -148,7 +148,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the tenantId property value. The Azure AD-assigned tenant ID of the customer tenant. + * Sets the tenantId property value. The Microsoft Entra ID-assigned tenant ID of the customer tenant. * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { diff --git a/src/Generated/Models/Device.php b/src/Generated/Models/Device.php index e4286b28821..b98b2a9806c 100644 --- a/src/Generated/Models/Device.php +++ b/src/Generated/Models/Device.php @@ -420,7 +420,7 @@ public function getTransitiveMemberOf(): ?array { } /** - * Gets the trustType property value. Type of trust for the joined device. Read-only. Possible values: Workplace (indicates bring your own personal devices), AzureAd (Cloud only joined devices), ServerAd (on-premises domain joined devices joined to Azure AD). For more details, see Introduction to device management in Azure Active Directory. + * Gets the trustType property value. Type of trust for the joined device. Read-only. Possible values: Workplace (indicates bring your own personal devices), AzureAd (Cloud only joined devices), ServerAd (on-premises domain joined devices joined to Microsoft Entra ID). For more details, see Introduction to device management in Microsoft Entra ID. * @return string|null */ public function getTrustType(): ?string { @@ -684,7 +684,7 @@ public function setTransitiveMemberOf(?array $value): void { } /** - * Sets the trustType property value. Type of trust for the joined device. Read-only. Possible values: Workplace (indicates bring your own personal devices), AzureAd (Cloud only joined devices), ServerAd (on-premises domain joined devices joined to Azure AD). For more details, see Introduction to device management in Azure Active Directory. + * Sets the trustType property value. Type of trust for the joined device. Read-only. Possible values: Workplace (indicates bring your own personal devices), AzureAd (Cloud only joined devices), ServerAd (on-premises domain joined devices joined to Microsoft Entra ID). For more details, see Introduction to device management in Microsoft Entra ID. * @param string|null $value Value to set for the trustType property. */ public function setTrustType(?string $value): void { diff --git a/src/Generated/Models/DeviceLocalCredential.php b/src/Generated/Models/DeviceLocalCredential.php new file mode 100644 index 00000000000..f4be89818de --- /dev/null +++ b/src/Generated/Models/DeviceLocalCredential.php @@ -0,0 +1,134 @@ +getBackingStore()->get('accountName'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'accountName'"); + } + + /** + * Gets the accountSid property value. The SID of the local admin account for which LAPS is enabled. + * @return string|null + */ + public function getAccountSid(): ?string { + $val = $this->getBackingStore()->get('accountSid'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'accountSid'"); + } + + /** + * Gets the backupDateTime property value. When the local administrator account credential for the device object was backed up to Azure Active Directory. + * @return DateTime|null + */ + public function getBackupDateTime(): ?DateTime { + $val = $this->getBackingStore()->get('backupDateTime'); + if (is_null($val) || $val instanceof DateTime) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'backupDateTime'"); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'accountName' => fn(ParseNode $n) => $o->setAccountName($n->getStringValue()), + 'accountSid' => fn(ParseNode $n) => $o->setAccountSid($n->getStringValue()), + 'backupDateTime' => fn(ParseNode $n) => $o->setBackupDateTime($n->getDateTimeValue()), + 'passwordBase64' => fn(ParseNode $n) => $o->setPasswordBase64($n->getStringValue()), + ]); + } + + /** + * Gets the passwordBase64 property value. The password for the local administrator account that is backed up to Azure Active Directory and returned as a Base64 encoded value. + * @return string|null + */ + public function getPasswordBase64(): ?string { + $val = $this->getBackingStore()->get('passwordBase64'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'passwordBase64'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeStringValue('accountName', $this->getAccountName()); + $writer->writeStringValue('accountSid', $this->getAccountSid()); + $writer->writeDateTimeValue('backupDateTime', $this->getBackupDateTime()); + $writer->writeStringValue('passwordBase64', $this->getPasswordBase64()); + } + + /** + * Sets the accountName property value. The name of the local admin account for which LAPS is enabled. + * @param string|null $value Value to set for the accountName property. + */ + public function setAccountName(?string $value): void { + $this->getBackingStore()->set('accountName', $value); + } + + /** + * Sets the accountSid property value. The SID of the local admin account for which LAPS is enabled. + * @param string|null $value Value to set for the accountSid property. + */ + public function setAccountSid(?string $value): void { + $this->getBackingStore()->set('accountSid', $value); + } + + /** + * Sets the backupDateTime property value. When the local administrator account credential for the device object was backed up to Azure Active Directory. + * @param DateTime|null $value Value to set for the backupDateTime property. + */ + public function setBackupDateTime(?DateTime $value): void { + $this->getBackingStore()->set('backupDateTime', $value); + } + + /** + * Sets the passwordBase64 property value. The password for the local administrator account that is backed up to Azure Active Directory and returned as a Base64 encoded value. + * @param string|null $value Value to set for the passwordBase64 property. + */ + public function setPasswordBase64(?string $value): void { + $this->getBackingStore()->set('passwordBase64', $value); + } + +} diff --git a/src/Generated/Models/DeviceLocalCredentialInfo.php b/src/Generated/Models/DeviceLocalCredentialInfo.php new file mode 100644 index 00000000000..ddab952f498 --- /dev/null +++ b/src/Generated/Models/DeviceLocalCredentialInfo.php @@ -0,0 +1,137 @@ +|null + */ + public function getCredentials(): ?array { + $val = $this->getBackingStore()->get('credentials'); + if (is_array($val) || is_null($val)) { + TypeUtils::validateCollectionValues($val, DeviceLocalCredential::class); + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'credentials'"); + } + + /** + * Gets the deviceName property value. Display name of the device that the local credentials are associated with. + * @return string|null + */ + public function getDeviceName(): ?string { + $val = $this->getBackingStore()->get('deviceName'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'deviceName'"); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'credentials' => fn(ParseNode $n) => $o->setCredentials($n->getCollectionOfObjectValues([DeviceLocalCredential::class, 'createFromDiscriminatorValue'])), + 'deviceName' => fn(ParseNode $n) => $o->setDeviceName($n->getStringValue()), + 'lastBackupDateTime' => fn(ParseNode $n) => $o->setLastBackupDateTime($n->getDateTimeValue()), + 'refreshDateTime' => fn(ParseNode $n) => $o->setRefreshDateTime($n->getDateTimeValue()), + ]); + } + + /** + * Gets the lastBackupDateTime property value. When the local administrator account credential was backed up to Azure Active Directory. + * @return DateTime|null + */ + public function getLastBackupDateTime(): ?DateTime { + $val = $this->getBackingStore()->get('lastBackupDateTime'); + if (is_null($val) || $val instanceof DateTime) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'lastBackupDateTime'"); + } + + /** + * Gets the refreshDateTime property value. When the local administrator account credential will be refreshed and backed up to Azure Active Directory. + * @return DateTime|null + */ + public function getRefreshDateTime(): ?DateTime { + $val = $this->getBackingStore()->get('refreshDateTime'); + if (is_null($val) || $val instanceof DateTime) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'refreshDateTime'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeCollectionOfObjectValues('credentials', $this->getCredentials()); + $writer->writeStringValue('deviceName', $this->getDeviceName()); + $writer->writeDateTimeValue('lastBackupDateTime', $this->getLastBackupDateTime()); + $writer->writeDateTimeValue('refreshDateTime', $this->getRefreshDateTime()); + } + + /** + * Sets the credentials property value. The credentials of the device's local administrator account backed up to Azure Active Directory. + * @param array|null $value Value to set for the credentials property. + */ + public function setCredentials(?array $value): void { + $this->getBackingStore()->set('credentials', $value); + } + + /** + * Sets the deviceName property value. Display name of the device that the local credentials are associated with. + * @param string|null $value Value to set for the deviceName property. + */ + public function setDeviceName(?string $value): void { + $this->getBackingStore()->set('deviceName', $value); + } + + /** + * Sets the lastBackupDateTime property value. When the local administrator account credential was backed up to Azure Active Directory. + * @param DateTime|null $value Value to set for the lastBackupDateTime property. + */ + public function setLastBackupDateTime(?DateTime $value): void { + $this->getBackingStore()->set('lastBackupDateTime', $value); + } + + /** + * Sets the refreshDateTime property value. When the local administrator account credential will be refreshed and backed up to Azure Active Directory. + * @param DateTime|null $value Value to set for the refreshDateTime property. + */ + public function setRefreshDateTime(?DateTime $value): void { + $this->getBackingStore()->set('refreshDateTime', $value); + } + +} diff --git a/src/Generated/Models/DeviceLocalCredentialInfoCollectionResponse.php b/src/Generated/Models/DeviceLocalCredentialInfoCollectionResponse.php new file mode 100644 index 00000000000..2a6605320fe --- /dev/null +++ b/src/Generated/Models/DeviceLocalCredentialInfoCollectionResponse.php @@ -0,0 +1,70 @@ + + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'value' => fn(ParseNode $n) => $o->setValue($n->getCollectionOfObjectValues([DeviceLocalCredentialInfo::class, 'createFromDiscriminatorValue'])), + ]); + } + + /** + * Gets the value property value. The value property + * @return array|null + */ + public function getValue(): ?array { + $val = $this->getBackingStore()->get('value'); + if (is_array($val) || is_null($val)) { + TypeUtils::validateCollectionValues($val, DeviceLocalCredentialInfo::class); + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'value'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeCollectionOfObjectValues('value', $this->getValue()); + } + + /** + * Sets the value property value. The value property + * @param array|null $value Value to set for the value property. + */ + public function setValue(?array $value): void { + $this->getBackingStore()->set('value', $value); + } + +} diff --git a/src/Generated/Models/Directory.php b/src/Generated/Models/Directory.php index eb26c978ab6..10f0dee57bf 100644 --- a/src/Generated/Models/Directory.php +++ b/src/Generated/Models/Directory.php @@ -81,6 +81,20 @@ public function getDeletedItems(): ?array { throw new \UnexpectedValueException("Invalid type found in backing store for 'deletedItems'"); } + /** + * Gets the deviceLocalCredentials property value. The credentials of the device's local administrator account backed up to Microsoft Entra ID. + * @return array|null + */ + public function getDeviceLocalCredentials(): ?array { + $val = $this->getBackingStore()->get('deviceLocalCredentials'); + if (is_array($val) || is_null($val)) { + TypeUtils::validateCollectionValues($val, DeviceLocalCredentialInfo::class); + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'deviceLocalCredentials'"); + } + /** * Gets the federationConfigurations property value. Configure domain federation with organizations whose identity provider (IdP) supports either the SAML or WS-Fed protocol. * @return array|null @@ -106,6 +120,7 @@ public function getFieldDeserializers(): array { 'attributeSets' => fn(ParseNode $n) => $o->setAttributeSets($n->getCollectionOfObjectValues([AttributeSet::class, 'createFromDiscriminatorValue'])), 'customSecurityAttributeDefinitions' => fn(ParseNode $n) => $o->setCustomSecurityAttributeDefinitions($n->getCollectionOfObjectValues([CustomSecurityAttributeDefinition::class, 'createFromDiscriminatorValue'])), 'deletedItems' => fn(ParseNode $n) => $o->setDeletedItems($n->getCollectionOfObjectValues([DirectoryObject::class, 'createFromDiscriminatorValue'])), + 'deviceLocalCredentials' => fn(ParseNode $n) => $o->setDeviceLocalCredentials($n->getCollectionOfObjectValues([DeviceLocalCredentialInfo::class, 'createFromDiscriminatorValue'])), 'federationConfigurations' => fn(ParseNode $n) => $o->setFederationConfigurations($n->getCollectionOfObjectValues([IdentityProviderBase::class, 'createFromDiscriminatorValue'])), 'onPremisesSynchronization' => fn(ParseNode $n) => $o->setOnPremisesSynchronization($n->getCollectionOfObjectValues([OnPremisesDirectorySynchronization::class, 'createFromDiscriminatorValue'])), ]); @@ -135,6 +150,7 @@ public function serialize(SerializationWriter $writer): void { $writer->writeCollectionOfObjectValues('attributeSets', $this->getAttributeSets()); $writer->writeCollectionOfObjectValues('customSecurityAttributeDefinitions', $this->getCustomSecurityAttributeDefinitions()); $writer->writeCollectionOfObjectValues('deletedItems', $this->getDeletedItems()); + $writer->writeCollectionOfObjectValues('deviceLocalCredentials', $this->getDeviceLocalCredentials()); $writer->writeCollectionOfObjectValues('federationConfigurations', $this->getFederationConfigurations()); $writer->writeCollectionOfObjectValues('onPremisesSynchronization', $this->getOnPremisesSynchronization()); } @@ -171,6 +187,14 @@ public function setDeletedItems(?array $value): void { $this->getBackingStore()->set('deletedItems', $value); } + /** + * Sets the deviceLocalCredentials property value. The credentials of the device's local administrator account backed up to Microsoft Entra ID. + * @param array|null $value Value to set for the deviceLocalCredentials property. + */ + public function setDeviceLocalCredentials(?array $value): void { + $this->getBackingStore()->set('deviceLocalCredentials', $value); + } + /** * Sets the federationConfigurations property value. Configure domain federation with organizations whose identity provider (IdP) supports either the SAML or WS-Fed protocol. * @param array|null $value Value to set for the federationConfigurations property. diff --git a/src/Generated/Models/DirectoryAudit.php b/src/Generated/Models/DirectoryAudit.php index 507dce8fa41..86124295518 100644 --- a/src/Generated/Models/DirectoryAudit.php +++ b/src/Generated/Models/DirectoryAudit.php @@ -39,7 +39,7 @@ public function getActivityDateTime(): ?DateTime { } /** - * Gets the activityDisplayName property value. Indicates the activity name or the operation name (examples: 'Create User' and 'Add member to group'). For a list of activities logged, refer to Azure AD audit log categories and activities. Supports $filter (eq, startswith). + * Gets the activityDisplayName property value. Indicates the activity name or the operation name (examples: 'Create User' and 'Add member to group'). For a list of activities logged, refer to Microsoft Entra audit log categories and activities. Supports $filter (eq, startswith). * @return string|null */ public function getActivityDisplayName(): ?string { @@ -65,7 +65,7 @@ public function getAdditionalDetails(): ?array { } /** - * Gets the category property value. Indicates which resource category that's targeted by the activity. For example: UserManagement, GroupManagement, ApplicationManagement, RoleManagement. For a list of categories for activities logged, refer to Azure AD audit log categories and activities. + * Gets the category property value. Indicates which resource category that's targeted by the activity. For example: UserManagement, GroupManagement, ApplicationManagement, RoleManagement. For a list of categories for activities logged, refer to Microsoft Entra audit log categories and activities. * @return string|null */ public function getCategory(): ?string { @@ -211,7 +211,7 @@ public function setActivityDateTime(?DateTime $value): void { } /** - * Sets the activityDisplayName property value. Indicates the activity name or the operation name (examples: 'Create User' and 'Add member to group'). For a list of activities logged, refer to Azure AD audit log categories and activities. Supports $filter (eq, startswith). + * Sets the activityDisplayName property value. Indicates the activity name or the operation name (examples: 'Create User' and 'Add member to group'). For a list of activities logged, refer to Microsoft Entra audit log categories and activities. Supports $filter (eq, startswith). * @param string|null $value Value to set for the activityDisplayName property. */ public function setActivityDisplayName(?string $value): void { @@ -227,7 +227,7 @@ public function setAdditionalDetails(?array $value): void { } /** - * Sets the category property value. Indicates which resource category that's targeted by the activity. For example: UserManagement, GroupManagement, ApplicationManagement, RoleManagement. For a list of categories for activities logged, refer to Azure AD audit log categories and activities. + * Sets the category property value. Indicates which resource category that's targeted by the activity. For example: UserManagement, GroupManagement, ApplicationManagement, RoleManagement. For a list of categories for activities logged, refer to Microsoft Entra audit log categories and activities. * @param string|null $value Value to set for the category property. */ public function setCategory(?string $value): void { diff --git a/src/Generated/Models/Domain.php b/src/Generated/Models/Domain.php index 6272f912882..dada70fd830 100644 --- a/src/Generated/Models/Domain.php +++ b/src/Generated/Models/Domain.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Domai } /** - * Gets the authenticationType property value. Indicates the configured authentication type for the domain. The value is either Managed or Federated. Managed indicates a cloud managed domain where Azure AD performs user authentication. Federated indicates authentication is federated with an identity provider such as the tenant's on-premises Active Directory via Active Directory Federation Services. Not nullable. + * Gets the authenticationType property value. Indicates the configured authentication type for the domain. The value is either Managed or Federated. Managed indicates a cloud managed domain where Microsoft Entra ID performs user authentication. Federated indicates authentication is federated with an identity provider such as the tenant's on-premises Active Directory via Active Directory Federation Services. Not nullable. * @return string|null */ public function getAuthenticationType(): ?string { @@ -64,7 +64,7 @@ public function getDomainNameReferences(): ?array { } /** - * Gets the federationConfiguration property value. Domain settings configured by a customer when federated with Azure AD. Supports $expand. + * Gets the federationConfiguration property value. Domain settings configured by a customer when federated with Microsoft Entra ID. Supports $expand. * @return array|null */ public function getFederationConfiguration(): ?array { @@ -260,7 +260,7 @@ public function getSupportedServices(): ?array { } /** - * Gets the verificationDnsRecords property value. DNS records that the customer adds to the DNS zone file of the domain before the customer can complete domain ownership verification with Azure AD. Read-only, Nullable. Supports $expand. + * Gets the verificationDnsRecords property value. DNS records that the customer adds to the DNS zone file of the domain before the customer can complete domain ownership verification with Microsoft Entra ID. Read-only, Nullable. Supports $expand. * @return array|null */ public function getVerificationDnsRecords(): ?array { @@ -299,7 +299,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the authenticationType property value. Indicates the configured authentication type for the domain. The value is either Managed or Federated. Managed indicates a cloud managed domain where Azure AD performs user authentication. Federated indicates authentication is federated with an identity provider such as the tenant's on-premises Active Directory via Active Directory Federation Services. Not nullable. + * Sets the authenticationType property value. Indicates the configured authentication type for the domain. The value is either Managed or Federated. Managed indicates a cloud managed domain where Microsoft Entra ID performs user authentication. Federated indicates authentication is federated with an identity provider such as the tenant's on-premises Active Directory via Active Directory Federation Services. Not nullable. * @param string|null $value Value to set for the authenticationType property. */ public function setAuthenticationType(?string $value): void { @@ -323,7 +323,7 @@ public function setDomainNameReferences(?array $value): void { } /** - * Sets the federationConfiguration property value. Domain settings configured by a customer when federated with Azure AD. Supports $expand. + * Sets the federationConfiguration property value. Domain settings configured by a customer when federated with Microsoft Entra ID. Supports $expand. * @param array|null $value Value to set for the federationConfiguration property. */ public function setFederationConfiguration(?array $value): void { @@ -427,7 +427,7 @@ public function setSupportedServices(?array $value): void { } /** - * Sets the verificationDnsRecords property value. DNS records that the customer adds to the DNS zone file of the domain before the customer can complete domain ownership verification with Azure AD. Read-only, Nullable. Supports $expand. + * Sets the verificationDnsRecords property value. DNS records that the customer adds to the DNS zone file of the domain before the customer can complete domain ownership verification with Microsoft Entra ID. Read-only, Nullable. Supports $expand. * @param array|null $value Value to set for the verificationDnsRecords property. */ public function setVerificationDnsRecords(?array $value): void { diff --git a/src/Generated/Models/EducationUser.php b/src/Generated/Models/EducationUser.php index 3863df47105..28d5f23222b 100644 --- a/src/Generated/Models/EducationUser.php +++ b/src/Generated/Models/EducationUser.php @@ -308,7 +308,7 @@ public function getOfficeLocation(): ?string { } /** - * Gets the onPremisesInfo property value. Additional information used to associate the Azure Active Directory user with its Active Directory counterpart. + * Gets the onPremisesInfo property value. Additional information used to associate the Microsoft Entra user with its Active Directory counterpart. * @return EducationOnPremisesInfo|null */ public function getOnPremisesInfo(): ?EducationOnPremisesInfo { @@ -748,7 +748,7 @@ public function setOfficeLocation(?string $value): void { } /** - * Sets the onPremisesInfo property value. Additional information used to associate the Azure Active Directory user with its Active Directory counterpart. + * Sets the onPremisesInfo property value. Additional information used to associate the Microsoft Entra user with its Active Directory counterpart. * @param EducationOnPremisesInfo|null $value Value to set for the onPremisesInfo property. */ public function setOnPremisesInfo(?EducationOnPremisesInfo $value): void { diff --git a/src/Generated/Models/EmailPayloadDetail.php b/src/Generated/Models/EmailPayloadDetail.php index 1d5a14d86f9..5b18e8f29fb 100644 --- a/src/Generated/Models/EmailPayloadDetail.php +++ b/src/Generated/Models/EmailPayloadDetail.php @@ -40,7 +40,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the fromEmail property value. The fromEmail property + * Gets the fromEmail property value. Email address of the user. * @return string|null */ public function getFromEmail(): ?string { @@ -52,7 +52,7 @@ public function getFromEmail(): ?string { } /** - * Gets the fromName property value. The fromName property + * Gets the fromName property value. Display name of the user. * @return string|null */ public function getFromName(): ?string { @@ -64,7 +64,7 @@ public function getFromName(): ?string { } /** - * Gets the isExternalSender property value. The isExternalSender property + * Gets the isExternalSender property value. Indicates whether the sender isn't from the user's organization. * @return bool|null */ public function getIsExternalSender(): ?bool { @@ -76,7 +76,7 @@ public function getIsExternalSender(): ?bool { } /** - * Gets the subject property value. The subject property + * Gets the subject property value. The subject of the email address sent to the user. * @return string|null */ public function getSubject(): ?string { @@ -100,7 +100,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the fromEmail property value. The fromEmail property + * Sets the fromEmail property value. Email address of the user. * @param string|null $value Value to set for the fromEmail property. */ public function setFromEmail(?string $value): void { @@ -108,7 +108,7 @@ public function setFromEmail(?string $value): void { } /** - * Sets the fromName property value. The fromName property + * Sets the fromName property value. Display name of the user. * @param string|null $value Value to set for the fromName property. */ public function setFromName(?string $value): void { @@ -116,7 +116,7 @@ public function setFromName(?string $value): void { } /** - * Sets the isExternalSender property value. The isExternalSender property + * Sets the isExternalSender property value. Indicates whether the sender isn't from the user's organization. * @param bool|null $value Value to set for the isExternalSender property. */ public function setIsExternalSender(?bool $value): void { @@ -124,7 +124,7 @@ public function setIsExternalSender(?bool $value): void { } /** - * Sets the subject property value. The subject property + * Sets the subject property value. The subject of the email address sent to the user. * @param string|null $value Value to set for the subject property. */ public function setSubject(?string $value): void { diff --git a/src/Generated/Models/EndUserNotification.php b/src/Generated/Models/EndUserNotification.php index e64e431a100..6e48c2fd76c 100644 --- a/src/Generated/Models/EndUserNotification.php +++ b/src/Generated/Models/EndUserNotification.php @@ -27,7 +27,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): EndUs } /** - * Gets the createdBy property value. The createdBy property + * Gets the createdBy property value. Identity of the user who created the notification. * @return EmailIdentity|null */ public function getCreatedBy(): ?EmailIdentity { @@ -39,7 +39,7 @@ public function getCreatedBy(): ?EmailIdentity { } /** - * Gets the createdDateTime property value. The createdDateTime property + * Gets the createdDateTime property value. Date and time when the notification was created. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getCreatedDateTime(): ?DateTime { @@ -51,7 +51,7 @@ public function getCreatedDateTime(): ?DateTime { } /** - * Gets the description property value. The description property + * Gets the description property value. Description of the notification as defined by the user. * @return string|null */ public function getDescription(): ?string { @@ -77,7 +77,7 @@ public function getDetails(): ?array { } /** - * Gets the displayName property value. The displayName property + * Gets the displayName property value. Name of the notification as defined by the user. * @return string|null */ public function getDisplayName(): ?string { @@ -117,7 +117,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the lastModifiedBy property value. The lastModifiedBy property + * Gets the lastModifiedBy property value. Identity of the user who last modified the notification. * @return EmailIdentity|null */ public function getLastModifiedBy(): ?EmailIdentity { @@ -129,7 +129,7 @@ public function getLastModifiedBy(): ?EmailIdentity { } /** - * Gets the lastModifiedDateTime property value. The lastModifiedDateTime property + * Gets the lastModifiedDateTime property value. Date and time when the notification was last modified. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getLastModifiedDateTime(): ?DateTime { @@ -141,7 +141,7 @@ public function getLastModifiedDateTime(): ?DateTime { } /** - * Gets the notificationType property value. The notificationType property + * Gets the notificationType property value. Type of notification. Possible values are: unknown, positiveReinforcement, noTraining, trainingAssignment, trainingReminder, unknownFutureValue. * @return EndUserNotificationType|null */ public function getNotificationType(): ?EndUserNotificationType { @@ -153,7 +153,7 @@ public function getNotificationType(): ?EndUserNotificationType { } /** - * Gets the source property value. The source property + * Gets the source property value. The source of the content. Possible values are: unknown, global, tenant, unknownFutureValue. * @return SimulationContentSource|null */ public function getSource(): ?SimulationContentSource { @@ -165,7 +165,7 @@ public function getSource(): ?SimulationContentSource { } /** - * Gets the status property value. The status property + * Gets the status property value. The status of the notification. Possible values are: unknown, draft, ready, archive, delete, unknownFutureValue. * @return SimulationContentStatus|null */ public function getStatus(): ?SimulationContentStatus { @@ -177,7 +177,7 @@ public function getStatus(): ?SimulationContentStatus { } /** - * Gets the supportedLocales property value. The supportedLocales property + * Gets the supportedLocales property value. Supported locales for endUserNotification content. * @return array|null */ public function getSupportedLocales(): ?array { @@ -210,7 +210,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the createdBy property value. The createdBy property + * Sets the createdBy property value. Identity of the user who created the notification. * @param EmailIdentity|null $value Value to set for the createdBy property. */ public function setCreatedBy(?EmailIdentity $value): void { @@ -218,7 +218,7 @@ public function setCreatedBy(?EmailIdentity $value): void { } /** - * Sets the createdDateTime property value. The createdDateTime property + * Sets the createdDateTime property value. Date and time when the notification was created. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the createdDateTime property. */ public function setCreatedDateTime(?DateTime $value): void { @@ -226,7 +226,7 @@ public function setCreatedDateTime(?DateTime $value): void { } /** - * Sets the description property value. The description property + * Sets the description property value. Description of the notification as defined by the user. * @param string|null $value Value to set for the description property. */ public function setDescription(?string $value): void { @@ -242,7 +242,7 @@ public function setDetails(?array $value): void { } /** - * Sets the displayName property value. The displayName property + * Sets the displayName property value. Name of the notification as defined by the user. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -250,7 +250,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the lastModifiedBy property value. The lastModifiedBy property + * Sets the lastModifiedBy property value. Identity of the user who last modified the notification. * @param EmailIdentity|null $value Value to set for the lastModifiedBy property. */ public function setLastModifiedBy(?EmailIdentity $value): void { @@ -258,7 +258,7 @@ public function setLastModifiedBy(?EmailIdentity $value): void { } /** - * Sets the lastModifiedDateTime property value. The lastModifiedDateTime property + * Sets the lastModifiedDateTime property value. Date and time when the notification was last modified. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the lastModifiedDateTime property. */ public function setLastModifiedDateTime(?DateTime $value): void { @@ -266,7 +266,7 @@ public function setLastModifiedDateTime(?DateTime $value): void { } /** - * Sets the notificationType property value. The notificationType property + * Sets the notificationType property value. Type of notification. Possible values are: unknown, positiveReinforcement, noTraining, trainingAssignment, trainingReminder, unknownFutureValue. * @param EndUserNotificationType|null $value Value to set for the notificationType property. */ public function setNotificationType(?EndUserNotificationType $value): void { @@ -274,7 +274,7 @@ public function setNotificationType(?EndUserNotificationType $value): void { } /** - * Sets the source property value. The source property + * Sets the source property value. The source of the content. Possible values are: unknown, global, tenant, unknownFutureValue. * @param SimulationContentSource|null $value Value to set for the source property. */ public function setSource(?SimulationContentSource $value): void { @@ -282,7 +282,7 @@ public function setSource(?SimulationContentSource $value): void { } /** - * Sets the status property value. The status property + * Sets the status property value. The status of the notification. Possible values are: unknown, draft, ready, archive, delete, unknownFutureValue. * @param SimulationContentStatus|null $value Value to set for the status property. */ public function setStatus(?SimulationContentStatus $value): void { @@ -290,7 +290,7 @@ public function setStatus(?SimulationContentStatus $value): void { } /** - * Sets the supportedLocales property value. The supportedLocales property + * Sets the supportedLocales property value. Supported locales for endUserNotification content. * @param array|null $value Value to set for the supportedLocales property. */ public function setSupportedLocales(?array $value): void { diff --git a/src/Generated/Models/EndUserNotificationDetail.php b/src/Generated/Models/EndUserNotificationDetail.php index f683b9452b0..67a7486402c 100644 --- a/src/Generated/Models/EndUserNotificationDetail.php +++ b/src/Generated/Models/EndUserNotificationDetail.php @@ -25,7 +25,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): EndUs } /** - * Gets the emailContent property value. The emailContent property + * Gets the emailContent property value. Email HTML content. * @return string|null */ public function getEmailContent(): ?string { @@ -53,7 +53,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the isDefaultLangauge property value. The isDefaultLangauge property + * Gets the isDefaultLangauge property value. Indicates whether this language is default. * @return bool|null */ public function getIsDefaultLangauge(): ?bool { @@ -65,7 +65,7 @@ public function getIsDefaultLangauge(): ?bool { } /** - * Gets the language property value. The language property + * Gets the language property value. Notification language. * @return string|null */ public function getLanguage(): ?string { @@ -77,7 +77,7 @@ public function getLanguage(): ?string { } /** - * Gets the locale property value. The locale property + * Gets the locale property value. Notification locale. * @return string|null */ public function getLocale(): ?string { @@ -101,7 +101,7 @@ public function getSentFrom(): ?EmailIdentity { } /** - * Gets the subject property value. The subject property + * Gets the subject property value. Mail subject. * @return string|null */ public function getSubject(): ?string { @@ -127,7 +127,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the emailContent property value. The emailContent property + * Sets the emailContent property value. Email HTML content. * @param string|null $value Value to set for the emailContent property. */ public function setEmailContent(?string $value): void { @@ -135,7 +135,7 @@ public function setEmailContent(?string $value): void { } /** - * Sets the isDefaultLangauge property value. The isDefaultLangauge property + * Sets the isDefaultLangauge property value. Indicates whether this language is default. * @param bool|null $value Value to set for the isDefaultLangauge property. */ public function setIsDefaultLangauge(?bool $value): void { @@ -143,7 +143,7 @@ public function setIsDefaultLangauge(?bool $value): void { } /** - * Sets the language property value. The language property + * Sets the language property value. Notification language. * @param string|null $value Value to set for the language property. */ public function setLanguage(?string $value): void { @@ -151,7 +151,7 @@ public function setLanguage(?string $value): void { } /** - * Sets the locale property value. The locale property + * Sets the locale property value. Notification locale. * @param string|null $value Value to set for the locale property. */ public function setLocale(?string $value): void { @@ -167,7 +167,7 @@ public function setSentFrom(?EmailIdentity $value): void { } /** - * Sets the subject property value. The subject property + * Sets the subject property value. Mail subject. * @param string|null $value Value to set for the subject property. */ public function setSubject(?string $value): void { diff --git a/src/Generated/Models/EndUserNotificationSetting.php b/src/Generated/Models/EndUserNotificationSetting.php index a56fecbe3f4..a0fe53f64d2 100644 --- a/src/Generated/Models/EndUserNotificationSetting.php +++ b/src/Generated/Models/EndUserNotificationSetting.php @@ -78,7 +78,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the notificationPreference property value. The notificationPreference property + * Gets the notificationPreference property value. Notification preference. Possible values are: unknown, microsoft, custom, unknownFutureValue. * @return EndUserNotificationPreference|null */ public function getNotificationPreference(): ?EndUserNotificationPreference { @@ -102,7 +102,7 @@ public function getOdataType(): ?string { } /** - * Gets the positiveReinforcement property value. The positiveReinforcement property + * Gets the positiveReinforcement property value. Positive reinforcement detail. * @return PositiveReinforcementNotification|null */ public function getPositiveReinforcement(): ?PositiveReinforcementNotification { @@ -114,7 +114,7 @@ public function getPositiveReinforcement(): ?PositiveReinforcementNotification { } /** - * Gets the settingType property value. The settingType property + * Gets the settingType property value. End user notification type. Possible values are: unknown, noTraining, trainingSelected, noNotification, unknownFutureValue. * @return EndUserNotificationSettingType|null */ public function getSettingType(): ?EndUserNotificationSettingType { @@ -154,7 +154,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the notificationPreference property value. The notificationPreference property + * Sets the notificationPreference property value. Notification preference. Possible values are: unknown, microsoft, custom, unknownFutureValue. * @param EndUserNotificationPreference|null $value Value to set for the notificationPreference property. */ public function setNotificationPreference(?EndUserNotificationPreference $value): void { @@ -170,7 +170,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the positiveReinforcement property value. The positiveReinforcement property + * Sets the positiveReinforcement property value. Positive reinforcement detail. * @param PositiveReinforcementNotification|null $value Value to set for the positiveReinforcement property. */ public function setPositiveReinforcement(?PositiveReinforcementNotification $value): void { @@ -178,7 +178,7 @@ public function setPositiveReinforcement(?PositiveReinforcementNotification $val } /** - * Sets the settingType property value. The settingType property + * Sets the settingType property value. End user notification type. Possible values are: unknown, noTraining, trainingSelected, noNotification, unknownFutureValue. * @param EndUserNotificationSettingType|null $value Value to set for the settingType property. */ public function setSettingType(?EndUserNotificationSettingType $value): void { diff --git a/src/Generated/Models/EntitlementManagement.php b/src/Generated/Models/EntitlementManagement.php index 5bda4ee81b1..2c3ac46c688 100644 --- a/src/Generated/Models/EntitlementManagement.php +++ b/src/Generated/Models/EntitlementManagement.php @@ -202,7 +202,7 @@ public function getResources(): ?array { } /** - * Gets the settings property value. The settings that control the behavior of Azure AD entitlement management. + * Gets the settings property value. The settings that control the behavior of Microsoft Entra entitlement management. * @return EntitlementManagementSettings|null */ public function getSettings(): ?EntitlementManagementSettings { @@ -322,7 +322,7 @@ public function setResources(?array $value): void { } /** - * Sets the settings property value. The settings that control the behavior of Azure AD entitlement management. + * Sets the settings property value. The settings that control the behavior of Microsoft Entra entitlement management. * @param EntitlementManagementSettings|null $value Value to set for the settings property. */ public function setSettings(?EntitlementManagementSettings $value): void { diff --git a/src/Generated/Models/Entity.php b/src/Generated/Models/Entity.php index fde015c6d38..3b0c926edec 100644 --- a/src/Generated/Models/Entity.php +++ b/src/Generated/Models/Entity.php @@ -53,6 +53,7 @@ use Microsoft\Graph\Generated\Models\Security\HostCookie; use Microsoft\Graph\Generated\Models\Security\Hostname; use Microsoft\Graph\Generated\Models\Security\HostPair; +use Microsoft\Graph\Generated\Models\Security\HostPort; use Microsoft\Graph\Generated\Models\Security\HostReputation; use Microsoft\Graph\Generated\Models\Security\HostSslCertificate; use Microsoft\Graph\Generated\Models\Security\HostTracker; @@ -311,6 +312,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Entit case '#microsoft.graph.deviceEnrollmentPlatformRestrictionsConfiguration': return new DeviceEnrollmentPlatformRestrictionsConfiguration(); case '#microsoft.graph.deviceEnrollmentWindowsHelloForBusinessConfiguration': return new DeviceEnrollmentWindowsHelloForBusinessConfiguration(); case '#microsoft.graph.deviceInstallState': return new DeviceInstallState(); + case '#microsoft.graph.deviceLocalCredentialInfo': return new DeviceLocalCredentialInfo(); case '#microsoft.graph.deviceLogCollectionResponse': return new DeviceLogCollectionResponse(); case '#microsoft.graph.deviceManagement': return new DeviceManagement(); case '#microsoft.graph.deviceManagementExchangeConnector': return new DeviceManagementExchangeConnector(); @@ -614,6 +616,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Entit case '#microsoft.graph.recordOperation': return new RecordOperation(); case '#microsoft.graph.referenceAttachment': return new ReferenceAttachment(); case '#microsoft.graph.remoteAssistancePartner': return new RemoteAssistancePartner(); + case '#microsoft.graph.remoteDesktopSecurityConfiguration': return new RemoteDesktopSecurityConfiguration(); case '#microsoft.graph.request': return new Request(); case '#microsoft.graph.resellerDelegatedAdminRelationship': return new ResellerDelegatedAdminRelationship(); case '#microsoft.graph.resourceOperation': return new ResourceOperation(); @@ -670,6 +673,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Entit case '#microsoft.graph.security.hostCookie': return new HostCookie(); case '#microsoft.graph.security.hostname': return new Hostname(); case '#microsoft.graph.security.hostPair': return new HostPair(); + case '#microsoft.graph.security.hostPort': return new HostPort(); case '#microsoft.graph.security.hostReputation': return new HostReputation(); case '#microsoft.graph.security.hostSslCertificate': return new HostSslCertificate(); case '#microsoft.graph.security.hostTracker': return new HostTracker(); @@ -741,6 +745,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Entit case '#microsoft.graph.synchronizationJob': return new SynchronizationJob(); case '#microsoft.graph.synchronizationSchema': return new SynchronizationSchema(); case '#microsoft.graph.synchronizationTemplate': return new SynchronizationTemplate(); + case '#microsoft.graph.targetDeviceGroup': return new TargetDeviceGroup(); case '#microsoft.graph.targetedManagedAppConfiguration': return new TargetedManagedAppConfiguration(); case '#microsoft.graph.targetedManagedAppPolicyAssignment': return new TargetedManagedAppPolicyAssignment(); case '#microsoft.graph.targetedManagedAppProtection': return new TargetedManagedAppProtection(); diff --git a/src/Generated/Models/ExcludeTarget.php b/src/Generated/Models/ExcludeTarget.php index 729887303df..3e25841bb79 100644 --- a/src/Generated/Models/ExcludeTarget.php +++ b/src/Generated/Models/ExcludeTarget.php @@ -69,7 +69,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the id property value. The object identifier of an Azure Active Directory user or group. + * Gets the id property value. The object identifier of a Microsoft Entra user or group. * @return string|null */ public function getId(): ?string { @@ -132,7 +132,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the id property value. The object identifier of an Azure Active Directory user or group. + * Sets the id property value. The object identifier of a Microsoft Entra user or group. * @param string|null $value Value to set for the id property. */ public function setId(?string $value): void { diff --git a/src/Generated/Models/ExtensionProperty.php b/src/Generated/Models/ExtensionProperty.php index 069e7ec1644..ba102d7fa57 100644 --- a/src/Generated/Models/ExtensionProperty.php +++ b/src/Generated/Models/ExtensionProperty.php @@ -59,6 +59,7 @@ public function getFieldDeserializers(): array { return array_merge(parent::getFieldDeserializers(), [ 'appDisplayName' => fn(ParseNode $n) => $o->setAppDisplayName($n->getStringValue()), 'dataType' => fn(ParseNode $n) => $o->setDataType($n->getStringValue()), + 'isMultiValued' => fn(ParseNode $n) => $o->setIsMultiValued($n->getBooleanValue()), 'isSyncedFromOnPremises' => fn(ParseNode $n) => $o->setIsSyncedFromOnPremises($n->getBooleanValue()), 'name' => fn(ParseNode $n) => $o->setName($n->getStringValue()), 'targetObjects' => function (ParseNode $n) { @@ -73,7 +74,19 @@ public function getFieldDeserializers(): array { } /** - * Gets the isSyncedFromOnPremises property value. Indicates if this extension property was synced from on-premises active directory using Azure AD Connect. Read-only. + * Gets the isMultiValued property value. The isMultiValued property + * @return bool|null + */ + public function getIsMultiValued(): ?bool { + $val = $this->getBackingStore()->get('isMultiValued'); + if (is_null($val) || is_bool($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'isMultiValued'"); + } + + /** + * Gets the isSyncedFromOnPremises property value. Indicates if this extension property was synced from on-premises active directory using Microsoft Entra Connect. Read-only. * @return bool|null */ public function getIsSyncedFromOnPremises(): ?bool { @@ -118,6 +131,7 @@ public function serialize(SerializationWriter $writer): void { parent::serialize($writer); $writer->writeStringValue('appDisplayName', $this->getAppDisplayName()); $writer->writeStringValue('dataType', $this->getDataType()); + $writer->writeBooleanValue('isMultiValued', $this->getIsMultiValued()); $writer->writeBooleanValue('isSyncedFromOnPremises', $this->getIsSyncedFromOnPremises()); $writer->writeStringValue('name', $this->getName()); $writer->writeCollectionOfPrimitiveValues('targetObjects', $this->getTargetObjects()); @@ -140,7 +154,15 @@ public function setDataType(?string $value): void { } /** - * Sets the isSyncedFromOnPremises property value. Indicates if this extension property was synced from on-premises active directory using Azure AD Connect. Read-only. + * Sets the isMultiValued property value. The isMultiValued property + * @param bool|null $value Value to set for the isMultiValued property. + */ + public function setIsMultiValued(?bool $value): void { + $this->getBackingStore()->set('isMultiValued', $value); + } + + /** + * Sets the isSyncedFromOnPremises property value. Indicates if this extension property was synced from on-premises active directory using Microsoft Entra Connect. Read-only. * @param bool|null $value Value to set for the isSyncedFromOnPremises property. */ public function setIsSyncedFromOnPremises(?bool $value): void { diff --git a/src/Generated/Models/ExternalConnectors/Acl.php b/src/Generated/Models/ExternalConnectors/Acl.php index f19490f90f4..da90c2486f5 100644 --- a/src/Generated/Models/ExternalConnectors/Acl.php +++ b/src/Generated/Models/ExternalConnectors/Acl.php @@ -106,7 +106,7 @@ public function getType(): ?AclType { } /** - * Gets the value property value. The unique identifer of the identity. For Azure Active Directory identities, value is set to the object identifier of the user, group or tenant for types user, group and everyone (and everyoneExceptGuests) respectively. For external groups value is set to the ID of the externalGroup + * Gets the value property value. The unique identifer of the identity. For Microsoft Entra identities, value is set to the object identifier of the user, group or tenant for types user, group and everyone (and everyoneExceptGuests) respectively. For external groups value is set to the ID of the externalGroup * @return string|null */ public function getValue(): ?string { @@ -170,7 +170,7 @@ public function setType(?AclType $value): void { } /** - * Sets the value property value. The unique identifer of the identity. For Azure Active Directory identities, value is set to the object identifier of the user, group or tenant for types user, group and everyone (and everyoneExceptGuests) respectively. For external groups value is set to the ID of the externalGroup + * Sets the value property value. The unique identifer of the identity. For Microsoft Entra identities, value is set to the object identifier of the user, group or tenant for types user, group and everyone (and everyoneExceptGuests) respectively. For external groups value is set to the ID of the externalGroup * @param string|null $value Value to set for the value property. */ public function setValue(?string $value): void { diff --git a/src/Generated/Models/ExternalConnectors/Configuration.php b/src/Generated/Models/ExternalConnectors/Configuration.php index c02ae803a04..336ce6ccb2a 100644 --- a/src/Generated/Models/ExternalConnectors/Configuration.php +++ b/src/Generated/Models/ExternalConnectors/Configuration.php @@ -49,7 +49,7 @@ public function getAdditionalData(): ?array { } /** - * Gets the authorizedAppIds property value. A collection of application IDs for registered Azure Active Directory apps that are allowed to manage the externalConnection and to index content in the externalConnection. + * Gets the authorizedAppIds property value. A collection of application IDs for registered Microsoft Entra apps that are allowed to manage the externalConnection and to index content in the externalConnection. * @return array|null */ public function getAuthorizedAppIds(): ?array { @@ -120,7 +120,7 @@ public function setAdditionalData(?array $value): void { } /** - * Sets the authorizedAppIds property value. A collection of application IDs for registered Azure Active Directory apps that are allowed to manage the externalConnection and to index content in the externalConnection. + * Sets the authorizedAppIds property value. A collection of application IDs for registered Microsoft Entra apps that are allowed to manage the externalConnection and to index content in the externalConnection. * @param array|null $value Value to set for the authorizedAppIds property. */ public function setAuthorizedAppIds(?array $value): void { diff --git a/src/Generated/Models/ExternalConnectors/ExternalConnection.php b/src/Generated/Models/ExternalConnectors/ExternalConnection.php index 277531d1171..ddd40818a45 100644 --- a/src/Generated/Models/ExternalConnectors/ExternalConnection.php +++ b/src/Generated/Models/ExternalConnectors/ExternalConnection.php @@ -50,6 +50,18 @@ public function getConfiguration(): ?Configuration { throw new \UnexpectedValueException("Invalid type found in backing store for 'configuration'"); } + /** + * Gets the connectorId property value. The Teams app ID. Optional. + * @return string|null + */ + public function getConnectorId(): ?string { + $val = $this->getBackingStore()->get('connectorId'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'connectorId'"); + } + /** * Gets the description property value. Description of the connection displayed in the Microsoft 365 admin center. Optional. * @return string|null @@ -71,6 +83,7 @@ public function getFieldDeserializers(): array { return array_merge(parent::getFieldDeserializers(), [ 'activitySettings' => fn(ParseNode $n) => $o->setActivitySettings($n->getObjectValue([ActivitySettings::class, 'createFromDiscriminatorValue'])), 'configuration' => fn(ParseNode $n) => $o->setConfiguration($n->getObjectValue([Configuration::class, 'createFromDiscriminatorValue'])), + 'connectorId' => fn(ParseNode $n) => $o->setConnectorId($n->getStringValue()), 'description' => fn(ParseNode $n) => $o->setDescription($n->getStringValue()), 'groups' => fn(ParseNode $n) => $o->setGroups($n->getCollectionOfObjectValues([ExternalGroup::class, 'createFromDiscriminatorValue'])), 'items' => fn(ParseNode $n) => $o->setItems($n->getCollectionOfObjectValues([ExternalItem::class, 'createFromDiscriminatorValue'])), @@ -180,6 +193,7 @@ public function serialize(SerializationWriter $writer): void { parent::serialize($writer); $writer->writeObjectValue('activitySettings', $this->getActivitySettings()); $writer->writeObjectValue('configuration', $this->getConfiguration()); + $writer->writeStringValue('connectorId', $this->getConnectorId()); $writer->writeStringValue('description', $this->getDescription()); $writer->writeCollectionOfObjectValues('groups', $this->getGroups()); $writer->writeCollectionOfObjectValues('items', $this->getItems()); @@ -205,6 +219,14 @@ public function setConfiguration(?Configuration $value): void { $this->getBackingStore()->set('configuration', $value); } + /** + * Sets the connectorId property value. The Teams app ID. Optional. + * @param string|null $value Value to set for the connectorId property. + */ + public function setConnectorId(?string $value): void { + $this->getBackingStore()->set('connectorId', $value); + } + /** * Sets the description property value. Description of the connection displayed in the Microsoft 365 admin center. Optional. * @param string|null $value Value to set for the description property. diff --git a/src/Generated/Models/ExternalConnectors/ExternalGroup.php b/src/Generated/Models/ExternalConnectors/ExternalGroup.php index 8eb74b978ed..b48de52b365 100644 --- a/src/Generated/Models/ExternalConnectors/ExternalGroup.php +++ b/src/Generated/Models/ExternalConnectors/ExternalGroup.php @@ -64,7 +64,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the members property value. A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * Gets the members property value. A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. * @return array|null */ public function getMembers(): ?array { @@ -105,7 +105,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the members property value. A member added to an externalGroup. You can add Azure Active Directory users, Azure Active Directory groups, or an externalGroup as members. + * Sets the members property value. A member added to an externalGroup. You can add Microsoft Entra users, Microsoft Entra groups, or an externalGroup as members. * @param array|null $value Value to set for the members property. */ public function setMembers(?array $value): void { diff --git a/src/Generated/Models/ExternalConnectors/Identity.php b/src/Generated/Models/ExternalConnectors/Identity.php index 5032ee07a9f..aa30e14ef1a 100644 --- a/src/Generated/Models/ExternalConnectors/Identity.php +++ b/src/Generated/Models/ExternalConnectors/Identity.php @@ -37,7 +37,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the type property value. The type of identity. Possible values are: user or group for Azure AD identities and externalgroup for groups in an external system. + * Gets the type property value. The type of identity. Possible values are: user or group for Microsoft Entra identities and externalgroup for groups in an external system. * @return IdentityType|null */ public function getType(): ?IdentityType { @@ -58,7 +58,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the type property value. The type of identity. Possible values are: user or group for Azure AD identities and externalgroup for groups in an external system. + * Sets the type property value. The type of identity. Possible values are: user or group for Microsoft Entra identities and externalgroup for groups in an external system. * @param IdentityType|null $value Value to set for the type property. */ public function setType(?IdentityType $value): void { diff --git a/src/Generated/Models/FederatedIdentityCredential.php b/src/Generated/Models/FederatedIdentityCredential.php index 5bec3e6dfc8..5a9fb950c0d 100644 --- a/src/Generated/Models/FederatedIdentityCredential.php +++ b/src/Generated/Models/FederatedIdentityCredential.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Feder } /** - * Gets the audiences property value. The audience that can appear in the external token. This field is mandatory and should be set to api://AzureADTokenExchange for Azure AD. It says what Microsoft identity platform should accept in the aud claim in the incoming token. This value represents Azure AD in your external identity provider and has no fixed value across identity providers - you may need to create a new application registration in your identity provider to serve as the audience of this token. This field can only accept a single value and has a limit of 600 characters. Required. + * Gets the audiences property value. The audience that can appear in the external token. This field is mandatory and should be set to api://AzureADTokenExchange for Microsoft Entra ID. It says what Microsoft identity platform should accept in the aud claim in the incoming token. This value represents Microsoft Entra ID in your external identity provider and has no fixed value across identity providers - you might need to create a new application registration in your identity provider to serve as the audience of this token. This field can only accept a single value and has a limit of 600 characters. Required. * @return array|null */ public function getAudiences(): ?array { @@ -40,7 +40,7 @@ public function getAudiences(): ?array { } /** - * Gets the description property value. The un-validated, user-provided description of the federated identity credential. It has a limit of 600 characters. Optional. + * Gets the description property value. The unvalidated description of the federated identity credential, provided by the user. It has a limit of 600 characters. Optional. * @return string|null */ public function getDescription(): ?string { @@ -74,7 +74,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the issuer property value. The URL of the external identity provider and must match the issuer claim of the external token being exchanged. The combination of the values of issuer and subject must be unique on the app. It has a limit of 600 characters. Required. + * Gets the issuer property value. The URL of the external identity provider, which must match the issuer claim of the external token being exchanged. The combination of the values of issuer and subject must be unique within the app. It has a limit of 600 characters. Required. * @return string|null */ public function getIssuer(): ?string { @@ -86,7 +86,7 @@ public function getIssuer(): ?string { } /** - * Gets the name property value. is the unique identifier for the federated identity credential, which has a limit of 120 characters and must be URL friendly. It is immutable once created. Required. Not nullable. Supports $filter (eq). + * Gets the name property value. The unique identifier for the federated identity credential, which has a limit of 120 characters and must be URL friendly. The string is immutable after it's created. Required. Not nullable. Supports $filter (eq). * @return string|null */ public function getName(): ?string { @@ -98,7 +98,7 @@ public function getName(): ?string { } /** - * Gets the subject property value. Required. The identifier of the external software workload within the external identity provider. Like the audience value, it has no fixed format, as each identity provider uses their own - sometimes a GUID, sometimes a colon delimited identifier, sometimes arbitrary strings. The value here must match the sub claim within the token presented to Azure AD. The combination of issuer and subject must be unique on the app. It has a limit of 600 characters. Supports $filter (eq). + * Gets the subject property value. Required. The identifier of the external software workload within the external identity provider. Like the audience value, it has no fixed format; each identity provider uses their own - sometimes a GUID, sometimes a colon delimited identifier, sometimes arbitrary strings. The value here must match the sub claim within the token presented to Microsoft Entra ID. The combination of issuer and subject must be unique within the app. It has a limit of 600 characters. Supports $filter (eq). * @return string|null */ public function getSubject(): ?string { @@ -123,7 +123,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the audiences property value. The audience that can appear in the external token. This field is mandatory and should be set to api://AzureADTokenExchange for Azure AD. It says what Microsoft identity platform should accept in the aud claim in the incoming token. This value represents Azure AD in your external identity provider and has no fixed value across identity providers - you may need to create a new application registration in your identity provider to serve as the audience of this token. This field can only accept a single value and has a limit of 600 characters. Required. + * Sets the audiences property value. The audience that can appear in the external token. This field is mandatory and should be set to api://AzureADTokenExchange for Microsoft Entra ID. It says what Microsoft identity platform should accept in the aud claim in the incoming token. This value represents Microsoft Entra ID in your external identity provider and has no fixed value across identity providers - you might need to create a new application registration in your identity provider to serve as the audience of this token. This field can only accept a single value and has a limit of 600 characters. Required. * @param array|null $value Value to set for the audiences property. */ public function setAudiences(?array $value): void { @@ -131,7 +131,7 @@ public function setAudiences(?array $value): void { } /** - * Sets the description property value. The un-validated, user-provided description of the federated identity credential. It has a limit of 600 characters. Optional. + * Sets the description property value. The unvalidated description of the federated identity credential, provided by the user. It has a limit of 600 characters. Optional. * @param string|null $value Value to set for the description property. */ public function setDescription(?string $value): void { @@ -139,7 +139,7 @@ public function setDescription(?string $value): void { } /** - * Sets the issuer property value. The URL of the external identity provider and must match the issuer claim of the external token being exchanged. The combination of the values of issuer and subject must be unique on the app. It has a limit of 600 characters. Required. + * Sets the issuer property value. The URL of the external identity provider, which must match the issuer claim of the external token being exchanged. The combination of the values of issuer and subject must be unique within the app. It has a limit of 600 characters. Required. * @param string|null $value Value to set for the issuer property. */ public function setIssuer(?string $value): void { @@ -147,7 +147,7 @@ public function setIssuer(?string $value): void { } /** - * Sets the name property value. is the unique identifier for the federated identity credential, which has a limit of 120 characters and must be URL friendly. It is immutable once created. Required. Not nullable. Supports $filter (eq). + * Sets the name property value. The unique identifier for the federated identity credential, which has a limit of 120 characters and must be URL friendly. The string is immutable after it's created. Required. Not nullable. Supports $filter (eq). * @param string|null $value Value to set for the name property. */ public function setName(?string $value): void { @@ -155,7 +155,7 @@ public function setName(?string $value): void { } /** - * Sets the subject property value. Required. The identifier of the external software workload within the external identity provider. Like the audience value, it has no fixed format, as each identity provider uses their own - sometimes a GUID, sometimes a colon delimited identifier, sometimes arbitrary strings. The value here must match the sub claim within the token presented to Azure AD. The combination of issuer and subject must be unique on the app. It has a limit of 600 characters. Supports $filter (eq). + * Sets the subject property value. Required. The identifier of the external software workload within the external identity provider. Like the audience value, it has no fixed format; each identity provider uses their own - sometimes a GUID, sometimes a colon delimited identifier, sometimes arbitrary strings. The value here must match the sub claim within the token presented to Microsoft Entra ID. The combination of issuer and subject must be unique within the app. It has a limit of 600 characters. Supports $filter (eq). * @param string|null $value Value to set for the subject property. */ public function setSubject(?string $value): void { diff --git a/src/Generated/Models/Group.php b/src/Generated/Models/Group.php index bc6df49d719..5399504ef60 100644 --- a/src/Generated/Models/Group.php +++ b/src/Generated/Models/Group.php @@ -440,7 +440,7 @@ public function getIsArchived(): ?bool { } /** - * Gets the isAssignableToRole property value. Indicates whether this group can be assigned to an Azure Active Directory role or not. Optional. This property can only be set while creating the group and is immutable. If set to true, the securityEnabled property must also be set to true, visibility must be Hidden, and the group cannot be a dynamic group (that is, groupTypes cannot contain DynamicMembership). Only callers in Global Administrator and Privileged Role Administrator roles can set this property. The caller must also be assigned the RoleManagement.ReadWrite.Directory permission to set this property or update the membership of such groups. For more, see Using a group to manage Azure AD role assignmentsUsing this feature requires a Azure AD Premium P1 license. Returned by default. Supports $filter (eq, ne, not). + * Gets the isAssignableToRole property value. Indicates whether this group can be assigned to a Microsoft Entra role or not. Optional. This property can only be set while creating the group and is immutable. If set to true, the securityEnabled property must also be set to true, visibility must be Hidden, and the group cannot be a dynamic group (that is, groupTypes cannot contain DynamicMembership). Only callers in Global Administrator and Privileged Role Administrator roles can set this property. The caller must also be assigned the RoleManagement.ReadWrite.Directory permission to set this property or update the membership of such groups. For more, see Using a group to manage Microsoft Entra role assignmentsUsing this feature requires a Microsoft Entra ID P1 license. Returned by default. Supports $filter (eq, ne, not). * @return bool|null */ public function getIsAssignableToRole(): ?bool { @@ -640,7 +640,7 @@ public function getOnPremisesProvisioningErrors(): ?array { } /** - * Gets the onPremisesSamAccountName property value. Contains the on-premises SAM account name synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Azure Active Directory via Azure AD Connect.Returned by default. Supports $filter (eq, ne, not, ge, le, in, startsWith). Read-only. + * Gets the onPremisesSamAccountName property value. Contains the on-premises SAM account name synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Microsoft Entra ID via Microsoft Entra Connect.Returned by default. Supports $filter (eq, ne, not, ge, le, in, startsWith). Read-only. * @return string|null */ public function getOnPremisesSamAccountName(): ?string { @@ -742,7 +742,7 @@ public function getPlanner(): ?PlannerGroup { } /** - * Gets the preferredDataLocation property value. The preferred data location for the Microsoft 365 group. By default, the group inherits the group creator's preferred data location. To set this property, the calling user must be assigned one of the following Azure AD roles: Global Administrator User Account Administrator Directory Writer Exchange Administrator SharePoint Administrator For more information about this property, see OneDrive Online Multi-Geo. Nullable. Returned by default. + * Gets the preferredDataLocation property value. The preferred data location for the Microsoft 365 group. By default, the group inherits the group creator's preferred data location. To set this property, the calling app must be granted the Directory.ReadWrite.All permission and the user be assigned one of the following Microsoft Entra roles: Global Administrator User Account Administrator Directory Writer Exchange Administrator SharePoint Administrator For more information about this property, see OneDrive Online Multi-Geo. Nullable. Returned by default. * @return string|null */ public function getPreferredDataLocation(): ?string { @@ -1236,7 +1236,7 @@ public function setIsArchived(?bool $value): void { } /** - * Sets the isAssignableToRole property value. Indicates whether this group can be assigned to an Azure Active Directory role or not. Optional. This property can only be set while creating the group and is immutable. If set to true, the securityEnabled property must also be set to true, visibility must be Hidden, and the group cannot be a dynamic group (that is, groupTypes cannot contain DynamicMembership). Only callers in Global Administrator and Privileged Role Administrator roles can set this property. The caller must also be assigned the RoleManagement.ReadWrite.Directory permission to set this property or update the membership of such groups. For more, see Using a group to manage Azure AD role assignmentsUsing this feature requires a Azure AD Premium P1 license. Returned by default. Supports $filter (eq, ne, not). + * Sets the isAssignableToRole property value. Indicates whether this group can be assigned to a Microsoft Entra role or not. Optional. This property can only be set while creating the group and is immutable. If set to true, the securityEnabled property must also be set to true, visibility must be Hidden, and the group cannot be a dynamic group (that is, groupTypes cannot contain DynamicMembership). Only callers in Global Administrator and Privileged Role Administrator roles can set this property. The caller must also be assigned the RoleManagement.ReadWrite.Directory permission to set this property or update the membership of such groups. For more, see Using a group to manage Microsoft Entra role assignmentsUsing this feature requires a Microsoft Entra ID P1 license. Returned by default. Supports $filter (eq, ne, not). * @param bool|null $value Value to set for the isAssignableToRole property. */ public function setIsAssignableToRole(?bool $value): void { @@ -1364,7 +1364,7 @@ public function setOnPremisesProvisioningErrors(?array $value): void { } /** - * Sets the onPremisesSamAccountName property value. Contains the on-premises SAM account name synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Azure Active Directory via Azure AD Connect.Returned by default. Supports $filter (eq, ne, not, ge, le, in, startsWith). Read-only. + * Sets the onPremisesSamAccountName property value. Contains the on-premises SAM account name synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Microsoft Entra ID via Microsoft Entra Connect.Returned by default. Supports $filter (eq, ne, not, ge, le, in, startsWith). Read-only. * @param string|null $value Value to set for the onPremisesSamAccountName property. */ public function setOnPremisesSamAccountName(?string $value): void { @@ -1428,7 +1428,7 @@ public function setPlanner(?PlannerGroup $value): void { } /** - * Sets the preferredDataLocation property value. The preferred data location for the Microsoft 365 group. By default, the group inherits the group creator's preferred data location. To set this property, the calling user must be assigned one of the following Azure AD roles: Global Administrator User Account Administrator Directory Writer Exchange Administrator SharePoint Administrator For more information about this property, see OneDrive Online Multi-Geo. Nullable. Returned by default. + * Sets the preferredDataLocation property value. The preferred data location for the Microsoft 365 group. By default, the group inherits the group creator's preferred data location. To set this property, the calling app must be granted the Directory.ReadWrite.All permission and the user be assigned one of the following Microsoft Entra roles: Global Administrator User Account Administrator Directory Writer Exchange Administrator SharePoint Administrator For more information about this property, see OneDrive Online Multi-Geo. Nullable. Returned by default. * @param string|null $value Value to set for the preferredDataLocation property. */ public function setPreferredDataLocation(?string $value): void { diff --git a/src/Generated/Models/GroupMembers.php b/src/Generated/Models/GroupMembers.php index 3f39542f2c7..2dda5848284 100644 --- a/src/Generated/Models/GroupMembers.php +++ b/src/Generated/Models/GroupMembers.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Group } /** - * Gets the description property value. The name of the group in Azure AD. Read only. + * Gets the description property value. The name of the group in Microsoft Entra ID. Read only. * @return string|null */ public function getDescription(): ?string { @@ -50,7 +50,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the groupId property value. The ID of the group in Azure AD. + * Gets the groupId property value. The ID of the group in Microsoft Entra ID. * @return string|null */ public function getGroupId(): ?string { @@ -72,7 +72,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the description property value. The name of the group in Azure AD. Read only. + * Sets the description property value. The name of the group in Microsoft Entra ID. Read only. * @param string|null $value Value to set for the description property. */ public function setDescription(?string $value): void { @@ -80,7 +80,7 @@ public function setDescription(?string $value): void { } /** - * Sets the groupId property value. The ID of the group in Azure AD. + * Sets the groupId property value. The ID of the group in Microsoft Entra ID. * @param string|null $value Value to set for the groupId property. */ public function setGroupId(?string $value): void { diff --git a/src/Generated/Models/Identity.php b/src/Generated/Models/Identity.php index 39eeace1d48..e57df238aac 100644 --- a/src/Generated/Models/Identity.php +++ b/src/Generated/Models/Identity.php @@ -35,6 +35,13 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Ident if ($mappingValueNode !== null) { $mappingValue = $mappingValueNode->getStringValue(); switch ($mappingValue) { + case '#microsoft.graph.azureCommunicationServicesUserIdentity': return new AzureCommunicationServicesUserIdentity(); + case '#microsoft.graph.communicationsApplicationIdentity': return new CommunicationsApplicationIdentity(); + case '#microsoft.graph.communicationsApplicationInstanceIdentity': return new CommunicationsApplicationInstanceIdentity(); + case '#microsoft.graph.communicationsEncryptedIdentity': return new CommunicationsEncryptedIdentity(); + case '#microsoft.graph.communicationsGuestIdentity': return new CommunicationsGuestIdentity(); + case '#microsoft.graph.communicationsPhoneIdentity': return new CommunicationsPhoneIdentity(); + case '#microsoft.graph.communicationsUserIdentity': return new CommunicationsUserIdentity(); case '#microsoft.graph.emailIdentity': return new EmailIdentity(); case '#microsoft.graph.initiator': return new Initiator(); case '#microsoft.graph.provisionedIdentity': return new ProvisionedIdentity(); diff --git a/src/Generated/Models/IdentityGovernance/CustomTaskExtension.php b/src/Generated/Models/IdentityGovernance/CustomTaskExtension.php index 5fc8c89c42a..8ffead86a09 100644 --- a/src/Generated/Models/IdentityGovernance/CustomTaskExtension.php +++ b/src/Generated/Models/IdentityGovernance/CustomTaskExtension.php @@ -42,7 +42,7 @@ public function getCallbackConfiguration(): ?CustomExtensionCallbackConfiguratio } /** - * Gets the createdBy property value. The unique identifier of the Azure AD user that created the custom task extension.Supports $filter(eq, ne) and $expand. + * Gets the createdBy property value. The unique identifier of the Microsoft Entra user that created the custom task extension.Supports $filter(eq, ne) and $expand. * @return User|null */ public function getCreatedBy(): ?User { @@ -81,7 +81,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the lastModifiedBy property value. The unique identifier of the Azure AD user that modified the custom task extension last.Supports $filter(eq, ne) and $expand. + * Gets the lastModifiedBy property value. The unique identifier of the Microsoft Entra user that modified the custom task extension last.Supports $filter(eq, ne) and $expand. * @return User|null */ public function getLastModifiedBy(): ?User { @@ -126,7 +126,7 @@ public function setCallbackConfiguration(?CustomExtensionCallbackConfiguration $ } /** - * Sets the createdBy property value. The unique identifier of the Azure AD user that created the custom task extension.Supports $filter(eq, ne) and $expand. + * Sets the createdBy property value. The unique identifier of the Microsoft Entra user that created the custom task extension.Supports $filter(eq, ne) and $expand. * @param User|null $value Value to set for the createdBy property. */ public function setCreatedBy(?User $value): void { @@ -142,7 +142,7 @@ public function setCreatedDateTime(?DateTime $value): void { } /** - * Sets the lastModifiedBy property value. The unique identifier of the Azure AD user that modified the custom task extension last.Supports $filter(eq, ne) and $expand. + * Sets the lastModifiedBy property value. The unique identifier of the Microsoft Entra user that modified the custom task extension last.Supports $filter(eq, ne) and $expand. * @param User|null $value Value to set for the lastModifiedBy property. */ public function setLastModifiedBy(?User $value): void { diff --git a/src/Generated/Models/IdentityGovernance/Workflow.php b/src/Generated/Models/IdentityGovernance/Workflow.php index 83b1daeafbe..fd49322e9a5 100644 --- a/src/Generated/Models/IdentityGovernance/Workflow.php +++ b/src/Generated/Models/IdentityGovernance/Workflow.php @@ -40,7 +40,7 @@ public function getDeletedDateTime(): ?DateTime { } /** - * Gets the executionScope property value. The unique identifier of the Azure AD identity that last modified the workflow object. + * Gets the executionScope property value. The unique identifier of the Microsoft Entra identity that last modified the workflow object. * @return array|null */ public function getExecutionScope(): ?array { @@ -190,7 +190,7 @@ public function setDeletedDateTime(?DateTime $value): void { } /** - * Sets the executionScope property value. The unique identifier of the Azure AD identity that last modified the workflow object. + * Sets the executionScope property value. The unique identifier of the Microsoft Entra identity that last modified the workflow object. * @param array|null $value Value to set for the executionScope property. */ public function setExecutionScope(?array $value): void { diff --git a/src/Generated/Models/IdentityGovernance/WorkflowBase.php b/src/Generated/Models/IdentityGovernance/WorkflowBase.php index 2b104adf824..3746c34e817 100644 --- a/src/Generated/Models/IdentityGovernance/WorkflowBase.php +++ b/src/Generated/Models/IdentityGovernance/WorkflowBase.php @@ -185,7 +185,7 @@ public function getIsSchedulingEnabled(): ?bool { } /** - * Gets the lastModifiedBy property value. The unique identifier of the Azure Active Directory identity that last modified the workflow. + * Gets the lastModifiedBy property value. The unique identifier of the Microsoft Entra identity that last modified the workflow. * @return User|null */ public function getLastModifiedBy(): ?User { @@ -335,7 +335,7 @@ public function setIsSchedulingEnabled(?bool $value): void { } /** - * Sets the lastModifiedBy property value. The unique identifier of the Azure Active Directory identity that last modified the workflow. + * Sets the lastModifiedBy property value. The unique identifier of the Microsoft Entra identity that last modified the workflow. * @param User|null $value Value to set for the lastModifiedBy property. */ public function setLastModifiedBy(?User $value): void { diff --git a/src/Generated/Models/IdentityProtectionRoot.php b/src/Generated/Models/IdentityProtectionRoot.php index 8643d40dd5b..4c7e922d52a 100644 --- a/src/Generated/Models/IdentityProtectionRoot.php +++ b/src/Generated/Models/IdentityProtectionRoot.php @@ -84,7 +84,7 @@ public function getOdataType(): ?string { } /** - * Gets the riskDetections property value. Risk detection in Azure AD Identity Protection and the associated information about the detection. + * Gets the riskDetections property value. Risk detection in Microsoft Entra ID Protection and the associated information about the detection. * @return array|null */ public function getRiskDetections(): ?array { @@ -98,7 +98,7 @@ public function getRiskDetections(): ?array { } /** - * Gets the riskyServicePrincipals property value. Azure AD service principals that are at risk. + * Gets the riskyServicePrincipals property value. Microsoft Entra service principals that are at risk. * @return array|null */ public function getRiskyServicePrincipals(): ?array { @@ -112,7 +112,7 @@ public function getRiskyServicePrincipals(): ?array { } /** - * Gets the riskyUsers property value. Users that are flagged as at-risk by Azure AD Identity Protection. + * Gets the riskyUsers property value. Users that are flagged as at-risk by Microsoft Entra ID Protection. * @return array|null */ public function getRiskyUsers(): ?array { @@ -126,7 +126,7 @@ public function getRiskyUsers(): ?array { } /** - * Gets the servicePrincipalRiskDetections property value. Represents information about detected at-risk service principals in an Azure AD tenant. + * Gets the servicePrincipalRiskDetections property value. Represents information about detected at-risk service principals in a Microsoft Entra tenant. * @return array|null */ public function getServicePrincipalRiskDetections(): ?array { @@ -177,7 +177,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the riskDetections property value. Risk detection in Azure AD Identity Protection and the associated information about the detection. + * Sets the riskDetections property value. Risk detection in Microsoft Entra ID Protection and the associated information about the detection. * @param array|null $value Value to set for the riskDetections property. */ public function setRiskDetections(?array $value): void { @@ -185,7 +185,7 @@ public function setRiskDetections(?array $value): void { } /** - * Sets the riskyServicePrincipals property value. Azure AD service principals that are at risk. + * Sets the riskyServicePrincipals property value. Microsoft Entra service principals that are at risk. * @param array|null $value Value to set for the riskyServicePrincipals property. */ public function setRiskyServicePrincipals(?array $value): void { @@ -193,7 +193,7 @@ public function setRiskyServicePrincipals(?array $value): void { } /** - * Sets the riskyUsers property value. Users that are flagged as at-risk by Azure AD Identity Protection. + * Sets the riskyUsers property value. Users that are flagged as at-risk by Microsoft Entra ID Protection. * @param array|null $value Value to set for the riskyUsers property. */ public function setRiskyUsers(?array $value): void { @@ -201,7 +201,7 @@ public function setRiskyUsers(?array $value): void { } /** - * Sets the servicePrincipalRiskDetections property value. Represents information about detected at-risk service principals in an Azure AD tenant. + * Sets the servicePrincipalRiskDetections property value. Represents information about detected at-risk service principals in a Microsoft Entra tenant. * @param array|null $value Value to set for the servicePrincipalRiskDetections property. */ public function setServicePrincipalRiskDetections(?array $value): void { diff --git a/src/Generated/Models/IdentitySecurityDefaultsEnforcementPolicy.php b/src/Generated/Models/IdentitySecurityDefaultsEnforcementPolicy.php index 16c1fb85166..2277a35ad27 100644 --- a/src/Generated/Models/IdentitySecurityDefaultsEnforcementPolicy.php +++ b/src/Generated/Models/IdentitySecurityDefaultsEnforcementPolicy.php @@ -37,7 +37,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the isEnabled property value. If set to true, Azure Active Directory security defaults are enabled for the tenant. + * Gets the isEnabled property value. If set to true, Microsoft Entra security defaults are enabled for the tenant. * @return bool|null */ public function getIsEnabled(): ?bool { @@ -58,7 +58,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the isEnabled property value. If set to true, Azure Active Directory security defaults are enabled for the tenant. + * Sets the isEnabled property value. If set to true, Microsoft Entra security defaults are enabled for the tenant. * @param bool|null $value Value to set for the isEnabled property. */ public function setIsEnabled(?bool $value): void { diff --git a/src/Generated/Models/IdentitySet.php b/src/Generated/Models/IdentitySet.php index f575ac8f255..98bb1441366 100644 --- a/src/Generated/Models/IdentitySet.php +++ b/src/Generated/Models/IdentitySet.php @@ -38,6 +38,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Ident case '#microsoft.graph.chatMessageFromIdentitySet': return new ChatMessageFromIdentitySet(); case '#microsoft.graph.chatMessageMentionedIdentitySet': return new ChatMessageMentionedIdentitySet(); case '#microsoft.graph.chatMessageReactionIdentitySet': return new ChatMessageReactionIdentitySet(); + case '#microsoft.graph.communicationsIdentitySet': return new CommunicationsIdentitySet(); case '#microsoft.graph.sharePointIdentitySet': return new SharePointIdentitySet(); } } diff --git a/src/Generated/Models/InternalDomainFederation.php b/src/Generated/Models/InternalDomainFederation.php index 3d3965f5c14..e5ba8e9388d 100644 --- a/src/Generated/Models/InternalDomainFederation.php +++ b/src/Generated/Models/InternalDomainFederation.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Inter } /** - * Gets the activeSignInUri property value. URL of the endpoint used by active clients when authenticating with federated domains set up for single sign-on in Azure Active Directory (Azure AD). Corresponds to the ActiveLogOnUri property of the Set-MsolDomainFederationSettings MSOnline v1 PowerShell cmdlet. + * Gets the activeSignInUri property value. URL of the endpoint used by active clients when authenticating with federated domains set up for single sign-on in Microsoft Entra ID. Corresponds to the ActiveLogOnUri property of the Set-MsolDomainFederationSettings MSOnline v1 PowerShell cmdlet. * @return string|null */ public function getActiveSignInUri(): ?string { @@ -38,7 +38,7 @@ public function getActiveSignInUri(): ?string { } /** - * Gets the federatedIdpMfaBehavior property value. Determines whether Azure AD accepts the MFA performed by the federated IdP when a federated user accesses an application that is governed by a conditional access policy that requires MFA. The possible values are: acceptIfMfaDoneByFederatedIdp, enforceMfaByFederatedIdp, rejectMfaByFederatedIdp, unknownFutureValue. For more information, see federatedIdpMfaBehavior values. + * Gets the federatedIdpMfaBehavior property value. Determines whether Microsoft Entra ID accepts the MFA performed by the federated IdP when a federated user accesses an application that is governed by a conditional access policy that requires MFA. The possible values are: acceptIfMfaDoneByFederatedIdp, enforceMfaByFederatedIdp, rejectMfaByFederatedIdp, unknownFutureValue. For more information, see federatedIdpMfaBehavior values. * @return FederatedIdpMfaBehavior|null */ public function getFederatedIdpMfaBehavior(): ?FederatedIdpMfaBehavior { @@ -67,7 +67,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the isSignedAuthenticationRequestRequired property value. If true, when SAML authentication requests are sent to the federated SAML IdP, Azure AD will sign those requests using the OrgID signing key. If false (default), the SAML authentication requests sent to the federated IdP are not signed. + * Gets the isSignedAuthenticationRequestRequired property value. If true, when SAML authentication requests are sent to the federated SAML IdP, Microsoft Entra ID will sign those requests using the OrgID signing key. If false (default), the SAML authentication requests sent to the federated IdP are not signed. * @return bool|null */ public function getIsSignedAuthenticationRequestRequired(): ?bool { @@ -115,7 +115,7 @@ public function getSigningCertificateUpdateStatus(): ?SigningCertificateUpdateSt } /** - * Gets the signOutUri property value. URI that clients are redirected to when they sign out of Azure AD services. Corresponds to the LogOffUri property of the Set-MsolDomainFederationSettings MSOnline v1 PowerShell cmdlet. + * Gets the signOutUri property value. URI that clients are redirected to when they sign out of Microsoft Entra services. Corresponds to the LogOffUri property of the Set-MsolDomainFederationSettings MSOnline v1 PowerShell cmdlet. * @return string|null */ public function getSignOutUri(): ?string { @@ -142,7 +142,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the activeSignInUri property value. URL of the endpoint used by active clients when authenticating with federated domains set up for single sign-on in Azure Active Directory (Azure AD). Corresponds to the ActiveLogOnUri property of the Set-MsolDomainFederationSettings MSOnline v1 PowerShell cmdlet. + * Sets the activeSignInUri property value. URL of the endpoint used by active clients when authenticating with federated domains set up for single sign-on in Microsoft Entra ID. Corresponds to the ActiveLogOnUri property of the Set-MsolDomainFederationSettings MSOnline v1 PowerShell cmdlet. * @param string|null $value Value to set for the activeSignInUri property. */ public function setActiveSignInUri(?string $value): void { @@ -150,7 +150,7 @@ public function setActiveSignInUri(?string $value): void { } /** - * Sets the federatedIdpMfaBehavior property value. Determines whether Azure AD accepts the MFA performed by the federated IdP when a federated user accesses an application that is governed by a conditional access policy that requires MFA. The possible values are: acceptIfMfaDoneByFederatedIdp, enforceMfaByFederatedIdp, rejectMfaByFederatedIdp, unknownFutureValue. For more information, see federatedIdpMfaBehavior values. + * Sets the federatedIdpMfaBehavior property value. Determines whether Microsoft Entra ID accepts the MFA performed by the federated IdP when a federated user accesses an application that is governed by a conditional access policy that requires MFA. The possible values are: acceptIfMfaDoneByFederatedIdp, enforceMfaByFederatedIdp, rejectMfaByFederatedIdp, unknownFutureValue. For more information, see federatedIdpMfaBehavior values. * @param FederatedIdpMfaBehavior|null $value Value to set for the federatedIdpMfaBehavior property. */ public function setFederatedIdpMfaBehavior(?FederatedIdpMfaBehavior $value): void { @@ -158,7 +158,7 @@ public function setFederatedIdpMfaBehavior(?FederatedIdpMfaBehavior $value): voi } /** - * Sets the isSignedAuthenticationRequestRequired property value. If true, when SAML authentication requests are sent to the federated SAML IdP, Azure AD will sign those requests using the OrgID signing key. If false (default), the SAML authentication requests sent to the federated IdP are not signed. + * Sets the isSignedAuthenticationRequestRequired property value. If true, when SAML authentication requests are sent to the federated SAML IdP, Microsoft Entra ID will sign those requests using the OrgID signing key. If false (default), the SAML authentication requests sent to the federated IdP are not signed. * @param bool|null $value Value to set for the isSignedAuthenticationRequestRequired property. */ public function setIsSignedAuthenticationRequestRequired(?bool $value): void { @@ -190,7 +190,7 @@ public function setSigningCertificateUpdateStatus(?SigningCertificateUpdateStatu } /** - * Sets the signOutUri property value. URI that clients are redirected to when they sign out of Azure AD services. Corresponds to the LogOffUri property of the Set-MsolDomainFederationSettings MSOnline v1 PowerShell cmdlet. + * Sets the signOutUri property value. URI that clients are redirected to when they sign out of Microsoft Entra services. Corresponds to the LogOffUri property of the Set-MsolDomainFederationSettings MSOnline v1 PowerShell cmdlet. * @param string|null $value Value to set for the signOutUri property. */ public function setSignOutUri(?string $value): void { diff --git a/src/Generated/Models/LandingPage.php b/src/Generated/Models/LandingPage.php index 1ba0d79e7e8..adc80ab3664 100644 --- a/src/Generated/Models/LandingPage.php +++ b/src/Generated/Models/LandingPage.php @@ -27,7 +27,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Landi } /** - * Gets the createdBy property value. The createdBy property + * Gets the createdBy property value. Identity of the user who created the landing page. * @return EmailIdentity|null */ public function getCreatedBy(): ?EmailIdentity { @@ -39,7 +39,7 @@ public function getCreatedBy(): ?EmailIdentity { } /** - * Gets the createdDateTime property value. The createdDateTime property + * Gets the createdDateTime property value. Date and time when the landing page was created. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getCreatedDateTime(): ?DateTime { @@ -51,7 +51,7 @@ public function getCreatedDateTime(): ?DateTime { } /** - * Gets the description property value. The description property + * Gets the description property value. Description of the landing page as defined by the user. * @return string|null */ public function getDescription(): ?string { @@ -63,7 +63,7 @@ public function getDescription(): ?string { } /** - * Gets the details property value. The details property + * Gets the details property value. The detail information for a landing page associated with a simulation during its creation. * @return array|null */ public function getDetails(): ?array { @@ -77,7 +77,7 @@ public function getDetails(): ?array { } /** - * Gets the displayName property value. The displayName property + * Gets the displayName property value. The display name of the landing page. * @return string|null */ public function getDisplayName(): ?string { @@ -117,7 +117,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the lastModifiedBy property value. The lastModifiedBy property + * Gets the lastModifiedBy property value. Email identity of the user who last modified the landing page. * @return EmailIdentity|null */ public function getLastModifiedBy(): ?EmailIdentity { @@ -129,7 +129,7 @@ public function getLastModifiedBy(): ?EmailIdentity { } /** - * Gets the lastModifiedDateTime property value. The lastModifiedDateTime property + * Gets the lastModifiedDateTime property value. Date and time when the landing page was last modified. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getLastModifiedDateTime(): ?DateTime { @@ -141,7 +141,7 @@ public function getLastModifiedDateTime(): ?DateTime { } /** - * Gets the locale property value. The locale property + * Gets the locale property value. Content locale. * @return string|null */ public function getLocale(): ?string { @@ -153,7 +153,7 @@ public function getLocale(): ?string { } /** - * Gets the source property value. The source property + * Gets the source property value. The source of the content. Possible values are: unknown, global, tenant, unknownFutureValue. * @return SimulationContentSource|null */ public function getSource(): ?SimulationContentSource { @@ -165,7 +165,7 @@ public function getSource(): ?SimulationContentSource { } /** - * Gets the status property value. The status property + * Gets the status property value. The status of the simulation. Possible values are: unknown, draft, ready, archive, delete, unknownFutureValue. * @return SimulationContentStatus|null */ public function getStatus(): ?SimulationContentStatus { @@ -177,7 +177,7 @@ public function getStatus(): ?SimulationContentStatus { } /** - * Gets the supportedLocales property value. The supportedLocales property + * Gets the supportedLocales property value. Supported locales. * @return array|null */ public function getSupportedLocales(): ?array { @@ -210,7 +210,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the createdBy property value. The createdBy property + * Sets the createdBy property value. Identity of the user who created the landing page. * @param EmailIdentity|null $value Value to set for the createdBy property. */ public function setCreatedBy(?EmailIdentity $value): void { @@ -218,7 +218,7 @@ public function setCreatedBy(?EmailIdentity $value): void { } /** - * Sets the createdDateTime property value. The createdDateTime property + * Sets the createdDateTime property value. Date and time when the landing page was created. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the createdDateTime property. */ public function setCreatedDateTime(?DateTime $value): void { @@ -226,7 +226,7 @@ public function setCreatedDateTime(?DateTime $value): void { } /** - * Sets the description property value. The description property + * Sets the description property value. Description of the landing page as defined by the user. * @param string|null $value Value to set for the description property. */ public function setDescription(?string $value): void { @@ -234,7 +234,7 @@ public function setDescription(?string $value): void { } /** - * Sets the details property value. The details property + * Sets the details property value. The detail information for a landing page associated with a simulation during its creation. * @param array|null $value Value to set for the details property. */ public function setDetails(?array $value): void { @@ -242,7 +242,7 @@ public function setDetails(?array $value): void { } /** - * Sets the displayName property value. The displayName property + * Sets the displayName property value. The display name of the landing page. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -250,7 +250,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the lastModifiedBy property value. The lastModifiedBy property + * Sets the lastModifiedBy property value. Email identity of the user who last modified the landing page. * @param EmailIdentity|null $value Value to set for the lastModifiedBy property. */ public function setLastModifiedBy(?EmailIdentity $value): void { @@ -258,7 +258,7 @@ public function setLastModifiedBy(?EmailIdentity $value): void { } /** - * Sets the lastModifiedDateTime property value. The lastModifiedDateTime property + * Sets the lastModifiedDateTime property value. Date and time when the landing page was last modified. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the lastModifiedDateTime property. */ public function setLastModifiedDateTime(?DateTime $value): void { @@ -266,7 +266,7 @@ public function setLastModifiedDateTime(?DateTime $value): void { } /** - * Sets the locale property value. The locale property + * Sets the locale property value. Content locale. * @param string|null $value Value to set for the locale property. */ public function setLocale(?string $value): void { @@ -274,7 +274,7 @@ public function setLocale(?string $value): void { } /** - * Sets the source property value. The source property + * Sets the source property value. The source of the content. Possible values are: unknown, global, tenant, unknownFutureValue. * @param SimulationContentSource|null $value Value to set for the source property. */ public function setSource(?SimulationContentSource $value): void { @@ -282,7 +282,7 @@ public function setSource(?SimulationContentSource $value): void { } /** - * Sets the status property value. The status property + * Sets the status property value. The status of the simulation. Possible values are: unknown, draft, ready, archive, delete, unknownFutureValue. * @param SimulationContentStatus|null $value Value to set for the status property. */ public function setStatus(?SimulationContentStatus $value): void { @@ -290,7 +290,7 @@ public function setStatus(?SimulationContentStatus $value): void { } /** - * Sets the supportedLocales property value. The supportedLocales property + * Sets the supportedLocales property value. Supported locales. * @param array|null $value Value to set for the supportedLocales property. */ public function setSupportedLocales(?array $value): void { diff --git a/src/Generated/Models/LandingPageDetail.php b/src/Generated/Models/LandingPageDetail.php index 4c112400e9d..500e822998a 100644 --- a/src/Generated/Models/LandingPageDetail.php +++ b/src/Generated/Models/LandingPageDetail.php @@ -25,7 +25,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Landi } /** - * Gets the content property value. The content property + * Gets the content property value. Landing page detail content. * @return string|null */ public function getContent(): ?string { @@ -50,7 +50,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the isDefaultLangauge property value. The isDefaultLangauge property + * Gets the isDefaultLangauge property value. Indicates whether this language detail is default for the landing page. * @return bool|null */ public function getIsDefaultLangauge(): ?bool { @@ -62,7 +62,7 @@ public function getIsDefaultLangauge(): ?bool { } /** - * Gets the language property value. The language property + * Gets the language property value. The content language for the landing page. * @return string|null */ public function getLanguage(): ?string { @@ -85,7 +85,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the content property value. The content property + * Sets the content property value. Landing page detail content. * @param string|null $value Value to set for the content property. */ public function setContent(?string $value): void { @@ -93,7 +93,7 @@ public function setContent(?string $value): void { } /** - * Sets the isDefaultLangauge property value. The isDefaultLangauge property + * Sets the isDefaultLangauge property value. Indicates whether this language detail is default for the landing page. * @param bool|null $value Value to set for the isDefaultLangauge property. */ public function setIsDefaultLangauge(?bool $value): void { @@ -101,7 +101,7 @@ public function setIsDefaultLangauge(?bool $value): void { } /** - * Sets the language property value. The language property + * Sets the language property value. The content language for the landing page. * @param string|null $value Value to set for the language property. */ public function setLanguage(?string $value): void { diff --git a/src/Generated/Models/LoginPage.php b/src/Generated/Models/LoginPage.php index 1081bc9b6cd..39886621f09 100644 --- a/src/Generated/Models/LoginPage.php +++ b/src/Generated/Models/LoginPage.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Login } /** - * Gets the content property value. The content property + * Gets the content property value. The HTML content of the login page. * @return string|null */ public function getContent(): ?string { @@ -38,7 +38,7 @@ public function getContent(): ?string { } /** - * Gets the createdBy property value. The createdBy property + * Gets the createdBy property value. Identity of the user who created the login page. * @return EmailIdentity|null */ public function getCreatedBy(): ?EmailIdentity { @@ -50,7 +50,7 @@ public function getCreatedBy(): ?EmailIdentity { } /** - * Gets the createdDateTime property value. The createdDateTime property + * Gets the createdDateTime property value. Date and time when the login page was created. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getCreatedDateTime(): ?DateTime { @@ -62,7 +62,7 @@ public function getCreatedDateTime(): ?DateTime { } /** - * Gets the description property value. The description property + * Gets the description property value. Description about the login page. * @return string|null */ public function getDescription(): ?string { @@ -74,7 +74,7 @@ public function getDescription(): ?string { } /** - * Gets the displayName property value. The displayName property + * Gets the displayName property value. Display name of the login page. * @return string|null */ public function getDisplayName(): ?string { @@ -106,7 +106,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the language property value. The language property + * Gets the language property value. The content language of the login page. * @return string|null */ public function getLanguage(): ?string { @@ -118,7 +118,7 @@ public function getLanguage(): ?string { } /** - * Gets the lastModifiedBy property value. The lastModifiedBy property + * Gets the lastModifiedBy property value. Identity of the user who last modified the login page. * @return EmailIdentity|null */ public function getLastModifiedBy(): ?EmailIdentity { @@ -130,7 +130,7 @@ public function getLastModifiedBy(): ?EmailIdentity { } /** - * Gets the lastModifiedDateTime property value. The lastModifiedDateTime property + * Gets the lastModifiedDateTime property value. Date and time when the login page was last modified. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getLastModifiedDateTime(): ?DateTime { @@ -142,7 +142,7 @@ public function getLastModifiedDateTime(): ?DateTime { } /** - * Gets the source property value. The source property + * Gets the source property value. The source of the content. Possible values are: unknown, global, tenant, unknownFutureValue. * @return SimulationContentSource|null */ public function getSource(): ?SimulationContentSource { @@ -154,7 +154,7 @@ public function getSource(): ?SimulationContentSource { } /** - * Gets the status property value. The status property + * Gets the status property value. The login page status. Possible values are: unknown, draft, ready, archive, delete, unknownFutureValue. * @return SimulationContentStatus|null */ public function getStatus(): ?SimulationContentStatus { @@ -184,7 +184,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the content property value. The content property + * Sets the content property value. The HTML content of the login page. * @param string|null $value Value to set for the content property. */ public function setContent(?string $value): void { @@ -192,7 +192,7 @@ public function setContent(?string $value): void { } /** - * Sets the createdBy property value. The createdBy property + * Sets the createdBy property value. Identity of the user who created the login page. * @param EmailIdentity|null $value Value to set for the createdBy property. */ public function setCreatedBy(?EmailIdentity $value): void { @@ -200,7 +200,7 @@ public function setCreatedBy(?EmailIdentity $value): void { } /** - * Sets the createdDateTime property value. The createdDateTime property + * Sets the createdDateTime property value. Date and time when the login page was created. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the createdDateTime property. */ public function setCreatedDateTime(?DateTime $value): void { @@ -208,7 +208,7 @@ public function setCreatedDateTime(?DateTime $value): void { } /** - * Sets the description property value. The description property + * Sets the description property value. Description about the login page. * @param string|null $value Value to set for the description property. */ public function setDescription(?string $value): void { @@ -216,7 +216,7 @@ public function setDescription(?string $value): void { } /** - * Sets the displayName property value. The displayName property + * Sets the displayName property value. Display name of the login page. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -224,7 +224,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the language property value. The language property + * Sets the language property value. The content language of the login page. * @param string|null $value Value to set for the language property. */ public function setLanguage(?string $value): void { @@ -232,7 +232,7 @@ public function setLanguage(?string $value): void { } /** - * Sets the lastModifiedBy property value. The lastModifiedBy property + * Sets the lastModifiedBy property value. Identity of the user who last modified the login page. * @param EmailIdentity|null $value Value to set for the lastModifiedBy property. */ public function setLastModifiedBy(?EmailIdentity $value): void { @@ -240,7 +240,7 @@ public function setLastModifiedBy(?EmailIdentity $value): void { } /** - * Sets the lastModifiedDateTime property value. The lastModifiedDateTime property + * Sets the lastModifiedDateTime property value. Date and time when the login page was last modified. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the lastModifiedDateTime property. */ public function setLastModifiedDateTime(?DateTime $value): void { @@ -248,7 +248,7 @@ public function setLastModifiedDateTime(?DateTime $value): void { } /** - * Sets the source property value. The source property + * Sets the source property value. The source of the content. Possible values are: unknown, global, tenant, unknownFutureValue. * @param SimulationContentSource|null $value Value to set for the source property. */ public function setSource(?SimulationContentSource $value): void { @@ -256,7 +256,7 @@ public function setSource(?SimulationContentSource $value): void { } /** - * Sets the status property value. The status property + * Sets the status property value. The login page status. Possible values are: unknown, draft, ready, archive, delete, unknownFutureValue. * @param SimulationContentStatus|null $value Value to set for the status property. */ public function setStatus(?SimulationContentStatus $value): void { diff --git a/src/Generated/Models/MicrosoftCustomTrainingSetting.php b/src/Generated/Models/MicrosoftCustomTrainingSetting.php index 8c4d630053a..6bb617c5a95 100644 --- a/src/Generated/Models/MicrosoftCustomTrainingSetting.php +++ b/src/Generated/Models/MicrosoftCustomTrainingSetting.php @@ -28,7 +28,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Micro } /** - * Gets the completionDateTime property value. The completionDateTime property + * Gets the completionDateTime property value. The completion date and time of the training. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getCompletionDateTime(): ?DateTime { @@ -53,7 +53,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the trainingAssignmentMappings property value. The trainingAssignmentMappings property + * Gets the trainingAssignmentMappings property value. The mapping details of the associated training. * @return array|null */ public function getTrainingAssignmentMappings(): ?array { @@ -67,7 +67,7 @@ public function getTrainingAssignmentMappings(): ?array { } /** - * Gets the trainingCompletionDuration property value. The trainingCompletionDuration property + * Gets the trainingCompletionDuration property value. The training completion duration that needs to be provided before scheduling the training. Possible values are: week, fortnite, month, unknownFutureValue. * @return TrainingCompletionDuration|null */ public function getTrainingCompletionDuration(): ?TrainingCompletionDuration { @@ -90,7 +90,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the completionDateTime property value. The completionDateTime property + * Sets the completionDateTime property value. The completion date and time of the training. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the completionDateTime property. */ public function setCompletionDateTime(?DateTime $value): void { @@ -98,7 +98,7 @@ public function setCompletionDateTime(?DateTime $value): void { } /** - * Sets the trainingAssignmentMappings property value. The trainingAssignmentMappings property + * Sets the trainingAssignmentMappings property value. The mapping details of the associated training. * @param array|null $value Value to set for the trainingAssignmentMappings property. */ public function setTrainingAssignmentMappings(?array $value): void { @@ -106,7 +106,7 @@ public function setTrainingAssignmentMappings(?array $value): void { } /** - * Sets the trainingCompletionDuration property value. The trainingCompletionDuration property + * Sets the trainingCompletionDuration property value. The training completion duration that needs to be provided before scheduling the training. Possible values are: week, fortnite, month, unknownFutureValue. * @param TrainingCompletionDuration|null $value Value to set for the trainingCompletionDuration property. */ public function setTrainingCompletionDuration(?TrainingCompletionDuration $value): void { diff --git a/src/Generated/Models/MicrosoftManagedTrainingSetting.php b/src/Generated/Models/MicrosoftManagedTrainingSetting.php index 9db49c75417..8291535f992 100644 --- a/src/Generated/Models/MicrosoftManagedTrainingSetting.php +++ b/src/Generated/Models/MicrosoftManagedTrainingSetting.php @@ -27,7 +27,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Micro } /** - * Gets the completionDateTime property value. The completionDateTime property + * Gets the completionDateTime property value. The completion date for the training. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getCompletionDateTime(): ?DateTime { @@ -51,7 +51,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the trainingCompletionDuration property value. The trainingCompletionDuration property + * Gets the trainingCompletionDuration property value. The training completion duration that needs to be provided before scheduling the training. The possible values are: week, fortnite, month, unknownFutureValue. * @return TrainingCompletionDuration|null */ public function getTrainingCompletionDuration(): ?TrainingCompletionDuration { @@ -73,7 +73,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the completionDateTime property value. The completionDateTime property + * Sets the completionDateTime property value. The completion date for the training. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the completionDateTime property. */ public function setCompletionDateTime(?DateTime $value): void { @@ -81,7 +81,7 @@ public function setCompletionDateTime(?DateTime $value): void { } /** - * Sets the trainingCompletionDuration property value. The trainingCompletionDuration property + * Sets the trainingCompletionDuration property value. The training completion duration that needs to be provided before scheduling the training. The possible values are: week, fortnite, month, unknownFutureValue. * @param TrainingCompletionDuration|null $value Value to set for the trainingCompletionDuration property. */ public function setTrainingCompletionDuration(?TrainingCompletionDuration $value): void { diff --git a/src/Generated/Models/MicrosoftTrainingAssignmentMapping.php b/src/Generated/Models/MicrosoftTrainingAssignmentMapping.php index 62f271d0692..614e2387923 100644 --- a/src/Generated/Models/MicrosoftTrainingAssignmentMapping.php +++ b/src/Generated/Models/MicrosoftTrainingAssignmentMapping.php @@ -27,7 +27,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Micro } /** - * Gets the assignedTo property value. The assignedTo property + * Gets the assignedTo property value. A user collection that specifies to whom the training should be assigned. Possible values are: none, allUsers, clickedPayload, compromised, reportedPhish, readButNotClicked, didNothing, unknownFutureValue. * @return array|null */ public function getAssignedTo(): ?array { @@ -75,7 +75,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the assignedTo property value. The assignedTo property + * Sets the assignedTo property value. A user collection that specifies to whom the training should be assigned. Possible values are: none, allUsers, clickedPayload, compromised, reportedPhish, readButNotClicked, didNothing, unknownFutureValue. * @param array|null $value Value to set for the assignedTo property. */ public function setAssignedTo(?array $value): void { diff --git a/src/Generated/Models/NoTrainingNotificationSetting.php b/src/Generated/Models/NoTrainingNotificationSetting.php index 04dfcf849d7..ebc8af9a33d 100644 --- a/src/Generated/Models/NoTrainingNotificationSetting.php +++ b/src/Generated/Models/NoTrainingNotificationSetting.php @@ -37,7 +37,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the simulationNotification property value. The simulationNotification property + * Gets the simulationNotification property value. The notification for the user who is part of the simulation. * @return SimulationNotification|null */ public function getSimulationNotification(): ?SimulationNotification { @@ -58,7 +58,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the simulationNotification property value. The simulationNotification property + * Sets the simulationNotification property value. The notification for the user who is part of the simulation. * @param SimulationNotification|null $value Value to set for the simulationNotification property. */ public function setSimulationNotification(?SimulationNotification $value): void { diff --git a/src/Generated/Models/OAuthConsentAppDetail.php b/src/Generated/Models/OAuthConsentAppDetail.php index 55015a478ce..4b23af869f8 100644 --- a/src/Generated/Models/OAuthConsentAppDetail.php +++ b/src/Generated/Models/OAuthConsentAppDetail.php @@ -48,7 +48,7 @@ public function getAdditionalData(): ?array { } /** - * Gets the appScope property value. The appScope property + * Gets the appScope property value. App scope. Possible values are: unknown, readCalendar, readContact, readMail, readAllChat, readAllFile, readAndWriteMail, sendMail, unknownFutureValue. * @return OAuthAppScope|null */ public function getAppScope(): ?OAuthAppScope { @@ -68,7 +68,7 @@ public function getBackingStore(): BackingStore { } /** - * Gets the displayLogo property value. The displayLogo property + * Gets the displayLogo property value. App display logo. * @return string|null */ public function getDisplayLogo(): ?string { @@ -80,7 +80,7 @@ public function getDisplayLogo(): ?string { } /** - * Gets the displayName property value. The displayName property + * Gets the displayName property value. App name. * @return string|null */ public function getDisplayName(): ?string { @@ -138,7 +138,7 @@ public function setAdditionalData(?array $value): void { } /** - * Sets the appScope property value. The appScope property + * Sets the appScope property value. App scope. Possible values are: unknown, readCalendar, readContact, readMail, readAllChat, readAllFile, readAndWriteMail, sendMail, unknownFutureValue. * @param OAuthAppScope|null $value Value to set for the appScope property. */ public function setAppScope(?OAuthAppScope $value): void { @@ -154,7 +154,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the displayLogo property value. The displayLogo property + * Sets the displayLogo property value. App display logo. * @param string|null $value Value to set for the displayLogo property. */ public function setDisplayLogo(?string $value): void { @@ -162,7 +162,7 @@ public function setDisplayLogo(?string $value): void { } /** - * Sets the displayName property value. The displayName property + * Sets the displayName property value. App name. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { diff --git a/src/Generated/Models/ObjectIdentity.php b/src/Generated/Models/ObjectIdentity.php index 2e2b562c03f..e2a52a086c4 100644 --- a/src/Generated/Models/ObjectIdentity.php +++ b/src/Generated/Models/ObjectIdentity.php @@ -70,7 +70,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the issuer property value. Specifies the issuer of the identity, for example facebook.com.For local accounts (where signInType isn't federated), this property is the local B2C tenant default domain name, for example contoso.onmicrosoft.com.For guests from other Azure AD organization, this is the domain of the federated organization, for example contoso.com.Supports $filter. 512 character limit. + * Gets the issuer property value. Specifies the issuer of the identity, for example facebook.com.For local accounts (where signInType isn't federated), this property is the local B2C tenant default domain name, for example contoso.onmicrosoft.com.For guests from other Microsoft Entra organization, this is the domain of the federated organization, for example contoso.com.Supports $filter. 512 character limit. * @return string|null */ public function getIssuer(): ?string { @@ -146,7 +146,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the issuer property value. Specifies the issuer of the identity, for example facebook.com.For local accounts (where signInType isn't federated), this property is the local B2C tenant default domain name, for example contoso.onmicrosoft.com.For guests from other Azure AD organization, this is the domain of the federated organization, for example contoso.com.Supports $filter. 512 character limit. + * Sets the issuer property value. Specifies the issuer of the identity, for example facebook.com.For local accounts (where signInType isn't federated), this property is the local B2C tenant default domain name, for example contoso.onmicrosoft.com.For guests from other Microsoft Entra organization, this is the domain of the federated organization, for example contoso.com.Supports $filter. 512 character limit. * @param string|null $value Value to set for the issuer property. */ public function setIssuer(?string $value): void { diff --git a/src/Generated/Models/OnPremisesDirectorySynchronizationFeature.php b/src/Generated/Models/OnPremisesDirectorySynchronizationFeature.php index e2097df8490..9a8e036ae46 100644 --- a/src/Generated/Models/OnPremisesDirectorySynchronizationFeature.php +++ b/src/Generated/Models/OnPremisesDirectorySynchronizationFeature.php @@ -80,7 +80,7 @@ public function getBlockSoftMatchEnabled(): ?bool { } /** - * Gets the bypassDirSyncOverridesEnabled property value. When true, persists the values of Mobile and OtherMobile in on-premises AD during sync cycles instead of values of MobilePhone or AlternateMobilePhones in Azure AD. + * Gets the bypassDirSyncOverridesEnabled property value. When true, persists the values of Mobile and OtherMobile in on-premises AD during sync cycles instead of values of MobilePhone or AlternateMobilePhones in Microsoft Entra ID. * @return bool|null */ public function getBypassDirSyncOverridesEnabled(): ?bool { @@ -140,7 +140,7 @@ public function getDeviceWritebackEnabled(): ?bool { } /** - * Gets the directoryExtensionsEnabled property value. Used to indicate that directory extensions are being synced from on-premises AD to Azure AD. + * Gets the directoryExtensionsEnabled property value. Used to indicate that directory extensions are being synced from on-premises AD to Microsoft Entra ID. * @return bool|null */ public function getDirectoryExtensionsEnabled(): ?bool { @@ -230,7 +230,7 @@ public function getPasswordSyncEnabled(): ?bool { } /** - * Gets the passwordWritebackEnabled property value. Used to indicate that writeback of password resets from Azure AD to on-premises AD is enabled. + * Gets the passwordWritebackEnabled property value. Used to indicate that writeback of password resets from Microsoft Entra ID to on-premises AD is enabled. * @return bool|null */ public function getPasswordWritebackEnabled(): ?bool { @@ -386,7 +386,7 @@ public function setBlockSoftMatchEnabled(?bool $value): void { } /** - * Sets the bypassDirSyncOverridesEnabled property value. When true, persists the values of Mobile and OtherMobile in on-premises AD during sync cycles instead of values of MobilePhone or AlternateMobilePhones in Azure AD. + * Sets the bypassDirSyncOverridesEnabled property value. When true, persists the values of Mobile and OtherMobile in on-premises AD during sync cycles instead of values of MobilePhone or AlternateMobilePhones in Microsoft Entra ID. * @param bool|null $value Value to set for the bypassDirSyncOverridesEnabled property. */ public function setBypassDirSyncOverridesEnabled(?bool $value): void { @@ -426,7 +426,7 @@ public function setDeviceWritebackEnabled(?bool $value): void { } /** - * Sets the directoryExtensionsEnabled property value. Used to indicate that directory extensions are being synced from on-premises AD to Azure AD. + * Sets the directoryExtensionsEnabled property value. Used to indicate that directory extensions are being synced from on-premises AD to Microsoft Entra ID. * @param bool|null $value Value to set for the directoryExtensionsEnabled property. */ public function setDirectoryExtensionsEnabled(?bool $value): void { @@ -466,7 +466,7 @@ public function setPasswordSyncEnabled(?bool $value): void { } /** - * Sets the passwordWritebackEnabled property value. Used to indicate that writeback of password resets from Azure AD to on-premises AD is enabled. + * Sets the passwordWritebackEnabled property value. Used to indicate that writeback of password resets from Microsoft Entra ID to on-premises AD is enabled. * @param bool|null $value Value to set for the passwordWritebackEnabled property. */ public function setPasswordWritebackEnabled(?bool $value): void { diff --git a/src/Generated/Models/OrganizationalBrandingProperties.php b/src/Generated/Models/OrganizationalBrandingProperties.php index 5e3dbd3bb67..dd039b6145f 100644 --- a/src/Generated/Models/OrganizationalBrandingProperties.php +++ b/src/Generated/Models/OrganizationalBrandingProperties.php @@ -241,7 +241,7 @@ public function getCustomTermsOfUseUrl(): ?string { } /** - * Gets the favicon property value. A custom icon (favicon) to replace a default Microsoft product favicon on an Azure AD tenant. + * Gets the favicon property value. A custom icon (favicon) to replace a default Microsoft product favicon on a Microsoft Entra tenant. * @return StreamInterface|null */ public function getFavicon(): ?StreamInterface { @@ -618,7 +618,7 @@ public function setCustomTermsOfUseUrl(?string $value): void { } /** - * Sets the favicon property value. A custom icon (favicon) to replace a default Microsoft product favicon on an Azure AD tenant. + * Sets the favicon property value. A custom icon (favicon) to replace a default Microsoft product favicon on a Microsoft Entra tenant. * @param StreamInterface|null $value Value to set for the favicon property. */ public function setFavicon(?StreamInterface $value): void { diff --git a/src/Generated/Models/PasswordCredential.php b/src/Generated/Models/PasswordCredential.php index 7147f54d21a..e327deb75e1 100644 --- a/src/Generated/Models/PasswordCredential.php +++ b/src/Generated/Models/PasswordCredential.php @@ -148,7 +148,7 @@ public function getOdataType(): ?string { } /** - * Gets the secretText property value. Read-only; Contains the strong passwords generated by Azure AD that are 16-64 characters in length. The generated password value is only returned during the initial POST request to addPassword. There is no way to retrieve this password in the future. + * Gets the secretText property value. Read-only; Contains the strong passwords generated by Microsoft Entra ID that are 16-64 characters in length. The generated password value is only returned during the initial POST request to addPassword. There is no way to retrieve this password in the future. * @return string|null */ public function getSecretText(): ?string { @@ -252,7 +252,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the secretText property value. Read-only; Contains the strong passwords generated by Azure AD that are 16-64 characters in length. The generated password value is only returned during the initial POST request to addPassword. There is no way to retrieve this password in the future. + * Sets the secretText property value. Read-only; Contains the strong passwords generated by Microsoft Entra ID that are 16-64 characters in length. The generated password value is only returned during the initial POST request to addPassword. There is no way to retrieve this password in the future. * @param string|null $value Value to set for the secretText property. */ public function setSecretText(?string $value): void { diff --git a/src/Generated/Models/PasswordResetResponse.php b/src/Generated/Models/PasswordResetResponse.php index 09f56d65b57..e757666f7e9 100644 --- a/src/Generated/Models/PasswordResetResponse.php +++ b/src/Generated/Models/PasswordResetResponse.php @@ -68,7 +68,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the newPassword property value. The Azure AD-generated password. + * Gets the newPassword property value. The Microsoft Entra ID-generated password. * @return string|null */ public function getNewPassword(): ?string { @@ -118,7 +118,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the newPassword property value. The Azure AD-generated password. + * Sets the newPassword property value. The Microsoft Entra ID-generated password. * @param string|null $value Value to set for the newPassword property. */ public function setNewPassword(?string $value): void { diff --git a/src/Generated/Models/Payload.php b/src/Generated/Models/Payload.php index d13b1f91256..fa541a28f8c 100644 --- a/src/Generated/Models/Payload.php +++ b/src/Generated/Models/Payload.php @@ -27,7 +27,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Paylo } /** - * Gets the brand property value. The brand property + * Gets the brand property value. The branch of a payload. Possible values are: unknown, other, americanExpress, capitalOne, dhl, docuSign, dropbox, facebook, firstAmerican, microsoft, netflix, scotiabank, sendGrid, stewartTitle, tesco, wellsFargo, syrinxCloud, adobe, teams, zoom, unknownFutureValue. * @return PayloadBrand|null */ public function getBrand(): ?PayloadBrand { @@ -39,7 +39,7 @@ public function getBrand(): ?PayloadBrand { } /** - * Gets the complexity property value. The complexity property + * Gets the complexity property value. The complexity of a payload. Possible values are: unknown, low, medium, high, unknownFutureValue. * @return PayloadComplexity|null */ public function getComplexity(): ?PayloadComplexity { @@ -51,7 +51,7 @@ public function getComplexity(): ?PayloadComplexity { } /** - * Gets the createdBy property value. The createdBy property + * Gets the createdBy property value. Identity of the user who created the attack simulation and training campaign payload. * @return EmailIdentity|null */ public function getCreatedBy(): ?EmailIdentity { @@ -63,7 +63,7 @@ public function getCreatedBy(): ?EmailIdentity { } /** - * Gets the createdDateTime property value. The createdDateTime property + * Gets the createdDateTime property value. Date and time when the attack simulation and training campaign payload. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getCreatedDateTime(): ?DateTime { @@ -75,7 +75,7 @@ public function getCreatedDateTime(): ?DateTime { } /** - * Gets the description property value. The description property + * Gets the description property value. Description of the attack simulation and training campaign payload. * @return string|null */ public function getDescription(): ?string { @@ -87,7 +87,7 @@ public function getDescription(): ?string { } /** - * Gets the detail property value. The detail property + * Gets the detail property value. Additional details about the payload. * @return PayloadDetail|null */ public function getDetail(): ?PayloadDetail { @@ -99,7 +99,7 @@ public function getDetail(): ?PayloadDetail { } /** - * Gets the displayName property value. The displayName property + * Gets the displayName property value. Display name of the attack simulation and training campaign payload. Supports $filter and $orderby. * @return string|null */ public function getDisplayName(): ?string { @@ -150,7 +150,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the industry property value. The industry property + * Gets the industry property value. Industry of a payload. Possible values are: unknown, other, banking, businessServices, consumerServices, education, energy, construction, consulting, financialServices, government, hospitality, insurance, legal, courierServices, IT, healthcare, manufacturing, retail, telecom, realEstate, unknownFutureValue. * @return PayloadIndustry|null */ public function getIndustry(): ?PayloadIndustry { @@ -162,7 +162,7 @@ public function getIndustry(): ?PayloadIndustry { } /** - * Gets the isAutomated property value. The isAutomated property + * Gets the isAutomated property value. Indicates whether the attack simulation and training campaign payload was created from an automation flow. Supports $filter and $orderby. * @return bool|null */ public function getIsAutomated(): ?bool { @@ -174,7 +174,7 @@ public function getIsAutomated(): ?bool { } /** - * Gets the isControversial property value. The isControversial property + * Gets the isControversial property value. Indicates whether the payload is controversial. * @return bool|null */ public function getIsControversial(): ?bool { @@ -186,7 +186,7 @@ public function getIsControversial(): ?bool { } /** - * Gets the isCurrentEvent property value. The isCurrentEvent property + * Gets the isCurrentEvent property value. Indicates whether the payload is from any recent event. * @return bool|null */ public function getIsCurrentEvent(): ?bool { @@ -198,7 +198,7 @@ public function getIsCurrentEvent(): ?bool { } /** - * Gets the language property value. The language property + * Gets the language property value. Payload language. * @return string|null */ public function getLanguage(): ?string { @@ -210,7 +210,7 @@ public function getLanguage(): ?string { } /** - * Gets the lastModifiedBy property value. The lastModifiedBy property + * Gets the lastModifiedBy property value. Identity of the user who most recently modified the attack simulation and training campaign payload. * @return EmailIdentity|null */ public function getLastModifiedBy(): ?EmailIdentity { @@ -222,7 +222,7 @@ public function getLastModifiedBy(): ?EmailIdentity { } /** - * Gets the lastModifiedDateTime property value. The lastModifiedDateTime property + * Gets the lastModifiedDateTime property value. Date and time when the attack simulation and training campaign payload was last modified. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getLastModifiedDateTime(): ?DateTime { @@ -234,7 +234,7 @@ public function getLastModifiedDateTime(): ?DateTime { } /** - * Gets the payloadTags property value. The payloadTags property + * Gets the payloadTags property value. Free text tags for a payload. * @return array|null */ public function getPayloadTags(): ?array { @@ -248,7 +248,7 @@ public function getPayloadTags(): ?array { } /** - * Gets the platform property value. The platform property + * Gets the platform property value. The payload delivery platform for a simulation. Possible values are: unknown, sms, email, teams, unknownFutureValue. * @return PayloadDeliveryPlatform|null */ public function getPlatform(): ?PayloadDeliveryPlatform { @@ -260,7 +260,7 @@ public function getPlatform(): ?PayloadDeliveryPlatform { } /** - * Gets the predictedCompromiseRate property value. The predictedCompromiseRate property + * Gets the predictedCompromiseRate property value. Predicted probability for a payload to phish a targeted user. * @return float|null */ public function getPredictedCompromiseRate(): ?float { @@ -272,7 +272,7 @@ public function getPredictedCompromiseRate(): ?float { } /** - * Gets the simulationAttackType property value. The simulationAttackType property + * Gets the simulationAttackType property value. Attack type of the attack simulation and training campaign. Supports $filter and $orderby. Possible values are: unknown, social, cloud, endpoint, unknownFutureValue. * @return SimulationAttackType|null */ public function getSimulationAttackType(): ?SimulationAttackType { @@ -296,7 +296,7 @@ public function getSource(): ?SimulationContentSource { } /** - * Gets the status property value. The status property + * Gets the status property value. Simulation content status. Supports $filter and $orderby. Possible values are: unknown, draft, ready, archive, delete, unknownFutureValue. * @return SimulationContentStatus|null */ public function getStatus(): ?SimulationContentStatus { @@ -308,7 +308,7 @@ public function getStatus(): ?SimulationContentStatus { } /** - * Gets the technique property value. The technique property + * Gets the technique property value. The social engineering technique used in the attack simulation and training campaign. Supports $filter and $orderby. Possible values are: unknown, credentialHarvesting, attachmentMalware, driveByUrl, linkInAttachment, linkToMalwareFile, unknownFutureValue, oAuthConsentGrant. Note that you must use the Prefer: include-unknown-enum-members request header to get the following values from this evolvable enum: oAuthConsentGrant. For more information on the types of social engineering attack techniques, see simulations. * @return SimulationAttackTechnique|null */ public function getTechnique(): ?SimulationAttackTechnique { @@ -320,7 +320,7 @@ public function getTechnique(): ?SimulationAttackTechnique { } /** - * Gets the theme property value. The theme property + * Gets the theme property value. The theme of a payload. Possible values are: unknown, other, accountActivation, accountVerification, billing, cleanUpMail, controversial, documentReceived, expense, fax, financeReport, incomingMessages, invoice, itemReceived, loginAlert, mailReceived, password, payment, payroll, personalizedOffer, quarantine, remoteWork, reviewMessage, securityUpdate, serviceSuspended, signatureRequired, upgradeMailboxStorage, verifyMailbox, voicemail, advertisement, employeeEngagement, unknownFutureValue. * @return PayloadTheme|null */ public function getTheme(): ?PayloadTheme { @@ -362,7 +362,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the brand property value. The brand property + * Sets the brand property value. The branch of a payload. Possible values are: unknown, other, americanExpress, capitalOne, dhl, docuSign, dropbox, facebook, firstAmerican, microsoft, netflix, scotiabank, sendGrid, stewartTitle, tesco, wellsFargo, syrinxCloud, adobe, teams, zoom, unknownFutureValue. * @param PayloadBrand|null $value Value to set for the brand property. */ public function setBrand(?PayloadBrand $value): void { @@ -370,7 +370,7 @@ public function setBrand(?PayloadBrand $value): void { } /** - * Sets the complexity property value. The complexity property + * Sets the complexity property value. The complexity of a payload. Possible values are: unknown, low, medium, high, unknownFutureValue. * @param PayloadComplexity|null $value Value to set for the complexity property. */ public function setComplexity(?PayloadComplexity $value): void { @@ -378,7 +378,7 @@ public function setComplexity(?PayloadComplexity $value): void { } /** - * Sets the createdBy property value. The createdBy property + * Sets the createdBy property value. Identity of the user who created the attack simulation and training campaign payload. * @param EmailIdentity|null $value Value to set for the createdBy property. */ public function setCreatedBy(?EmailIdentity $value): void { @@ -386,7 +386,7 @@ public function setCreatedBy(?EmailIdentity $value): void { } /** - * Sets the createdDateTime property value. The createdDateTime property + * Sets the createdDateTime property value. Date and time when the attack simulation and training campaign payload. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the createdDateTime property. */ public function setCreatedDateTime(?DateTime $value): void { @@ -394,7 +394,7 @@ public function setCreatedDateTime(?DateTime $value): void { } /** - * Sets the description property value. The description property + * Sets the description property value. Description of the attack simulation and training campaign payload. * @param string|null $value Value to set for the description property. */ public function setDescription(?string $value): void { @@ -402,7 +402,7 @@ public function setDescription(?string $value): void { } /** - * Sets the detail property value. The detail property + * Sets the detail property value. Additional details about the payload. * @param PayloadDetail|null $value Value to set for the detail property. */ public function setDetail(?PayloadDetail $value): void { @@ -410,7 +410,7 @@ public function setDetail(?PayloadDetail $value): void { } /** - * Sets the displayName property value. The displayName property + * Sets the displayName property value. Display name of the attack simulation and training campaign payload. Supports $filter and $orderby. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -418,7 +418,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the industry property value. The industry property + * Sets the industry property value. Industry of a payload. Possible values are: unknown, other, banking, businessServices, consumerServices, education, energy, construction, consulting, financialServices, government, hospitality, insurance, legal, courierServices, IT, healthcare, manufacturing, retail, telecom, realEstate, unknownFutureValue. * @param PayloadIndustry|null $value Value to set for the industry property. */ public function setIndustry(?PayloadIndustry $value): void { @@ -426,7 +426,7 @@ public function setIndustry(?PayloadIndustry $value): void { } /** - * Sets the isAutomated property value. The isAutomated property + * Sets the isAutomated property value. Indicates whether the attack simulation and training campaign payload was created from an automation flow. Supports $filter and $orderby. * @param bool|null $value Value to set for the isAutomated property. */ public function setIsAutomated(?bool $value): void { @@ -434,7 +434,7 @@ public function setIsAutomated(?bool $value): void { } /** - * Sets the isControversial property value. The isControversial property + * Sets the isControversial property value. Indicates whether the payload is controversial. * @param bool|null $value Value to set for the isControversial property. */ public function setIsControversial(?bool $value): void { @@ -442,7 +442,7 @@ public function setIsControversial(?bool $value): void { } /** - * Sets the isCurrentEvent property value. The isCurrentEvent property + * Sets the isCurrentEvent property value. Indicates whether the payload is from any recent event. * @param bool|null $value Value to set for the isCurrentEvent property. */ public function setIsCurrentEvent(?bool $value): void { @@ -450,7 +450,7 @@ public function setIsCurrentEvent(?bool $value): void { } /** - * Sets the language property value. The language property + * Sets the language property value. Payload language. * @param string|null $value Value to set for the language property. */ public function setLanguage(?string $value): void { @@ -458,7 +458,7 @@ public function setLanguage(?string $value): void { } /** - * Sets the lastModifiedBy property value. The lastModifiedBy property + * Sets the lastModifiedBy property value. Identity of the user who most recently modified the attack simulation and training campaign payload. * @param EmailIdentity|null $value Value to set for the lastModifiedBy property. */ public function setLastModifiedBy(?EmailIdentity $value): void { @@ -466,7 +466,7 @@ public function setLastModifiedBy(?EmailIdentity $value): void { } /** - * Sets the lastModifiedDateTime property value. The lastModifiedDateTime property + * Sets the lastModifiedDateTime property value. Date and time when the attack simulation and training campaign payload was last modified. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the lastModifiedDateTime property. */ public function setLastModifiedDateTime(?DateTime $value): void { @@ -474,7 +474,7 @@ public function setLastModifiedDateTime(?DateTime $value): void { } /** - * Sets the payloadTags property value. The payloadTags property + * Sets the payloadTags property value. Free text tags for a payload. * @param array|null $value Value to set for the payloadTags property. */ public function setPayloadTags(?array $value): void { @@ -482,7 +482,7 @@ public function setPayloadTags(?array $value): void { } /** - * Sets the platform property value. The platform property + * Sets the platform property value. The payload delivery platform for a simulation. Possible values are: unknown, sms, email, teams, unknownFutureValue. * @param PayloadDeliveryPlatform|null $value Value to set for the platform property. */ public function setPlatform(?PayloadDeliveryPlatform $value): void { @@ -490,7 +490,7 @@ public function setPlatform(?PayloadDeliveryPlatform $value): void { } /** - * Sets the predictedCompromiseRate property value. The predictedCompromiseRate property + * Sets the predictedCompromiseRate property value. Predicted probability for a payload to phish a targeted user. * @param float|null $value Value to set for the predictedCompromiseRate property. */ public function setPredictedCompromiseRate(?float $value): void { @@ -498,7 +498,7 @@ public function setPredictedCompromiseRate(?float $value): void { } /** - * Sets the simulationAttackType property value. The simulationAttackType property + * Sets the simulationAttackType property value. Attack type of the attack simulation and training campaign. Supports $filter and $orderby. Possible values are: unknown, social, cloud, endpoint, unknownFutureValue. * @param SimulationAttackType|null $value Value to set for the simulationAttackType property. */ public function setSimulationAttackType(?SimulationAttackType $value): void { @@ -514,7 +514,7 @@ public function setSource(?SimulationContentSource $value): void { } /** - * Sets the status property value. The status property + * Sets the status property value. Simulation content status. Supports $filter and $orderby. Possible values are: unknown, draft, ready, archive, delete, unknownFutureValue. * @param SimulationContentStatus|null $value Value to set for the status property. */ public function setStatus(?SimulationContentStatus $value): void { @@ -522,7 +522,7 @@ public function setStatus(?SimulationContentStatus $value): void { } /** - * Sets the technique property value. The technique property + * Sets the technique property value. The social engineering technique used in the attack simulation and training campaign. Supports $filter and $orderby. Possible values are: unknown, credentialHarvesting, attachmentMalware, driveByUrl, linkInAttachment, linkToMalwareFile, unknownFutureValue, oAuthConsentGrant. Note that you must use the Prefer: include-unknown-enum-members request header to get the following values from this evolvable enum: oAuthConsentGrant. For more information on the types of social engineering attack techniques, see simulations. * @param SimulationAttackTechnique|null $value Value to set for the technique property. */ public function setTechnique(?SimulationAttackTechnique $value): void { @@ -530,7 +530,7 @@ public function setTechnique(?SimulationAttackTechnique $value): void { } /** - * Sets the theme property value. The theme property + * Sets the theme property value. The theme of a payload. Possible values are: unknown, other, accountActivation, accountVerification, billing, cleanUpMail, controversial, documentReceived, expense, fax, financeReport, incomingMessages, invoice, itemReceived, loginAlert, mailReceived, password, payment, payroll, personalizedOffer, quarantine, remoteWork, reviewMessage, securityUpdate, serviceSuspended, signatureRequired, upgradeMailboxStorage, verifyMailbox, voicemail, advertisement, employeeEngagement, unknownFutureValue. * @param PayloadTheme|null $value Value to set for the theme property. */ public function setTheme(?PayloadTheme $value): void { diff --git a/src/Generated/Models/PayloadCoachmark.php b/src/Generated/Models/PayloadCoachmark.php index 040d5a80cd7..8ab28c28c36 100644 --- a/src/Generated/Models/PayloadCoachmark.php +++ b/src/Generated/Models/PayloadCoachmark.php @@ -56,7 +56,7 @@ public function getBackingStore(): BackingStore { } /** - * Gets the coachmarkLocation property value. The coachmarkLocation property + * Gets the coachmarkLocation property value. The coachmark location. * @return CoachmarkLocation|null */ public function getCoachmarkLocation(): ?CoachmarkLocation { @@ -68,7 +68,7 @@ public function getCoachmarkLocation(): ?CoachmarkLocation { } /** - * Gets the description property value. The description property + * Gets the description property value. The description about the coachmark. * @return string|null */ public function getDescription(): ?string { @@ -97,7 +97,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the indicator property value. The indicator property + * Gets the indicator property value. The coachmark indicator. * @return string|null */ public function getIndicator(): ?string { @@ -109,7 +109,7 @@ public function getIndicator(): ?string { } /** - * Gets the isValid property value. The isValid property + * Gets the isValid property value. Indicates whether the coachmark is valid or not. * @return bool|null */ public function getIsValid(): ?bool { @@ -121,7 +121,7 @@ public function getIsValid(): ?bool { } /** - * Gets the language property value. The language property + * Gets the language property value. The coachmark language. * @return string|null */ public function getLanguage(): ?string { @@ -145,7 +145,7 @@ public function getOdataType(): ?string { } /** - * Gets the order property value. The order property + * Gets the order property value. The coachmark order. * @return string|null */ public function getOrder(): ?string { @@ -188,7 +188,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the coachmarkLocation property value. The coachmarkLocation property + * Sets the coachmarkLocation property value. The coachmark location. * @param CoachmarkLocation|null $value Value to set for the coachmarkLocation property. */ public function setCoachmarkLocation(?CoachmarkLocation $value): void { @@ -196,7 +196,7 @@ public function setCoachmarkLocation(?CoachmarkLocation $value): void { } /** - * Sets the description property value. The description property + * Sets the description property value. The description about the coachmark. * @param string|null $value Value to set for the description property. */ public function setDescription(?string $value): void { @@ -204,7 +204,7 @@ public function setDescription(?string $value): void { } /** - * Sets the indicator property value. The indicator property + * Sets the indicator property value. The coachmark indicator. * @param string|null $value Value to set for the indicator property. */ public function setIndicator(?string $value): void { @@ -212,7 +212,7 @@ public function setIndicator(?string $value): void { } /** - * Sets the isValid property value. The isValid property + * Sets the isValid property value. Indicates whether the coachmark is valid or not. * @param bool|null $value Value to set for the isValid property. */ public function setIsValid(?bool $value): void { @@ -220,7 +220,7 @@ public function setIsValid(?bool $value): void { } /** - * Sets the language property value. The language property + * Sets the language property value. The coachmark language. * @param string|null $value Value to set for the language property. */ public function setLanguage(?string $value): void { @@ -236,7 +236,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the order property value. The order property + * Sets the order property value. The coachmark order. * @param string|null $value Value to set for the order property. */ public function setOrder(?string $value): void { diff --git a/src/Generated/Models/PayloadDetail.php b/src/Generated/Models/PayloadDetail.php index a6e9422ae1e..94f67ea6c63 100644 --- a/src/Generated/Models/PayloadDetail.php +++ b/src/Generated/Models/PayloadDetail.php @@ -64,7 +64,7 @@ public function getBackingStore(): BackingStore { } /** - * Gets the coachmarks property value. The coachmarks property + * Gets the coachmarks property value. Payload coachmark details. * @return array|null */ public function getCoachmarks(): ?array { @@ -78,7 +78,7 @@ public function getCoachmarks(): ?array { } /** - * Gets the content property value. The content property + * Gets the content property value. Payload content details. * @return string|null */ public function getContent(): ?string { @@ -116,7 +116,7 @@ public function getOdataType(): ?string { } /** - * Gets the phishingUrl property value. The phishingUrl property + * Gets the phishingUrl property value. The phishing URL used to target a user. * @return string|null */ public function getPhishingUrl(): ?string { @@ -156,7 +156,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the coachmarks property value. The coachmarks property + * Sets the coachmarks property value. Payload coachmark details. * @param array|null $value Value to set for the coachmarks property. */ public function setCoachmarks(?array $value): void { @@ -164,7 +164,7 @@ public function setCoachmarks(?array $value): void { } /** - * Sets the content property value. The content property + * Sets the content property value. Payload content details. * @param string|null $value Value to set for the content property. */ public function setContent(?string $value): void { @@ -180,7 +180,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the phishingUrl property value. The phishingUrl property + * Sets the phishingUrl property value. The phishing URL used to target a user. * @param string|null $value Value to set for the phishingUrl property. */ public function setPhishingUrl(?string $value): void { diff --git a/src/Generated/Models/PermissionGrantConditionSet.php b/src/Generated/Models/PermissionGrantConditionSet.php index 8cf57d28926..c24c6c03a26 100644 --- a/src/Generated/Models/PermissionGrantConditionSet.php +++ b/src/Generated/Models/PermissionGrantConditionSet.php @@ -66,7 +66,7 @@ public function getClientApplicationsFromVerifiedPublisherOnly(): ?bool { } /** - * Gets the clientApplicationTenantIds property value. A list of Azure Active Directory tenant IDs in which the client application is registered, or a list with the single value all to match with client apps registered in any tenant. Default is the single value all. + * Gets the clientApplicationTenantIds property value. A list of Microsoft Entra tenant IDs in which the client application is registered, or a list with the single value all to match with client apps registered in any tenant. Default is the single value all. * @return array|null */ public function getClientApplicationTenantIds(): ?array { @@ -216,7 +216,7 @@ public function setClientApplicationsFromVerifiedPublisherOnly(?bool $value): vo } /** - * Sets the clientApplicationTenantIds property value. A list of Azure Active Directory tenant IDs in which the client application is registered, or a list with the single value all to match with client apps registered in any tenant. Default is the single value all. + * Sets the clientApplicationTenantIds property value. A list of Microsoft Entra tenant IDs in which the client application is registered, or a list with the single value all to match with client apps registered in any tenant. Default is the single value all. * @param array|null $value Value to set for the clientApplicationTenantIds property. */ public function setClientApplicationTenantIds(?array $value): void { diff --git a/src/Generated/Models/PolicyRoot.php b/src/Generated/Models/PolicyRoot.php index cd266e6338a..bdeeecf823b 100644 --- a/src/Generated/Models/PolicyRoot.php +++ b/src/Generated/Models/PolicyRoot.php @@ -78,7 +78,7 @@ public function getAuthenticationFlowsPolicy(): ?AuthenticationFlowsPolicy { } /** - * Gets the authenticationMethodsPolicy property value. The authentication methods and the users that are allowed to use them to sign in and perform multifactor authentication (MFA) in Azure Active Directory (Azure AD). + * Gets the authenticationMethodsPolicy property value. The authentication methods and the users that are allowed to use them to sign in and perform multifactor authentication (MFA) in Microsoft Entra ID. * @return AuthenticationMethodsPolicy|null */ public function getAuthenticationMethodsPolicy(): ?AuthenticationMethodsPolicy { @@ -90,7 +90,7 @@ public function getAuthenticationMethodsPolicy(): ?AuthenticationMethodsPolicy { } /** - * Gets the authenticationStrengthPolicies property value. The authentication method combinations that are to be used in scenarios defined by Azure AD Conditional Access. + * Gets the authenticationStrengthPolicies property value. The authentication method combinations that are to be used in scenarios defined by Microsoft Entra Conditional Access. * @return array|null */ public function getAuthenticationStrengthPolicies(): ?array { @@ -104,7 +104,7 @@ public function getAuthenticationStrengthPolicies(): ?array { } /** - * Gets the authorizationPolicy property value. The policy that controls Azure AD authorization settings. + * Gets the authorizationPolicy property value. The policy that controls Microsoft Entra authorization settings. * @return AuthorizationPolicy|null */ public function getAuthorizationPolicy(): ?AuthorizationPolicy { @@ -144,7 +144,7 @@ public function getConditionalAccessPolicies(): ?array { } /** - * Gets the crossTenantAccessPolicy property value. The custom rules that define an access scenario when interacting with external Azure AD tenants. + * Gets the crossTenantAccessPolicy property value. The custom rules that define an access scenario when interacting with external Microsoft Entra tenants. * @return CrossTenantAccessPolicy|null */ public function getCrossTenantAccessPolicy(): ?CrossTenantAccessPolicy { @@ -211,7 +211,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the homeRealmDiscoveryPolicies property value. The policy to control Azure AD authentication behavior for federated users. + * Gets the homeRealmDiscoveryPolicies property value. The policy to control Microsoft Entra authentication behavior for federated users. * @return array|null */ public function getHomeRealmDiscoveryPolicies(): ?array { @@ -279,7 +279,7 @@ public function getRoleManagementPolicyAssignments(): ?array { } /** - * Gets the tokenIssuancePolicies property value. The policy that specifies the characteristics of SAML tokens issued by Azure AD. + * Gets the tokenIssuancePolicies property value. The policy that specifies the characteristics of SAML tokens issued by Microsoft Entra ID. * @return array|null */ public function getTokenIssuancePolicies(): ?array { @@ -293,7 +293,7 @@ public function getTokenIssuancePolicies(): ?array { } /** - * Gets the tokenLifetimePolicies property value. The policy that controls the lifetime of a JWT access token, an ID token, or a SAML 1.1/2.0 token issued by Azure AD. + * Gets the tokenLifetimePolicies property value. The policy that controls the lifetime of a JWT access token, an ID token, or a SAML 1.1/2.0 token issued by Microsoft Entra ID. * @return array|null */ public function getTokenLifetimePolicies(): ?array { @@ -366,7 +366,7 @@ public function setAuthenticationFlowsPolicy(?AuthenticationFlowsPolicy $value): } /** - * Sets the authenticationMethodsPolicy property value. The authentication methods and the users that are allowed to use them to sign in and perform multifactor authentication (MFA) in Azure Active Directory (Azure AD). + * Sets the authenticationMethodsPolicy property value. The authentication methods and the users that are allowed to use them to sign in and perform multifactor authentication (MFA) in Microsoft Entra ID. * @param AuthenticationMethodsPolicy|null $value Value to set for the authenticationMethodsPolicy property. */ public function setAuthenticationMethodsPolicy(?AuthenticationMethodsPolicy $value): void { @@ -374,7 +374,7 @@ public function setAuthenticationMethodsPolicy(?AuthenticationMethodsPolicy $val } /** - * Sets the authenticationStrengthPolicies property value. The authentication method combinations that are to be used in scenarios defined by Azure AD Conditional Access. + * Sets the authenticationStrengthPolicies property value. The authentication method combinations that are to be used in scenarios defined by Microsoft Entra Conditional Access. * @param array|null $value Value to set for the authenticationStrengthPolicies property. */ public function setAuthenticationStrengthPolicies(?array $value): void { @@ -382,7 +382,7 @@ public function setAuthenticationStrengthPolicies(?array $value): void { } /** - * Sets the authorizationPolicy property value. The policy that controls Azure AD authorization settings. + * Sets the authorizationPolicy property value. The policy that controls Microsoft Entra authorization settings. * @param AuthorizationPolicy|null $value Value to set for the authorizationPolicy property. */ public function setAuthorizationPolicy(?AuthorizationPolicy $value): void { @@ -406,7 +406,7 @@ public function setConditionalAccessPolicies(?array $value): void { } /** - * Sets the crossTenantAccessPolicy property value. The custom rules that define an access scenario when interacting with external Azure AD tenants. + * Sets the crossTenantAccessPolicy property value. The custom rules that define an access scenario when interacting with external Microsoft Entra tenants. * @param CrossTenantAccessPolicy|null $value Value to set for the crossTenantAccessPolicy property. */ public function setCrossTenantAccessPolicy(?CrossTenantAccessPolicy $value): void { @@ -430,7 +430,7 @@ public function setFeatureRolloutPolicies(?array $value): void { } /** - * Sets the homeRealmDiscoveryPolicies property value. The policy to control Azure AD authentication behavior for federated users. + * Sets the homeRealmDiscoveryPolicies property value. The policy to control Microsoft Entra authentication behavior for federated users. * @param array|null $value Value to set for the homeRealmDiscoveryPolicies property. */ public function setHomeRealmDiscoveryPolicies(?array $value): void { @@ -470,7 +470,7 @@ public function setRoleManagementPolicyAssignments(?array $value): void { } /** - * Sets the tokenIssuancePolicies property value. The policy that specifies the characteristics of SAML tokens issued by Azure AD. + * Sets the tokenIssuancePolicies property value. The policy that specifies the characteristics of SAML tokens issued by Microsoft Entra ID. * @param array|null $value Value to set for the tokenIssuancePolicies property. */ public function setTokenIssuancePolicies(?array $value): void { @@ -478,7 +478,7 @@ public function setTokenIssuancePolicies(?array $value): void { } /** - * Sets the tokenLifetimePolicies property value. The policy that controls the lifetime of a JWT access token, an ID token, or a SAML 1.1/2.0 token issued by Azure AD. + * Sets the tokenLifetimePolicies property value. The policy that controls the lifetime of a JWT access token, an ID token, or a SAML 1.1/2.0 token issued by Microsoft Entra ID. * @param array|null $value Value to set for the tokenLifetimePolicies property. */ public function setTokenLifetimePolicies(?array $value): void { diff --git a/src/Generated/Models/PositiveReinforcementNotification.php b/src/Generated/Models/PositiveReinforcementNotification.php index 1ba63accd48..893147faf11 100644 --- a/src/Generated/Models/PositiveReinforcementNotification.php +++ b/src/Generated/Models/PositiveReinforcementNotification.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Posit } /** - * Gets the deliveryPreference property value. The deliveryPreference property + * Gets the deliveryPreference property value. Delivery preference. Possible values are: unknown, deliverImmedietly, deliverAfterCampaignEnd, unknownFutureValue. * @return NotificationDeliveryPreference|null */ public function getDeliveryPreference(): ?NotificationDeliveryPreference { @@ -58,7 +58,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the deliveryPreference property value. The deliveryPreference property + * Sets the deliveryPreference property value. Delivery preference. Possible values are: unknown, deliverImmedietly, deliverAfterCampaignEnd, unknownFutureValue. * @param NotificationDeliveryPreference|null $value Value to set for the deliveryPreference property. */ public function setDeliveryPreference(?NotificationDeliveryPreference $value): void { diff --git a/src/Generated/Models/ProvisioningObjectSummary.php b/src/Generated/Models/ProvisioningObjectSummary.php index 55035670fe3..b8dc7341a2c 100644 --- a/src/Generated/Models/ProvisioningObjectSummary.php +++ b/src/Generated/Models/ProvisioningObjectSummary.php @@ -139,7 +139,7 @@ public function getModifiedProperties(): ?array { } /** - * Gets the provisioningAction property value. Indicates the activity name or the operation name. Possible values are: create, update, delete, stageddelete, disable, other and unknownFutureValue. For a list of activities logged, refer to Azure AD activity list. Supports $filter (eq, contains). + * Gets the provisioningAction property value. Indicates the activity name or the operation name. Possible values are: create, update, delete, stageddelete, disable, other and unknownFutureValue. For a list of activities logged, refer to Microsoft Entra activity list. Supports $filter (eq, contains). * @return ProvisioningAction|null */ public function getProvisioningAction(): ?ProvisioningAction { @@ -237,7 +237,7 @@ public function getTargetSystem(): ?ProvisioningSystem { } /** - * Gets the tenantId property value. Unique Azure AD tenant ID. Supports $filter (eq, contains). + * Gets the tenantId property value. Unique Microsoft Entra tenant ID. Supports $filter (eq, contains). * @return string|null */ public function getTenantId(): ?string { @@ -329,7 +329,7 @@ public function setModifiedProperties(?array $value): void { } /** - * Sets the provisioningAction property value. Indicates the activity name or the operation name. Possible values are: create, update, delete, stageddelete, disable, other and unknownFutureValue. For a list of activities logged, refer to Azure AD activity list. Supports $filter (eq, contains). + * Sets the provisioningAction property value. Indicates the activity name or the operation name. Possible values are: create, update, delete, stageddelete, disable, other and unknownFutureValue. For a list of activities logged, refer to Microsoft Entra activity list. Supports $filter (eq, contains). * @param ProvisioningAction|null $value Value to set for the provisioningAction property. */ public function setProvisioningAction(?ProvisioningAction $value): void { @@ -393,7 +393,7 @@ public function setTargetSystem(?ProvisioningSystem $value): void { } /** - * Sets the tenantId property value. Unique Azure AD tenant ID. Supports $filter (eq, contains). + * Sets the tenantId property value. Unique Microsoft Entra tenant ID. Supports $filter (eq, contains). * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { diff --git a/src/Generated/Models/RemoteDesktopSecurityConfiguration.php b/src/Generated/Models/RemoteDesktopSecurityConfiguration.php new file mode 100644 index 00000000000..26f6fb2bc13 --- /dev/null +++ b/src/Generated/Models/RemoteDesktopSecurityConfiguration.php @@ -0,0 +1,92 @@ + + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'isRemoteDesktopProtocolEnabled' => fn(ParseNode $n) => $o->setIsRemoteDesktopProtocolEnabled($n->getBooleanValue()), + 'targetDeviceGroups' => fn(ParseNode $n) => $o->setTargetDeviceGroups($n->getCollectionOfObjectValues([TargetDeviceGroup::class, 'createFromDiscriminatorValue'])), + ]); + } + + /** + * Gets the isRemoteDesktopProtocolEnabled property value. Determines if Microsoft Entra ID RDS authentication protocol for RDP is enabled. + * @return bool|null + */ + public function getIsRemoteDesktopProtocolEnabled(): ?bool { + $val = $this->getBackingStore()->get('isRemoteDesktopProtocolEnabled'); + if (is_null($val) || is_bool($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'isRemoteDesktopProtocolEnabled'"); + } + + /** + * Gets the targetDeviceGroups property value. The collection of target device groups that are associated with the RDS security configuration that will be enabled for SSO when a client connects to the target device over RDP using the new Microsoft Entra ID RDS authentication protocol. + * @return array|null + */ + public function getTargetDeviceGroups(): ?array { + $val = $this->getBackingStore()->get('targetDeviceGroups'); + if (is_array($val) || is_null($val)) { + TypeUtils::validateCollectionValues($val, TargetDeviceGroup::class); + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'targetDeviceGroups'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeBooleanValue('isRemoteDesktopProtocolEnabled', $this->getIsRemoteDesktopProtocolEnabled()); + $writer->writeCollectionOfObjectValues('targetDeviceGroups', $this->getTargetDeviceGroups()); + } + + /** + * Sets the isRemoteDesktopProtocolEnabled property value. Determines if Microsoft Entra ID RDS authentication protocol for RDP is enabled. + * @param bool|null $value Value to set for the isRemoteDesktopProtocolEnabled property. + */ + public function setIsRemoteDesktopProtocolEnabled(?bool $value): void { + $this->getBackingStore()->set('isRemoteDesktopProtocolEnabled', $value); + } + + /** + * Sets the targetDeviceGroups property value. The collection of target device groups that are associated with the RDS security configuration that will be enabled for SSO when a client connects to the target device over RDP using the new Microsoft Entra ID RDS authentication protocol. + * @param array|null $value Value to set for the targetDeviceGroups property. + */ + public function setTargetDeviceGroups(?array $value): void { + $this->getBackingStore()->set('targetDeviceGroups', $value); + } + +} diff --git a/src/Generated/Models/ReportRoot.php b/src/Generated/Models/ReportRoot.php index d0be395fdf0..6f903f77c4b 100644 --- a/src/Generated/Models/ReportRoot.php +++ b/src/Generated/Models/ReportRoot.php @@ -49,7 +49,7 @@ public function getAdditionalData(): ?array { } /** - * Gets the authenticationMethods property value. Container for navigation properties for Azure AD authentication methods resources. + * Gets the authenticationMethods property value. Container for navigation properties for Microsoft Entra authentication methods resources. * @return AuthenticationMethodsRoot|null */ public function getAuthenticationMethods(): ?AuthenticationMethodsRoot { @@ -189,7 +189,7 @@ public function setAdditionalData(?array $value): void { } /** - * Sets the authenticationMethods property value. Container for navigation properties for Azure AD authentication methods resources. + * Sets the authenticationMethods property value. Container for navigation properties for Microsoft Entra authentication methods resources. * @param AuthenticationMethodsRoot|null $value Value to set for the authenticationMethods property. */ public function setAuthenticationMethods(?AuthenticationMethodsRoot $value): void { diff --git a/src/Generated/Models/ResourceSpecificPermissionGrant.php b/src/Generated/Models/ResourceSpecificPermissionGrant.php index 3b6b2b8b1d9..c96298f05fa 100644 --- a/src/Generated/Models/ResourceSpecificPermissionGrant.php +++ b/src/Generated/Models/ResourceSpecificPermissionGrant.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Resou } /** - * Gets the clientAppId property value. ID of the service principal of the Azure AD app that has been granted access. Read-only. + * Gets the clientAppId property value. ID of the service principal of the Microsoft Entra app that has been granted access. Read-only. * @return string|null */ public function getClientAppId(): ?string { @@ -38,7 +38,7 @@ public function getClientAppId(): ?string { } /** - * Gets the clientId property value. ID of the Azure AD app that has been granted access. Read-only. + * Gets the clientId property value. ID of the Microsoft Entra app that has been granted access. Read-only. * @return string|null */ public function getClientId(): ?string { @@ -89,7 +89,7 @@ public function getPermissionType(): ?string { } /** - * Gets the resourceAppId property value. ID of the Azure AD app that is hosting the resource. Read-only. + * Gets the resourceAppId property value. ID of the Microsoft Entra app that is hosting the resource. Read-only. * @return string|null */ public function getResourceAppId(): ?string { @@ -114,7 +114,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the clientAppId property value. ID of the service principal of the Azure AD app that has been granted access. Read-only. + * Sets the clientAppId property value. ID of the service principal of the Microsoft Entra app that has been granted access. Read-only. * @param string|null $value Value to set for the clientAppId property. */ public function setClientAppId(?string $value): void { @@ -122,7 +122,7 @@ public function setClientAppId(?string $value): void { } /** - * Sets the clientId property value. ID of the Azure AD app that has been granted access. Read-only. + * Sets the clientId property value. ID of the Microsoft Entra app that has been granted access. Read-only. * @param string|null $value Value to set for the clientId property. */ public function setClientId(?string $value): void { @@ -146,7 +146,7 @@ public function setPermissionType(?string $value): void { } /** - * Sets the resourceAppId property value. ID of the Azure AD app that is hosting the resource. Read-only. + * Sets the resourceAppId property value. ID of the Microsoft Entra app that is hosting the resource. Read-only. * @param string|null $value Value to set for the resourceAppId property. */ public function setResourceAppId(?string $value): void { diff --git a/src/Generated/Models/RiskyServicePrincipal.php b/src/Generated/Models/RiskyServicePrincipal.php index d159a43ff6d..23735e51e58 100644 --- a/src/Generated/Models/RiskyServicePrincipal.php +++ b/src/Generated/Models/RiskyServicePrincipal.php @@ -78,7 +78,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the history property value. Represents the risk history of Azure AD service principals. + * Gets the history property value. Represents the risk history of Microsoft Entra service principals. * @return array|null */ public function getHistory(): ?array { @@ -104,7 +104,7 @@ public function getIsEnabled(): ?bool { } /** - * Gets the isProcessing property value. Indicates whether Azure AD is currently processing the service principal's risky state. + * Gets the isProcessing property value. Indicates whether Microsoft Entra ID is currently processing the service principal's risky state. * @return bool|null */ public function getIsProcessing(): ?bool { @@ -164,7 +164,7 @@ public function getRiskState(): ?RiskState { } /** - * Gets the servicePrincipalType property value. Identifies whether the service principal represents an Application, a ManagedIdentity, or a legacy application (socialIdp). This is set by Azure AD internally and is inherited from servicePrincipal. + * Gets the servicePrincipalType property value. Identifies whether the service principal represents an Application, a ManagedIdentity, or a legacy application (socialIdp). This is set by Microsoft Entra ID internally and is inherited from servicePrincipal. * @return string|null */ public function getServicePrincipalType(): ?string { @@ -210,7 +210,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the history property value. Represents the risk history of Azure AD service principals. + * Sets the history property value. Represents the risk history of Microsoft Entra service principals. * @param array|null $value Value to set for the history property. */ public function setHistory(?array $value): void { @@ -226,7 +226,7 @@ public function setIsEnabled(?bool $value): void { } /** - * Sets the isProcessing property value. Indicates whether Azure AD is currently processing the service principal's risky state. + * Sets the isProcessing property value. Indicates whether Microsoft Entra ID is currently processing the service principal's risky state. * @param bool|null $value Value to set for the isProcessing property. */ public function setIsProcessing(?bool $value): void { @@ -266,7 +266,7 @@ public function setRiskState(?RiskState $value): void { } /** - * Sets the servicePrincipalType property value. Identifies whether the service principal represents an Application, a ManagedIdentity, or a legacy application (socialIdp). This is set by Azure AD internally and is inherited from servicePrincipal. + * Sets the servicePrincipalType property value. Identifies whether the service principal represents an Application, a ManagedIdentity, or a legacy application (socialIdp). This is set by Microsoft Entra ID internally and is inherited from servicePrincipal. * @param string|null $value Value to set for the servicePrincipalType property. */ public function setServicePrincipalType(?string $value): void { diff --git a/src/Generated/Models/SamlOrWsFedProvider.php b/src/Generated/Models/SamlOrWsFedProvider.php index dec6c2eb49f..85ef882b236 100644 --- a/src/Generated/Models/SamlOrWsFedProvider.php +++ b/src/Generated/Models/SamlOrWsFedProvider.php @@ -73,7 +73,7 @@ public function getMetadataExchangeUri(): ?string { } /** - * Gets the passiveSignInUri property value. URI that web-based clients are directed to when signing in to Azure Active Directory (Azure AD) services. + * Gets the passiveSignInUri property value. URI that web-based clients are directed to when signing in to Microsoft Entra services. * @return string|null */ public function getPassiveSignInUri(): ?string { @@ -97,7 +97,7 @@ public function getPreferredAuthenticationProtocol(): ?AuthenticationProtocol { } /** - * Gets the signingCertificate property value. Current certificate used to sign tokens passed to the Microsoft identity platform. The certificate is formatted as a Base64 encoded string of the public portion of the federated IdP's token signing certificate and must be compatible with the X509Certificate2 class. This property is used in the following scenarios: if a rollover is required outside of the autorollover update a new federation service is being set up if the new token signing certificate isn't present in the federation properties after the federation service certificate has been updated. Azure AD updates certificates via an autorollover process in which it attempts to retrieve a new certificate from the federation service metadata, 30 days before expiry of the current certificate. If a new certificate isn't available, Azure AD monitors the metadata daily and will update the federation settings for the domain when a new certificate is available. + * Gets the signingCertificate property value. Current certificate used to sign tokens passed to the Microsoft identity platform. The certificate is formatted as a Base64 encoded string of the public portion of the federated IdP's token signing certificate and must be compatible with the X509Certificate2 class. This property is used in the following scenarios: if a rollover is required outside of the autorollover update a new federation service is being set up if the new token signing certificate isn't present in the federation properties after the federation service certificate has been updated. Microsoft Entra ID updates certificates via an autorollover process in which it attempts to retrieve a new certificate from the federation service metadata, 30 days before expiry of the current certificate. If a new certificate isn't available, Microsoft Entra ID monitors the metadata daily and will update the federation settings for the domain when a new certificate is available. * @return string|null */ public function getSigningCertificate(): ?string { @@ -138,7 +138,7 @@ public function setMetadataExchangeUri(?string $value): void { } /** - * Sets the passiveSignInUri property value. URI that web-based clients are directed to when signing in to Azure Active Directory (Azure AD) services. + * Sets the passiveSignInUri property value. URI that web-based clients are directed to when signing in to Microsoft Entra services. * @param string|null $value Value to set for the passiveSignInUri property. */ public function setPassiveSignInUri(?string $value): void { @@ -154,7 +154,7 @@ public function setPreferredAuthenticationProtocol(?AuthenticationProtocol $valu } /** - * Sets the signingCertificate property value. Current certificate used to sign tokens passed to the Microsoft identity platform. The certificate is formatted as a Base64 encoded string of the public portion of the federated IdP's token signing certificate and must be compatible with the X509Certificate2 class. This property is used in the following scenarios: if a rollover is required outside of the autorollover update a new federation service is being set up if the new token signing certificate isn't present in the federation properties after the federation service certificate has been updated. Azure AD updates certificates via an autorollover process in which it attempts to retrieve a new certificate from the federation service metadata, 30 days before expiry of the current certificate. If a new certificate isn't available, Azure AD monitors the metadata daily and will update the federation settings for the domain when a new certificate is available. + * Sets the signingCertificate property value. Current certificate used to sign tokens passed to the Microsoft identity platform. The certificate is formatted as a Base64 encoded string of the public portion of the federated IdP's token signing certificate and must be compatible with the X509Certificate2 class. This property is used in the following scenarios: if a rollover is required outside of the autorollover update a new federation service is being set up if the new token signing certificate isn't present in the federation properties after the federation service certificate has been updated. Microsoft Entra ID updates certificates via an autorollover process in which it attempts to retrieve a new certificate from the federation service metadata, 30 days before expiry of the current certificate. If a new certificate isn't available, Microsoft Entra ID monitors the metadata daily and will update the federation settings for the domain when a new certificate is available. * @param string|null $value Value to set for the signingCertificate property. */ public function setSigningCertificate(?string $value): void { diff --git a/src/Generated/Models/SchemaExtension.php b/src/Generated/Models/SchemaExtension.php index 61f2ecfcad4..23fda8edd2e 100644 --- a/src/Generated/Models/SchemaExtension.php +++ b/src/Generated/Models/SchemaExtension.php @@ -60,7 +60,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the owner property value. The appId of the application that is the owner of the schema extension. The owner of the schema definition must be explicitly specified during the Create and Update operations, or it will be implied and auto-assigned by Azure AD as follows: In delegated access: The signed-in user must be the owner of the app that calls Microsoft Graph to create the schema extension definition. If the signed-in user isn't the owner of the calling app, they must explicitly specify the owner property, and assign it the appId of an app that they own. In app-only access: The owner property isn't required in the request body. Instead, the calling app is assigned ownership of the schema extension. So, for example, if creating a new schema extension definition using Graph Explorer, you must supply the owner property. Once set, this property is read-only and cannot be changed. Supports $filter (eq). + * Gets the owner property value. The appId of the application that is the owner of the schema extension. The owner of the schema definition must be explicitly specified during the Create and Update operations, or it will be implied and auto-assigned by Microsoft Entra ID as follows: In delegated access: The signed-in user must be the owner of the app that calls Microsoft Graph to create the schema extension definition. If the signed-in user isn't the owner of the calling app, they must explicitly specify the owner property, and assign it the appId of an app that they own. In app-only access: The owner property isn't required in the request body. Instead, the calling app is assigned ownership of the schema extension. So, for example, if creating a new schema extension definition using Graph Explorer, you must supply the owner property. Once set, this property is read-only and cannot be changed. Supports $filter (eq). * @return string|null */ public function getOwner(): ?string { @@ -133,7 +133,7 @@ public function setDescription(?string $value): void { } /** - * Sets the owner property value. The appId of the application that is the owner of the schema extension. The owner of the schema definition must be explicitly specified during the Create and Update operations, or it will be implied and auto-assigned by Azure AD as follows: In delegated access: The signed-in user must be the owner of the app that calls Microsoft Graph to create the schema extension definition. If the signed-in user isn't the owner of the calling app, they must explicitly specify the owner property, and assign it the appId of an app that they own. In app-only access: The owner property isn't required in the request body. Instead, the calling app is assigned ownership of the schema extension. So, for example, if creating a new schema extension definition using Graph Explorer, you must supply the owner property. Once set, this property is read-only and cannot be changed. Supports $filter (eq). + * Sets the owner property value. The appId of the application that is the owner of the schema extension. The owner of the schema definition must be explicitly specified during the Create and Update operations, or it will be implied and auto-assigned by Microsoft Entra ID as follows: In delegated access: The signed-in user must be the owner of the app that calls Microsoft Graph to create the schema extension definition. If the signed-in user isn't the owner of the calling app, they must explicitly specify the owner property, and assign it the appId of an app that they own. In app-only access: The owner property isn't required in the request body. Instead, the calling app is assigned ownership of the schema extension. So, for example, if creating a new schema extension definition using Graph Explorer, you must supply the owner property. Once set, this property is read-only and cannot be changed. Supports $filter (eq). * @param string|null $value Value to set for the owner property. */ public function setOwner(?string $value): void { diff --git a/src/Generated/Models/SecureScoreControlProfile.php b/src/Generated/Models/SecureScoreControlProfile.php index b2572160aeb..2a237f4c05d 100644 --- a/src/Generated/Models/SecureScoreControlProfile.php +++ b/src/Generated/Models/SecureScoreControlProfile.php @@ -223,7 +223,7 @@ public function getRemediationImpact(): ?string { } /** - * Gets the service property value. Service that owns the control (Exchange, Sharepoint, Azure AD). + * Gets the service property value. Service that owns the control (Exchange, Sharepoint, Microsoft Entra ID). * @return string|null */ public function getService(): ?string { @@ -428,7 +428,7 @@ public function setRemediationImpact(?string $value): void { } /** - * Sets the service property value. Service that owns the control (Exchange, Sharepoint, Azure AD). + * Sets the service property value. Service that owns the control (Exchange, Sharepoint, Microsoft Entra ID). * @param string|null $value Value to set for the service property. */ public function setService(?string $value): void { diff --git a/src/Generated/Models/Security/Alert.php b/src/Generated/Models/Security/Alert.php index 830d44fa65d..a2226ebae39 100644 --- a/src/Generated/Models/Security/Alert.php +++ b/src/Generated/Models/Security/Alert.php @@ -220,6 +220,7 @@ public function getFieldDeserializers(): array { /** @var array|null $val */ $this->setMitreTechniques($val); }, + 'productName' => fn(ParseNode $n) => $o->setProductName($n->getStringValue()), 'providerAlertId' => fn(ParseNode $n) => $o->setProviderAlertId($n->getStringValue()), 'recommendedActions' => fn(ParseNode $n) => $o->setRecommendedActions($n->getStringValue()), 'resolvedDateTime' => fn(ParseNode $n) => $o->setResolvedDateTime($n->getDateTimeValue()), @@ -307,6 +308,18 @@ public function getMitreTechniques(): ?array { throw new \UnexpectedValueException("Invalid type found in backing store for 'mitreTechniques'"); } + /** + * Gets the productName property value. The productName property + * @return string|null + */ + public function getProductName(): ?string { + $val = $this->getBackingStore()->get('productName'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'productName'"); + } + /** * Gets the providerAlertId property value. The ID of the alert as it appears in the security provider product that generated the alert. * @return string|null @@ -380,7 +393,7 @@ public function getStatus(): ?AlertStatus { } /** - * Gets the tenantId property value. The Azure Active Directory tenant the alert was created in. + * Gets the tenantId property value. The Microsoft Entra tenant the alert was created in. * @return string|null */ public function getTenantId(): ?string { @@ -452,6 +465,7 @@ public function serialize(SerializationWriter $writer): void { $writer->writeDateTimeValue('lastActivityDateTime', $this->getLastActivityDateTime()); $writer->writeDateTimeValue('lastUpdateDateTime', $this->getLastUpdateDateTime()); $writer->writeCollectionOfPrimitiveValues('mitreTechniques', $this->getMitreTechniques()); + $writer->writeStringValue('productName', $this->getProductName()); $writer->writeStringValue('providerAlertId', $this->getProviderAlertId()); $writer->writeStringValue('recommendedActions', $this->getRecommendedActions()); $writer->writeDateTimeValue('resolvedDateTime', $this->getResolvedDateTime()); @@ -616,6 +630,14 @@ public function setMitreTechniques(?array $value): void { $this->getBackingStore()->set('mitreTechniques', $value); } + /** + * Sets the productName property value. The productName property + * @param string|null $value Value to set for the productName property. + */ + public function setProductName(?string $value): void { + $this->getBackingStore()->set('productName', $value); + } + /** * Sets the providerAlertId property value. The ID of the alert as it appears in the security provider product that generated the alert. * @param string|null $value Value to set for the providerAlertId property. @@ -665,7 +687,7 @@ public function setStatus(?AlertStatus $value): void { } /** - * Sets the tenantId property value. The Azure Active Directory tenant the alert was created in. + * Sets the tenantId property value. The Microsoft Entra tenant the alert was created in. * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { diff --git a/src/Generated/Models/Security/AlertEvidence.php b/src/Generated/Models/Security/AlertEvidence.php index 5e0af0a09a7..2871f49690c 100644 --- a/src/Generated/Models/Security/AlertEvidence.php +++ b/src/Generated/Models/Security/AlertEvidence.php @@ -54,6 +54,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Alert case '#microsoft.graph.security.kubernetesControllerEvidence': return new KubernetesControllerEvidence(); case '#microsoft.graph.security.kubernetesNamespaceEvidence': return new KubernetesNamespaceEvidence(); case '#microsoft.graph.security.kubernetesPodEvidence': return new KubernetesPodEvidence(); + case '#microsoft.graph.security.kubernetesSecretEvidence': return new KubernetesSecretEvidence(); case '#microsoft.graph.security.kubernetesServiceAccountEvidence': return new KubernetesServiceAccountEvidence(); case '#microsoft.graph.security.kubernetesServiceEvidence': return new KubernetesServiceEvidence(); case '#microsoft.graph.security.mailboxEvidence': return new MailboxEvidence(); diff --git a/src/Generated/Models/Security/DetectionSource.php b/src/Generated/Models/Security/DetectionSource.php index e3711a7df3a..4f9f2ddf8e2 100644 --- a/src/Generated/Models/Security/DetectionSource.php +++ b/src/Generated/Models/Security/DetectionSource.php @@ -24,4 +24,20 @@ class DetectionSource extends Enum { public const APP_GOVERNANCE_DETECTION = 'appGovernanceDetection'; public const UNKNOWN_FUTURE_VALUE = 'unknownFutureValue'; public const MICROSOFT_DEFENDER_FOR_CLOUD = 'microsoftDefenderForCloud'; + public const MICROSOFT_DEFENDER_FOR_IO_T = 'microsoftDefenderForIoT'; + public const MICROSOFT_DEFENDER_FOR_SERVERS = 'microsoftDefenderForServers'; + public const MICROSOFT_DEFENDER_FOR_STORAGE = 'microsoftDefenderForStorage'; + public const MICROSOFT_DEFENDER_FOR_D_N_S = 'microsoftDefenderForDNS'; + public const MICROSOFT_DEFENDER_FOR_DATABASES = 'microsoftDefenderForDatabases'; + public const MICROSOFT_DEFENDER_FOR_CONTAINERS = 'microsoftDefenderForContainers'; + public const MICROSOFT_DEFENDER_FOR_NETWORK = 'microsoftDefenderForNetwork'; + public const MICROSOFT_DEFENDER_FOR_APP_SERVICE = 'microsoftDefenderForAppService'; + public const MICROSOFT_DEFENDER_FOR_KEY_VAULT = 'microsoftDefenderForKeyVault'; + public const MICROSOFT_DEFENDER_FOR_RESOURCE_MANAGER = 'microsoftDefenderForResourceManager'; + public const MICROSOFT_DEFENDER_FOR_API_MANAGEMENT = 'microsoftDefenderForApiManagement'; + public const NRT_ALERTS = 'nrtAlerts'; + public const SCHEDULED_ALERTS = 'scheduledAlerts'; + public const MICROSOFT_DEFENDER_THREAT_INTELLIGENCE_ANALYTICS = 'microsoftDefenderThreatIntelligenceAnalytics'; + public const BUILT_IN_ML = 'builtInMl'; + public const MICROSOFT_SENTINEL = 'microsoftSentinel'; } diff --git a/src/Generated/Models/Security/DeviceEvidence.php b/src/Generated/Models/Security/DeviceEvidence.php index 94118c8f44a..be9a4cf945a 100644 --- a/src/Generated/Models/Security/DeviceEvidence.php +++ b/src/Generated/Models/Security/DeviceEvidence.php @@ -28,7 +28,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Devic } /** - * Gets the azureAdDeviceId property value. A unique identifier assigned to a device by Azure Active Directory (Azure AD) when device is Azure AD-joined. + * Gets the azureAdDeviceId property value. A unique identifier assigned to a device by Microsoft Entra ID when device is Microsoft Entra joined. * @return string|null */ public function getAzureAdDeviceId(): ?string { @@ -281,7 +281,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the azureAdDeviceId property value. A unique identifier assigned to a device by Azure Active Directory (Azure AD) when device is Azure AD-joined. + * Sets the azureAdDeviceId property value. A unique identifier assigned to a device by Microsoft Entra ID when device is Microsoft Entra joined. * @param string|null $value Value to set for the azureAdDeviceId property. */ public function setAzureAdDeviceId(?string $value): void { diff --git a/src/Generated/Models/Security/Host.php b/src/Generated/Models/Security/Host.php index a045d16e164..9fdf2ba406a 100644 --- a/src/Generated/Models/Security/Host.php +++ b/src/Generated/Models/Security/Host.php @@ -36,7 +36,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Host } /** - * Gets the childHostPairs property value. The hostPairs that are resources associated with a host, where that host is the parentHost and has an outgoing pairing to a cihldHost. + * Gets the childHostPairs property value. The hostPairs that are resources associated with a host, where that host is the parentHost and has an outgoing pairing to a childHost. * @return array|null */ public function getChildHostPairs(): ?array { @@ -93,6 +93,7 @@ public function getFieldDeserializers(): array { 'parentHostPairs' => fn(ParseNode $n) => $o->setParentHostPairs($n->getCollectionOfObjectValues([HostPair::class, 'createFromDiscriminatorValue'])), 'passiveDns' => fn(ParseNode $n) => $o->setPassiveDns($n->getCollectionOfObjectValues([PassiveDnsRecord::class, 'createFromDiscriminatorValue'])), 'passiveDnsReverse' => fn(ParseNode $n) => $o->setPassiveDnsReverse($n->getCollectionOfObjectValues([PassiveDnsRecord::class, 'createFromDiscriminatorValue'])), + 'ports' => fn(ParseNode $n) => $o->setPorts($n->getCollectionOfObjectValues([HostPort::class, 'createFromDiscriminatorValue'])), 'reputation' => fn(ParseNode $n) => $o->setReputation($n->getObjectValue([HostReputation::class, 'createFromDiscriminatorValue'])), 'sslCertificates' => fn(ParseNode $n) => $o->setSslCertificates($n->getCollectionOfObjectValues([HostSslCertificate::class, 'createFromDiscriminatorValue'])), 'subdomains' => fn(ParseNode $n) => $o->setSubdomains($n->getCollectionOfObjectValues([Subdomain::class, 'createFromDiscriminatorValue'])), @@ -181,6 +182,20 @@ public function getPassiveDnsReverse(): ?array { throw new \UnexpectedValueException("Invalid type found in backing store for 'passiveDnsReverse'"); } + /** + * Gets the ports property value. The hostPorts associated with a host. + * @return array|null + */ + public function getPorts(): ?array { + $val = $this->getBackingStore()->get('ports'); + if (is_array($val) || is_null($val)) { + TypeUtils::validateCollectionValues($val, HostPort::class); + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'ports'"); + } + /** * Gets the reputation property value. Represents a calculated reputation of this host. * @return HostReputation|null @@ -262,6 +277,7 @@ public function serialize(SerializationWriter $writer): void { $writer->writeCollectionOfObjectValues('parentHostPairs', $this->getParentHostPairs()); $writer->writeCollectionOfObjectValues('passiveDns', $this->getPassiveDns()); $writer->writeCollectionOfObjectValues('passiveDnsReverse', $this->getPassiveDnsReverse()); + $writer->writeCollectionOfObjectValues('ports', $this->getPorts()); $writer->writeObjectValue('reputation', $this->getReputation()); $writer->writeCollectionOfObjectValues('sslCertificates', $this->getSslCertificates()); $writer->writeCollectionOfObjectValues('subdomains', $this->getSubdomains()); @@ -270,7 +286,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the childHostPairs property value. The hostPairs that are resources associated with a host, where that host is the parentHost and has an outgoing pairing to a cihldHost. + * Sets the childHostPairs property value. The hostPairs that are resources associated with a host, where that host is the parentHost and has an outgoing pairing to a childHost. * @param array|null $value Value to set for the childHostPairs property. */ public function setChildHostPairs(?array $value): void { @@ -341,6 +357,14 @@ public function setPassiveDnsReverse(?array $value): void { $this->getBackingStore()->set('passiveDnsReverse', $value); } + /** + * Sets the ports property value. The hostPorts associated with a host. + * @param array|null $value Value to set for the ports property. + */ + public function setPorts(?array $value): void { + $this->getBackingStore()->set('ports', $value); + } + /** * Sets the reputation property value. Represents a calculated reputation of this host. * @param HostReputation|null $value Value to set for the reputation property. diff --git a/src/Generated/Models/Security/HostPort.php b/src/Generated/Models/Security/HostPort.php new file mode 100644 index 00000000000..7ee77ec3a6b --- /dev/null +++ b/src/Generated/Models/Security/HostPort.php @@ -0,0 +1,294 @@ +|null + */ + public function getBanners(): ?array { + $val = $this->getBackingStore()->get('banners'); + if (is_array($val) || is_null($val)) { + TypeUtils::validateCollectionValues($val, HostPortBanner::class); + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'banners'"); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'banners' => fn(ParseNode $n) => $o->setBanners($n->getCollectionOfObjectValues([HostPortBanner::class, 'createFromDiscriminatorValue'])), + 'firstSeenDateTime' => fn(ParseNode $n) => $o->setFirstSeenDateTime($n->getDateTimeValue()), + 'host' => fn(ParseNode $n) => $o->setHost($n->getObjectValue([Host::class, 'createFromDiscriminatorValue'])), + 'lastScanDateTime' => fn(ParseNode $n) => $o->setLastScanDateTime($n->getDateTimeValue()), + 'lastSeenDateTime' => fn(ParseNode $n) => $o->setLastSeenDateTime($n->getDateTimeValue()), + 'mostRecentSslCertificate' => fn(ParseNode $n) => $o->setMostRecentSslCertificate($n->getObjectValue([SslCertificate::class, 'createFromDiscriminatorValue'])), + 'port' => fn(ParseNode $n) => $o->setPort($n->getIntegerValue()), + 'protocol' => fn(ParseNode $n) => $o->setProtocol($n->getEnumValue(HostPortProtocol::class)), + 'services' => fn(ParseNode $n) => $o->setServices($n->getCollectionOfObjectValues([HostPortComponent::class, 'createFromDiscriminatorValue'])), + 'status' => fn(ParseNode $n) => $o->setStatus($n->getEnumValue(HostPortStatus::class)), + 'timesObserved' => fn(ParseNode $n) => $o->setTimesObserved($n->getIntegerValue()), + ]); + } + + /** + * Gets the firstSeenDateTime property value. The first date and time when Microsoft Defender Threat Intelligence observed the hostPort. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @return DateTime|null + */ + public function getFirstSeenDateTime(): ?DateTime { + $val = $this->getBackingStore()->get('firstSeenDateTime'); + if (is_null($val) || $val instanceof DateTime) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'firstSeenDateTime'"); + } + + /** + * Gets the host property value. The host property + * @return Host|null + */ + public function getHost(): ?Host { + $val = $this->getBackingStore()->get('host'); + if (is_null($val) || $val instanceof Host) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'host'"); + } + + /** + * Gets the lastScanDateTime property value. The last date and time when Microsoft Defender Threat Intelligence scanned the hostPort. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @return DateTime|null + */ + public function getLastScanDateTime(): ?DateTime { + $val = $this->getBackingStore()->get('lastScanDateTime'); + if (is_null($val) || $val instanceof DateTime) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'lastScanDateTime'"); + } + + /** + * Gets the lastSeenDateTime property value. The last date and time when Microsoft Defender Threat Intelligence observed the hostPort. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @return DateTime|null + */ + public function getLastSeenDateTime(): ?DateTime { + $val = $this->getBackingStore()->get('lastSeenDateTime'); + if (is_null($val) || $val instanceof DateTime) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'lastSeenDateTime'"); + } + + /** + * Gets the mostRecentSslCertificate property value. The most recent sslCertificate used to communicate on the port. + * @return SslCertificate|null + */ + public function getMostRecentSslCertificate(): ?SslCertificate { + $val = $this->getBackingStore()->get('mostRecentSslCertificate'); + if (is_null($val) || $val instanceof SslCertificate) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'mostRecentSslCertificate'"); + } + + /** + * Gets the port property value. The numerical identifier of the port which is standardized across the internet. + * @return int|null + */ + public function getPort(): ?int { + $val = $this->getBackingStore()->get('port'); + if (is_null($val) || is_int($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'port'"); + } + + /** + * Gets the protocol property value. The general protocol used to scan the port. The possible values are: tcp, udp, unknownFutureValue. + * @return HostPortProtocol|null + */ + public function getProtocol(): ?HostPortProtocol { + $val = $this->getBackingStore()->get('protocol'); + if (is_null($val) || $val instanceof HostPortProtocol) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'protocol'"); + } + + /** + * Gets the services property value. The hostPortComponents retrieved from scanning the port. + * @return array|null + */ + public function getServices(): ?array { + $val = $this->getBackingStore()->get('services'); + if (is_array($val) || is_null($val)) { + TypeUtils::validateCollectionValues($val, HostPortComponent::class); + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'services'"); + } + + /** + * Gets the status property value. The status of the port. The possible values are: open, filtered, closed, unknownFutureValue. + * @return HostPortStatus|null + */ + public function getStatus(): ?HostPortStatus { + $val = $this->getBackingStore()->get('status'); + if (is_null($val) || $val instanceof HostPortStatus) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'status'"); + } + + /** + * Gets the timesObserved property value. The total amount of times that Microsoft Defender Threat Intelligence has observed the hostPort in all its scans. + * @return int|null + */ + public function getTimesObserved(): ?int { + $val = $this->getBackingStore()->get('timesObserved'); + if (is_null($val) || is_int($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'timesObserved'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeCollectionOfObjectValues('banners', $this->getBanners()); + $writer->writeDateTimeValue('firstSeenDateTime', $this->getFirstSeenDateTime()); + $writer->writeObjectValue('host', $this->getHost()); + $writer->writeDateTimeValue('lastScanDateTime', $this->getLastScanDateTime()); + $writer->writeDateTimeValue('lastSeenDateTime', $this->getLastSeenDateTime()); + $writer->writeObjectValue('mostRecentSslCertificate', $this->getMostRecentSslCertificate()); + $writer->writeIntegerValue('port', $this->getPort()); + $writer->writeEnumValue('protocol', $this->getProtocol()); + $writer->writeCollectionOfObjectValues('services', $this->getServices()); + $writer->writeEnumValue('status', $this->getStatus()); + $writer->writeIntegerValue('timesObserved', $this->getTimesObserved()); + } + + /** + * Sets the banners property value. The hostPortBanners retrieved from scanning the port. + * @param array|null $value Value to set for the banners property. + */ + public function setBanners(?array $value): void { + $this->getBackingStore()->set('banners', $value); + } + + /** + * Sets the firstSeenDateTime property value. The first date and time when Microsoft Defender Threat Intelligence observed the hostPort. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @param DateTime|null $value Value to set for the firstSeenDateTime property. + */ + public function setFirstSeenDateTime(?DateTime $value): void { + $this->getBackingStore()->set('firstSeenDateTime', $value); + } + + /** + * Sets the host property value. The host property + * @param Host|null $value Value to set for the host property. + */ + public function setHost(?Host $value): void { + $this->getBackingStore()->set('host', $value); + } + + /** + * Sets the lastScanDateTime property value. The last date and time when Microsoft Defender Threat Intelligence scanned the hostPort. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @param DateTime|null $value Value to set for the lastScanDateTime property. + */ + public function setLastScanDateTime(?DateTime $value): void { + $this->getBackingStore()->set('lastScanDateTime', $value); + } + + /** + * Sets the lastSeenDateTime property value. The last date and time when Microsoft Defender Threat Intelligence observed the hostPort. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @param DateTime|null $value Value to set for the lastSeenDateTime property. + */ + public function setLastSeenDateTime(?DateTime $value): void { + $this->getBackingStore()->set('lastSeenDateTime', $value); + } + + /** + * Sets the mostRecentSslCertificate property value. The most recent sslCertificate used to communicate on the port. + * @param SslCertificate|null $value Value to set for the mostRecentSslCertificate property. + */ + public function setMostRecentSslCertificate(?SslCertificate $value): void { + $this->getBackingStore()->set('mostRecentSslCertificate', $value); + } + + /** + * Sets the port property value. The numerical identifier of the port which is standardized across the internet. + * @param int|null $value Value to set for the port property. + */ + public function setPort(?int $value): void { + $this->getBackingStore()->set('port', $value); + } + + /** + * Sets the protocol property value. The general protocol used to scan the port. The possible values are: tcp, udp, unknownFutureValue. + * @param HostPortProtocol|null $value Value to set for the protocol property. + */ + public function setProtocol(?HostPortProtocol $value): void { + $this->getBackingStore()->set('protocol', $value); + } + + /** + * Sets the services property value. The hostPortComponents retrieved from scanning the port. + * @param array|null $value Value to set for the services property. + */ + public function setServices(?array $value): void { + $this->getBackingStore()->set('services', $value); + } + + /** + * Sets the status property value. The status of the port. The possible values are: open, filtered, closed, unknownFutureValue. + * @param HostPortStatus|null $value Value to set for the status property. + */ + public function setStatus(?HostPortStatus $value): void { + $this->getBackingStore()->set('status', $value); + } + + /** + * Sets the timesObserved property value. The total amount of times that Microsoft Defender Threat Intelligence has observed the hostPort in all its scans. + * @param int|null $value Value to set for the timesObserved property. + */ + public function setTimesObserved(?int $value): void { + $this->getBackingStore()->set('timesObserved', $value); + } + +} diff --git a/src/Generated/Models/Security/HostPortBanner.php b/src/Generated/Models/Security/HostPortBanner.php new file mode 100644 index 00000000000..0c96097c283 --- /dev/null +++ b/src/Generated/Models/Security/HostPortBanner.php @@ -0,0 +1,225 @@ +backingStore = BackingStoreFactorySingleton::getInstance()->createBackingStore(); + $this->setAdditionalData([]); + } + + /** + * Creates a new instance of the appropriate class based on discriminator value + * @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object + * @return HostPortBanner + */ + public static function createFromDiscriminatorValue(ParseNode $parseNode): HostPortBanner { + return new HostPortBanner(); + } + + /** + * Gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + * @return array|null + */ + public function getAdditionalData(): ?array { + $val = $this->getBackingStore()->get('additionalData'); + if (is_null($val) || is_array($val)) { + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'additionalData'"); + } + + /** + * Gets the BackingStore property value. Stores model information. + * @return BackingStore + */ + public function getBackingStore(): BackingStore { + return $this->backingStore; + } + + /** + * Gets the banner property value. The text response received from a web component when scanning a hostPort. + * @return string|null + */ + public function getBanner(): ?string { + $val = $this->getBackingStore()->get('banner'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'banner'"); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return [ + 'banner' => fn(ParseNode $n) => $o->setBanner($n->getStringValue()), + 'firstSeenDateTime' => fn(ParseNode $n) => $o->setFirstSeenDateTime($n->getDateTimeValue()), + 'lastSeenDateTime' => fn(ParseNode $n) => $o->setLastSeenDateTime($n->getDateTimeValue()), + '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()), + 'scanProtocol' => fn(ParseNode $n) => $o->setScanProtocol($n->getStringValue()), + 'timesObserved' => fn(ParseNode $n) => $o->setTimesObserved($n->getIntegerValue()), + ]; + } + + /** + * Gets the firstSeenDateTime property value. The first date and time when Microsoft Defender Threat Intelligence observed the hostPortBanner. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @return DateTime|null + */ + public function getFirstSeenDateTime(): ?DateTime { + $val = $this->getBackingStore()->get('firstSeenDateTime'); + if (is_null($val) || $val instanceof DateTime) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'firstSeenDateTime'"); + } + + /** + * Gets the lastSeenDateTime property value. The last date and time when Microsoft Defender Threat Intelligence observed the hostPortBanner. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @return DateTime|null + */ + public function getLastSeenDateTime(): ?DateTime { + $val = $this->getBackingStore()->get('lastSeenDateTime'); + if (is_null($val) || $val instanceof DateTime) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'lastSeenDateTime'"); + } + + /** + * Gets the @odata.type property value. The OdataType property + * @return string|null + */ + public function getOdataType(): ?string { + $val = $this->getBackingStore()->get('odataType'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'odataType'"); + } + + /** + * Gets the scanProtocol property value. The specific protocol used to scan the hostPort. + * @return string|null + */ + public function getScanProtocol(): ?string { + $val = $this->getBackingStore()->get('scanProtocol'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'scanProtocol'"); + } + + /** + * Gets the timesObserved property value. The total amount of times that Microsoft Defender Threat Intelligence has observed the hostPortBanner in all its scans. + * @return int|null + */ + public function getTimesObserved(): ?int { + $val = $this->getBackingStore()->get('timesObserved'); + if (is_null($val) || is_int($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'timesObserved'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + $writer->writeStringValue('banner', $this->getBanner()); + $writer->writeDateTimeValue('firstSeenDateTime', $this->getFirstSeenDateTime()); + $writer->writeDateTimeValue('lastSeenDateTime', $this->getLastSeenDateTime()); + $writer->writeStringValue('@odata.type', $this->getOdataType()); + $writer->writeStringValue('scanProtocol', $this->getScanProtocol()); + $writer->writeIntegerValue('timesObserved', $this->getTimesObserved()); + $writer->writeAdditionalData($this->getAdditionalData()); + } + + /** + * Sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + * @param array $value Value to set for the AdditionalData property. + */ + public function setAdditionalData(?array $value): void { + $this->getBackingStore()->set('additionalData', $value); + } + + /** + * Sets the BackingStore property value. Stores model information. + * @param BackingStore $value Value to set for the BackingStore property. + */ + public function setBackingStore(BackingStore $value): void { + $this->backingStore = $value; + } + + /** + * Sets the banner property value. The text response received from a web component when scanning a hostPort. + * @param string|null $value Value to set for the banner property. + */ + public function setBanner(?string $value): void { + $this->getBackingStore()->set('banner', $value); + } + + /** + * Sets the firstSeenDateTime property value. The first date and time when Microsoft Defender Threat Intelligence observed the hostPortBanner. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @param DateTime|null $value Value to set for the firstSeenDateTime property. + */ + public function setFirstSeenDateTime(?DateTime $value): void { + $this->getBackingStore()->set('firstSeenDateTime', $value); + } + + /** + * Sets the lastSeenDateTime property value. The last date and time when Microsoft Defender Threat Intelligence observed the hostPortBanner. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @param DateTime|null $value Value to set for the lastSeenDateTime property. + */ + public function setLastSeenDateTime(?DateTime $value): void { + $this->getBackingStore()->set('lastSeenDateTime', $value); + } + + /** + * Sets the @odata.type property value. The OdataType property + * @param string|null $value Value to set for the @odata.type property. + */ + public function setOdataType(?string $value): void { + $this->getBackingStore()->set('odataType', $value); + } + + /** + * Sets the scanProtocol property value. The specific protocol used to scan the hostPort. + * @param string|null $value Value to set for the scanProtocol property. + */ + public function setScanProtocol(?string $value): void { + $this->getBackingStore()->set('scanProtocol', $value); + } + + /** + * Sets the timesObserved property value. The total amount of times that Microsoft Defender Threat Intelligence has observed the hostPortBanner in all its scans. + * @param int|null $value Value to set for the timesObserved property. + */ + public function setTimesObserved(?int $value): void { + $this->getBackingStore()->set('timesObserved', $value); + } + +} diff --git a/src/Generated/Models/Security/HostPortCollectionResponse.php b/src/Generated/Models/Security/HostPortCollectionResponse.php new file mode 100644 index 00000000000..ea0e5c387b0 --- /dev/null +++ b/src/Generated/Models/Security/HostPortCollectionResponse.php @@ -0,0 +1,71 @@ + + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'value' => fn(ParseNode $n) => $o->setValue($n->getCollectionOfObjectValues([HostPort::class, 'createFromDiscriminatorValue'])), + ]); + } + + /** + * Gets the value property value. The value property + * @return array|null + */ + public function getValue(): ?array { + $val = $this->getBackingStore()->get('value'); + if (is_array($val) || is_null($val)) { + TypeUtils::validateCollectionValues($val, HostPort::class); + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'value'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeCollectionOfObjectValues('value', $this->getValue()); + } + + /** + * Sets the value property value. The value property + * @param array|null $value Value to set for the value property. + */ + public function setValue(?array $value): void { + $this->getBackingStore()->set('value', $value); + } + +} diff --git a/src/Generated/Models/Security/HostPortComponent.php b/src/Generated/Models/Security/HostPortComponent.php new file mode 100644 index 00000000000..e8aef91ec9d --- /dev/null +++ b/src/Generated/Models/Security/HostPortComponent.php @@ -0,0 +1,203 @@ +backingStore = BackingStoreFactorySingleton::getInstance()->createBackingStore(); + $this->setAdditionalData([]); + } + + /** + * Creates a new instance of the appropriate class based on discriminator value + * @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object + * @return HostPortComponent + */ + public static function createFromDiscriminatorValue(ParseNode $parseNode): HostPortComponent { + return new HostPortComponent(); + } + + /** + * Gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + * @return array|null + */ + public function getAdditionalData(): ?array { + $val = $this->getBackingStore()->get('additionalData'); + if (is_null($val) || is_array($val)) { + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'additionalData'"); + } + + /** + * Gets the BackingStore property value. Stores model information. + * @return BackingStore + */ + public function getBackingStore(): BackingStore { + return $this->backingStore; + } + + /** + * Gets the component property value. The component property + * @return HostComponent|null + */ + public function getComponent(): ?HostComponent { + $val = $this->getBackingStore()->get('component'); + if (is_null($val) || $val instanceof HostComponent) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'component'"); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return [ + 'component' => fn(ParseNode $n) => $o->setComponent($n->getObjectValue([HostComponent::class, 'createFromDiscriminatorValue'])), + 'firstSeenDateTime' => fn(ParseNode $n) => $o->setFirstSeenDateTime($n->getDateTimeValue()), + 'isRecent' => fn(ParseNode $n) => $o->setIsRecent($n->getBooleanValue()), + 'lastSeenDateTime' => fn(ParseNode $n) => $o->setLastSeenDateTime($n->getDateTimeValue()), + '@odata.type' => fn(ParseNode $n) => $o->setOdataType($n->getStringValue()), + ]; + } + + /** + * Gets the firstSeenDateTime property value. The first date and time when Microsoft Defender Threat Intelligence observed the hostPortComponent. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @return DateTime|null + */ + public function getFirstSeenDateTime(): ?DateTime { + $val = $this->getBackingStore()->get('firstSeenDateTime'); + if (is_null($val) || $val instanceof DateTime) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'firstSeenDateTime'"); + } + + /** + * Gets the isRecent property value. Indicates whether this hostPortComponent is recent, which is determined by whether the hostPortComponent was observed either at the same time or after the latest hostPortBanner in the scan history, or within two days of the latest scan of the hostPort when there are no hostPortBanners in the scan history. + * @return bool|null + */ + public function getIsRecent(): ?bool { + $val = $this->getBackingStore()->get('isRecent'); + if (is_null($val) || is_bool($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'isRecent'"); + } + + /** + * Gets the lastSeenDateTime property value. The last date and time when Microsoft Defender Threat Intelligence observed the hostPortComponent. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @return DateTime|null + */ + public function getLastSeenDateTime(): ?DateTime { + $val = $this->getBackingStore()->get('lastSeenDateTime'); + if (is_null($val) || $val instanceof DateTime) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'lastSeenDateTime'"); + } + + /** + * Gets the @odata.type property value. The OdataType property + * @return string|null + */ + public function getOdataType(): ?string { + $val = $this->getBackingStore()->get('odataType'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'odataType'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + $writer->writeObjectValue('component', $this->getComponent()); + $writer->writeDateTimeValue('firstSeenDateTime', $this->getFirstSeenDateTime()); + $writer->writeBooleanValue('isRecent', $this->getIsRecent()); + $writer->writeDateTimeValue('lastSeenDateTime', $this->getLastSeenDateTime()); + $writer->writeStringValue('@odata.type', $this->getOdataType()); + $writer->writeAdditionalData($this->getAdditionalData()); + } + + /** + * Sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + * @param array $value Value to set for the AdditionalData property. + */ + public function setAdditionalData(?array $value): void { + $this->getBackingStore()->set('additionalData', $value); + } + + /** + * Sets the BackingStore property value. Stores model information. + * @param BackingStore $value Value to set for the BackingStore property. + */ + public function setBackingStore(BackingStore $value): void { + $this->backingStore = $value; + } + + /** + * Sets the component property value. The component property + * @param HostComponent|null $value Value to set for the component property. + */ + public function setComponent(?HostComponent $value): void { + $this->getBackingStore()->set('component', $value); + } + + /** + * Sets the firstSeenDateTime property value. The first date and time when Microsoft Defender Threat Intelligence observed the hostPortComponent. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @param DateTime|null $value Value to set for the firstSeenDateTime property. + */ + public function setFirstSeenDateTime(?DateTime $value): void { + $this->getBackingStore()->set('firstSeenDateTime', $value); + } + + /** + * Sets the isRecent property value. Indicates whether this hostPortComponent is recent, which is determined by whether the hostPortComponent was observed either at the same time or after the latest hostPortBanner in the scan history, or within two days of the latest scan of the hostPort when there are no hostPortBanners in the scan history. + * @param bool|null $value Value to set for the isRecent property. + */ + public function setIsRecent(?bool $value): void { + $this->getBackingStore()->set('isRecent', $value); + } + + /** + * Sets the lastSeenDateTime property value. The last date and time when Microsoft Defender Threat Intelligence observed the hostPortComponent. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014, is 2014-01-01T00:00:00Z. + * @param DateTime|null $value Value to set for the lastSeenDateTime property. + */ + public function setLastSeenDateTime(?DateTime $value): void { + $this->getBackingStore()->set('lastSeenDateTime', $value); + } + + /** + * Sets the @odata.type property value. The OdataType property + * @param string|null $value Value to set for the @odata.type property. + */ + public function setOdataType(?string $value): void { + $this->getBackingStore()->set('odataType', $value); + } + +} diff --git a/src/Generated/Models/Security/HostPortProtocol.php b/src/Generated/Models/Security/HostPortProtocol.php new file mode 100644 index 00000000000..414465a4525 --- /dev/null +++ b/src/Generated/Models/Security/HostPortProtocol.php @@ -0,0 +1,11 @@ +setOdataType('#microsoft.graph.security.kubernetesSecretEvidence'); + } + + /** + * Creates a new instance of the appropriate class based on discriminator value + * @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object + * @return KubernetesSecretEvidence + */ + public static function createFromDiscriminatorValue(ParseNode $parseNode): KubernetesSecretEvidence { + return new KubernetesSecretEvidence(); + } + + /** + * Gets the namespace property value. The secret namespace. + * @return KubernetesNamespaceEvidence|null + */ + public function getEscapedNamespace(): ?KubernetesNamespaceEvidence { + $val = $this->getBackingStore()->get('escapedNamespace'); + if (is_null($val) || $val instanceof KubernetesNamespaceEvidence) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'escapedNamespace'"); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'namespace' => fn(ParseNode $n) => $o->setEscapedNamespace($n->getObjectValue([KubernetesNamespaceEvidence::class, 'createFromDiscriminatorValue'])), + 'name' => fn(ParseNode $n) => $o->setName($n->getStringValue()), + 'secretType' => fn(ParseNode $n) => $o->setSecretType($n->getStringValue()), + ]); + } + + /** + * Gets the name property value. The secret name. + * @return string|null + */ + public function getName(): ?string { + $val = $this->getBackingStore()->get('name'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'name'"); + } + + /** + * Gets the secretType property value. The secret type can include both built-in types and custom ones. Examples of built-in types are: Opaque, kubernetes.io/service-account-token, kubernetes.io/dockercfg, kubernetes.io/dockerconfigjson, kubernetes.io/basic-auth, kubernetes.io/ssh-auth, kubernetes.io/tls, bootstrap.kubernetes.io/token. + * @return string|null + */ + public function getSecretType(): ?string { + $val = $this->getBackingStore()->get('secretType'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'secretType'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeObjectValue('namespace', $this->getEscapedNamespace()); + $writer->writeStringValue('name', $this->getName()); + $writer->writeStringValue('secretType', $this->getSecretType()); + } + + /** + * Sets the namespace property value. The secret namespace. + * @param KubernetesNamespaceEvidence|null $value Value to set for the namespace property. + */ + public function setEscapedNamespace(?KubernetesNamespaceEvidence $value): void { + $this->getBackingStore()->set('escapedNamespace', $value); + } + + /** + * Sets the name property value. The secret name. + * @param string|null $value Value to set for the name property. + */ + public function setName(?string $value): void { + $this->getBackingStore()->set('name', $value); + } + + /** + * Sets the secretType property value. The secret type can include both built-in types and custom ones. Examples of built-in types are: Opaque, kubernetes.io/service-account-token, kubernetes.io/dockercfg, kubernetes.io/dockerconfigjson, kubernetes.io/basic-auth, kubernetes.io/ssh-auth, kubernetes.io/tls, bootstrap.kubernetes.io/token. + * @param string|null $value Value to set for the secretType property. + */ + public function setSecretType(?string $value): void { + $this->getBackingStore()->set('secretType', $value); + } + +} diff --git a/src/Generated/Models/Security/ServiceSource.php b/src/Generated/Models/Security/ServiceSource.php index 278f29e4871..6410ed4d7da 100644 --- a/src/Generated/Models/Security/ServiceSource.php +++ b/src/Generated/Models/Security/ServiceSource.php @@ -16,4 +16,5 @@ class ServiceSource extends Enum { public const DATA_LOSS_PREVENTION = 'dataLossPrevention'; public const UNKNOWN_FUTURE_VALUE = 'unknownFutureValue'; public const MICROSOFT_DEFENDER_FOR_CLOUD = 'microsoftDefenderForCloud'; + public const MICROSOFT_SENTINEL = 'microsoftSentinel'; } diff --git a/src/Generated/Models/Security/ThreatIntelligence.php b/src/Generated/Models/Security/ThreatIntelligence.php index f5b20243b39..fb5a9bedfed 100644 --- a/src/Generated/Models/Security/ThreatIntelligence.php +++ b/src/Generated/Models/Security/ThreatIntelligence.php @@ -66,6 +66,7 @@ public function getFieldDeserializers(): array { 'hostComponents' => fn(ParseNode $n) => $o->setHostComponents($n->getCollectionOfObjectValues([HostComponent::class, 'createFromDiscriminatorValue'])), 'hostCookies' => fn(ParseNode $n) => $o->setHostCookies($n->getCollectionOfObjectValues([HostCookie::class, 'createFromDiscriminatorValue'])), 'hostPairs' => fn(ParseNode $n) => $o->setHostPairs($n->getCollectionOfObjectValues([HostPair::class, 'createFromDiscriminatorValue'])), + 'hostPorts' => fn(ParseNode $n) => $o->setHostPorts($n->getCollectionOfObjectValues([HostPort::class, 'createFromDiscriminatorValue'])), 'hosts' => fn(ParseNode $n) => $o->setHosts($n->getCollectionOfObjectValues([Host::class, 'createFromDiscriminatorValue'])), 'hostSslCertificates' => fn(ParseNode $n) => $o->setHostSslCertificates($n->getCollectionOfObjectValues([HostSslCertificate::class, 'createFromDiscriminatorValue'])), 'hostTrackers' => fn(ParseNode $n) => $o->setHostTrackers($n->getCollectionOfObjectValues([HostTracker::class, 'createFromDiscriminatorValue'])), @@ -122,6 +123,20 @@ public function getHostPairs(): ?array { throw new \UnexpectedValueException("Invalid type found in backing store for 'hostPairs'"); } + /** + * Gets the hostPorts property value. Retrieve details about hostPort objects.Note: List retrieval is not yet supported. + * @return array|null + */ + public function getHostPorts(): ?array { + $val = $this->getBackingStore()->get('hostPorts'); + if (is_array($val) || is_null($val)) { + TypeUtils::validateCollectionValues($val, HostPort::class); + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'hostPorts'"); + } + /** * Gets the hosts property value. Refers to host objects that Microsoft Threat Intelligence has observed.Note: List retrieval is not yet supported. * @return array|null @@ -287,6 +302,7 @@ public function serialize(SerializationWriter $writer): void { $writer->writeCollectionOfObjectValues('hostComponents', $this->getHostComponents()); $writer->writeCollectionOfObjectValues('hostCookies', $this->getHostCookies()); $writer->writeCollectionOfObjectValues('hostPairs', $this->getHostPairs()); + $writer->writeCollectionOfObjectValues('hostPorts', $this->getHostPorts()); $writer->writeCollectionOfObjectValues('hosts', $this->getHosts()); $writer->writeCollectionOfObjectValues('hostSslCertificates', $this->getHostSslCertificates()); $writer->writeCollectionOfObjectValues('hostTrackers', $this->getHostTrackers()); @@ -340,6 +356,14 @@ public function setHostPairs(?array $value): void { $this->getBackingStore()->set('hostPairs', $value); } + /** + * Sets the hostPorts property value. Retrieve details about hostPort objects.Note: List retrieval is not yet supported. + * @param array|null $value Value to set for the hostPorts property. + */ + public function setHostPorts(?array $value): void { + $this->getBackingStore()->set('hostPorts', $value); + } + /** * Sets the hosts property value. Refers to host objects that Microsoft Threat Intelligence has observed.Note: List retrieval is not yet supported. * @param array|null $value Value to set for the hosts property. diff --git a/src/Generated/Models/Security/UserAccount.php b/src/Generated/Models/Security/UserAccount.php index 8887f6adac6..96e5cde379b 100644 --- a/src/Generated/Models/Security/UserAccount.php +++ b/src/Generated/Models/Security/UserAccount.php @@ -60,7 +60,7 @@ public function getAdditionalData(): ?array { } /** - * Gets the azureAdUserId property value. The user object identifier in Azure Active Directory (Azure AD). + * Gets the azureAdUserId property value. The user object identifier in Microsoft Entra ID. * @return string|null */ public function getAzureAdUserId(): ?string { @@ -80,7 +80,7 @@ public function getBackingStore(): BackingStore { } /** - * Gets the displayName property value. The user display name in Azure AD. + * Gets the displayName property value. The user display name in Microsoft Entra ID. * @return string|null */ public function getDisplayName(): ?string { @@ -133,7 +133,7 @@ public function getOdataType(): ?string { } /** - * Gets the userPrincipalName property value. The user principal name of the account in Azure AD. + * Gets the userPrincipalName property value. The user principal name of the account in Microsoft Entra ID. * @return string|null */ public function getUserPrincipalName(): ?string { @@ -188,7 +188,7 @@ public function setAdditionalData(?array $value): void { } /** - * Sets the azureAdUserId property value. The user object identifier in Azure Active Directory (Azure AD). + * Sets the azureAdUserId property value. The user object identifier in Microsoft Entra ID. * @param string|null $value Value to set for the azureAdUserId property. */ public function setAzureAdUserId(?string $value): void { @@ -204,7 +204,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the displayName property value. The user display name in Azure AD. + * Sets the displayName property value. The user display name in Microsoft Entra ID. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -228,7 +228,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the userPrincipalName property value. The user principal name of the account in Azure AD. + * Sets the userPrincipalName property value. The user principal name of the account in Microsoft Entra ID. * @param string|null $value Value to set for the userPrincipalName property. */ public function setUserPrincipalName(?string $value): void { diff --git a/src/Generated/Models/ServicePrincipal.php b/src/Generated/Models/ServicePrincipal.php index fc9385ade2b..8bd9735f7c3 100644 --- a/src/Generated/Models/ServicePrincipal.php +++ b/src/Generated/Models/ServicePrincipal.php @@ -371,6 +371,7 @@ public function getFieldDeserializers(): array { 'passwordCredentials' => fn(ParseNode $n) => $o->setPasswordCredentials($n->getCollectionOfObjectValues([PasswordCredential::class, 'createFromDiscriminatorValue'])), 'preferredSingleSignOnMode' => fn(ParseNode $n) => $o->setPreferredSingleSignOnMode($n->getStringValue()), 'preferredTokenSigningKeyThumbprint' => fn(ParseNode $n) => $o->setPreferredTokenSigningKeyThumbprint($n->getStringValue()), + 'remoteDesktopSecurityConfiguration' => fn(ParseNode $n) => $o->setRemoteDesktopSecurityConfiguration($n->getObjectValue([RemoteDesktopSecurityConfiguration::class, 'createFromDiscriminatorValue'])), 'replyUrls' => function (ParseNode $n) { $val = $n->getCollectionOfPrimitiveValues(); if (is_array($val)) { @@ -435,7 +436,7 @@ public function getHomeRealmDiscoveryPolicies(): ?array { } /** - * Gets the info property value. Basic profile information of the acquired application such as app's marketing, support, terms of service and privacy statement URLs. The terms of service and privacy statement are surfaced to users through the user consent experience. For more info, see How to: Add Terms of service and privacy statement for registered Azure AD apps. Supports $filter (eq, ne, not, ge, le, and eq on null values). + * Gets the info property value. Basic profile information of the acquired application such as app's marketing, support, terms of service and privacy statement URLs. The terms of service and privacy statement are surfaced to users through the user consent experience. For more info, see How to: Add Terms of service and privacy statement for registered Microsoft Entra apps. Supports $filter (eq, ne, not, ge, le, and eq on null values). * @return InformationalUrl|null */ public function getInfo(): ?InformationalUrl { @@ -461,7 +462,7 @@ public function getKeyCredentials(): ?array { } /** - * Gets the loginUrl property value. Specifies the URL where the service provider redirects the user to Azure AD to authenticate. Azure AD uses the URL to launch the application from Microsoft 365 or the Azure AD My Apps. When blank, Azure AD performs IdP-initiated sign-on for applications configured with SAML-based single sign-on. The user launches the application from Microsoft 365, the Azure AD My Apps, or the Azure AD SSO URL. + * Gets the loginUrl property value. Specifies the URL where the service provider redirects the user to Microsoft Entra ID to authenticate. Microsoft Entra ID uses the URL to launch the application from Microsoft 365 or the Microsoft Entra My Apps. When blank, Microsoft Entra ID performs IdP-initiated sign-on for applications configured with SAML-based single sign-on. The user launches the application from Microsoft 365, the Microsoft Entra My Apps, or the Microsoft Entra SSO URL. * @return string|null */ public function getLoginUrl(): ?string { @@ -511,7 +512,7 @@ public function getNotes(): ?string { } /** - * Gets the notificationEmailAddresses property value. Specifies the list of email addresses where Azure AD sends a notification when the active certificate is near the expiration date. This is only for the certificates used to sign the SAML token issued for Azure AD Gallery applications. + * Gets the notificationEmailAddresses property value. Specifies the list of email addresses where Microsoft Entra ID sends a notification when the active certificate is near the expiration date. This is only for the certificates used to sign the SAML token issued for Microsoft Entra Gallery applications. * @return array|null */ public function getNotificationEmailAddresses(): ?array { @@ -595,7 +596,7 @@ public function getPasswordCredentials(): ?array { } /** - * Gets the preferredSingleSignOnMode property value. Specifies the single sign-on mode configured for this application. Azure AD uses the preferred single sign-on mode to launch the application from Microsoft 365 or the Azure AD My Apps. The supported values are password, saml, notSupported, and oidc. + * Gets the preferredSingleSignOnMode property value. Specifies the single sign-on mode configured for this application. Microsoft Entra ID uses the preferred single sign-on mode to launch the application from Microsoft 365 or the My Apps portal. The supported values are password, saml, notSupported, and oidc. * @return string|null */ public function getPreferredSingleSignOnMode(): ?string { @@ -618,6 +619,18 @@ public function getPreferredTokenSigningKeyThumbprint(): ?string { throw new \UnexpectedValueException("Invalid type found in backing store for 'preferredTokenSigningKeyThumbprint'"); } + /** + * Gets the remoteDesktopSecurityConfiguration property value. The remoteDesktopSecurityConfiguration object applied to this service principal. Supports $filter (eq) for isRemoteDesktopProtocolEnabled property. + * @return RemoteDesktopSecurityConfiguration|null + */ + public function getRemoteDesktopSecurityConfiguration(): ?RemoteDesktopSecurityConfiguration { + $val = $this->getBackingStore()->get('remoteDesktopSecurityConfiguration'); + if (is_null($val) || $val instanceof RemoteDesktopSecurityConfiguration) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'remoteDesktopSecurityConfiguration'"); + } + /** * Gets the replyUrls property value. The URLs that user tokens are sent to for sign in with the associated application, or the redirect URIs that OAuth 2.0 authorization codes and access tokens are sent to for the associated application. Not nullable. * @return array|null @@ -659,7 +672,7 @@ public function getSamlSingleSignOnSettings(): ?SamlSingleSignOnSettings { } /** - * Gets the servicePrincipalNames property value. Contains the list of identifiersUris, copied over from the associated application. Additional values can be added to hybrid applications. These values can be used to identify the permissions exposed by this app within Azure AD. For example,Client apps can specify a resource URI which is based on the values of this property to acquire an access token, which is the URI returned in the 'aud' claim.The any operator is required for filter expressions on multi-valued properties. Not nullable. Supports $filter (eq, not, ge, le, startsWith). + * Gets the servicePrincipalNames property value. Contains the list of identifiersUris, copied over from the associated application. Additional values can be added to hybrid applications. These values can be used to identify the permissions exposed by this app within Microsoft Entra ID. For example,Client apps can specify a resource URI which is based on the values of this property to acquire an access token, which is the URI returned in the 'aud' claim.The any operator is required for filter expressions on multi-valued properties. Not nullable. Supports $filter (eq, not, ge, le, startsWith). * @return array|null */ public function getServicePrincipalNames(): ?array { @@ -673,7 +686,7 @@ public function getServicePrincipalNames(): ?array { } /** - * Gets the servicePrincipalType property value. Identifies whether the service principal represents an application, a managed identity, or a legacy application. This is set by Azure AD internally. The servicePrincipalType property can be set to three different values: Application - A service principal that represents an application or service. The appId property identifies the associated app registration, and matches the appId of an application, possibly from a different tenant. If the associated app registration is missing, tokens are not issued for the service principal.ManagedIdentity - A service principal that represents a managed identity. Service principals representing managed identities can be granted access and permissions, but cannot be updated or modified directly.Legacy - A service principal that represents an app created before app registrations, or through legacy experiences. Legacy service principal can have credentials, service principal names, reply URLs, and other properties which are editable by an authorized user, but does not have an associated app registration. The appId value does not associate the service principal with an app registration. The service principal can only be used in the tenant where it was created.SocialIdp - For internal use. + * Gets the servicePrincipalType property value. Identifies whether the service principal represents an application, a managed identity, or a legacy application. This is set by Microsoft Entra ID internally. The servicePrincipalType property can be set to three different values: Application - A service principal that represents an application or service. The appId property identifies the associated app registration, and matches the appId of an application, possibly from a different tenant. If the associated app registration is missing, tokens are not issued for the service principal.ManagedIdentity - A service principal that represents a managed identity. Service principals representing managed identities can be granted access and permissions, but cannot be updated or modified directly.Legacy - A service principal that represents an app created before app registrations, or through legacy experiences. Legacy service principal can have credentials, service principal names, reply URLs, and other properties which are editable by an authorized user, but does not have an associated app registration. The appId value does not associate the service principal with an app registration. The service principal can only be used in the tenant where it was created.SocialIdp - For internal use. * @return string|null */ public function getServicePrincipalType(): ?string { @@ -685,7 +698,7 @@ public function getServicePrincipalType(): ?string { } /** - * Gets the signInAudience property value. Specifies the Microsoft accounts that are supported for the current application. Read-only. Supported values are:AzureADMyOrg: Users with a Microsoft work or school account in my organization's Azure AD tenant (single-tenant).AzureADMultipleOrgs: Users with a Microsoft work or school account in any organization's Azure AD tenant (multi-tenant).AzureADandPersonalMicrosoftAccount: Users with a personal Microsoft account, or a work or school account in any organization's Azure AD tenant.PersonalMicrosoftAccount: Users with a personal Microsoft account only. + * Gets the signInAudience property value. Specifies the Microsoft accounts that are supported for the current application. Read-only. Supported values are:AzureADMyOrg: Users with a Microsoft work or school account in my organization's Microsoft Entra tenant (single-tenant).AzureADMultipleOrgs: Users with a Microsoft work or school account in any organization's Microsoft Entra tenant (multi-tenant).AzureADandPersonalMicrosoftAccount: Users with a personal Microsoft account, or a work or school account in any organization's Microsoft Entra tenant.PersonalMicrosoftAccount: Users with a personal Microsoft account only. * @return string|null */ public function getSignInAudience(): ?string { @@ -697,7 +710,7 @@ public function getSignInAudience(): ?string { } /** - * Gets the synchronization property value. Represents the capability for Azure Active Directory (Azure AD) identity synchronization through the Microsoft Graph API. + * Gets the synchronization property value. Represents the capability for Microsoft Entra identity synchronization through the Microsoft Graph API. * @return Synchronization|null */ public function getSynchronization(): ?Synchronization { @@ -723,7 +736,7 @@ public function getTags(): ?array { } /** - * Gets the tokenEncryptionKeyId property value. Specifies the keyId of a public key from the keyCredentials collection. When configured, Azure AD issues tokens for this application encrypted using the key specified by this property. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signed-in user. + * Gets the tokenEncryptionKeyId property value. Specifies the keyId of a public key from the keyCredentials collection. When configured, Microsoft Entra ID issues tokens for this application encrypted using the key specified by this property. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signed-in user. * @return string|null */ public function getTokenEncryptionKeyId(): ?string { @@ -832,6 +845,7 @@ public function serialize(SerializationWriter $writer): void { $writer->writeCollectionOfObjectValues('passwordCredentials', $this->getPasswordCredentials()); $writer->writeStringValue('preferredSingleSignOnMode', $this->getPreferredSingleSignOnMode()); $writer->writeStringValue('preferredTokenSigningKeyThumbprint', $this->getPreferredTokenSigningKeyThumbprint()); + $writer->writeObjectValue('remoteDesktopSecurityConfiguration', $this->getRemoteDesktopSecurityConfiguration()); $writer->writeCollectionOfPrimitiveValues('replyUrls', $this->getReplyUrls()); $writer->writeCollectionOfObjectValues('resourceSpecificApplicationPermissions', $this->getResourceSpecificApplicationPermissions()); $writer->writeObjectValue('samlSingleSignOnSettings', $this->getSamlSingleSignOnSettings()); @@ -1040,7 +1054,7 @@ public function setHomeRealmDiscoveryPolicies(?array $value): void { } /** - * Sets the info property value. Basic profile information of the acquired application such as app's marketing, support, terms of service and privacy statement URLs. The terms of service and privacy statement are surfaced to users through the user consent experience. For more info, see How to: Add Terms of service and privacy statement for registered Azure AD apps. Supports $filter (eq, ne, not, ge, le, and eq on null values). + * Sets the info property value. Basic profile information of the acquired application such as app's marketing, support, terms of service and privacy statement URLs. The terms of service and privacy statement are surfaced to users through the user consent experience. For more info, see How to: Add Terms of service and privacy statement for registered Microsoft Entra apps. Supports $filter (eq, ne, not, ge, le, and eq on null values). * @param InformationalUrl|null $value Value to set for the info property. */ public function setInfo(?InformationalUrl $value): void { @@ -1056,7 +1070,7 @@ public function setKeyCredentials(?array $value): void { } /** - * Sets the loginUrl property value. Specifies the URL where the service provider redirects the user to Azure AD to authenticate. Azure AD uses the URL to launch the application from Microsoft 365 or the Azure AD My Apps. When blank, Azure AD performs IdP-initiated sign-on for applications configured with SAML-based single sign-on. The user launches the application from Microsoft 365, the Azure AD My Apps, or the Azure AD SSO URL. + * Sets the loginUrl property value. Specifies the URL where the service provider redirects the user to Microsoft Entra ID to authenticate. Microsoft Entra ID uses the URL to launch the application from Microsoft 365 or the Microsoft Entra My Apps. When blank, Microsoft Entra ID performs IdP-initiated sign-on for applications configured with SAML-based single sign-on. The user launches the application from Microsoft 365, the Microsoft Entra My Apps, or the Microsoft Entra SSO URL. * @param string|null $value Value to set for the loginUrl property. */ public function setLoginUrl(?string $value): void { @@ -1088,7 +1102,7 @@ public function setNotes(?string $value): void { } /** - * Sets the notificationEmailAddresses property value. Specifies the list of email addresses where Azure AD sends a notification when the active certificate is near the expiration date. This is only for the certificates used to sign the SAML token issued for Azure AD Gallery applications. + * Sets the notificationEmailAddresses property value. Specifies the list of email addresses where Microsoft Entra ID sends a notification when the active certificate is near the expiration date. This is only for the certificates used to sign the SAML token issued for Microsoft Entra Gallery applications. * @param array|null $value Value to set for the notificationEmailAddresses property. */ public function setNotificationEmailAddresses(?array $value): void { @@ -1136,7 +1150,7 @@ public function setPasswordCredentials(?array $value): void { } /** - * Sets the preferredSingleSignOnMode property value. Specifies the single sign-on mode configured for this application. Azure AD uses the preferred single sign-on mode to launch the application from Microsoft 365 or the Azure AD My Apps. The supported values are password, saml, notSupported, and oidc. + * Sets the preferredSingleSignOnMode property value. Specifies the single sign-on mode configured for this application. Microsoft Entra ID uses the preferred single sign-on mode to launch the application from Microsoft 365 or the My Apps portal. The supported values are password, saml, notSupported, and oidc. * @param string|null $value Value to set for the preferredSingleSignOnMode property. */ public function setPreferredSingleSignOnMode(?string $value): void { @@ -1151,6 +1165,14 @@ public function setPreferredTokenSigningKeyThumbprint(?string $value): void { $this->getBackingStore()->set('preferredTokenSigningKeyThumbprint', $value); } + /** + * Sets the remoteDesktopSecurityConfiguration property value. The remoteDesktopSecurityConfiguration object applied to this service principal. Supports $filter (eq) for isRemoteDesktopProtocolEnabled property. + * @param RemoteDesktopSecurityConfiguration|null $value Value to set for the remoteDesktopSecurityConfiguration property. + */ + public function setRemoteDesktopSecurityConfiguration(?RemoteDesktopSecurityConfiguration $value): void { + $this->getBackingStore()->set('remoteDesktopSecurityConfiguration', $value); + } + /** * Sets the replyUrls property value. The URLs that user tokens are sent to for sign in with the associated application, or the redirect URIs that OAuth 2.0 authorization codes and access tokens are sent to for the associated application. Not nullable. * @param array|null $value Value to set for the replyUrls property. @@ -1176,7 +1198,7 @@ public function setSamlSingleSignOnSettings(?SamlSingleSignOnSettings $value): v } /** - * Sets the servicePrincipalNames property value. Contains the list of identifiersUris, copied over from the associated application. Additional values can be added to hybrid applications. These values can be used to identify the permissions exposed by this app within Azure AD. For example,Client apps can specify a resource URI which is based on the values of this property to acquire an access token, which is the URI returned in the 'aud' claim.The any operator is required for filter expressions on multi-valued properties. Not nullable. Supports $filter (eq, not, ge, le, startsWith). + * Sets the servicePrincipalNames property value. Contains the list of identifiersUris, copied over from the associated application. Additional values can be added to hybrid applications. These values can be used to identify the permissions exposed by this app within Microsoft Entra ID. For example,Client apps can specify a resource URI which is based on the values of this property to acquire an access token, which is the URI returned in the 'aud' claim.The any operator is required for filter expressions on multi-valued properties. Not nullable. Supports $filter (eq, not, ge, le, startsWith). * @param array|null $value Value to set for the servicePrincipalNames property. */ public function setServicePrincipalNames(?array $value): void { @@ -1184,7 +1206,7 @@ public function setServicePrincipalNames(?array $value): void { } /** - * Sets the servicePrincipalType property value. Identifies whether the service principal represents an application, a managed identity, or a legacy application. This is set by Azure AD internally. The servicePrincipalType property can be set to three different values: Application - A service principal that represents an application or service. The appId property identifies the associated app registration, and matches the appId of an application, possibly from a different tenant. If the associated app registration is missing, tokens are not issued for the service principal.ManagedIdentity - A service principal that represents a managed identity. Service principals representing managed identities can be granted access and permissions, but cannot be updated or modified directly.Legacy - A service principal that represents an app created before app registrations, or through legacy experiences. Legacy service principal can have credentials, service principal names, reply URLs, and other properties which are editable by an authorized user, but does not have an associated app registration. The appId value does not associate the service principal with an app registration. The service principal can only be used in the tenant where it was created.SocialIdp - For internal use. + * Sets the servicePrincipalType property value. Identifies whether the service principal represents an application, a managed identity, or a legacy application. This is set by Microsoft Entra ID internally. The servicePrincipalType property can be set to three different values: Application - A service principal that represents an application or service. The appId property identifies the associated app registration, and matches the appId of an application, possibly from a different tenant. If the associated app registration is missing, tokens are not issued for the service principal.ManagedIdentity - A service principal that represents a managed identity. Service principals representing managed identities can be granted access and permissions, but cannot be updated or modified directly.Legacy - A service principal that represents an app created before app registrations, or through legacy experiences. Legacy service principal can have credentials, service principal names, reply URLs, and other properties which are editable by an authorized user, but does not have an associated app registration. The appId value does not associate the service principal with an app registration. The service principal can only be used in the tenant where it was created.SocialIdp - For internal use. * @param string|null $value Value to set for the servicePrincipalType property. */ public function setServicePrincipalType(?string $value): void { @@ -1192,7 +1214,7 @@ public function setServicePrincipalType(?string $value): void { } /** - * Sets the signInAudience property value. Specifies the Microsoft accounts that are supported for the current application. Read-only. Supported values are:AzureADMyOrg: Users with a Microsoft work or school account in my organization's Azure AD tenant (single-tenant).AzureADMultipleOrgs: Users with a Microsoft work or school account in any organization's Azure AD tenant (multi-tenant).AzureADandPersonalMicrosoftAccount: Users with a personal Microsoft account, or a work or school account in any organization's Azure AD tenant.PersonalMicrosoftAccount: Users with a personal Microsoft account only. + * Sets the signInAudience property value. Specifies the Microsoft accounts that are supported for the current application. Read-only. Supported values are:AzureADMyOrg: Users with a Microsoft work or school account in my organization's Microsoft Entra tenant (single-tenant).AzureADMultipleOrgs: Users with a Microsoft work or school account in any organization's Microsoft Entra tenant (multi-tenant).AzureADandPersonalMicrosoftAccount: Users with a personal Microsoft account, or a work or school account in any organization's Microsoft Entra tenant.PersonalMicrosoftAccount: Users with a personal Microsoft account only. * @param string|null $value Value to set for the signInAudience property. */ public function setSignInAudience(?string $value): void { @@ -1200,7 +1222,7 @@ public function setSignInAudience(?string $value): void { } /** - * Sets the synchronization property value. Represents the capability for Azure Active Directory (Azure AD) identity synchronization through the Microsoft Graph API. + * Sets the synchronization property value. Represents the capability for Microsoft Entra identity synchronization through the Microsoft Graph API. * @param Synchronization|null $value Value to set for the synchronization property. */ public function setSynchronization(?Synchronization $value): void { @@ -1216,7 +1238,7 @@ public function setTags(?array $value): void { } /** - * Sets the tokenEncryptionKeyId property value. Specifies the keyId of a public key from the keyCredentials collection. When configured, Azure AD issues tokens for this application encrypted using the key specified by this property. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signed-in user. + * Sets the tokenEncryptionKeyId property value. Specifies the keyId of a public key from the keyCredentials collection. When configured, Microsoft Entra ID issues tokens for this application encrypted using the key specified by this property. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signed-in user. * @param string|null $value Value to set for the tokenEncryptionKeyId property. */ public function setTokenEncryptionKeyId(?string $value): void { diff --git a/src/Generated/Models/SignIn.php b/src/Generated/Models/SignIn.php index ff8c022916d..edf7e8058ec 100644 --- a/src/Generated/Models/SignIn.php +++ b/src/Generated/Models/SignIn.php @@ -39,7 +39,7 @@ public function getAppDisplayName(): ?string { } /** - * Gets the appId property value. Unique GUID representing the app ID in the Azure Active Directory. Supports $filter (eq). + * Gets the appId property value. Unique GUID representing the app ID in the Microsoft Entra ID. Supports $filter (eq). * @return string|null */ public function getAppId(): ?string { @@ -51,7 +51,7 @@ public function getAppId(): ?string { } /** - * Gets the appliedConditionalAccessPolicies property value. Provides a list of conditional access policies that are triggered by the corresponding sign-in activity. + * Gets the appliedConditionalAccessPolicies property value. Provides a list of conditional access policies that are triggered by the corresponding sign-in activity. Apps need additional Conditional Access-related privileges to read the details of this property. For more information, see Viewing applied conditional access (CA) policies in sign-ins. * @return array|null */ public function getAppliedConditionalAccessPolicies(): ?array { @@ -225,7 +225,7 @@ public function getResourceId(): ?string { } /** - * Gets the riskDetail property value. Provides the 'reason' behind a specific state of a risky user, sign-in or a risk event. The possible values are: none, adminGeneratedTemporaryPassword, userPerformedSecuredPasswordChange, userPerformedSecuredPasswordReset, adminConfirmedSigninSafe, aiConfirmedSigninSafe, userPassedMFADrivenByRiskBasedPolicy, adminDismissedAllRiskForUser, adminConfirmedSigninCompromised, unknownFutureValue. The value none means that no action has been performed on the user or sign-in so far. Supports $filter (eq).Note: Details for this property require an Azure AD Premium P2 license. Other licenses return the value hidden. + * Gets the riskDetail property value. Provides the 'reason' behind a specific state of a risky user, sign-in or a risk event. The possible values are: none, adminGeneratedTemporaryPassword, userPerformedSecuredPasswordChange, userPerformedSecuredPasswordReset, adminConfirmedSigninSafe, aiConfirmedSigninSafe, userPassedMFADrivenByRiskBasedPolicy, adminDismissedAllRiskForUser, adminConfirmedSigninCompromised, unknownFutureValue. The value none means that no action has been performed on the user or sign-in so far. Supports $filter (eq).Note: Details for this property require a Microsoft Entra ID P2 license. Other licenses return the value hidden. * @return RiskDetail|null */ public function getRiskDetail(): ?RiskDetail { @@ -265,7 +265,7 @@ public function getRiskEventTypesV2(): ?array { } /** - * Gets the riskLevelAggregated property value. Aggregated risk level. The possible values are: none, low, medium, high, hidden, and unknownFutureValue. The value hidden means the user or sign-in wasn't enabled for Azure AD Identity Protection. Supports $filter (eq). Note: Details for this property are only available for Azure AD Premium P2 customers. All other customers are returned hidden. + * Gets the riskLevelAggregated property value. Aggregated risk level. The possible values are: none, low, medium, high, hidden, and unknownFutureValue. The value hidden means the user or sign-in wasn't enabled for Microsoft Entra ID Protection. Supports $filter (eq). Note: Details for this property are only available for Microsoft Entra ID P2 customers. All other customers are returned hidden. * @return RiskLevel|null */ public function getRiskLevelAggregated(): ?RiskLevel { @@ -277,7 +277,7 @@ public function getRiskLevelAggregated(): ?RiskLevel { } /** - * Gets the riskLevelDuringSignIn property value. Risk level during sign-in. The possible values are: none, low, medium, high, hidden, and unknownFutureValue. The value hidden means the user or sign-in wasn't enabled for Azure AD Identity Protection. Supports $filter (eq). Note: Details for this property are only available for Azure AD Premium P2 customers. All other customers are returned hidden. + * Gets the riskLevelDuringSignIn property value. Risk level during sign-in. The possible values are: none, low, medium, high, hidden, and unknownFutureValue. The value hidden means the user or sign-in wasn't enabled for Microsoft Entra ID Protection. Supports $filter (eq). Note: Details for this property are only available for Microsoft Entra ID P2 customers. All other customers are returned hidden. * @return RiskLevel|null */ public function getRiskLevelDuringSignIn(): ?RiskLevel { @@ -388,7 +388,7 @@ public function setAppDisplayName(?string $value): void { } /** - * Sets the appId property value. Unique GUID representing the app ID in the Azure Active Directory. Supports $filter (eq). + * Sets the appId property value. Unique GUID representing the app ID in the Microsoft Entra ID. Supports $filter (eq). * @param string|null $value Value to set for the appId property. */ public function setAppId(?string $value): void { @@ -396,7 +396,7 @@ public function setAppId(?string $value): void { } /** - * Sets the appliedConditionalAccessPolicies property value. Provides a list of conditional access policies that are triggered by the corresponding sign-in activity. + * Sets the appliedConditionalAccessPolicies property value. Provides a list of conditional access policies that are triggered by the corresponding sign-in activity. Apps need additional Conditional Access-related privileges to read the details of this property. For more information, see Viewing applied conditional access (CA) policies in sign-ins. * @param array|null $value Value to set for the appliedConditionalAccessPolicies property. */ public function setAppliedConditionalAccessPolicies(?array $value): void { @@ -484,7 +484,7 @@ public function setResourceId(?string $value): void { } /** - * Sets the riskDetail property value. Provides the 'reason' behind a specific state of a risky user, sign-in or a risk event. The possible values are: none, adminGeneratedTemporaryPassword, userPerformedSecuredPasswordChange, userPerformedSecuredPasswordReset, adminConfirmedSigninSafe, aiConfirmedSigninSafe, userPassedMFADrivenByRiskBasedPolicy, adminDismissedAllRiskForUser, adminConfirmedSigninCompromised, unknownFutureValue. The value none means that no action has been performed on the user or sign-in so far. Supports $filter (eq).Note: Details for this property require an Azure AD Premium P2 license. Other licenses return the value hidden. + * Sets the riskDetail property value. Provides the 'reason' behind a specific state of a risky user, sign-in or a risk event. The possible values are: none, adminGeneratedTemporaryPassword, userPerformedSecuredPasswordChange, userPerformedSecuredPasswordReset, adminConfirmedSigninSafe, aiConfirmedSigninSafe, userPassedMFADrivenByRiskBasedPolicy, adminDismissedAllRiskForUser, adminConfirmedSigninCompromised, unknownFutureValue. The value none means that no action has been performed on the user or sign-in so far. Supports $filter (eq).Note: Details for this property require a Microsoft Entra ID P2 license. Other licenses return the value hidden. * @param RiskDetail|null $value Value to set for the riskDetail property. */ public function setRiskDetail(?RiskDetail $value): void { @@ -508,7 +508,7 @@ public function setRiskEventTypesV2(?array $value): void { } /** - * Sets the riskLevelAggregated property value. Aggregated risk level. The possible values are: none, low, medium, high, hidden, and unknownFutureValue. The value hidden means the user or sign-in wasn't enabled for Azure AD Identity Protection. Supports $filter (eq). Note: Details for this property are only available for Azure AD Premium P2 customers. All other customers are returned hidden. + * Sets the riskLevelAggregated property value. Aggregated risk level. The possible values are: none, low, medium, high, hidden, and unknownFutureValue. The value hidden means the user or sign-in wasn't enabled for Microsoft Entra ID Protection. Supports $filter (eq). Note: Details for this property are only available for Microsoft Entra ID P2 customers. All other customers are returned hidden. * @param RiskLevel|null $value Value to set for the riskLevelAggregated property. */ public function setRiskLevelAggregated(?RiskLevel $value): void { @@ -516,7 +516,7 @@ public function setRiskLevelAggregated(?RiskLevel $value): void { } /** - * Sets the riskLevelDuringSignIn property value. Risk level during sign-in. The possible values are: none, low, medium, high, hidden, and unknownFutureValue. The value hidden means the user or sign-in wasn't enabled for Azure AD Identity Protection. Supports $filter (eq). Note: Details for this property are only available for Azure AD Premium P2 customers. All other customers are returned hidden. + * Sets the riskLevelDuringSignIn property value. Risk level during sign-in. The possible values are: none, low, medium, high, hidden, and unknownFutureValue. The value hidden means the user or sign-in wasn't enabled for Microsoft Entra ID Protection. Supports $filter (eq). Note: Details for this property are only available for Microsoft Entra ID P2 customers. All other customers are returned hidden. * @param RiskLevel|null $value Value to set for the riskLevelDuringSignIn property. */ public function setRiskLevelDuringSignIn(?RiskLevel $value): void { diff --git a/src/Generated/Models/SignInActivity.php b/src/Generated/Models/SignInActivity.php index 9e8d31fb782..1d4ee1e2239 100644 --- a/src/Generated/Models/SignInActivity.php +++ b/src/Generated/Models/SignInActivity.php @@ -72,7 +72,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the lastNonInteractiveSignInDateTime property value. The last non-interactive sign-in date for a specific user. You can use this field to calculate the last time a client attempted to sign into the directory on behalf of a user. Because some users may use clients to access tenant resources rather than signing into your tenant directly, you can use the non-interactive sign-in date to along with lastSignInDateTime to identify inactive users. The timestamp represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is: '2014-01-01T00:00:00Z'. Azure AD maintains non-interactive sign-ins going back to May 2020. For more information about using the value of this property, see Manage inactive user accounts in Azure AD. + * Gets the lastNonInteractiveSignInDateTime property value. The last non-interactive sign-in date for a specific user. You can use this field to calculate the last time a client attempted to sign into the directory on behalf of a user. Because some users may use clients to access tenant resources rather than signing into your tenant directly, you can use the non-interactive sign-in date to along with lastSignInDateTime to identify inactive users. The timestamp represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is: '2014-01-01T00:00:00Z'. Microsoft Entra ID maintains non-interactive sign-ins going back to May 2020. For more information about using the value of this property, see Manage inactive user accounts in Microsoft Entra ID. * @return DateTime|null */ public function getLastNonInteractiveSignInDateTime(): ?DateTime { @@ -96,7 +96,7 @@ public function getLastNonInteractiveSignInRequestId(): ?string { } /** - * Gets the lastSignInDateTime property value. The last interactive sign-in date and time for a specific user. You can use this field to calculate the last time a user attempted to sign into the directory with an interactive authentication method. This field can be used to build reports, such as inactive users. The timestamp represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is: '2014-01-01T00:00:00Z'. Azure AD maintains interactive sign-ins going back to April 2020. For more information about using the value of this property, see Manage inactive user accounts in Azure AD. + * Gets the lastSignInDateTime property value. The last interactive sign-in date and time for a specific user. You can use this field to calculate the last time a user attempted to sign into the directory with an interactive authentication method. This field can be used to build reports, such as inactive users. The timestamp represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is: '2014-01-01T00:00:00Z'. Microsoft Entra ID maintains interactive sign-ins going back to April 2020. For more information about using the value of this property, see Manage inactive user accounts in Microsoft Entra ID. * @return DateTime|null */ public function getLastSignInDateTime(): ?DateTime { @@ -161,7 +161,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the lastNonInteractiveSignInDateTime property value. The last non-interactive sign-in date for a specific user. You can use this field to calculate the last time a client attempted to sign into the directory on behalf of a user. Because some users may use clients to access tenant resources rather than signing into your tenant directly, you can use the non-interactive sign-in date to along with lastSignInDateTime to identify inactive users. The timestamp represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is: '2014-01-01T00:00:00Z'. Azure AD maintains non-interactive sign-ins going back to May 2020. For more information about using the value of this property, see Manage inactive user accounts in Azure AD. + * Sets the lastNonInteractiveSignInDateTime property value. The last non-interactive sign-in date for a specific user. You can use this field to calculate the last time a client attempted to sign into the directory on behalf of a user. Because some users may use clients to access tenant resources rather than signing into your tenant directly, you can use the non-interactive sign-in date to along with lastSignInDateTime to identify inactive users. The timestamp represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is: '2014-01-01T00:00:00Z'. Microsoft Entra ID maintains non-interactive sign-ins going back to May 2020. For more information about using the value of this property, see Manage inactive user accounts in Microsoft Entra ID. * @param DateTime|null $value Value to set for the lastNonInteractiveSignInDateTime property. */ public function setLastNonInteractiveSignInDateTime(?DateTime $value): void { @@ -177,7 +177,7 @@ public function setLastNonInteractiveSignInRequestId(?string $value): void { } /** - * Sets the lastSignInDateTime property value. The last interactive sign-in date and time for a specific user. You can use this field to calculate the last time a user attempted to sign into the directory with an interactive authentication method. This field can be used to build reports, such as inactive users. The timestamp represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is: '2014-01-01T00:00:00Z'. Azure AD maintains interactive sign-ins going back to April 2020. For more information about using the value of this property, see Manage inactive user accounts in Azure AD. + * Sets the lastSignInDateTime property value. The last interactive sign-in date and time for a specific user. You can use this field to calculate the last time a user attempted to sign into the directory with an interactive authentication method. This field can be used to build reports, such as inactive users. The timestamp represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is: '2014-01-01T00:00:00Z'. Microsoft Entra ID maintains interactive sign-ins going back to April 2020. For more information about using the value of this property, see Manage inactive user accounts in Microsoft Entra ID. * @param DateTime|null $value Value to set for the lastSignInDateTime property. */ public function setLastSignInDateTime(?DateTime $value): void { diff --git a/src/Generated/Models/Simulation.php b/src/Generated/Models/Simulation.php index 76d643200b1..7312f2a14c3 100644 --- a/src/Generated/Models/Simulation.php +++ b/src/Generated/Models/Simulation.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Simul } /** - * Gets the attackTechnique property value. The social engineering technique used in the attack simulation and training campaign. Supports $filter and $orderby. Possible values are: unknown, credentialHarvesting, attachmentMalware, driveByUrl, linkInAttachment, linkToMalwareFile, unknownFutureValue. For more information on the types of social engineering attack techniques, see simulations. + * Gets the attackTechnique property value. The social engineering technique used in the attack simulation and training campaign. Supports $filter and $orderby. Possible values are: unknown, credentialHarvesting, attachmentMalware, driveByUrl, linkInAttachment, linkToMalwareFile, unknownFutureValue, oAuthConsentGrant. Note that you must use the Prefer: include-unknown-enum-members request header to get the following values from this evolvable enum: oAuthConsentGrant. For more information on the types of social engineering attack techniques, see simulations. * @return SimulationAttackTechnique|null */ public function getAttackTechnique(): ?SimulationAttackTechnique { @@ -122,7 +122,7 @@ public function getDisplayName(): ?string { } /** - * Gets the durationInDays property value. The durationInDays property + * Gets the durationInDays property value. Simulation duration in days. * @return int|null */ public function getDurationInDays(): ?int { @@ -134,7 +134,7 @@ public function getDurationInDays(): ?int { } /** - * Gets the endUserNotificationSetting property value. The endUserNotificationSetting property + * Gets the endUserNotificationSetting property value. Details about the end user notification setting. * @return EndUserNotificationSetting|null */ public function getEndUserNotificationSetting(): ?EndUserNotificationSetting { @@ -146,7 +146,7 @@ public function getEndUserNotificationSetting(): ?EndUserNotificationSetting { } /** - * Gets the excludedAccountTarget property value. The excludedAccountTarget property + * Gets the excludedAccountTarget property value. Users excluded from the simulation. * @return AccountTargetContent|null */ public function getExcludedAccountTarget(): ?AccountTargetContent { @@ -192,7 +192,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the includedAccountTarget property value. The includedAccountTarget property + * Gets the includedAccountTarget property value. Users targeted in the simulation. * @return AccountTargetContent|null */ public function getIncludedAccountTarget(): ?AccountTargetContent { @@ -216,7 +216,7 @@ public function getIsAutomated(): ?bool { } /** - * Gets the landingPage property value. The landingPage property + * Gets the landingPage property value. The landing page associated with a simulation during its creation. * @return LandingPage|null */ public function getLandingPage(): ?LandingPage { @@ -264,7 +264,7 @@ public function getLaunchDateTime(): ?DateTime { } /** - * Gets the loginPage property value. The loginPage property + * Gets the loginPage property value. The login page associated with a simulation during its creation. * @return LoginPage|null */ public function getLoginPage(): ?LoginPage { @@ -276,7 +276,7 @@ public function getLoginPage(): ?LoginPage { } /** - * Gets the oAuthConsentAppDetail property value. The oAuthConsentAppDetail property + * Gets the oAuthConsentAppDetail property value. OAuth app details for the OAuth technique. * @return OAuthConsentAppDetail|null */ public function getOAuthConsentAppDetail(): ?OAuthConsentAppDetail { @@ -288,7 +288,7 @@ public function getOAuthConsentAppDetail(): ?OAuthConsentAppDetail { } /** - * Gets the payload property value. The payload property + * Gets the payload property value. The payload associated with a simulation during its creation. * @return Payload|null */ public function getPayload(): ?Payload { @@ -336,7 +336,7 @@ public function getStatus(): ?SimulationStatus { } /** - * Gets the trainingSetting property value. The trainingSetting property + * Gets the trainingSetting property value. Details about the training settings for a simulation. * @return TrainingSetting|null */ public function getTrainingSetting(): ?TrainingSetting { @@ -380,7 +380,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the attackTechnique property value. The social engineering technique used in the attack simulation and training campaign. Supports $filter and $orderby. Possible values are: unknown, credentialHarvesting, attachmentMalware, driveByUrl, linkInAttachment, linkToMalwareFile, unknownFutureValue. For more information on the types of social engineering attack techniques, see simulations. + * Sets the attackTechnique property value. The social engineering technique used in the attack simulation and training campaign. Supports $filter and $orderby. Possible values are: unknown, credentialHarvesting, attachmentMalware, driveByUrl, linkInAttachment, linkToMalwareFile, unknownFutureValue, oAuthConsentGrant. Note that you must use the Prefer: include-unknown-enum-members request header to get the following values from this evolvable enum: oAuthConsentGrant. For more information on the types of social engineering attack techniques, see simulations. * @param SimulationAttackTechnique|null $value Value to set for the attackTechnique property. */ public function setAttackTechnique(?SimulationAttackTechnique $value): void { @@ -444,7 +444,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the durationInDays property value. The durationInDays property + * Sets the durationInDays property value. Simulation duration in days. * @param int|null $value Value to set for the durationInDays property. */ public function setDurationInDays(?int $value): void { @@ -452,7 +452,7 @@ public function setDurationInDays(?int $value): void { } /** - * Sets the endUserNotificationSetting property value. The endUserNotificationSetting property + * Sets the endUserNotificationSetting property value. Details about the end user notification setting. * @param EndUserNotificationSetting|null $value Value to set for the endUserNotificationSetting property. */ public function setEndUserNotificationSetting(?EndUserNotificationSetting $value): void { @@ -460,7 +460,7 @@ public function setEndUserNotificationSetting(?EndUserNotificationSetting $value } /** - * Sets the excludedAccountTarget property value. The excludedAccountTarget property + * Sets the excludedAccountTarget property value. Users excluded from the simulation. * @param AccountTargetContent|null $value Value to set for the excludedAccountTarget property. */ public function setExcludedAccountTarget(?AccountTargetContent $value): void { @@ -468,7 +468,7 @@ public function setExcludedAccountTarget(?AccountTargetContent $value): void { } /** - * Sets the includedAccountTarget property value. The includedAccountTarget property + * Sets the includedAccountTarget property value. Users targeted in the simulation. * @param AccountTargetContent|null $value Value to set for the includedAccountTarget property. */ public function setIncludedAccountTarget(?AccountTargetContent $value): void { @@ -484,7 +484,7 @@ public function setIsAutomated(?bool $value): void { } /** - * Sets the landingPage property value. The landingPage property + * Sets the landingPage property value. The landing page associated with a simulation during its creation. * @param LandingPage|null $value Value to set for the landingPage property. */ public function setLandingPage(?LandingPage $value): void { @@ -516,7 +516,7 @@ public function setLaunchDateTime(?DateTime $value): void { } /** - * Sets the loginPage property value. The loginPage property + * Sets the loginPage property value. The login page associated with a simulation during its creation. * @param LoginPage|null $value Value to set for the loginPage property. */ public function setLoginPage(?LoginPage $value): void { @@ -524,7 +524,7 @@ public function setLoginPage(?LoginPage $value): void { } /** - * Sets the oAuthConsentAppDetail property value. The oAuthConsentAppDetail property + * Sets the oAuthConsentAppDetail property value. OAuth app details for the OAuth technique. * @param OAuthConsentAppDetail|null $value Value to set for the oAuthConsentAppDetail property. */ public function setOAuthConsentAppDetail(?OAuthConsentAppDetail $value): void { @@ -532,7 +532,7 @@ public function setOAuthConsentAppDetail(?OAuthConsentAppDetail $value): void { } /** - * Sets the payload property value. The payload property + * Sets the payload property value. The payload associated with a simulation during its creation. * @param Payload|null $value Value to set for the payload property. */ public function setPayload(?Payload $value): void { @@ -564,7 +564,7 @@ public function setStatus(?SimulationStatus $value): void { } /** - * Sets the trainingSetting property value. The trainingSetting property + * Sets the trainingSetting property value. Details about the training settings for a simulation. * @param TrainingSetting|null $value Value to set for the trainingSetting property. */ public function setTrainingSetting(?TrainingSetting $value): void { diff --git a/src/Generated/Models/SimulationNotification.php b/src/Generated/Models/SimulationNotification.php index 83389c4c0c5..08ccd3d8072 100644 --- a/src/Generated/Models/SimulationNotification.php +++ b/src/Generated/Models/SimulationNotification.php @@ -37,7 +37,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the targettedUserType property value. The targettedUserType property + * Gets the targettedUserType property value. Target user type. Possible values are: unknown, clicked, compromised, allUsers, unknownFutureValue. * @return TargettedUserType|null */ public function getTargettedUserType(): ?TargettedUserType { @@ -58,7 +58,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the targettedUserType property value. The targettedUserType property + * Sets the targettedUserType property value. Target user type. Possible values are: unknown, clicked, compromised, allUsers, unknownFutureValue. * @param TargettedUserType|null $value Value to set for the targettedUserType property. */ public function setTargettedUserType(?TargettedUserType $value): void { diff --git a/src/Generated/Models/SingleUser.php b/src/Generated/Models/SingleUser.php index f61acf4e0df..05b572f3d42 100644 --- a/src/Generated/Models/SingleUser.php +++ b/src/Generated/Models/SingleUser.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Singl } /** - * Gets the description property value. The name of the user in Azure AD. Read only. + * Gets the description property value. The name of the user in Microsoft Entra ID. Read only. * @return string|null */ public function getDescription(): ?string { @@ -50,7 +50,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the userId property value. The ID of the user in Azure AD. + * Gets the userId property value. The ID of the user in Microsoft Entra ID. * @return string|null */ public function getUserId(): ?string { @@ -72,7 +72,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the description property value. The name of the user in Azure AD. Read only. + * Sets the description property value. The name of the user in Microsoft Entra ID. Read only. * @param string|null $value Value to set for the description property. */ public function setDescription(?string $value): void { @@ -80,7 +80,7 @@ public function setDescription(?string $value): void { } /** - * Sets the userId property value. The ID of the user in Azure AD. + * Sets the userId property value. The ID of the user in Microsoft Entra ID. * @param string|null $value Value to set for the userId property. */ public function setUserId(?string $value): void { diff --git a/src/Generated/Models/SkypeForBusinessUserConversationMember.php b/src/Generated/Models/SkypeForBusinessUserConversationMember.php index 43569eef5b5..01a4f320eae 100644 --- a/src/Generated/Models/SkypeForBusinessUserConversationMember.php +++ b/src/Generated/Models/SkypeForBusinessUserConversationMember.php @@ -50,7 +50,7 @@ public function getTenantId(): ?string { } /** - * Gets the userId property value. Azure Active Directory ID of the user. + * Gets the userId property value. Microsoft Entra ID of the user. * @return string|null */ public function getUserId(): ?string { @@ -80,7 +80,7 @@ public function setTenantId(?string $value): void { } /** - * Sets the userId property value. Azure Active Directory ID of the user. + * Sets the userId property value. Microsoft Entra ID of the user. * @param string|null $value Value to set for the userId property. */ public function setUserId(?string $value): void { diff --git a/src/Generated/Models/SmsAuthenticationMethodTarget.php b/src/Generated/Models/SmsAuthenticationMethodTarget.php index b714575bca5..de656786e37 100644 --- a/src/Generated/Models/SmsAuthenticationMethodTarget.php +++ b/src/Generated/Models/SmsAuthenticationMethodTarget.php @@ -36,7 +36,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the isUsableForSignIn property value. Determines if users can use this authentication method to sign in to Azure AD. true if users can use this method for primary authentication, otherwise false. + * Gets the isUsableForSignIn property value. Determines if users can use this authentication method to sign in to Microsoft Entra ID. true if users can use this method for primary authentication, otherwise false. * @return bool|null */ public function getIsUsableForSignIn(): ?bool { @@ -57,7 +57,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the isUsableForSignIn property value. Determines if users can use this authentication method to sign in to Azure AD. true if users can use this method for primary authentication, otherwise false. + * Sets the isUsableForSignIn property value. Determines if users can use this authentication method to sign in to Microsoft Entra ID. true if users can use this method for primary authentication, otherwise false. * @param bool|null $value Value to set for the isUsableForSignIn property. */ public function setIsUsableForSignIn(?bool $value): void { diff --git a/src/Generated/Models/StringKeyLongValuePair.php b/src/Generated/Models/StringKeyLongValuePair.php index c89463b5290..898f59f4eaa 100644 --- a/src/Generated/Models/StringKeyLongValuePair.php +++ b/src/Generated/Models/StringKeyLongValuePair.php @@ -69,7 +69,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the key property value. The mapping of the user type from the source system to the target system. For example:User to User - For Azure AD to Azure AD synchronization worker to user - For Workday to Azure AD synchronization. + * Gets the key property value. The mapping of the user type from the source system to the target system. For example:User to User - For Microsoft Entra ID to Microsoft Entra ID synchronization worker to user - For Workday to Microsoft Entra synchronization. * @return string|null */ public function getKey(): ?string { @@ -132,7 +132,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the key property value. The mapping of the user type from the source system to the target system. For example:User to User - For Azure AD to Azure AD synchronization worker to user - For Workday to Azure AD synchronization. + * Sets the key property value. The mapping of the user type from the source system to the target system. For example:User to User - For Microsoft Entra ID to Microsoft Entra ID synchronization worker to user - For Workday to Microsoft Entra synchronization. * @param string|null $value Value to set for the key property. */ public function setKey(?string $value): void { diff --git a/src/Generated/Models/SynchronizationJobSubject.php b/src/Generated/Models/SynchronizationJobSubject.php index 18158b5d98e..176d09f9fcd 100644 --- a/src/Generated/Models/SynchronizationJobSubject.php +++ b/src/Generated/Models/SynchronizationJobSubject.php @@ -82,7 +82,7 @@ public function getLinks(): ?SynchronizationLinkedObjects { } /** - * Gets the objectId property value. The identifier of an object to which a synchronizationJob is to be applied. Can be one of the following: An onPremisesDistinguishedName for synchronization from Active Directory to Azure AD.The user ID for synchronization from Azure AD to a third-party.The Worker ID of the Workday worker for synchronization from Workday to either Active Directory or Azure AD. + * Gets the objectId property value. The identifier of an object to which a synchronizationJob is to be applied. Can be one of the following: An onPremisesDistinguishedName for synchronization from Active Directory to Azure AD.The user ID for synchronization from Microsoft Entra ID to a third-party.The Worker ID of the Workday worker for synchronization from Workday to either Active Directory or Microsoft Entra ID. * @return string|null */ public function getObjectId(): ?string { @@ -94,7 +94,7 @@ public function getObjectId(): ?string { } /** - * Gets the objectTypeName property value. The type of the object to which a synchronizationJob is to be applied. Can be one of the following: user for synchronizing between Active Directory and Azure AD.User for synchronizing a user between Azure AD and a third-party application. Worker for synchronization a user between Workday and either Active Directory or Azure AD.Group for synchronizing a group between Azure AD and a third-party application. + * Gets the objectTypeName property value. The type of the object to which a synchronizationJob is to be applied. Can be one of the following: user for synchronizing between Active Directory and Azure AD.User for synchronizing a user between Microsoft Entra ID and a third-party application. Worker for synchronization a user between Workday and either Active Directory or Microsoft Entra ID.Group for synchronizing a group between Microsoft Entra ID and a third-party application. * @return string|null */ public function getObjectTypeName(): ?string { @@ -154,7 +154,7 @@ public function setLinks(?SynchronizationLinkedObjects $value): void { } /** - * Sets the objectId property value. The identifier of an object to which a synchronizationJob is to be applied. Can be one of the following: An onPremisesDistinguishedName for synchronization from Active Directory to Azure AD.The user ID for synchronization from Azure AD to a third-party.The Worker ID of the Workday worker for synchronization from Workday to either Active Directory or Azure AD. + * Sets the objectId property value. The identifier of an object to which a synchronizationJob is to be applied. Can be one of the following: An onPremisesDistinguishedName for synchronization from Active Directory to Azure AD.The user ID for synchronization from Microsoft Entra ID to a third-party.The Worker ID of the Workday worker for synchronization from Workday to either Active Directory or Microsoft Entra ID. * @param string|null $value Value to set for the objectId property. */ public function setObjectId(?string $value): void { @@ -162,7 +162,7 @@ public function setObjectId(?string $value): void { } /** - * Sets the objectTypeName property value. The type of the object to which a synchronizationJob is to be applied. Can be one of the following: user for synchronizing between Active Directory and Azure AD.User for synchronizing a user between Azure AD and a third-party application. Worker for synchronization a user between Workday and either Active Directory or Azure AD.Group for synchronizing a group between Azure AD and a third-party application. + * Sets the objectTypeName property value. The type of the object to which a synchronizationJob is to be applied. Can be one of the following: user for synchronizing between Active Directory and Azure AD.User for synchronizing a user between Microsoft Entra ID and a third-party application. Worker for synchronization a user between Workday and either Active Directory or Microsoft Entra ID.Group for synchronizing a group between Microsoft Entra ID and a third-party application. * @param string|null $value Value to set for the objectTypeName property. */ public function setObjectTypeName(?string $value): void { diff --git a/src/Generated/Models/TargetDeviceGroup.php b/src/Generated/Models/TargetDeviceGroup.php new file mode 100644 index 00000000000..6731e5a0b48 --- /dev/null +++ b/src/Generated/Models/TargetDeviceGroup.php @@ -0,0 +1,67 @@ +getBackingStore()->get('displayName'); + if (is_null($val) || is_string($val)) { + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'displayName'"); + } + + /** + * The deserialization information for the current model + * @return array + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'displayName' => fn(ParseNode $n) => $o->setDisplayName($n->getStringValue()), + ]); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeStringValue('displayName', $this->getDisplayName()); + } + + /** + * Sets the displayName property value. Display name for the target device group. + * @param string|null $value Value to set for the displayName property. + */ + public function setDisplayName(?string $value): void { + $this->getBackingStore()->set('displayName', $value); + } + +} diff --git a/src/Generated/Models/TargetDeviceGroupCollectionResponse.php b/src/Generated/Models/TargetDeviceGroupCollectionResponse.php new file mode 100644 index 00000000000..92dfef750a5 --- /dev/null +++ b/src/Generated/Models/TargetDeviceGroupCollectionResponse.php @@ -0,0 +1,70 @@ + + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'value' => fn(ParseNode $n) => $o->setValue($n->getCollectionOfObjectValues([TargetDeviceGroup::class, 'createFromDiscriminatorValue'])), + ]); + } + + /** + * Gets the value property value. The value property + * @return array|null + */ + public function getValue(): ?array { + $val = $this->getBackingStore()->get('value'); + if (is_array($val) || is_null($val)) { + TypeUtils::validateCollectionValues($val, TargetDeviceGroup::class); + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'value'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeCollectionOfObjectValues('value', $this->getValue()); + } + + /** + * Sets the value property value. The value property + * @param array|null $value Value to set for the value property. + */ + public function setValue(?array $value): void { + $this->getBackingStore()->set('value', $value); + } + +} diff --git a/src/Generated/Models/Team.php b/src/Generated/Models/Team.php index a81b5a4ccae..0f683093f6c 100644 --- a/src/Generated/Models/Team.php +++ b/src/Generated/Models/Team.php @@ -381,7 +381,7 @@ public function getTemplate(): ?TeamsTemplate { } /** - * Gets the tenantId property value. The ID of the Azure Active Directory tenant. + * Gets the tenantId property value. The ID of the Microsoft Entra tenant. * @return string|null */ public function getTenantId(): ?string { @@ -653,7 +653,7 @@ public function setTemplate(?TeamsTemplate $value): void { } /** - * Sets the tenantId property value. The ID of the Azure Active Directory tenant. + * Sets the tenantId property value. The ID of the Microsoft Entra tenant. * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { diff --git a/src/Generated/Models/TeamInfo.php b/src/Generated/Models/TeamInfo.php index 06b6a1e21b8..c9d6d1f8896 100644 --- a/src/Generated/Models/TeamInfo.php +++ b/src/Generated/Models/TeamInfo.php @@ -70,7 +70,7 @@ public function getTeam(): ?Team { } /** - * Gets the tenantId property value. The ID of the Azure Active Directory tenant. + * Gets the tenantId property value. The ID of the Microsoft Entra tenant. * @return string|null */ public function getTenantId(): ?string { @@ -109,7 +109,7 @@ public function setTeam(?Team $value): void { } /** - * Sets the tenantId property value. The ID of the Azure Active Directory tenant. + * Sets the tenantId property value. The ID of the Microsoft Entra tenant. * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { diff --git a/src/Generated/Models/TenantInformation.php b/src/Generated/Models/TenantInformation.php index 278c84eae82..025887e1912 100644 --- a/src/Generated/Models/TenantInformation.php +++ b/src/Generated/Models/TenantInformation.php @@ -56,7 +56,7 @@ public function getBackingStore(): BackingStore { } /** - * Gets the defaultDomainName property value. Primary domain name of an Azure AD tenant. + * Gets the defaultDomainName property value. Primary domain name of a Microsoft Entra tenant. * @return string|null */ public function getDefaultDomainName(): ?string { @@ -68,7 +68,7 @@ public function getDefaultDomainName(): ?string { } /** - * Gets the displayName property value. Display name of an Azure AD tenant. + * Gets the displayName property value. Display name of a Microsoft Entra tenant. * @return string|null */ public function getDisplayName(): ?string { @@ -80,7 +80,7 @@ public function getDisplayName(): ?string { } /** - * Gets the federationBrandName property value. Name shown to users that sign in to an Azure AD tenant. + * Gets the federationBrandName property value. Name shown to users that sign in to a Microsoft Entra tenant. * @return string|null */ public function getFederationBrandName(): ?string { @@ -119,7 +119,7 @@ public function getOdataType(): ?string { } /** - * Gets the tenantId property value. Unique identifier of an Azure AD tenant. + * Gets the tenantId property value. Unique identifier of a Microsoft Entra tenant. * @return string|null */ public function getTenantId(): ?string { @@ -160,7 +160,7 @@ public function setBackingStore(BackingStore $value): void { } /** - * Sets the defaultDomainName property value. Primary domain name of an Azure AD tenant. + * Sets the defaultDomainName property value. Primary domain name of a Microsoft Entra tenant. * @param string|null $value Value to set for the defaultDomainName property. */ public function setDefaultDomainName(?string $value): void { @@ -168,7 +168,7 @@ public function setDefaultDomainName(?string $value): void { } /** - * Sets the displayName property value. Display name of an Azure AD tenant. + * Sets the displayName property value. Display name of a Microsoft Entra tenant. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -176,7 +176,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the federationBrandName property value. Name shown to users that sign in to an Azure AD tenant. + * Sets the federationBrandName property value. Name shown to users that sign in to a Microsoft Entra tenant. * @param string|null $value Value to set for the federationBrandName property. */ public function setFederationBrandName(?string $value): void { @@ -192,7 +192,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the tenantId property value. Unique identifier of an Azure AD tenant. + * Sets the tenantId property value. Unique identifier of a Microsoft Entra tenant. * @param string|null $value Value to set for the tenantId property. */ public function setTenantId(?string $value): void { diff --git a/src/Generated/Models/TermsOfUseContainer.php b/src/Generated/Models/TermsOfUseContainer.php index 54057e3e06c..9510a9c3235 100644 --- a/src/Generated/Models/TermsOfUseContainer.php +++ b/src/Generated/Models/TermsOfUseContainer.php @@ -40,7 +40,7 @@ public function getAgreementAcceptances(): ?array { } /** - * Gets the agreements property value. Represents a tenant's customizable terms of use agreement that's created and managed with Azure Active Directory (Azure AD). + * Gets the agreements property value. Represents a tenant's customizable terms of use agreement that's created and managed with Microsoft Entra ID Governance. * @return array|null */ public function getAgreements(): ?array { @@ -84,7 +84,7 @@ public function setAgreementAcceptances(?array $value): void { } /** - * Sets the agreements property value. Represents a tenant's customizable terms of use agreement that's created and managed with Azure Active Directory (Azure AD). + * Sets the agreements property value. Represents a tenant's customizable terms of use agreement that's created and managed with Microsoft Entra ID Governance. * @param array|null $value Value to set for the agreements property. */ public function setAgreements(?array $value): void { diff --git a/src/Generated/Models/Training.php b/src/Generated/Models/Training.php index 116d1df4718..db23ddef904 100644 --- a/src/Generated/Models/Training.php +++ b/src/Generated/Models/Training.php @@ -27,7 +27,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Train } /** - * Gets the availabilityStatus property value. The availabilityStatus property + * Gets the availabilityStatus property value. Training availability status. Possible values are: unknown, notAvailable, available, archive, delete, unknownFutureValue. * @return TrainingAvailabilityStatus|null */ public function getAvailabilityStatus(): ?TrainingAvailabilityStatus { @@ -39,7 +39,7 @@ public function getAvailabilityStatus(): ?TrainingAvailabilityStatus { } /** - * Gets the createdBy property value. The createdBy property + * Gets the createdBy property value. Identity of the user who created the training. * @return EmailIdentity|null */ public function getCreatedBy(): ?EmailIdentity { @@ -51,7 +51,7 @@ public function getCreatedBy(): ?EmailIdentity { } /** - * Gets the createdDateTime property value. The createdDateTime property + * Gets the createdDateTime property value. Date and time when the training was created. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getCreatedDateTime(): ?DateTime { @@ -63,7 +63,7 @@ public function getCreatedDateTime(): ?DateTime { } /** - * Gets the description property value. The description property + * Gets the description property value. The description for the training. * @return string|null */ public function getDescription(): ?string { @@ -75,7 +75,7 @@ public function getDescription(): ?string { } /** - * Gets the displayName property value. The displayName property + * Gets the displayName property value. The display name for the training. * @return string|null */ public function getDisplayName(): ?string { @@ -87,7 +87,7 @@ public function getDisplayName(): ?string { } /** - * Gets the durationInMinutes property value. The durationInMinutes property + * Gets the durationInMinutes property value. Training duration. * @return int|null */ public function getDurationInMinutes(): ?int { @@ -137,7 +137,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the hasEvaluation property value. The hasEvaluation property + * Gets the hasEvaluation property value. Indicates whether the training has any evaluation. * @return bool|null */ public function getHasEvaluation(): ?bool { @@ -149,7 +149,7 @@ public function getHasEvaluation(): ?bool { } /** - * Gets the languageDetails property value. The languageDetails property + * Gets the languageDetails property value. Language specific details on a training. * @return array|null */ public function getLanguageDetails(): ?array { @@ -163,7 +163,7 @@ public function getLanguageDetails(): ?array { } /** - * Gets the lastModifiedBy property value. The lastModifiedBy property + * Gets the lastModifiedBy property value. Identity of the user who last modified the training. * @return EmailIdentity|null */ public function getLastModifiedBy(): ?EmailIdentity { @@ -175,7 +175,7 @@ public function getLastModifiedBy(): ?EmailIdentity { } /** - * Gets the lastModifiedDateTime property value. The lastModifiedDateTime property + * Gets the lastModifiedDateTime property value. Date and time when the training was last modified. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getLastModifiedDateTime(): ?DateTime { @@ -187,7 +187,7 @@ public function getLastModifiedDateTime(): ?DateTime { } /** - * Gets the source property value. The source property + * Gets the source property value. Training content source. Possible values are: unknown, global, tenant, unknownFutureValue. * @return SimulationContentSource|null */ public function getSource(): ?SimulationContentSource { @@ -199,7 +199,7 @@ public function getSource(): ?SimulationContentSource { } /** - * Gets the supportedLocales property value. The supportedLocales property + * Gets the supportedLocales property value. Supported locales for content for the associated training. * @return array|null */ public function getSupportedLocales(): ?array { @@ -213,7 +213,7 @@ public function getSupportedLocales(): ?array { } /** - * Gets the tags property value. The tags property + * Gets the tags property value. Training tags. * @return array|null */ public function getTags(): ?array { @@ -227,7 +227,7 @@ public function getTags(): ?array { } /** - * Gets the type property value. The type property + * Gets the type property value. The type of training. Possible values are: unknown, phishing, unknownFutureValue. * @return TrainingType|null */ public function getType(): ?TrainingType { @@ -261,7 +261,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the availabilityStatus property value. The availabilityStatus property + * Sets the availabilityStatus property value. Training availability status. Possible values are: unknown, notAvailable, available, archive, delete, unknownFutureValue. * @param TrainingAvailabilityStatus|null $value Value to set for the availabilityStatus property. */ public function setAvailabilityStatus(?TrainingAvailabilityStatus $value): void { @@ -269,7 +269,7 @@ public function setAvailabilityStatus(?TrainingAvailabilityStatus $value): void } /** - * Sets the createdBy property value. The createdBy property + * Sets the createdBy property value. Identity of the user who created the training. * @param EmailIdentity|null $value Value to set for the createdBy property. */ public function setCreatedBy(?EmailIdentity $value): void { @@ -277,7 +277,7 @@ public function setCreatedBy(?EmailIdentity $value): void { } /** - * Sets the createdDateTime property value. The createdDateTime property + * Sets the createdDateTime property value. Date and time when the training was created. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the createdDateTime property. */ public function setCreatedDateTime(?DateTime $value): void { @@ -285,7 +285,7 @@ public function setCreatedDateTime(?DateTime $value): void { } /** - * Sets the description property value. The description property + * Sets the description property value. The description for the training. * @param string|null $value Value to set for the description property. */ public function setDescription(?string $value): void { @@ -293,7 +293,7 @@ public function setDescription(?string $value): void { } /** - * Sets the displayName property value. The displayName property + * Sets the displayName property value. The display name for the training. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -301,7 +301,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the durationInMinutes property value. The durationInMinutes property + * Sets the durationInMinutes property value. Training duration. * @param int|null $value Value to set for the durationInMinutes property. */ public function setDurationInMinutes(?int $value): void { @@ -309,7 +309,7 @@ public function setDurationInMinutes(?int $value): void { } /** - * Sets the hasEvaluation property value. The hasEvaluation property + * Sets the hasEvaluation property value. Indicates whether the training has any evaluation. * @param bool|null $value Value to set for the hasEvaluation property. */ public function setHasEvaluation(?bool $value): void { @@ -317,7 +317,7 @@ public function setHasEvaluation(?bool $value): void { } /** - * Sets the languageDetails property value. The languageDetails property + * Sets the languageDetails property value. Language specific details on a training. * @param array|null $value Value to set for the languageDetails property. */ public function setLanguageDetails(?array $value): void { @@ -325,7 +325,7 @@ public function setLanguageDetails(?array $value): void { } /** - * Sets the lastModifiedBy property value. The lastModifiedBy property + * Sets the lastModifiedBy property value. Identity of the user who last modified the training. * @param EmailIdentity|null $value Value to set for the lastModifiedBy property. */ public function setLastModifiedBy(?EmailIdentity $value): void { @@ -333,7 +333,7 @@ public function setLastModifiedBy(?EmailIdentity $value): void { } /** - * Sets the lastModifiedDateTime property value. The lastModifiedDateTime property + * Sets the lastModifiedDateTime property value. Date and time when the training was last modified. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the lastModifiedDateTime property. */ public function setLastModifiedDateTime(?DateTime $value): void { @@ -341,7 +341,7 @@ public function setLastModifiedDateTime(?DateTime $value): void { } /** - * Sets the source property value. The source property + * Sets the source property value. Training content source. Possible values are: unknown, global, tenant, unknownFutureValue. * @param SimulationContentSource|null $value Value to set for the source property. */ public function setSource(?SimulationContentSource $value): void { @@ -349,7 +349,7 @@ public function setSource(?SimulationContentSource $value): void { } /** - * Sets the supportedLocales property value. The supportedLocales property + * Sets the supportedLocales property value. Supported locales for content for the associated training. * @param array|null $value Value to set for the supportedLocales property. */ public function setSupportedLocales(?array $value): void { @@ -357,7 +357,7 @@ public function setSupportedLocales(?array $value): void { } /** - * Sets the tags property value. The tags property + * Sets the tags property value. Training tags. * @param array|null $value Value to set for the tags property. */ public function setTags(?array $value): void { @@ -365,7 +365,7 @@ public function setTags(?array $value): void { } /** - * Sets the type property value. The type property + * Sets the type property value. The type of training. Possible values are: unknown, phishing, unknownFutureValue. * @param TrainingType|null $value Value to set for the type property. */ public function setType(?TrainingType $value): void { diff --git a/src/Generated/Models/TrainingLanguageDetail.php b/src/Generated/Models/TrainingLanguageDetail.php index e804a77b786..a192daccc0a 100644 --- a/src/Generated/Models/TrainingLanguageDetail.php +++ b/src/Generated/Models/TrainingLanguageDetail.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Train } /** - * Gets the content property value. The content property + * Gets the content property value. Language specific content for the training. * @return string|null */ public function getContent(): ?string { @@ -38,7 +38,7 @@ public function getContent(): ?string { } /** - * Gets the createdBy property value. The createdBy property + * Gets the createdBy property value. Identity of the user who created the language details. * @return EmailIdentity|null */ public function getCreatedBy(): ?EmailIdentity { @@ -50,7 +50,7 @@ public function getCreatedBy(): ?EmailIdentity { } /** - * Gets the createdDateTime property value. The createdDateTime property + * Gets the createdDateTime property value. Date and time when the language details were created. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getCreatedDateTime(): ?DateTime { @@ -62,7 +62,7 @@ public function getCreatedDateTime(): ?DateTime { } /** - * Gets the description property value. The description property + * Gets the description property value. Description as defined by the user. * @return string|null */ public function getDescription(): ?string { @@ -74,7 +74,7 @@ public function getDescription(): ?string { } /** - * Gets the displayName property value. The displayName property + * Gets the displayName property value. Display name as defined by the user. * @return string|null */ public function getDisplayName(): ?string { @@ -105,7 +105,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the isDefaultLangauge property value. The isDefaultLangauge property + * Gets the isDefaultLangauge property value. Indicates whether the training has a default language. * @return bool|null */ public function getIsDefaultLangauge(): ?bool { @@ -117,7 +117,7 @@ public function getIsDefaultLangauge(): ?bool { } /** - * Gets the lastModifiedBy property value. The lastModifiedBy property + * Gets the lastModifiedBy property value. Identity of the user who last modified the details. * @return EmailIdentity|null */ public function getLastModifiedBy(): ?EmailIdentity { @@ -129,7 +129,7 @@ public function getLastModifiedBy(): ?EmailIdentity { } /** - * Gets the lastModifiedDateTime property value. The lastModifiedDateTime property + * Gets the lastModifiedDateTime property value. Date and time when the trainingLanguageDetail was last modified. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @return DateTime|null */ public function getLastModifiedDateTime(): ?DateTime { @@ -141,7 +141,7 @@ public function getLastModifiedDateTime(): ?DateTime { } /** - * Gets the locale property value. The locale property + * Gets the locale property value. Content locale for the training detail. * @return string|null */ public function getLocale(): ?string { @@ -170,7 +170,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the content property value. The content property + * Sets the content property value. Language specific content for the training. * @param string|null $value Value to set for the content property. */ public function setContent(?string $value): void { @@ -178,7 +178,7 @@ public function setContent(?string $value): void { } /** - * Sets the createdBy property value. The createdBy property + * Sets the createdBy property value. Identity of the user who created the language details. * @param EmailIdentity|null $value Value to set for the createdBy property. */ public function setCreatedBy(?EmailIdentity $value): void { @@ -186,7 +186,7 @@ public function setCreatedBy(?EmailIdentity $value): void { } /** - * Sets the createdDateTime property value. The createdDateTime property + * Sets the createdDateTime property value. Date and time when the language details were created. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the createdDateTime property. */ public function setCreatedDateTime(?DateTime $value): void { @@ -194,7 +194,7 @@ public function setCreatedDateTime(?DateTime $value): void { } /** - * Sets the description property value. The description property + * Sets the description property value. Description as defined by the user. * @param string|null $value Value to set for the description property. */ public function setDescription(?string $value): void { @@ -202,7 +202,7 @@ public function setDescription(?string $value): void { } /** - * Sets the displayName property value. The displayName property + * Sets the displayName property value. Display name as defined by the user. * @param string|null $value Value to set for the displayName property. */ public function setDisplayName(?string $value): void { @@ -210,7 +210,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the isDefaultLangauge property value. The isDefaultLangauge property + * Sets the isDefaultLangauge property value. Indicates whether the training has a default language. * @param bool|null $value Value to set for the isDefaultLangauge property. */ public function setIsDefaultLangauge(?bool $value): void { @@ -218,7 +218,7 @@ public function setIsDefaultLangauge(?bool $value): void { } /** - * Sets the lastModifiedBy property value. The lastModifiedBy property + * Sets the lastModifiedBy property value. Identity of the user who last modified the details. * @param EmailIdentity|null $value Value to set for the lastModifiedBy property. */ public function setLastModifiedBy(?EmailIdentity $value): void { @@ -226,7 +226,7 @@ public function setLastModifiedBy(?EmailIdentity $value): void { } /** - * Sets the lastModifiedDateTime property value. The lastModifiedDateTime property + * Sets the lastModifiedDateTime property value. Date and time when the trainingLanguageDetail was last modified. The timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. * @param DateTime|null $value Value to set for the lastModifiedDateTime property. */ public function setLastModifiedDateTime(?DateTime $value): void { @@ -234,7 +234,7 @@ public function setLastModifiedDateTime(?DateTime $value): void { } /** - * Sets the locale property value. The locale property + * Sets the locale property value. Content locale for the training detail. * @param string|null $value Value to set for the locale property. */ public function setLocale(?string $value): void { diff --git a/src/Generated/Models/TrainingNotificationSetting.php b/src/Generated/Models/TrainingNotificationSetting.php index 99b65ab866c..b8a99c695b7 100644 --- a/src/Generated/Models/TrainingNotificationSetting.php +++ b/src/Generated/Models/TrainingNotificationSetting.php @@ -38,7 +38,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the trainingAssignment property value. The trainingAssignment property + * Gets the trainingAssignment property value. Training assignment details. * @return BaseEndUserNotification|null */ public function getTrainingAssignment(): ?BaseEndUserNotification { @@ -50,7 +50,7 @@ public function getTrainingAssignment(): ?BaseEndUserNotification { } /** - * Gets the trainingReminder property value. The trainingReminder property + * Gets the trainingReminder property value. Training reminder details. * @return TrainingReminderNotification|null */ public function getTrainingReminder(): ?TrainingReminderNotification { @@ -72,7 +72,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the trainingAssignment property value. The trainingAssignment property + * Sets the trainingAssignment property value. Training assignment details. * @param BaseEndUserNotification|null $value Value to set for the trainingAssignment property. */ public function setTrainingAssignment(?BaseEndUserNotification $value): void { @@ -80,7 +80,7 @@ public function setTrainingAssignment(?BaseEndUserNotification $value): void { } /** - * Sets the trainingReminder property value. The trainingReminder property + * Sets the trainingReminder property value. Training reminder details. * @param TrainingReminderNotification|null $value Value to set for the trainingReminder property. */ public function setTrainingReminder(?TrainingReminderNotification $value): void { diff --git a/src/Generated/Models/TrainingReminderNotification.php b/src/Generated/Models/TrainingReminderNotification.php index 3022d250b93..3d9c48c88e6 100644 --- a/src/Generated/Models/TrainingReminderNotification.php +++ b/src/Generated/Models/TrainingReminderNotification.php @@ -26,7 +26,7 @@ public static function createFromDiscriminatorValue(ParseNode $parseNode): Train } /** - * Gets the deliveryFrequency property value. The deliveryFrequency property + * Gets the deliveryFrequency property value. Configurable frequency for the reminder email introduced during simulation creation. Possible values are: unknown, weekly, biWeekly, unknownFutureValue. * @return NotificationDeliveryFrequency|null */ public function getDeliveryFrequency(): ?NotificationDeliveryFrequency { @@ -58,7 +58,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the deliveryFrequency property value. The deliveryFrequency property + * Sets the deliveryFrequency property value. Configurable frequency for the reminder email introduced during simulation creation. Possible values are: unknown, weekly, biWeekly, unknownFutureValue. * @param NotificationDeliveryFrequency|null $value Value to set for the deliveryFrequency property. */ public function setDeliveryFrequency(?NotificationDeliveryFrequency $value): void { diff --git a/src/Generated/Models/TrainingSetting.php b/src/Generated/Models/TrainingSetting.php index 1c436c552e3..f42dd53cbe4 100644 --- a/src/Generated/Models/TrainingSetting.php +++ b/src/Generated/Models/TrainingSetting.php @@ -91,7 +91,7 @@ public function getOdataType(): ?string { } /** - * Gets the settingType property value. The settingType property + * Gets the settingType property value. Type of setting. Possible values are: microsoftCustom, microsoftManaged, noTraining, custom, unknownFutureValue. * @return TrainingSettingType|null */ public function getSettingType(): ?TrainingSettingType { @@ -137,7 +137,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the settingType property value. The settingType property + * Sets the settingType property value. Type of setting. Possible values are: microsoftCustom, microsoftManaged, noTraining, custom, unknownFutureValue. * @param TrainingSettingType|null $value Value to set for the settingType property. */ public function setSettingType(?TrainingSettingType $value): void { diff --git a/src/Generated/Models/UnifiedRoleAssignmentScheduleInstance.php b/src/Generated/Models/UnifiedRoleAssignmentScheduleInstance.php index aeb3ec18f0e..8720f19b9c0 100644 --- a/src/Generated/Models/UnifiedRoleAssignmentScheduleInstance.php +++ b/src/Generated/Models/UnifiedRoleAssignmentScheduleInstance.php @@ -91,7 +91,7 @@ public function getMemberType(): ?string { } /** - * Gets the roleAssignmentOriginId property value. The identifier of the role assignment in Azure AD. Supports $filter (eq, ne). + * Gets the roleAssignmentOriginId property value. The identifier of the role assignment in Microsoft Entra. Supports $filter (eq, ne). * @return string|null */ public function getRoleAssignmentOriginId(): ?string { @@ -174,7 +174,7 @@ public function setMemberType(?string $value): void { } /** - * Sets the roleAssignmentOriginId property value. The identifier of the role assignment in Azure AD. Supports $filter (eq, ne). + * Sets the roleAssignmentOriginId property value. The identifier of the role assignment in Microsoft Entra. Supports $filter (eq, ne). * @param string|null $value Value to set for the roleAssignmentOriginId property. */ public function setRoleAssignmentOriginId(?string $value): void { diff --git a/src/Generated/Models/UnifiedRoleDefinition.php b/src/Generated/Models/UnifiedRoleDefinition.php index d421e6c379b..53a283d3d37 100644 --- a/src/Generated/Models/UnifiedRoleDefinition.php +++ b/src/Generated/Models/UnifiedRoleDefinition.php @@ -76,7 +76,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the inheritsPermissionsFrom property value. Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Gets the inheritsPermissionsFrom property value. Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. * @return array|null */ public function getInheritsPermissionsFrom(): ?array { @@ -90,7 +90,7 @@ public function getInheritsPermissionsFrom(): ?array { } /** - * Gets the isBuiltIn property value. Flag indicating whether the role definition is part of the default set included in Azure Active Directory (Azure AD) or a custom definition. Read-only. Supports $filter (eq, in). + * Gets the isBuiltIn property value. Flag indicating whether the role definition is part of the default set included in Microsoft Entra or a custom definition. Read-only. Supports $filter (eq, in). * @return bool|null */ public function getIsBuiltIn(): ?bool { @@ -199,7 +199,7 @@ public function setDisplayName(?string $value): void { } /** - * Sets the inheritsPermissionsFrom property value. Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Sets the inheritsPermissionsFrom property value. Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. * @param array|null $value Value to set for the inheritsPermissionsFrom property. */ public function setInheritsPermissionsFrom(?array $value): void { @@ -207,7 +207,7 @@ public function setInheritsPermissionsFrom(?array $value): void { } /** - * Sets the isBuiltIn property value. Flag indicating whether the role definition is part of the default set included in Azure Active Directory (Azure AD) or a custom definition. Read-only. Supports $filter (eq, in). + * Sets the isBuiltIn property value. Flag indicating whether the role definition is part of the default set included in Microsoft Entra or a custom definition. Read-only. Supports $filter (eq, in). * @param bool|null $value Value to set for the isBuiltIn property. */ public function setIsBuiltIn(?bool $value): void { diff --git a/src/Generated/Models/UnifiedRoleManagementPolicyAssignment.php b/src/Generated/Models/UnifiedRoleManagementPolicyAssignment.php index c0adaebcf4a..4d816e2feae 100644 --- a/src/Generated/Models/UnifiedRoleManagementPolicyAssignment.php +++ b/src/Generated/Models/UnifiedRoleManagementPolicyAssignment.php @@ -64,7 +64,7 @@ public function getPolicyId(): ?string { } /** - * Gets the roleDefinitionId property value. For Azure AD roles policy, it's the identifier of the role definition object where the policy applies. For PIM for groups membership and ownership, it's either member or owner. Supports $filter (eq). + * Gets the roleDefinitionId property value. For Microsoft Entra roles policy, it's the identifier of the role definition object where the policy applies. For PIM for groups membership and ownership, it's either member or owner. Supports $filter (eq). * @return string|null */ public function getRoleDefinitionId(): ?string { @@ -129,7 +129,7 @@ public function setPolicyId(?string $value): void { } /** - * Sets the roleDefinitionId property value. For Azure AD roles policy, it's the identifier of the role definition object where the policy applies. For PIM for groups membership and ownership, it's either member or owner. Supports $filter (eq). + * Sets the roleDefinitionId property value. For Microsoft Entra roles policy, it's the identifier of the role definition object where the policy applies. For PIM for groups membership and ownership, it's either member or owner. Supports $filter (eq). * @param string|null $value Value to set for the roleDefinitionId property. */ public function setRoleDefinitionId(?string $value): void { diff --git a/src/Generated/Models/User.php b/src/Generated/Models/User.php index 46d673d7e51..6f41af7d0a3 100644 --- a/src/Generated/Models/User.php +++ b/src/Generated/Models/User.php @@ -328,7 +328,7 @@ public function getCountry(): ?string { } /** - * Gets the createdDateTime property value. The date and time the user was created, in ISO 8601 format and in UTC time. The value cannot be modified and is automatically populated when the entity is created. Nullable. For on-premises users, the value represents when they were first created in Azure AD. Property is null for some users created before June 2018 and on-premises users that were synced to Azure AD before June 2018. Read-only. Returned only on $select. Supports $filter (eq, ne, not , ge, le, in). + * Gets the createdDateTime property value. The date and time the user was created, in ISO 8601 format and in UTC time. The value cannot be modified and is automatically populated when the entity is created. Nullable. For on-premises users, the value represents when they were first created in Microsoft Entra ID. Property is null for some users created before June 2018 and on-premises users that were synced to Microsoft Entra ID before June 2018. Read-only. Returned only on $select. Supports $filter (eq, ne, not , ge, le, in). * @return DateTime|null */ public function getCreatedDateTime(): ?DateTime { @@ -504,7 +504,7 @@ public function getEmployeeId(): ?string { } /** - * Gets the employeeLeaveDateTime property value. The date and time when the user left or will leave the organization. To read this property, the calling app must be assigned the User-LifeCycleInfo.Read.All permission. To write this property, the calling app must be assigned the User.Read.All and User-LifeCycleInfo.ReadWrite.All permissions. To read this property in delegated scenarios, the admin needs one of the following Azure AD roles: Lifecycle Workflows Administrator, Global Reader, or Global Administrator. To write this property in delegated scenarios, the admin needs the Global Administrator role. Supports $filter (eq, ne, not , ge, le, in). For more information, see Configure the employeeLeaveDateTime property for a user. + * Gets the employeeLeaveDateTime property value. The date and time when the user left or will leave the organization. To read this property, the calling app must be assigned the User-LifeCycleInfo.Read.All permission. To write this property, the calling app must be assigned the User.Read.All and User-LifeCycleInfo.ReadWrite.All permissions. To read this property in delegated scenarios, the admin needs one of the following Microsoft Entra roles: Lifecycle Workflows Administrator, Global Reader, or Global Administrator. To write this property in delegated scenarios, the admin needs the Global Administrator role. Supports $filter (eq, ne, not , ge, le, in). For more information, see Configure the employeeLeaveDateTime property for a user. * @return DateTime|null */ public function getEmployeeLeaveDateTime(): ?DateTime { @@ -955,7 +955,7 @@ public function getJoinedTeams(): ?array { } /** - * Gets the lastPasswordChangeDateTime property value. The time when this Azure AD user last changed their password or when their password was created, whichever date the latest action was performed. The date and time information uses ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. Returned only on $select. + * Gets the lastPasswordChangeDateTime property value. The time when this Microsoft Entra user last changed their password or when their password was created, whichever date the latest action was performed. The date and time information uses ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. Returned only on $select. * @return DateTime|null */ public function getLastPasswordChangeDateTime(): ?DateTime { @@ -1201,7 +1201,7 @@ public function getOnlineMeetings(): ?array { } /** - * Gets the onPremisesDistinguishedName property value. Contains the on-premises Active Directory distinguished name or DN. The property is only populated for customers who are synchronizing their on-premises directory to Azure Active Directory via Azure AD Connect. Read-only. Returned only on $select. + * Gets the onPremisesDistinguishedName property value. Contains the on-premises Active Directory distinguished name or DN. The property is only populated for customers who are synchronizing their on-premises directory to Microsoft Entra ID via Microsoft Entra Connect. Read-only. Returned only on $select. * @return string|null */ public function getOnPremisesDistinguishedName(): ?string { @@ -1213,7 +1213,7 @@ public function getOnPremisesDistinguishedName(): ?string { } /** - * Gets the onPremisesDomainName property value. Contains the on-premises domainFQDN, also called dnsDomainName synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Azure Active Directory via Azure AD Connect. Read-only. Returned only on $select. + * Gets the onPremisesDomainName property value. Contains the on-premises domainFQDN, also called dnsDomainName synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Microsoft Entra ID via Microsoft Entra Connect. Read-only. Returned only on $select. * @return string|null */ public function getOnPremisesDomainName(): ?string { @@ -1237,7 +1237,7 @@ public function getOnPremisesExtensionAttributes(): ?OnPremisesExtensionAttribut } /** - * Gets the onPremisesImmutableId property value. This property is used to associate an on-premises Active Directory user account to their Azure AD user object. This property must be specified when creating a new user account in the Graph if you're using a federated domain for the user's userPrincipalName (UPN) property. NOTE: The $ and _ characters can't be used when specifying this property. Returned only on $select. Supports $filter (eq, ne, not, ge, le, in).. + * Gets the onPremisesImmutableId property value. This property is used to associate an on-premises Active Directory user account to their Microsoft Entra user object. This property must be specified when creating a new user account in the Graph if you're using a federated domain for the user's userPrincipalName (UPN) property. NOTE: The $ and _ characters can't be used when specifying this property. Returned only on $select. Supports $filter (eq, ne, not, ge, le, in).. * @return string|null */ public function getOnPremisesImmutableId(): ?string { @@ -1275,7 +1275,7 @@ public function getOnPremisesProvisioningErrors(): ?array { } /** - * Gets the onPremisesSamAccountName property value. Contains the on-premises samAccountName synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Azure Active Directory via Azure AD Connect. Read-only. Returned only on $select. Supports $filter (eq, ne, not, ge, le, in, startsWith). + * Gets the onPremisesSamAccountName property value. Contains the on-premises samAccountName synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Microsoft Entra ID via Microsoft Entra Connect. Read-only. Returned only on $select. Supports $filter (eq, ne, not, ge, le, in, startsWith). * @return string|null */ public function getOnPremisesSamAccountName(): ?string { @@ -1299,7 +1299,7 @@ public function getOnPremisesSecurityIdentifier(): ?string { } /** - * Gets the onPremisesSyncEnabled property value. true if this user object is currently being synced from an on-premises Active Directory (AD); otherwise the user isn't being synced and can be managed in Azure Active Directory (Azure AD). Read-only. Returned only on $select. Supports $filter (eq, ne, not, in, and eq on null values). + * Gets the onPremisesSyncEnabled property value. true if this user object is currently being synced from an on-premises Active Directory (AD); otherwise the user isn't being synced and can be managed in Microsoft Entra ID. Read-only. Returned only on $select. Supports $filter (eq, ne, not, in, and eq on null values). * @return bool|null */ public function getOnPremisesSyncEnabled(): ?bool { @@ -1311,7 +1311,7 @@ public function getOnPremisesSyncEnabled(): ?bool { } /** - * Gets the onPremisesUserPrincipalName property value. Contains the on-premises userPrincipalName synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Azure Active Directory via Azure AD Connect. Read-only. Returned only on $select. Supports $filter (eq, ne, not, ge, le, in, startsWith). + * Gets the onPremisesUserPrincipalName property value. Contains the on-premises userPrincipalName synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Microsoft Entra ID via Microsoft Entra Connect. Read-only. Returned only on $select. Supports $filter (eq, ne, not, ge, le, in, startsWith). * @return string|null */ public function getOnPremisesUserPrincipalName(): ?string { @@ -1377,7 +1377,7 @@ public function getOwnedObjects(): ?array { } /** - * Gets the passwordPolicies property value. Specifies password policies for the user. This value is an enumeration with one possible value being DisableStrongPassword, which allows weaker passwords than the default policy to be specified. DisablePasswordExpiration can also be specified. The two may be specified together; for example: DisablePasswordExpiration, DisableStrongPassword. Returned only on $select. For more information on the default password policies, see Azure AD password policies. Supports $filter (ne, not, and eq on null values). + * Gets the passwordPolicies property value. Specifies password policies for the user. This value is an enumeration with one possible value being DisableStrongPassword, which allows weaker passwords than the default policy to be specified. DisablePasswordExpiration can also be specified. The two may be specified together; for example: DisablePasswordExpiration, DisableStrongPassword. Returned only on $select. For more information on the default password policies, see Microsoft Entra password policies. Supports $filter (ne, not, and eq on null values). * @return string|null */ public function getPasswordPolicies(): ?string { @@ -1661,7 +1661,7 @@ public function getShowInAddressList(): ?bool { } /** - * Gets the signInActivity property value. Get the last signed-in date and request ID of the sign-in for a given user. Read-only.Returned only on $select. Supports $filter (eq, ne, not, ge, le) but not with any other filterable properties. Note: Details for this property require an Azure AD Premium P1/P2 license and the AuditLog.Read.All permission.This property is not returned for a user who has never signed in or last signed in before April 2020. + * Gets the signInActivity property value. Get the last signed-in date and request ID of the sign-in for a given user. Read-only.Returned only on $select. Supports $filter (eq, ne, not, ge, le) but not with any other filterable properties. Note: Details for this property require a Microsoft Entra ID P1 or P2 license and the AuditLog.Read.All permission.This property is not returned for a user who has never signed in or last signed in before April 2020. * @return SignInActivity|null */ public function getSignInActivity(): ?SignInActivity { @@ -1797,7 +1797,7 @@ public function getUserPrincipalName(): ?string { } /** - * Gets the userType property value. A string value that can be used to classify user types in your directory, such as Member and Guest. Returned only on $select. Supports $filter (eq, ne, not, in, and eq on null values). NOTE: For more information about the permissions for member and guest users, see What are the default user permissions in Azure Active Directory? + * Gets the userType property value. A string value that can be used to classify user types in your directory, such as Member and Guest. Returned only on $select. Supports $filter (eq, ne, not, in, and eq on null values). NOTE: For more information about the permissions for member and guest users, see What are the default user permissions in Microsoft Entra ID? * @return string|null */ public function getUserType(): ?string { @@ -2125,7 +2125,7 @@ public function setCountry(?string $value): void { } /** - * Sets the createdDateTime property value. The date and time the user was created, in ISO 8601 format and in UTC time. The value cannot be modified and is automatically populated when the entity is created. Nullable. For on-premises users, the value represents when they were first created in Azure AD. Property is null for some users created before June 2018 and on-premises users that were synced to Azure AD before June 2018. Read-only. Returned only on $select. Supports $filter (eq, ne, not , ge, le, in). + * Sets the createdDateTime property value. The date and time the user was created, in ISO 8601 format and in UTC time. The value cannot be modified and is automatically populated when the entity is created. Nullable. For on-premises users, the value represents when they were first created in Microsoft Entra ID. Property is null for some users created before June 2018 and on-premises users that were synced to Microsoft Entra ID before June 2018. Read-only. Returned only on $select. Supports $filter (eq, ne, not , ge, le, in). * @param DateTime|null $value Value to set for the createdDateTime property. */ public function setCreatedDateTime(?DateTime $value): void { @@ -2237,7 +2237,7 @@ public function setEmployeeId(?string $value): void { } /** - * Sets the employeeLeaveDateTime property value. The date and time when the user left or will leave the organization. To read this property, the calling app must be assigned the User-LifeCycleInfo.Read.All permission. To write this property, the calling app must be assigned the User.Read.All and User-LifeCycleInfo.ReadWrite.All permissions. To read this property in delegated scenarios, the admin needs one of the following Azure AD roles: Lifecycle Workflows Administrator, Global Reader, or Global Administrator. To write this property in delegated scenarios, the admin needs the Global Administrator role. Supports $filter (eq, ne, not , ge, le, in). For more information, see Configure the employeeLeaveDateTime property for a user. + * Sets the employeeLeaveDateTime property value. The date and time when the user left or will leave the organization. To read this property, the calling app must be assigned the User-LifeCycleInfo.Read.All permission. To write this property, the calling app must be assigned the User.Read.All and User-LifeCycleInfo.ReadWrite.All permissions. To read this property in delegated scenarios, the admin needs one of the following Microsoft Entra roles: Lifecycle Workflows Administrator, Global Reader, or Global Administrator. To write this property in delegated scenarios, the admin needs the Global Administrator role. Supports $filter (eq, ne, not , ge, le, in). For more information, see Configure the employeeLeaveDateTime property for a user. * @param DateTime|null $value Value to set for the employeeLeaveDateTime property. */ public function setEmployeeLeaveDateTime(?DateTime $value): void { @@ -2397,7 +2397,7 @@ public function setJoinedTeams(?array $value): void { } /** - * Sets the lastPasswordChangeDateTime property value. The time when this Azure AD user last changed their password or when their password was created, whichever date the latest action was performed. The date and time information uses ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. Returned only on $select. + * Sets the lastPasswordChangeDateTime property value. The time when this Microsoft Entra user last changed their password or when their password was created, whichever date the latest action was performed. The date and time information uses ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. Returned only on $select. * @param DateTime|null $value Value to set for the lastPasswordChangeDateTime property. */ public function setLastPasswordChangeDateTime(?DateTime $value): void { @@ -2549,7 +2549,7 @@ public function setOnlineMeetings(?array $value): void { } /** - * Sets the onPremisesDistinguishedName property value. Contains the on-premises Active Directory distinguished name or DN. The property is only populated for customers who are synchronizing their on-premises directory to Azure Active Directory via Azure AD Connect. Read-only. Returned only on $select. + * Sets the onPremisesDistinguishedName property value. Contains the on-premises Active Directory distinguished name or DN. The property is only populated for customers who are synchronizing their on-premises directory to Microsoft Entra ID via Microsoft Entra Connect. Read-only. Returned only on $select. * @param string|null $value Value to set for the onPremisesDistinguishedName property. */ public function setOnPremisesDistinguishedName(?string $value): void { @@ -2557,7 +2557,7 @@ public function setOnPremisesDistinguishedName(?string $value): void { } /** - * Sets the onPremisesDomainName property value. Contains the on-premises domainFQDN, also called dnsDomainName synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Azure Active Directory via Azure AD Connect. Read-only. Returned only on $select. + * Sets the onPremisesDomainName property value. Contains the on-premises domainFQDN, also called dnsDomainName synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Microsoft Entra ID via Microsoft Entra Connect. Read-only. Returned only on $select. * @param string|null $value Value to set for the onPremisesDomainName property. */ public function setOnPremisesDomainName(?string $value): void { @@ -2573,7 +2573,7 @@ public function setOnPremisesExtensionAttributes(?OnPremisesExtensionAttributes } /** - * Sets the onPremisesImmutableId property value. This property is used to associate an on-premises Active Directory user account to their Azure AD user object. This property must be specified when creating a new user account in the Graph if you're using a federated domain for the user's userPrincipalName (UPN) property. NOTE: The $ and _ characters can't be used when specifying this property. Returned only on $select. Supports $filter (eq, ne, not, ge, le, in).. + * Sets the onPremisesImmutableId property value. This property is used to associate an on-premises Active Directory user account to their Microsoft Entra user object. This property must be specified when creating a new user account in the Graph if you're using a federated domain for the user's userPrincipalName (UPN) property. NOTE: The $ and _ characters can't be used when specifying this property. Returned only on $select. Supports $filter (eq, ne, not, ge, le, in).. * @param string|null $value Value to set for the onPremisesImmutableId property. */ public function setOnPremisesImmutableId(?string $value): void { @@ -2597,7 +2597,7 @@ public function setOnPremisesProvisioningErrors(?array $value): void { } /** - * Sets the onPremisesSamAccountName property value. Contains the on-premises samAccountName synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Azure Active Directory via Azure AD Connect. Read-only. Returned only on $select. Supports $filter (eq, ne, not, ge, le, in, startsWith). + * Sets the onPremisesSamAccountName property value. Contains the on-premises samAccountName synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Microsoft Entra ID via Microsoft Entra Connect. Read-only. Returned only on $select. Supports $filter (eq, ne, not, ge, le, in, startsWith). * @param string|null $value Value to set for the onPremisesSamAccountName property. */ public function setOnPremisesSamAccountName(?string $value): void { @@ -2613,7 +2613,7 @@ public function setOnPremisesSecurityIdentifier(?string $value): void { } /** - * Sets the onPremisesSyncEnabled property value. true if this user object is currently being synced from an on-premises Active Directory (AD); otherwise the user isn't being synced and can be managed in Azure Active Directory (Azure AD). Read-only. Returned only on $select. Supports $filter (eq, ne, not, in, and eq on null values). + * Sets the onPremisesSyncEnabled property value. true if this user object is currently being synced from an on-premises Active Directory (AD); otherwise the user isn't being synced and can be managed in Microsoft Entra ID. Read-only. Returned only on $select. Supports $filter (eq, ne, not, in, and eq on null values). * @param bool|null $value Value to set for the onPremisesSyncEnabled property. */ public function setOnPremisesSyncEnabled(?bool $value): void { @@ -2621,7 +2621,7 @@ public function setOnPremisesSyncEnabled(?bool $value): void { } /** - * Sets the onPremisesUserPrincipalName property value. Contains the on-premises userPrincipalName synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Azure Active Directory via Azure AD Connect. Read-only. Returned only on $select. Supports $filter (eq, ne, not, ge, le, in, startsWith). + * Sets the onPremisesUserPrincipalName property value. Contains the on-premises userPrincipalName synchronized from the on-premises directory. The property is only populated for customers who are synchronizing their on-premises directory to Microsoft Entra ID via Microsoft Entra Connect. Read-only. Returned only on $select. Supports $filter (eq, ne, not, ge, le, in, startsWith). * @param string|null $value Value to set for the onPremisesUserPrincipalName property. */ public function setOnPremisesUserPrincipalName(?string $value): void { @@ -2661,7 +2661,7 @@ public function setOwnedObjects(?array $value): void { } /** - * Sets the passwordPolicies property value. Specifies password policies for the user. This value is an enumeration with one possible value being DisableStrongPassword, which allows weaker passwords than the default policy to be specified. DisablePasswordExpiration can also be specified. The two may be specified together; for example: DisablePasswordExpiration, DisableStrongPassword. Returned only on $select. For more information on the default password policies, see Azure AD password policies. Supports $filter (ne, not, and eq on null values). + * Sets the passwordPolicies property value. Specifies password policies for the user. This value is an enumeration with one possible value being DisableStrongPassword, which allows weaker passwords than the default policy to be specified. DisablePasswordExpiration can also be specified. The two may be specified together; for example: DisablePasswordExpiration, DisableStrongPassword. Returned only on $select. For more information on the default password policies, see Microsoft Entra password policies. Supports $filter (ne, not, and eq on null values). * @param string|null $value Value to set for the passwordPolicies property. */ public function setPasswordPolicies(?string $value): void { @@ -2837,7 +2837,7 @@ public function setShowInAddressList(?bool $value): void { } /** - * Sets the signInActivity property value. Get the last signed-in date and request ID of the sign-in for a given user. Read-only.Returned only on $select. Supports $filter (eq, ne, not, ge, le) but not with any other filterable properties. Note: Details for this property require an Azure AD Premium P1/P2 license and the AuditLog.Read.All permission.This property is not returned for a user who has never signed in or last signed in before April 2020. + * Sets the signInActivity property value. Get the last signed-in date and request ID of the sign-in for a given user. Read-only.Returned only on $select. Supports $filter (eq, ne, not, ge, le) but not with any other filterable properties. Note: Details for this property require a Microsoft Entra ID P1 or P2 license and the AuditLog.Read.All permission.This property is not returned for a user who has never signed in or last signed in before April 2020. * @param SignInActivity|null $value Value to set for the signInActivity property. */ public function setSignInActivity(?SignInActivity $value): void { @@ -2925,7 +2925,7 @@ public function setUserPrincipalName(?string $value): void { } /** - * Sets the userType property value. A string value that can be used to classify user types in your directory, such as Member and Guest. Returned only on $select. Supports $filter (eq, ne, not, in, and eq on null values). NOTE: For more information about the permissions for member and guest users, see What are the default user permissions in Azure Active Directory? + * Sets the userType property value. A string value that can be used to classify user types in your directory, such as Member and Guest. Returned only on $select. Supports $filter (eq, ne, not, in, and eq on null values). NOTE: For more information about the permissions for member and guest users, see What are the default user permissions in Microsoft Entra ID? * @param string|null $value Value to set for the userType property. */ public function setUserType(?string $value): void { diff --git a/src/Generated/Models/UserLastSignInRecommendationInsightSetting.php b/src/Generated/Models/UserLastSignInRecommendationInsightSetting.php index 7323a12c735..0174fce7bb9 100644 --- a/src/Generated/Models/UserLastSignInRecommendationInsightSetting.php +++ b/src/Generated/Models/UserLastSignInRecommendationInsightSetting.php @@ -39,7 +39,7 @@ public function getFieldDeserializers(): array { } /** - * Gets the recommendationLookBackDuration property value. Optional. Indicates the time period of inactivity (with respect to the start date of the review instance) that recommendations will be configured from. The recommendation will be to deny if the user is inactive during the look-back duration. For reviews of groups and Azure AD roles, any duration is accepted. For reviews of applications, 30 days is the maximum duration. If not specified, the duration is 30 days. + * Gets the recommendationLookBackDuration property value. Optional. Indicates the time period of inactivity (with respect to the start date of the review instance) that recommendations will be configured from. The recommendation will be to deny if the user is inactive during the look-back duration. For reviews of groups and Microsoft Entra roles, any duration is accepted. For reviews of applications, 30 days is the maximum duration. If not specified, the duration is 30 days. * @return DateInterval|null */ public function getRecommendationLookBackDuration(): ?DateInterval { @@ -73,7 +73,7 @@ public function serialize(SerializationWriter $writer): void { } /** - * Sets the recommendationLookBackDuration property value. Optional. Indicates the time period of inactivity (with respect to the start date of the review instance) that recommendations will be configured from. The recommendation will be to deny if the user is inactive during the look-back duration. For reviews of groups and Azure AD roles, any duration is accepted. For reviews of applications, 30 days is the maximum duration. If not specified, the duration is 30 days. + * Sets the recommendationLookBackDuration property value. Optional. Indicates the time period of inactivity (with respect to the start date of the review instance) that recommendations will be configured from. The recommendation will be to deny if the user is inactive during the look-back duration. For reviews of groups and Microsoft Entra roles, any duration is accepted. For reviews of applications, 30 days is the maximum duration. If not specified, the duration is 30 days. * @param DateInterval|null $value Value to set for the recommendationLookBackDuration property. */ public function setRecommendationLookBackDuration(?DateInterval $value): void { diff --git a/src/Generated/Models/X509CertificateAuthenticationMethodConfiguration.php b/src/Generated/Models/X509CertificateAuthenticationMethodConfiguration.php index b68b95af5cd..cabebae4683 100644 --- a/src/Generated/Models/X509CertificateAuthenticationMethodConfiguration.php +++ b/src/Generated/Models/X509CertificateAuthenticationMethodConfiguration.php @@ -39,7 +39,7 @@ public function getAuthenticationModeConfiguration(): ?X509CertificateAuthentica } /** - * Gets the certificateUserBindings property value. Defines fields in the X.509 certificate that map to attributes of the Azure AD user object in order to bind the certificate to the user. The priority of the object determines the order in which the binding is carried out. The first binding that matches will be used and the rest ignored. + * Gets the certificateUserBindings property value. Defines fields in the X.509 certificate that map to attributes of the Microsoft Entra user object in order to bind the certificate to the user. The priority of the object determines the order in which the binding is carried out. The first binding that matches will be used and the rest ignored. * @return array|null */ public function getCertificateUserBindings(): ?array { @@ -99,7 +99,7 @@ public function setAuthenticationModeConfiguration(?X509CertificateAuthenticatio } /** - * Sets the certificateUserBindings property value. Defines fields in the X.509 certificate that map to attributes of the Azure AD user object in order to bind the certificate to the user. The priority of the object determines the order in which the binding is carried out. The first binding that matches will be used and the rest ignored. + * Sets the certificateUserBindings property value. Defines fields in the X.509 certificate that map to attributes of the Microsoft Entra user object in order to bind the certificate to the user. The priority of the object determines the order in which the binding is carried out. The first binding that matches will be used and the rest ignored. * @param array|null $value Value to set for the certificateUserBindings property. */ public function setCertificateUserBindings(?array $value): void { diff --git a/src/Generated/Models/X509CertificateUserBinding.php b/src/Generated/Models/X509CertificateUserBinding.php index d61731246a4..312be088004 100644 --- a/src/Generated/Models/X509CertificateUserBinding.php +++ b/src/Generated/Models/X509CertificateUserBinding.php @@ -82,7 +82,7 @@ public function getOdataType(): ?string { } /** - * Gets the priority property value. The priority of the binding. Azure AD uses the binding with the highest priority. This value must be a non-negative integer and unique in the collection of objects in the certificateUserBindings property of an x509CertificateAuthenticationMethodConfiguration object. Required + * Gets the priority property value. The priority of the binding. Microsoft Entra ID uses the binding with the highest priority. This value must be a non-negative integer and unique in the collection of objects in the certificateUserBindings property of an x509CertificateAuthenticationMethodConfiguration object. Required * @return int|null */ public function getPriority(): ?int { @@ -94,7 +94,7 @@ public function getPriority(): ?int { } /** - * Gets the userProperty property value. Defines the Azure AD user property of the user object to use for the binding. The possible values are: userPrincipalName, onPremisesUserPrincipalName, certificateUserIds. Required. + * Gets the userProperty property value. Defines the Microsoft Entra user property of the user object to use for the binding. The possible values are: userPrincipalName, onPremisesUserPrincipalName, certificateUserIds. Required. * @return string|null */ public function getUserProperty(): ?string { @@ -154,7 +154,7 @@ public function setOdataType(?string $value): void { } /** - * Sets the priority property value. The priority of the binding. Azure AD uses the binding with the highest priority. This value must be a non-negative integer and unique in the collection of objects in the certificateUserBindings property of an x509CertificateAuthenticationMethodConfiguration object. Required + * Sets the priority property value. The priority of the binding. Microsoft Entra ID uses the binding with the highest priority. This value must be a non-negative integer and unique in the collection of objects in the certificateUserBindings property of an x509CertificateAuthenticationMethodConfiguration object. Required * @param int|null $value Value to set for the priority property. */ public function setPriority(?int $value): void { @@ -162,7 +162,7 @@ public function setPriority(?int $value): void { } /** - * Sets the userProperty property value. Defines the Azure AD user property of the user object to use for the binding. The possible values are: userPrincipalName, onPremisesUserPrincipalName, certificateUserIds. Required. + * Sets the userProperty property value. Defines the Microsoft Entra user property of the user object to use for the binding. The possible values are: userPrincipalName, onPremisesUserPrincipalName, certificateUserIds. Required. * @param string|null $value Value to set for the userProperty property. */ public function setUserProperty(?string $value): void { diff --git a/src/Generated/Oauth2PermissionGrants/Count/CountRequestBuilder.php b/src/Generated/Oauth2PermissionGrants/Count/CountRequestBuilder.php index ea387a440a5..bd1ec8c3f1b 100644 --- a/src/Generated/Oauth2PermissionGrants/Count/CountRequestBuilder.php +++ b/src/Generated/Oauth2PermissionGrants/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Oauth2PermissionGrants/Delta/DeltaRequestBuilder.php b/src/Generated/Oauth2PermissionGrants/Delta/DeltaRequestBuilder.php index 32f5c3d4cf3..0302f79b26f 100644 --- a/src/Generated/Oauth2PermissionGrants/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Oauth2PermissionGrants/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Oauth2PermissionGrants/Item/OAuth2PermissionGrantItemRequestBuilder.php b/src/Generated/Oauth2PermissionGrants/Item/OAuth2PermissionGrantItemRequestBuilder.php index 9a2e03cf6e7..073462e47bf 100644 --- a/src/Generated/Oauth2PermissionGrants/Item/OAuth2PermissionGrantItemRequestBuilder.php +++ b/src/Generated/Oauth2PermissionGrants/Item/OAuth2PermissionGrantItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\OAuth2PermissionGrant; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a delegated permission grant, represented by an oAuth2PermissionGrant object. When a delegated permission grant is deleted, the access it granted is revoked. Existing access tokens will continue to be valid for their lifetime, but new access tokens will not be granted for the delegated permissions identified in the deleted oAuth2PermissionGrant. This API is available in the following national cloud deployments. * @param OAuth2PermissionGrantItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/oauth2permissiongrant-delete?view=graph-rest-1.0 Find more info here */ public function delete(?OAuth2PermissionGrantItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of a single delegated permission grant represented by an oAuth2PermissionGrant object. An oAuth2PermissionGrant represents delegated permissions which have been granted for a client application to access an API on behalf of a signed-in user. This API is available in the following national cloud deployments. * @param OAuth2PermissionGrantItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/oauth2permissiongrant-get?view=graph-rest-1.0 Find more info here */ public function get(?OAuth2PermissionGrantItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of oAuth2PermissionGrant object, representing a delegated permission grant. An oAuth2PermissionGrant can be updated to change which delegated permissions are granted, by adding or removing items from the list in scopes. This API is available in the following national cloud deployments. * @param OAuth2PermissionGrant $body The request body * @param OAuth2PermissionGrantItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/oauth2permissiongrant-update?view=graph-rest-1.0 Find more info here */ public function patch(OAuth2PermissionGrant $body, ?OAuth2PermissionGrantItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?OAuth2PermissionGrantItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?OAuth2PermissionGrantItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?OAuth2PermissionGrantItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(OAuth2PermissionGrant $body, ?OAuth2Pe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Oauth2PermissionGrants/Oauth2PermissionGrantsRequestBuilder.php b/src/Generated/Oauth2PermissionGrants/Oauth2PermissionGrantsRequestBuilder.php index 027a05d8801..bb5030a757c 100644 --- a/src/Generated/Oauth2PermissionGrants/Oauth2PermissionGrantsRequestBuilder.php +++ b/src/Generated/Oauth2PermissionGrants/Oauth2PermissionGrantsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\OAuth2PermissionGrant; use Microsoft\Graph\Generated\Models\OAuth2PermissionGrantCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of oAuth2PermissionGrant objects, representing delegated permissions which have been granted for client applications to access APIs on behalf of signed-in users. This API is available in the following national cloud deployments. * @param Oauth2PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/oauth2permissiongrant-list?view=graph-rest-1.0 Find more info here */ public function get(?Oauth2PermissionGrantsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a delegated permission grant represented by an oAuth2PermissionGrant object. A delegated permission grant authorizes a client service principal (representing a client application) to access a resource service principal (representing an API), on behalf of a signed-in user, for the level of access limited by the delegated permissions which were granted. This API is available in the following national cloud deployments. * @param OAuth2PermissionGrant $body The request body * @param Oauth2PermissionGrantsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/oauth2permissiongrant-post?view=graph-rest-1.0 Find more info here */ public function post(OAuth2PermissionGrant $body, ?Oauth2PermissionGrantsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?Oauth2PermissionGrantsRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?Oauth2PermissionGrantsRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(OAuth2PermissionGrant $body, ?Oauth2Per $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/Count/CountRequestBuilder.php b/src/Generated/Organization/Count/CountRequestBuilder.php index cc070bfdecb..cc2a838ec50 100644 --- a/src/Generated/Organization/Count/CountRequestBuilder.php +++ b/src/Generated/Organization/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Organization/Delta/DeltaRequestBuilder.php b/src/Generated/Organization/Delta/DeltaRequestBuilder.php index 874e35339c0..aeb6450bd18 100644 --- a/src/Generated/Organization/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Organization/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Organization/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/Organization/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index 12b1b9b2e88..8cbd4c2127b 100644 --- a/src/Generated/Organization/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/Organization/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/Organization/GetByIds/GetByIdsRequestBuilder.php index 10d3d97d9d6..9a0e2741c8c 100644 --- a/src/Generated/Organization/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/Organization/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/BackgroundImage/BackgroundImageRequestBuilder.php b/src/Generated/Organization/Item/Branding/BackgroundImage/BackgroundImageRequestBuilder.php index c9a9d9d2d0a..e08a5b6279c 100644 --- a/src/Generated/Organization/Item/Branding/BackgroundImage/BackgroundImageRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/BackgroundImage/BackgroundImageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Image that appears as the background of the sign-in page. The allowed types are PNG or JPEG not smaller than 300 KB and not larger than 1920 × 1080 pixels. A smaller image will reduce bandwidth requirements and make the page load faster. * @param BackgroundImageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-get?view=graph-rest-1.0 Find more info here */ public function get(?BackgroundImageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Image that appears as the background of the sign-in page. The allowed types are PNG or JPEG not smaller than 300 KB and not larger than 1920 × 1080 pixels. A smaller image will reduce bandwidth requirements and make the page load faster. * @param StreamInterface $body Binary request body + * @param string $contentType * @param BackgroundImageRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?BackgroundImageRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?BackgroundImageRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,16 +81,18 @@ public function toGetRequestInformation(?BackgroundImageRequestBuilderGetRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** * Image that appears as the background of the sign-in page. The allowed types are PNG or JPEG not smaller than 300 KB and not larger than 1920 × 1080 pixels. A smaller image will reduce bandwidth requirements and make the page load faster. * @param StreamInterface $body Binary request body + * @param string $contentType * @param BackgroundImageRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?BackgroundImageRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?BackgroundImageRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?BackgroundImageR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/BannerLogo/BannerLogoRequestBuilder.php b/src/Generated/Organization/Item/Branding/BannerLogo/BannerLogoRequestBuilder.php index 91de9fcbfe8..fcd042b716e 100644 --- a/src/Generated/Organization/Item/Branding/BannerLogo/BannerLogoRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/BannerLogo/BannerLogoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A banner version of your company logo that appears on the sign-in page. The allowed types are PNG or JPEG not larger than 36 × 245 pixels. We recommend using a transparent image with no padding around the logo. * @param BannerLogoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-get?view=graph-rest-1.0 Find more info here */ public function get(?BannerLogoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * A banner version of your company logo that appears on the sign-in page. The allowed types are PNG or JPEG not larger than 36 × 245 pixels. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param BannerLogoRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?BannerLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?BannerLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,16 +81,18 @@ public function toGetRequestInformation(?BannerLogoRequestBuilderGetRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** * A banner version of your company logo that appears on the sign-in page. The allowed types are PNG or JPEG not larger than 36 × 245 pixels. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param BannerLogoRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?BannerLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?BannerLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?BannerLogoReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/BrandingRequestBuilder.php b/src/Generated/Organization/Item/Branding/BrandingRequestBuilder.php index 1b6db01eb81..4eaf20cf497 100644 --- a/src/Generated/Organization/Item/Branding/BrandingRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/BrandingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrganizationalBranding; use Microsoft\Graph\Generated\Organization\Item\Branding\BackgroundImage\BackgroundImageRequestBuilder; @@ -98,59 +97,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the default organizational branding object. To delete the organizationalBranding object, all images (Stream types) must first be removed from the object. This API is available in the following national cloud deployments. * @param BrandingRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-delete?view=graph-rest-1.0 Find more info here */ public function delete(?BrandingRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the default organizational branding object, if the Accept-Language header is set to 0 or default. If no default organizational branding object exists, this method returns a 404 Not Found error. If the Accept-Language header is set to an existing locale identified by the value of its id, this method retrieves the branding for the specified locale. This method retrieves only non-Stream properties, for example, usernameHintText and signInPageText. To retrieve Stream types of the default branding, for example, bannerLogo and backgroundImage, use the GET organizationalBrandingLocalization method. This API is available in the following national cloud deployments. * @param BrandingRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-get?view=graph-rest-1.0 Find more info here */ public function get(?BrandingRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrganizationalBranding::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrganizationalBranding::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the default branding object specified by the organizationalBranding resource. This API is available in the following national cloud deployments. * @param OrganizationalBranding $body The request body * @param BrandingRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-update?view=graph-rest-1.0 Find more info here */ public function patch(OrganizationalBranding $body, ?BrandingRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrganizationalBranding::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrganizationalBranding::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -167,6 +157,7 @@ public function toDeleteRequestInformation(?BrandingRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -180,7 +171,6 @@ public function toGetRequestInformation(?BrandingRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -188,6 +178,7 @@ public function toGetRequestInformation(?BrandingRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -202,11 +193,11 @@ public function toPatchRequestInformation(OrganizationalBranding $body, ?Brandin $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/CustomCSS/CustomCSSRequestBuilder.php b/src/Generated/Organization/Item/Branding/CustomCSS/CustomCSSRequestBuilder.php index 2a50bcf386d..873019df508 100644 --- a/src/Generated/Organization/Item/Branding/CustomCSS/CustomCSSRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/CustomCSS/CustomCSSRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * CSS styling that appears on the sign-in page. The allowed format is .css format only and not larger than 25 KB. * @param CustomCSSRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-get?view=graph-rest-1.0 Find more info here */ public function get(?CustomCSSRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * CSS styling that appears on the sign-in page. The allowed format is .css format only and not larger than 25 KB. * @param StreamInterface $body Binary request body + * @param string $contentType * @param CustomCSSRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?CustomCSSRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?CustomCSSRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,16 +81,18 @@ public function toGetRequestInformation(?CustomCSSRequestBuilderGetRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** * CSS styling that appears on the sign-in page. The allowed format is .css format only and not larger than 25 KB. * @param StreamInterface $body Binary request body + * @param string $contentType * @param CustomCSSRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?CustomCSSRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?CustomCSSRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?CustomCSSRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/Favicon/FaviconRequestBuilder.php b/src/Generated/Organization/Item/Branding/Favicon/FaviconRequestBuilder.php index 784fd75c01b..75638bb49c2 100644 --- a/src/Generated/Organization/Item/Branding/Favicon/FaviconRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/Favicon/FaviconRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -32,45 +31,44 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * A custom icon (favicon) to replace a default Microsoft product favicon on an Azure AD tenant. + * A custom icon (favicon) to replace a default Microsoft product favicon on a Microsoft Entra tenant. * @param FaviconRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-get?view=graph-rest-1.0 Find more info here */ public function get(?FaviconRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** - * A custom icon (favicon) to replace a default Microsoft product favicon on an Azure AD tenant. + * A custom icon (favicon) to replace a default Microsoft product favicon on a Microsoft Entra tenant. * @param StreamInterface $body Binary request body + * @param string $contentType * @param FaviconRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?FaviconRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?FaviconRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** - * A custom icon (favicon) to replace a default Microsoft product favicon on an Azure AD tenant. + * A custom icon (favicon) to replace a default Microsoft product favicon on a Microsoft Entra tenant. * @param FaviconRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -83,16 +81,18 @@ public function toGetRequestInformation(?FaviconRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** - * A custom icon (favicon) to replace a default Microsoft product favicon on an Azure AD tenant. + * A custom icon (favicon) to replace a default Microsoft product favicon on a Microsoft Entra tenant. * @param StreamInterface $body Binary request body + * @param string $contentType * @param FaviconRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?FaviconRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?FaviconRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?FaviconRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/HeaderLogo/HeaderLogoRequestBuilder.php b/src/Generated/Organization/Item/Branding/HeaderLogo/HeaderLogoRequestBuilder.php index 11f97dd28e6..cfda2745b8a 100644 --- a/src/Generated/Organization/Item/Branding/HeaderLogo/HeaderLogoRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/HeaderLogo/HeaderLogoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A company logo that appears in the header of the sign-in page. The allowed types are PNG or JPEG not larger than 36 × 245 pixels. We recommend using a transparent image with no padding around the logo. * @param HeaderLogoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-get?view=graph-rest-1.0 Find more info here */ public function get(?HeaderLogoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * A company logo that appears in the header of the sign-in page. The allowed types are PNG or JPEG not larger than 36 × 245 pixels. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param HeaderLogoRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?HeaderLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?HeaderLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,16 +81,18 @@ public function toGetRequestInformation(?HeaderLogoRequestBuilderGetRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** * A company logo that appears in the header of the sign-in page. The allowed types are PNG or JPEG not larger than 36 × 245 pixels. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param HeaderLogoRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?HeaderLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?HeaderLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?HeaderLogoReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/Localizations/Count/CountRequestBuilder.php b/src/Generated/Organization/Item/Branding/Localizations/Count/CountRequestBuilder.php index bf6c8ba0079..d9eb10e03c9 100644 --- a/src/Generated/Organization/Item/Branding/Localizations/Count/CountRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/Localizations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/Localizations/Item/BackgroundImage/BackgroundImageRequestBuilder.php b/src/Generated/Organization/Item/Branding/Localizations/Item/BackgroundImage/BackgroundImageRequestBuilder.php index b668848ed67..6d690056fc2 100644 --- a/src/Generated/Organization/Item/Branding/Localizations/Item/BackgroundImage/BackgroundImageRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/Localizations/Item/BackgroundImage/BackgroundImageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Image that appears as the background of the sign-in page. The allowed types are PNG or JPEG not smaller than 300 KB and not larger than 1920 × 1080 pixels. A smaller image will reduce bandwidth requirements and make the page load faster. * @param BackgroundImageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-list-localizations?view=graph-rest-1.0 Find more info here */ public function get(?BackgroundImageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Image that appears as the background of the sign-in page. The allowed types are PNG or JPEG not smaller than 300 KB and not larger than 1920 × 1080 pixels. A smaller image will reduce bandwidth requirements and make the page load faster. * @param StreamInterface $body Binary request body + * @param string $contentType * @param BackgroundImageRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?BackgroundImageRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?BackgroundImageRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,16 +81,18 @@ public function toGetRequestInformation(?BackgroundImageRequestBuilderGetRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** * Image that appears as the background of the sign-in page. The allowed types are PNG or JPEG not smaller than 300 KB and not larger than 1920 × 1080 pixels. A smaller image will reduce bandwidth requirements and make the page load faster. * @param StreamInterface $body Binary request body + * @param string $contentType * @param BackgroundImageRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?BackgroundImageRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?BackgroundImageRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?BackgroundImageR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/Localizations/Item/BannerLogo/BannerLogoRequestBuilder.php b/src/Generated/Organization/Item/Branding/Localizations/Item/BannerLogo/BannerLogoRequestBuilder.php index 652c5e13897..37ae00625ff 100644 --- a/src/Generated/Organization/Item/Branding/Localizations/Item/BannerLogo/BannerLogoRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/Localizations/Item/BannerLogo/BannerLogoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A banner version of your company logo that appears on the sign-in page. The allowed types are PNG or JPEG not larger than 36 × 245 pixels. We recommend using a transparent image with no padding around the logo. * @param BannerLogoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-list-localizations?view=graph-rest-1.0 Find more info here */ public function get(?BannerLogoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * A banner version of your company logo that appears on the sign-in page. The allowed types are PNG or JPEG not larger than 36 × 245 pixels. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param BannerLogoRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?BannerLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?BannerLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,16 +81,18 @@ public function toGetRequestInformation(?BannerLogoRequestBuilderGetRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** * A banner version of your company logo that appears on the sign-in page. The allowed types are PNG or JPEG not larger than 36 × 245 pixels. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param BannerLogoRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?BannerLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?BannerLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?BannerLogoReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/Localizations/Item/CustomCSS/CustomCSSRequestBuilder.php b/src/Generated/Organization/Item/Branding/Localizations/Item/CustomCSS/CustomCSSRequestBuilder.php index 7369af9f031..5fd5eb9859c 100644 --- a/src/Generated/Organization/Item/Branding/Localizations/Item/CustomCSS/CustomCSSRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/Localizations/Item/CustomCSS/CustomCSSRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * CSS styling that appears on the sign-in page. The allowed format is .css format only and not larger than 25 KB. * @param CustomCSSRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-list-localizations?view=graph-rest-1.0 Find more info here */ public function get(?CustomCSSRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * CSS styling that appears on the sign-in page. The allowed format is .css format only and not larger than 25 KB. * @param StreamInterface $body Binary request body + * @param string $contentType * @param CustomCSSRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?CustomCSSRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?CustomCSSRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,16 +81,18 @@ public function toGetRequestInformation(?CustomCSSRequestBuilderGetRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** * CSS styling that appears on the sign-in page. The allowed format is .css format only and not larger than 25 KB. * @param StreamInterface $body Binary request body + * @param string $contentType * @param CustomCSSRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?CustomCSSRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?CustomCSSRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?CustomCSSRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/Localizations/Item/Favicon/FaviconRequestBuilder.php b/src/Generated/Organization/Item/Branding/Localizations/Item/Favicon/FaviconRequestBuilder.php index 53b478f4532..df40b5b12a7 100644 --- a/src/Generated/Organization/Item/Branding/Localizations/Item/Favicon/FaviconRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/Localizations/Item/Favicon/FaviconRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -32,45 +31,44 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * A custom icon (favicon) to replace a default Microsoft product favicon on an Azure AD tenant. + * A custom icon (favicon) to replace a default Microsoft product favicon on a Microsoft Entra tenant. * @param FaviconRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-list-localizations?view=graph-rest-1.0 Find more info here */ public function get(?FaviconRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** - * A custom icon (favicon) to replace a default Microsoft product favicon on an Azure AD tenant. + * A custom icon (favicon) to replace a default Microsoft product favicon on a Microsoft Entra tenant. * @param StreamInterface $body Binary request body + * @param string $contentType * @param FaviconRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?FaviconRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?FaviconRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** - * A custom icon (favicon) to replace a default Microsoft product favicon on an Azure AD tenant. + * A custom icon (favicon) to replace a default Microsoft product favicon on a Microsoft Entra tenant. * @param FaviconRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -83,16 +81,18 @@ public function toGetRequestInformation(?FaviconRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** - * A custom icon (favicon) to replace a default Microsoft product favicon on an Azure AD tenant. + * A custom icon (favicon) to replace a default Microsoft product favicon on a Microsoft Entra tenant. * @param StreamInterface $body Binary request body + * @param string $contentType * @param FaviconRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?FaviconRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?FaviconRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?FaviconRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/Localizations/Item/HeaderLogo/HeaderLogoRequestBuilder.php b/src/Generated/Organization/Item/Branding/Localizations/Item/HeaderLogo/HeaderLogoRequestBuilder.php index 625417d8439..b6d07a5cf2c 100644 --- a/src/Generated/Organization/Item/Branding/Localizations/Item/HeaderLogo/HeaderLogoRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/Localizations/Item/HeaderLogo/HeaderLogoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A company logo that appears in the header of the sign-in page. The allowed types are PNG or JPEG not larger than 36 × 245 pixels. We recommend using a transparent image with no padding around the logo. * @param HeaderLogoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-list-localizations?view=graph-rest-1.0 Find more info here */ public function get(?HeaderLogoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * A company logo that appears in the header of the sign-in page. The allowed types are PNG or JPEG not larger than 36 × 245 pixels. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param HeaderLogoRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?HeaderLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?HeaderLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,16 +81,18 @@ public function toGetRequestInformation(?HeaderLogoRequestBuilderGetRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** * A company logo that appears in the header of the sign-in page. The allowed types are PNG or JPEG not larger than 36 × 245 pixels. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param HeaderLogoRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?HeaderLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?HeaderLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?HeaderLogoReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/Localizations/Item/OrganizationalBrandingLocalizationItemRequestBuilder.php b/src/Generated/Organization/Item/Branding/Localizations/Item/OrganizationalBrandingLocalizationItemRequestBuilder.php index a9a31b84cd2..9675cc85665 100644 --- a/src/Generated/Organization/Item/Branding/Localizations/Item/OrganizationalBrandingLocalizationItemRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/Localizations/Item/OrganizationalBrandingLocalizationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrganizationalBrandingLocalization; use Microsoft\Graph\Generated\Organization\Item\Branding\Localizations\Item\BackgroundImage\BackgroundImageRequestBuilder; @@ -90,59 +89,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a localized branding object. To delete the organizationalBrandingLocalization object, all images (Stream types) must first be removed from the object. This API is available in the following national cloud deployments. * @param OrganizationalBrandingLocalizationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbrandinglocalization-delete?view=graph-rest-1.0 Find more info here */ public function delete(?OrganizationalBrandingLocalizationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an organizationalBrandingLocalization object. To retrieve a localization branding object, specify the value of id in the URL. This API is available in the following national cloud deployments. * @param OrganizationalBrandingLocalizationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbrandinglocalization-get?view=graph-rest-1.0 Find more info here */ public function get(?OrganizationalBrandingLocalizationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrganizationalBrandingLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrganizationalBrandingLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an organizationalBrandingLocalization object for a specific localization. This API is available in the following national cloud deployments. * @param OrganizationalBrandingLocalization $body The request body * @param OrganizationalBrandingLocalizationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbrandinglocalization-update?view=graph-rest-1.0 Find more info here */ public function patch(OrganizationalBrandingLocalization $body, ?OrganizationalBrandingLocalizationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrganizationalBrandingLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrganizationalBrandingLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -159,6 +149,7 @@ public function toDeleteRequestInformation(?OrganizationalBrandingLocalizationIt $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -172,7 +163,6 @@ public function toGetRequestInformation(?OrganizationalBrandingLocalizationItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -180,6 +170,7 @@ public function toGetRequestInformation(?OrganizationalBrandingLocalizationItemR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -194,11 +185,11 @@ public function toPatchRequestInformation(OrganizationalBrandingLocalization $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/Localizations/Item/SquareLogo/SquareLogoRequestBuilder.php b/src/Generated/Organization/Item/Branding/Localizations/Item/SquareLogo/SquareLogoRequestBuilder.php index 86063552215..06901e81b62 100644 --- a/src/Generated/Organization/Item/Branding/Localizations/Item/SquareLogo/SquareLogoRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/Localizations/Item/SquareLogo/SquareLogoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A square version of your company logo that appears in Windows 10 out-of-box experiences (OOBE) and when Windows Autopilot is enabled for deployment. Allowed types are PNG or JPEG not larger than 240 x 240 pixels and not more than 10 KB in size. We recommend using a transparent image with no padding around the logo. * @param SquareLogoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-list-localizations?view=graph-rest-1.0 Find more info here */ public function get(?SquareLogoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * A square version of your company logo that appears in Windows 10 out-of-box experiences (OOBE) and when Windows Autopilot is enabled for deployment. Allowed types are PNG or JPEG not larger than 240 x 240 pixels and not more than 10 KB in size. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param SquareLogoRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?SquareLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?SquareLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,16 +81,18 @@ public function toGetRequestInformation(?SquareLogoRequestBuilderGetRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** * A square version of your company logo that appears in Windows 10 out-of-box experiences (OOBE) and when Windows Autopilot is enabled for deployment. Allowed types are PNG or JPEG not larger than 240 x 240 pixels and not more than 10 KB in size. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param SquareLogoRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?SquareLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?SquareLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?SquareLogoReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/Localizations/Item/SquareLogoDark/SquareLogoDarkRequestBuilder.php b/src/Generated/Organization/Item/Branding/Localizations/Item/SquareLogoDark/SquareLogoDarkRequestBuilder.php index ea23c31c364..57a6dda5447 100644 --- a/src/Generated/Organization/Item/Branding/Localizations/Item/SquareLogoDark/SquareLogoDarkRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/Localizations/Item/SquareLogoDark/SquareLogoDarkRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A square dark version of your company logo that appears in Windows 10 out-of-box experiences (OOBE) and when Windows Autopilot is enabled for deployment. Allowed types are PNG or JPEG not larger than 240 x 240 pixels and not more than 10 KB in size. We recommend using a transparent image with no padding around the logo. * @param SquareLogoDarkRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-list-localizations?view=graph-rest-1.0 Find more info here */ public function get(?SquareLogoDarkRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * A square dark version of your company logo that appears in Windows 10 out-of-box experiences (OOBE) and when Windows Autopilot is enabled for deployment. Allowed types are PNG or JPEG not larger than 240 x 240 pixels and not more than 10 KB in size. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param SquareLogoDarkRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?SquareLogoDarkRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?SquareLogoDarkRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,16 +81,18 @@ public function toGetRequestInformation(?SquareLogoDarkRequestBuilderGetRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** * A square dark version of your company logo that appears in Windows 10 out-of-box experiences (OOBE) and when Windows Autopilot is enabled for deployment. Allowed types are PNG or JPEG not larger than 240 x 240 pixels and not more than 10 KB in size. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param SquareLogoDarkRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?SquareLogoDarkRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?SquareLogoDarkRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?SquareLogoDarkRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/Localizations/LocalizationsRequestBuilder.php b/src/Generated/Organization/Item/Branding/Localizations/LocalizationsRequestBuilder.php index 5a353cde66d..ee417b1bcb7 100644 --- a/src/Generated/Organization/Item/Branding/Localizations/LocalizationsRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/Localizations/LocalizationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrganizationalBrandingLocalization; use Microsoft\Graph\Generated\Models\OrganizationalBrandingLocalizationCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve all localization branding objects, including the default branding. This API is available in the following national cloud deployments. * @param LocalizationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-list-localizations?view=graph-rest-1.0 Find more info here */ public function get(?LocalizationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrganizationalBrandingLocalizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrganizationalBrandingLocalizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new organizationalBrandingLocalization object. This creates a localized branding and at the same time, the default branding if it doesn't exist. The default branding is created only once. It's loaded when a localized branding isn't configured for the user's browser language. To retrieve the default branding, see Get branding. This API is available in the following national cloud deployments. * @param OrganizationalBrandingLocalization $body The request body * @param LocalizationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-post-localizations?view=graph-rest-1.0 Find more info here */ public function post(OrganizationalBrandingLocalization $body, ?LocalizationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrganizationalBrandingLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrganizationalBrandingLocalization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?LocalizationsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?LocalizationsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OrganizationalBrandingLocalization $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/SquareLogo/SquareLogoRequestBuilder.php b/src/Generated/Organization/Item/Branding/SquareLogo/SquareLogoRequestBuilder.php index 2cd3d08cf15..ed4a1077727 100644 --- a/src/Generated/Organization/Item/Branding/SquareLogo/SquareLogoRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/SquareLogo/SquareLogoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A square version of your company logo that appears in Windows 10 out-of-box experiences (OOBE) and when Windows Autopilot is enabled for deployment. Allowed types are PNG or JPEG not larger than 240 x 240 pixels and not more than 10 KB in size. We recommend using a transparent image with no padding around the logo. * @param SquareLogoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-get?view=graph-rest-1.0 Find more info here */ public function get(?SquareLogoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * A square version of your company logo that appears in Windows 10 out-of-box experiences (OOBE) and when Windows Autopilot is enabled for deployment. Allowed types are PNG or JPEG not larger than 240 x 240 pixels and not more than 10 KB in size. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param SquareLogoRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?SquareLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?SquareLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,16 +81,18 @@ public function toGetRequestInformation(?SquareLogoRequestBuilderGetRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** * A square version of your company logo that appears in Windows 10 out-of-box experiences (OOBE) and when Windows Autopilot is enabled for deployment. Allowed types are PNG or JPEG not larger than 240 x 240 pixels and not more than 10 KB in size. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param SquareLogoRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?SquareLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?SquareLogoRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?SquareLogoReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Branding/SquareLogoDark/SquareLogoDarkRequestBuilder.php b/src/Generated/Organization/Item/Branding/SquareLogoDark/SquareLogoDarkRequestBuilder.php index 24ef0bc0e3f..f59d3867ca2 100644 --- a/src/Generated/Organization/Item/Branding/SquareLogoDark/SquareLogoDarkRequestBuilder.php +++ b/src/Generated/Organization/Item/Branding/SquareLogoDark/SquareLogoDarkRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A square dark version of your company logo that appears in Windows 10 out-of-box experiences (OOBE) and when Windows Autopilot is enabled for deployment. Allowed types are PNG or JPEG not larger than 240 x 240 pixels and not more than 10 KB in size. We recommend using a transparent image with no padding around the logo. * @param SquareLogoDarkRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organizationalbranding-get?view=graph-rest-1.0 Find more info here */ public function get(?SquareLogoDarkRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * A square dark version of your company logo that appears in Windows 10 out-of-box experiences (OOBE) and when Windows Autopilot is enabled for deployment. Allowed types are PNG or JPEG not larger than 240 x 240 pixels and not more than 10 KB in size. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param SquareLogoDarkRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ - public function put(StreamInterface $body, ?SquareLogoDarkRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { + public function put(StreamInterface $body, string $contentType, ?SquareLogoDarkRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,16 +81,18 @@ public function toGetRequestInformation(?SquareLogoDarkRequestBuilderGetRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "image/bmp, image/jpg, image/jpeg, image/gif, image/vnd.microsoft.icon, image/png, image/tiff, application/json, application/json"); return $requestInfo; } /** * A square dark version of your company logo that appears in Windows 10 out-of-box experiences (OOBE) and when Windows Autopilot is enabled for deployment. Allowed types are PNG or JPEG not larger than 240 x 240 pixels and not more than 10 KB in size. We recommend using a transparent image with no padding around the logo. * @param StreamInterface $body Binary request body + * @param string $contentType * @param SquareLogoDarkRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ - public function toPutRequestInformation(StreamInterface $body, ?SquareLogoDarkRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { + public function toPutRequestInformation(StreamInterface $body, string $contentType, ?SquareLogoDarkRequestBuilderPutRequestConfiguration $requestConfiguration = null): RequestInformation { $requestInfo = new RequestInformation(); $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; @@ -101,7 +101,8 @@ public function toPutRequestInformation(StreamInterface $body, ?SquareLogoDarkRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, $contentType); return $requestInfo; } diff --git a/src/Generated/Organization/Item/CertificateBasedAuthConfiguration/CertificateBasedAuthConfigurationRequestBuilder.php b/src/Generated/Organization/Item/CertificateBasedAuthConfiguration/CertificateBasedAuthConfigurationRequestBuilder.php index d01bf381c46..3924b8f49b5 100644 --- a/src/Generated/Organization/Item/CertificateBasedAuthConfiguration/CertificateBasedAuthConfigurationRequestBuilder.php +++ b/src/Generated/Organization/Item/CertificateBasedAuthConfiguration/CertificateBasedAuthConfigurationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CertificateBasedAuthConfiguration; use Microsoft\Graph\Generated\Models\CertificateBasedAuthConfigurationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of certificateBasedAuthConfiguration objects. This API is available in the following national cloud deployments. * @param CertificateBasedAuthConfigurationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/certificatebasedauthconfiguration-list?view=graph-rest-1.0 Find more info here */ public function get(?CertificateBasedAuthConfigurationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new certificateBasedAuthConfiguration object. This API is available in the following national cloud deployments. * @param CertificateBasedAuthConfiguration $body The request body * @param CertificateBasedAuthConfigurationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/certificatebasedauthconfiguration-post-certificatebasedauthconfiguration?view=graph-rest-1.0 Find more info here */ public function post(CertificateBasedAuthConfiguration $body, ?CertificateBasedAuthConfigurationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CertificateBasedAuthConfigurationReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CertificateBasedAuthConfigurationReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(CertificateBasedAuthConfiguration $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/Item/CertificateBasedAuthConfiguration/Count/CountRequestBuilder.php b/src/Generated/Organization/Item/CertificateBasedAuthConfiguration/Count/CountRequestBuilder.php index 72b6b5f9ef2..33825a9a18d 100644 --- a/src/Generated/Organization/Item/CertificateBasedAuthConfiguration/Count/CountRequestBuilder.php +++ b/src/Generated/Organization/Item/CertificateBasedAuthConfiguration/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Organization/Item/CertificateBasedAuthConfiguration/Item/CertificateBasedAuthConfigurationItemRequestBuilder.php b/src/Generated/Organization/Item/CertificateBasedAuthConfiguration/Item/CertificateBasedAuthConfigurationItemRequestBuilder.php index 5fb86d72539..9ad2f8852e5 100644 --- a/src/Generated/Organization/Item/CertificateBasedAuthConfiguration/Item/CertificateBasedAuthConfigurationItemRequestBuilder.php +++ b/src/Generated/Organization/Item/CertificateBasedAuthConfiguration/Item/CertificateBasedAuthConfigurationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CertificateBasedAuthConfiguration; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,39 +33,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a certificateBasedAuthConfiguration object. This API is available in the following national cloud deployments. * @param CertificateBasedAuthConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/certificatebasedauthconfiguration-delete?view=graph-rest-1.0 Find more info here */ public function delete(?CertificateBasedAuthConfigurationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties of a certificateBasedAuthConfiguration object. This API is available in the following national cloud deployments. * @param CertificateBasedAuthConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/certificatebasedauthconfiguration-get?view=graph-rest-1.0 Find more info here */ public function get(?CertificateBasedAuthConfigurationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CertificateBasedAuthConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +76,7 @@ public function toDeleteRequestInformation(?CertificateBasedAuthConfigurationIte $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -96,7 +90,6 @@ public function toGetRequestInformation(?CertificateBasedAuthConfigurationItemRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -104,6 +97,7 @@ public function toGetRequestInformation(?CertificateBasedAuthConfigurationItemRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Organization/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/Organization/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index f575ef022f0..d01fcc439aa 100644 --- a/src/Generated/Organization/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/Organization/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/Organization/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index 3bf70917af1..fcf57ad249d 100644 --- a/src/Generated/Organization/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/Organization/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Organization/Item/Extensions/Count/CountRequestBuilder.php index 0c804a6d35c..9119e25cddf 100644 --- a/src/Generated/Organization/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Organization/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Organization/Item/Extensions/ExtensionsRequestBuilder.php index 43fdae73757..e896db7df8a 100644 --- a/src/Generated/Organization/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Organization/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of open extensions defined for the organization. Read-only. Nullable. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for organization * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Organization/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 22d160a2d1f..9aa1adb571b 100644 --- a/src/Generated/Organization/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Organization/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for organization * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of open extensions defined for the organization. Read-only. Nullable. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in organization * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/Organization/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index c8ea1e7d825..befbd49b5b0 100644 --- a/src/Generated/Organization/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/Organization/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/Organization/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index 687958b6790..1bd78f5e038 100644 --- a/src/Generated/Organization/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/Organization/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/Item/OrganizationItemRequestBuilder.php b/src/Generated/Organization/Item/OrganizationItemRequestBuilder.php index b979dad6c17..94887cf21c4 100644 --- a/src/Generated/Organization/Item/OrganizationItemRequestBuilder.php +++ b/src/Generated/Organization/Item/OrganizationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Organization; use Microsoft\Graph\Generated\Organization\Item\Branding\BrandingRequestBuilder; @@ -106,58 +105,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from organization * @param OrganizationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OrganizationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the organization object. * @param OrganizationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-organization-get?view=graph-rest-1.0 Find more info here */ public function get(?OrganizationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Organization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Organization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the currently authenticated organization. In this case, organization is defined as a collection of exactly one record, and so its ID must be specified in the request. The ID is also known as the tenantId of the organization. This API is available in the following national cloud deployments. * @param Organization $body The request body * @param OrganizationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/organization-update?view=graph-rest-1.0 Find more info here */ public function patch(Organization $body, ?OrganizationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Organization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Organization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -174,6 +164,7 @@ public function toDeleteRequestInformation(?OrganizationItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -187,7 +178,6 @@ public function toGetRequestInformation(?OrganizationItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -195,6 +185,7 @@ public function toGetRequestInformation(?OrganizationItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -209,11 +200,11 @@ public function toPatchRequestInformation(Organization $body, ?OrganizationItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/Item/Restore/RestoreRequestBuilder.php b/src/Generated/Organization/Item/Restore/RestoreRequestBuilder.php index 08baa1859b1..e0516c01479 100644 --- a/src/Generated/Organization/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/Organization/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Organization/Item/SetMobileDeviceManagementAuthority/SetMobileDeviceManagementAuthorityRequestBuilder.php b/src/Generated/Organization/Item/SetMobileDeviceManagementAuthority/SetMobileDeviceManagementAuthorityRequestBuilder.php index 2bc079473ab..2c42436b19e 100644 --- a/src/Generated/Organization/Item/SetMobileDeviceManagementAuthority/SetMobileDeviceManagementAuthorityRequestBuilder.php +++ b/src/Generated/Organization/Item/SetMobileDeviceManagementAuthority/SetMobileDeviceManagementAuthorityRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Set mobile device management authority * @param SetMobileDeviceManagementAuthorityRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-onboarding-organization-setmobiledevicemanagementauthority?view=graph-rest-1.0 Find more info here */ public function post(?SetMobileDeviceManagementAuthorityRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SetMobileDeviceManagementAuthorityPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SetMobileDeviceManagementAuthorityPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toPostRequestInformation(?SetMobileDeviceManagementAuthorityRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Organization/OrganizationRequestBuilder.php b/src/Generated/Organization/OrganizationRequestBuilder.php index 22ea09435d9..c6eab4ec527 100644 --- a/src/Generated/Organization/OrganizationRequestBuilder.php +++ b/src/Generated/Organization/OrganizationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Organization; use Microsoft\Graph\Generated\Models\OrganizationCollectionResponse; @@ -85,45 +84,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List properties and relationships of the organization objects. + * Retrieve a list of organization objects. There's only one organization object in the collection. This API is available in the following national cloud deployments. * @param OrganizationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-onboarding-organization-list?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/organization-list?view=graph-rest-1.0 Find more info here */ public function get(?OrganizationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrganizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrganizationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to organization * @param Organization $body The request body * @param OrganizationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Organization $body, ?OrganizationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Organization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Organization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List properties and relationships of the organization objects. + * Retrieve a list of organization objects. There's only one organization object in the collection. This API is available in the following national cloud deployments. * @param OrganizationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -132,7 +125,6 @@ public function toGetRequestInformation(?OrganizationRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +132,7 @@ public function toGetRequestInformation(?OrganizationRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +147,11 @@ public function toPostRequestInformation(Organization $body, ?OrganizationReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Organization/OrganizationRequestBuilderGetQueryParameters.php b/src/Generated/Organization/OrganizationRequestBuilderGetQueryParameters.php index 16dd0675ddc..64d14f563ec 100644 --- a/src/Generated/Organization/OrganizationRequestBuilderGetQueryParameters.php +++ b/src/Generated/Organization/OrganizationRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List properties and relationships of the organization objects. + * Retrieve a list of organization objects. There's only one organization object in the collection. This API is available in the following national cloud deployments. */ class OrganizationRequestBuilderGetQueryParameters { diff --git a/src/Generated/Organization/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/Organization/ValidateProperties/ValidatePropertiesRequestBuilder.php index 42c04744d52..4abcd56dd73 100644 --- a/src/Generated/Organization/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/Organization/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/PermissionGrants/Delta/DeltaRequestBuilder.php b/src/Generated/PermissionGrants/Delta/DeltaRequestBuilder.php index cba2156e466..8188873cc1d 100644 --- a/src/Generated/PermissionGrants/Delta/DeltaRequestBuilder.php +++ b/src/Generated/PermissionGrants/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/PermissionGrants/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/PermissionGrants/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index 7d7c428e0d6..47062cc5148 100644 --- a/src/Generated/PermissionGrants/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/PermissionGrants/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/PermissionGrants/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/PermissionGrants/GetByIds/GetByIdsRequestBuilder.php index 029d0043a19..ae526ac3a39 100644 --- a/src/Generated/PermissionGrants/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/PermissionGrants/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/PermissionGrants/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/PermissionGrants/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index 207e7f19455..e7fdae39006 100644 --- a/src/Generated/PermissionGrants/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/PermissionGrants/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/PermissionGrants/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/PermissionGrants/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index 9ed586e80c1..6a321799d3d 100644 --- a/src/Generated/PermissionGrants/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/PermissionGrants/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/PermissionGrants/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/PermissionGrants/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index f91ba956d03..7ae1cce294e 100644 --- a/src/Generated/PermissionGrants/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/PermissionGrants/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/PermissionGrants/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/PermissionGrants/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index 1ac1e5ca3f9..c90018b89fc 100644 --- a/src/Generated/PermissionGrants/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/PermissionGrants/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php b/src/Generated/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php index 22b5eb715a7..ebf01f5666a 100644 --- a/src/Generated/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php +++ b/src/Generated/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrant; use Microsoft\Graph\Generated\PermissionGrants\Item\CheckMemberGroups\CheckMemberGroupsRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from permissionGrants * @param ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entity from permissionGrants by key * @param ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in permissionGrants * @param ResourceSpecificPermissionGrant $body The request body * @param ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ResourceSpecificPermissionGrant $body, ?ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?ResourceSpecificPermissionGrantItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/PermissionGrants/Item/Restore/RestoreRequestBuilder.php b/src/Generated/PermissionGrants/Item/Restore/RestoreRequestBuilder.php index 83aa89317fd..74a73ecec38 100644 --- a/src/Generated/PermissionGrants/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/PermissionGrants/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/PermissionGrants/PermissionGrantsRequestBuilder.php b/src/Generated/PermissionGrants/PermissionGrantsRequestBuilder.php index 08561035c77..75eca4faca3 100644 --- a/src/Generated/PermissionGrants/PermissionGrantsRequestBuilder.php +++ b/src/Generated/PermissionGrants/PermissionGrantsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrant; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrantCollectionResponse; @@ -79,38 +78,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from permissionGrants * @param PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PermissionGrantsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to permissionGrants * @param ResourceSpecificPermissionGrant $body The request body * @param PermissionGrantsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ResourceSpecificPermissionGrant $body, ?PermissionGrantsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -123,7 +116,6 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +123,7 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +138,11 @@ public function toPostRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/PermissionGrants/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/PermissionGrants/ValidateProperties/ValidatePropertiesRequestBuilder.php index 61bc30de9dc..b76cccdec54 100644 --- a/src/Generated/PermissionGrants/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/PermissionGrants/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Places/Count/CountRequestBuilder.php b/src/Generated/Places/Count/CountRequestBuilder.php index 31d2d0aa93c..308046fd261 100644 --- a/src/Generated/Places/Count/CountRequestBuilder.php +++ b/src/Generated/Places/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Places/GraphRoom/Count/CountRequestBuilder.php b/src/Generated/Places/GraphRoom/Count/CountRequestBuilder.php index e2729ddb568..0bb0be79744 100644 --- a/src/Generated/Places/GraphRoom/Count/CountRequestBuilder.php +++ b/src/Generated/Places/GraphRoom/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Places/GraphRoom/GraphRoomRequestBuilder.php b/src/Generated/Places/GraphRoom/GraphRoomRequestBuilder.php index 02e2ce82b77..24c2e12812b 100644 --- a/src/Generated/Places/GraphRoom/GraphRoomRequestBuilder.php +++ b/src/Generated/Places/GraphRoom/GraphRoomRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RoomCollectionResponse; use Microsoft\Graph\Generated\Places\GraphRoom\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.room in the microsoft.graph.place collection * @param GraphRoomRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphRoomRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoomCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoomCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphRoomRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphRoomRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Places/GraphRoomList/Count/CountRequestBuilder.php b/src/Generated/Places/GraphRoomList/Count/CountRequestBuilder.php index a5dba375674..c4b00b99e88 100644 --- a/src/Generated/Places/GraphRoomList/Count/CountRequestBuilder.php +++ b/src/Generated/Places/GraphRoomList/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Places/GraphRoomList/GraphRoomListRequestBuilder.php b/src/Generated/Places/GraphRoomList/GraphRoomListRequestBuilder.php index 001a9ae8c8b..c8be47d3f23 100644 --- a/src/Generated/Places/GraphRoomList/GraphRoomListRequestBuilder.php +++ b/src/Generated/Places/GraphRoomList/GraphRoomListRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RoomListCollectionResponse; use Microsoft\Graph\Generated\Places\GraphRoomList\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.roomList in the microsoft.graph.place collection * @param GraphRoomListRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphRoomListRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoomListCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoomListCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphRoomListRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphRoomListRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Places/Item/GraphRoom/GraphRoomRequestBuilder.php b/src/Generated/Places/Item/GraphRoom/GraphRoomRequestBuilder.php index b17913666e9..35b0ad6ebcd 100644 --- a/src/Generated/Places/Item/GraphRoom/GraphRoomRequestBuilder.php +++ b/src/Generated/Places/Item/GraphRoom/GraphRoomRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Room; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.place as microsoft.graph.room * @param GraphRoomRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphRoomRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Room::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Room::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphRoomRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphRoomRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Places/Item/GraphRoomList/GraphRoomListRequestBuilder.php b/src/Generated/Places/Item/GraphRoomList/GraphRoomListRequestBuilder.php index 9906b17d53d..8b1e6075d3c 100644 --- a/src/Generated/Places/Item/GraphRoomList/GraphRoomListRequestBuilder.php +++ b/src/Generated/Places/Item/GraphRoomList/GraphRoomListRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RoomList; use Microsoft\Graph\Generated\Places\Item\GraphRoomList\Rooms\RoomsRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.place as microsoft.graph.roomList * @param GraphRoomListRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphRoomListRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoomList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoomList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphRoomListRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphRoomListRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Places/Item/GraphRoomList/Rooms/Count/CountRequestBuilder.php b/src/Generated/Places/Item/GraphRoomList/Rooms/Count/CountRequestBuilder.php index 3fe2b6cc376..bb3b81306a9 100644 --- a/src/Generated/Places/Item/GraphRoomList/Rooms/Count/CountRequestBuilder.php +++ b/src/Generated/Places/Item/GraphRoomList/Rooms/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Places/Item/GraphRoomList/Rooms/Item/RoomItemRequestBuilder.php b/src/Generated/Places/Item/GraphRoomList/Rooms/Item/RoomItemRequestBuilder.php index 6879558fc1e..f1ec1883793 100644 --- a/src/Generated/Places/Item/GraphRoomList/Rooms/Item/RoomItemRequestBuilder.php +++ b/src/Generated/Places/Item/GraphRoomList/Rooms/Item/RoomItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Room; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property rooms for places * @param RoomItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RoomItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get rooms from places * @param RoomItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoomItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Room::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Room::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property rooms in places * @param Room $body The request body * @param RoomItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Room $body, ?RoomItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Room::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Room::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?RoomItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?RoomItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?RoomItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Room $body, ?RoomItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Places/Item/GraphRoomList/Rooms/RoomsRequestBuilder.php b/src/Generated/Places/Item/GraphRoomList/Rooms/RoomsRequestBuilder.php index b2faaf01199..bfe132672a0 100644 --- a/src/Generated/Places/Item/GraphRoomList/Rooms/RoomsRequestBuilder.php +++ b/src/Generated/Places/Item/GraphRoomList/Rooms/RoomsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Room; use Microsoft\Graph\Generated\Models\RoomCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get rooms from places * @param RoomsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoomsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoomCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoomCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to rooms for places * @param Room $body The request body * @param RoomsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Room $body, ?RoomsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Room::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Room::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RoomsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RoomsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Room $body, ?RoomsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Places/Item/PlaceItemRequestBuilder.php b/src/Generated/Places/Item/PlaceItemRequestBuilder.php index b1c84468557..ca51927acd3 100644 --- a/src/Generated/Places/Item/PlaceItemRequestBuilder.php +++ b/src/Generated/Places/Item/PlaceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Place; use Microsoft\Graph\Generated\Places\Item\GraphRoom\GraphRoomRequestBuilder; @@ -50,39 +49,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from places * @param PlaceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlaceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Update the properties of place object, which can be a room or roomList. You can identify the room or roomList by specifying the id or emailAddress property. This API is available in the following national cloud deployments. * @param Place $body The request body * @param PlaceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/place-update?view=graph-rest-1.0 Find more info here */ public function patch(Place $body, ?PlaceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Place::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Place::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,6 +92,7 @@ public function toDeleteRequestInformation(?PlaceItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,11 +107,11 @@ public function toPatchRequestInformation(Place $body, ?PlaceItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Buckets/BucketsRequestBuilder.php b/src/Generated/Planner/Buckets/BucketsRequestBuilder.php index 648c9b38d91..f6465e4ad3e 100644 --- a/src/Generated/Planner/Buckets/BucketsRequestBuilder.php +++ b/src/Generated/Planner/Buckets/BucketsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucket; use Microsoft\Graph\Generated\Models\PlannerBucketCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannerbucket objects. This API is available in the following national cloud deployments. * @param BucketsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/planner-list-buckets?view=graph-rest-1.0 Find more info here */ public function get(?BucketsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new plannerBucket object. This API is available in the following national cloud deployments. * @param PlannerBucket $body The request body * @param BucketsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/planner-post-buckets?view=graph-rest-1.0 Find more info here */ public function post(PlannerBucket $body, ?BucketsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?BucketsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?BucketsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(PlannerBucket $body, ?BucketsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Buckets/Count/CountRequestBuilder.php b/src/Generated/Planner/Buckets/Count/CountRequestBuilder.php index ba56a441245..ab93f46f14c 100644 --- a/src/Generated/Planner/Buckets/Count/CountRequestBuilder.php +++ b/src/Generated/Planner/Buckets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Planner/Buckets/Item/PlannerBucketItemRequestBuilder.php b/src/Generated/Planner/Buckets/Item/PlannerBucketItemRequestBuilder.php index a077240e6f0..b97d35cfe8a 100644 --- a/src/Generated/Planner/Buckets/Item/PlannerBucketItemRequestBuilder.php +++ b/src/Generated/Planner/Buckets/Item/PlannerBucketItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucket; use Microsoft\Graph\Generated\Planner\Buckets\Item\Tasks\TasksRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete plannerBucket. This API is available in the following national cloud deployments. * @param PlannerBucketItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbucket-delete?view=graph-rest-1.0 Find more info here */ public function delete(?PlannerBucketItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerBucket object. This API is available in the following national cloud deployments. * @param PlannerBucketItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbucket-get?view=graph-rest-1.0 Find more info here */ public function get(?PlannerBucketItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property buckets in planner * @param PlannerBucket $body The request body * @param PlannerBucketItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbucket-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerBucket $body, ?PlannerBucketItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?PlannerBucketItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?PlannerBucketItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?PlannerBucketItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(PlannerBucket $body, ?PlannerBucketIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Buckets/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/Planner/Buckets/Item/Tasks/Count/CountRequestBuilder.php index e436ce5a1b6..4a3e4f0c6eb 100644 --- a/src/Generated/Planner/Buckets/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/Planner/Buckets/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Planner/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php b/src/Generated/Planner/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php index 3389982a5e6..abc1b0678ab 100644 --- a/src/Generated/Planner/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Planner/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerAssignedToTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignedToTaskBoardFormat for planner * @param AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerAssignedToTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignedToTaskBoardFormat in planner * @param PlannerAssignedToTaskBoardTaskFormat $body The request body * @param AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerAssignedToTaskBoardTaskFormat $body, ?AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AssignedToTaskBoardFormatRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerAssignedToTaskBoardTaskFormat $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php b/src/Generated/Planner/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php index cce056d9759..fab68f3b3fa 100644 --- a/src/Generated/Planner/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Planner/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucketTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property bucketTaskBoardFormat for planner * @param BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerBucketTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param BucketTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?BucketTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property bucketTaskBoardFormat in planner * @param PlannerBucketTaskBoardTaskFormat $body The request body * @param BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerBucketTaskBoardTaskFormat $body, ?BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?BucketTaskBoardFormatRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerBucketTaskBoardTaskFormat $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php b/src/Generated/Planner/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php index d5db729a749..a3f752b576e 100644 --- a/src/Generated/Planner/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Planner/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTaskDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for planner * @param DetailsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DetailsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerTaskDetails object. This API is available in the following national cloud deployments. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-get?view=graph-rest-1.0 Find more info here */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in planner * @param PlannerTaskDetails $body The request body * @param DetailsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerTaskDetails $body, ?DetailsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DetailsRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerTaskDetails $body, ?DetailsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php b/src/Generated/Planner/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php index 9b63943e1f0..2453b50301d 100644 --- a/src/Generated/Planner/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php +++ b/src/Generated/Planner/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Planner\Buckets\Item\Tasks\Item\AssignedToTaskBoardFormat\AssignedToTaskBoardFormatRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for planner * @param PlannerTaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerTaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. The collection of tasks in the bucket. * @param PlannerTaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerTaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in planner * @param PlannerTask $body The request body * @param PlannerTaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerTask $body, ?PlannerTaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?PlannerTaskItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(PlannerTask $body, ?PlannerTaskItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php b/src/Generated/Planner/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php index b0be5501dda..0ab375d4da4 100644 --- a/src/Generated/Planner/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Planner/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerProgressTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property progressTaskBoardFormat for planner * @param ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerProgressTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property progressTaskBoardFormat in planner * @param PlannerProgressTaskBoardTaskFormat $body The request body * @param ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerProgressTaskBoardTaskFormat $body, ?ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ProgressTaskBoardFormatRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerProgressTaskBoardTaskFormat $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Buckets/Item/Tasks/TasksRequestBuilder.php b/src/Generated/Planner/Buckets/Item/Tasks/TasksRequestBuilder.php index 3373fc07f14..d80b97d7c4a 100644 --- a/src/Generated/Planner/Buckets/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/Planner/Buckets/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Models\PlannerTaskCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannerTask objects associated to a plannerBucket object. This API is available in the following national cloud deployments. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbucket-list-tasks?view=graph-rest-1.0 Find more info here */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for planner * @param PlannerTask $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PlannerTask $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PlannerTask $body, ?TasksRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/PlannerRequestBuilder.php b/src/Generated/Planner/PlannerRequestBuilder.php index f539ab5dd7b..e567aadd351 100644 --- a/src/Generated/Planner/PlannerRequestBuilder.php +++ b/src/Generated/Planner/PlannerRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Planner; use Microsoft\Graph\Generated\Planner\Buckets\BucketsRequestBuilder; @@ -58,38 +57,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get planner * @param PlannerRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Planner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Planner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update planner * @param Planner $body The request body * @param PlannerRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Planner $body, ?PlannerRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Planner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Planner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,7 +95,6 @@ public function toGetRequestInformation(?PlannerRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -110,6 +102,7 @@ public function toGetRequestInformation(?PlannerRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -124,11 +117,11 @@ public function toPatchRequestInformation(Planner $body, ?PlannerRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Count/CountRequestBuilder.php b/src/Generated/Planner/Plans/Count/CountRequestBuilder.php index 409cd7a429b..93f1655761d 100644 --- a/src/Generated/Planner/Plans/Count/CountRequestBuilder.php +++ b/src/Generated/Planner/Plans/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Buckets/BucketsRequestBuilder.php b/src/Generated/Planner/Plans/Item/Buckets/BucketsRequestBuilder.php index b50fb2ab01b..20144776e0c 100644 --- a/src/Generated/Planner/Plans/Item/Buckets/BucketsRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Buckets/BucketsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucket; use Microsoft\Graph\Generated\Models\PlannerBucketCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannerBucket objects contained by a plannerPlan object. This API is available in the following national cloud deployments. * @param BucketsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplan-list-buckets?view=graph-rest-1.0 Find more info here */ public function get(?BucketsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to buckets for planner * @param PlannerBucket $body The request body * @param BucketsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PlannerBucket $body, ?BucketsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?BucketsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?BucketsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PlannerBucket $body, ?BucketsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Buckets/Count/CountRequestBuilder.php b/src/Generated/Planner/Plans/Item/Buckets/Count/CountRequestBuilder.php index 54f56db1857..9754ae1fd8d 100644 --- a/src/Generated/Planner/Plans/Item/Buckets/Count/CountRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Buckets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Buckets/Item/PlannerBucketItemRequestBuilder.php b/src/Generated/Planner/Plans/Item/Buckets/Item/PlannerBucketItemRequestBuilder.php index 97a80086a21..60a6681c0c5 100644 --- a/src/Generated/Planner/Plans/Item/Buckets/Item/PlannerBucketItemRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Buckets/Item/PlannerBucketItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucket; use Microsoft\Graph\Generated\Planner\Plans\Item\Buckets\Item\Tasks\TasksRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property buckets for planner * @param PlannerBucketItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerBucketItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Collection of buckets in the plan. * @param PlannerBucketItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerBucketItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property buckets in planner * @param PlannerBucket $body The request body * @param PlannerBucketItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerBucket $body, ?PlannerBucketItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?PlannerBucketItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?PlannerBucketItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?PlannerBucketItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(PlannerBucket $body, ?PlannerBucketIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Count/CountRequestBuilder.php index d8f56e87e8b..1458c799135 100644 --- a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php index cb2ef99bfb0..984c983a9d2 100644 --- a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerAssignedToTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignedToTaskBoardFormat for planner * @param AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerAssignedToTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignedToTaskBoardFormat in planner * @param PlannerAssignedToTaskBoardTaskFormat $body The request body * @param AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerAssignedToTaskBoardTaskFormat $body, ?AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AssignedToTaskBoardFormatRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerAssignedToTaskBoardTaskFormat $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php index 8e892831c06..35fe62873c8 100644 --- a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucketTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property bucketTaskBoardFormat for planner * @param BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerBucketTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param BucketTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?BucketTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property bucketTaskBoardFormat in planner * @param PlannerBucketTaskBoardTaskFormat $body The request body * @param BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerBucketTaskBoardTaskFormat $body, ?BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?BucketTaskBoardFormatRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerBucketTaskBoardTaskFormat $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php index 761ed985c8c..8e939d8439b 100644 --- a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTaskDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for planner * @param DetailsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DetailsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerTaskDetails object. This API is available in the following national cloud deployments. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-get?view=graph-rest-1.0 Find more info here */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in planner * @param PlannerTaskDetails $body The request body * @param DetailsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerTaskDetails $body, ?DetailsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DetailsRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerTaskDetails $body, ?DetailsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php index 7fbc9a54864..3d7ecb88a89 100644 --- a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Planner\Plans\Item\Buckets\Item\Tasks\Item\AssignedToTaskBoardFormat\AssignedToTaskBoardFormatRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for planner * @param PlannerTaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerTaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. The collection of tasks in the bucket. * @param PlannerTaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerTaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in planner * @param PlannerTask $body The request body * @param PlannerTaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerTask $body, ?PlannerTaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?PlannerTaskItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(PlannerTask $body, ?PlannerTaskItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php index e26a1e0e157..91f668e4581 100644 --- a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerProgressTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property progressTaskBoardFormat for planner * @param ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerProgressTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property progressTaskBoardFormat in planner * @param PlannerProgressTaskBoardTaskFormat $body The request body * @param ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerProgressTaskBoardTaskFormat $body, ?ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ProgressTaskBoardFormatRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerProgressTaskBoardTaskFormat $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/TasksRequestBuilder.php b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/TasksRequestBuilder.php index 49d3e337fef..9ebaf9cd697 100644 --- a/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Buckets/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Models\PlannerTaskCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannerTask objects associated to a plannerBucket object. This API is available in the following national cloud deployments. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbucket-list-tasks?view=graph-rest-1.0 Find more info here */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for planner * @param PlannerTask $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PlannerTask $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PlannerTask $body, ?TasksRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Details/DetailsRequestBuilder.php b/src/Generated/Planner/Plans/Item/Details/DetailsRequestBuilder.php index 2dfbecc5d3b..aa318aef779 100644 --- a/src/Generated/Planner/Plans/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerPlanDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for planner * @param DetailsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DetailsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerPlanDetails object. This API is available in the following national cloud deployments. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplandetails-get?view=graph-rest-1.0 Find more info here */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in planner * @param PlannerPlanDetails $body The request body * @param DetailsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplandetails-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerPlanDetails $body, ?DetailsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DetailsRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerPlanDetails $body, ?DetailsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/PlannerPlanItemRequestBuilder.php b/src/Generated/Planner/Plans/Item/PlannerPlanItemRequestBuilder.php index 2bb46e35fda..18c117f896a 100644 --- a/src/Generated/Planner/Plans/Item/PlannerPlanItemRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/PlannerPlanItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerPlan; use Microsoft\Graph\Generated\Planner\Plans\Item\Buckets\BucketsRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a plannerPlan object. This API is available in the following national cloud deployments. * @param PlannerPlanItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplan-delete?view=graph-rest-1.0 Find more info here */ public function delete(?PlannerPlanItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerplan object. This API is available in the following national cloud deployments. * @param PlannerPlanItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplan-get?view=graph-rest-1.0 Find more info here */ public function get(?PlannerPlanItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a plannerPlan object. This API is available in the following national cloud deployments. * @param PlannerPlan $body The request body * @param PlannerPlanItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplan-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerPlan $body, ?PlannerPlanItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?PlannerPlanItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?PlannerPlanItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?PlannerPlanItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(PlannerPlan $body, ?PlannerPlanItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/Planner/Plans/Item/Tasks/Count/CountRequestBuilder.php index 2793d10fd8a..8c1d5506169 100644 --- a/src/Generated/Planner/Plans/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php b/src/Generated/Planner/Plans/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php index f2f03885a6d..7f8a086cf12 100644 --- a/src/Generated/Planner/Plans/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerAssignedToTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignedToTaskBoardFormat for planner * @param AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerAssignedToTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignedToTaskBoardFormat in planner * @param PlannerAssignedToTaskBoardTaskFormat $body The request body * @param AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerAssignedToTaskBoardTaskFormat $body, ?AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AssignedToTaskBoardFormatRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerAssignedToTaskBoardTaskFormat $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php b/src/Generated/Planner/Plans/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php index 888e46a9557..3b4cdb680fb 100644 --- a/src/Generated/Planner/Plans/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucketTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property bucketTaskBoardFormat for planner * @param BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerBucketTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param BucketTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?BucketTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property bucketTaskBoardFormat in planner * @param PlannerBucketTaskBoardTaskFormat $body The request body * @param BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerBucketTaskBoardTaskFormat $body, ?BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?BucketTaskBoardFormatRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerBucketTaskBoardTaskFormat $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Tasks/Item/Details/DetailsRequestBuilder.php b/src/Generated/Planner/Plans/Item/Tasks/Item/Details/DetailsRequestBuilder.php index 097b7e3ddde..87b9adcf3d9 100644 --- a/src/Generated/Planner/Plans/Item/Tasks/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Tasks/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTaskDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for planner * @param DetailsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DetailsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerTaskDetails object. This API is available in the following national cloud deployments. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-get?view=graph-rest-1.0 Find more info here */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in planner * @param PlannerTaskDetails $body The request body * @param DetailsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerTaskDetails $body, ?DetailsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DetailsRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerTaskDetails $body, ?DetailsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php b/src/Generated/Planner/Plans/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php index d7ace50751f..a23b66b8813 100644 --- a/src/Generated/Planner/Plans/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Planner\Plans\Item\Tasks\Item\AssignedToTaskBoardFormat\AssignedToTaskBoardFormatRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for planner * @param PlannerTaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerTaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Collection of tasks in the plan. * @param PlannerTaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerTaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in planner * @param PlannerTask $body The request body * @param PlannerTaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerTask $body, ?PlannerTaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?PlannerTaskItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(PlannerTask $body, ?PlannerTaskItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php b/src/Generated/Planner/Plans/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php index a581e0e3ac3..f48640e6a1f 100644 --- a/src/Generated/Planner/Plans/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerProgressTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property progressTaskBoardFormat for planner * @param ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerProgressTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property progressTaskBoardFormat in planner * @param PlannerProgressTaskBoardTaskFormat $body The request body * @param ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerProgressTaskBoardTaskFormat $body, ?ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ProgressTaskBoardFormatRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerProgressTaskBoardTaskFormat $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/Item/Tasks/TasksRequestBuilder.php b/src/Generated/Planner/Plans/Item/Tasks/TasksRequestBuilder.php index f91af36ceb7..dac648d82ca 100644 --- a/src/Generated/Planner/Plans/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/Planner/Plans/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Models\PlannerTaskCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannerTask objects associated with a plannerPlan object. This API is available in the following national cloud deployments. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplan-list-tasks?view=graph-rest-1.0 Find more info here */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for planner * @param PlannerTask $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PlannerTask $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PlannerTask $body, ?TasksRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Plans/PlansRequestBuilder.php b/src/Generated/Planner/Plans/PlansRequestBuilder.php index 54f6a846a28..d00ae007408 100644 --- a/src/Generated/Planner/Plans/PlansRequestBuilder.php +++ b/src/Generated/Planner/Plans/PlansRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerPlan; use Microsoft\Graph\Generated\Models\PlannerPlanCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of plannerPlan objects. This API is available in the following national cloud deployments. * @param PlansRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/planner-list-plans?view=graph-rest-1.0 Find more info here */ public function get(?PlansRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new plannerPlan. This API is available in the following national cloud deployments. * @param PlannerPlan $body The request body * @param PlansRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/planner-post-plans?view=graph-rest-1.0 Find more info here */ public function post(PlannerPlan $body, ?PlansRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PlansRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PlansRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(PlannerPlan $body, ?PlansRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Tasks/Count/CountRequestBuilder.php b/src/Generated/Planner/Tasks/Count/CountRequestBuilder.php index ab1d948a077..b1bb7169601 100644 --- a/src/Generated/Planner/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/Planner/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Planner/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php b/src/Generated/Planner/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php index 06e62ffe431..1bab648cc32 100644 --- a/src/Generated/Planner/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Planner/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerAssignedToTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignedToTaskBoardFormat for planner * @param AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerAssignedToTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignedToTaskBoardFormat in planner * @param PlannerAssignedToTaskBoardTaskFormat $body The request body * @param AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerAssignedToTaskBoardTaskFormat $body, ?AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AssignedToTaskBoardFormatRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerAssignedToTaskBoardTaskFormat $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php b/src/Generated/Planner/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php index b99445f6790..708d247c31d 100644 --- a/src/Generated/Planner/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Planner/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucketTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property bucketTaskBoardFormat for planner * @param BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerBucketTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param BucketTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?BucketTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property bucketTaskBoardFormat in planner * @param PlannerBucketTaskBoardTaskFormat $body The request body * @param BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerBucketTaskBoardTaskFormat $body, ?BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?BucketTaskBoardFormatRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerBucketTaskBoardTaskFormat $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Tasks/Item/Details/DetailsRequestBuilder.php b/src/Generated/Planner/Tasks/Item/Details/DetailsRequestBuilder.php index 9b48788502b..406da5e7768 100644 --- a/src/Generated/Planner/Tasks/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Planner/Tasks/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTaskDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for planner * @param DetailsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DetailsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerTaskDetails object. This API is available in the following national cloud deployments. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-get?view=graph-rest-1.0 Find more info here */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in planner * @param PlannerTaskDetails $body The request body * @param DetailsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerTaskDetails $body, ?DetailsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DetailsRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerTaskDetails $body, ?DetailsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Tasks/Item/PlannerTaskItemRequestBuilder.php b/src/Generated/Planner/Tasks/Item/PlannerTaskItemRequestBuilder.php index 6acc8329428..a8de48ee22c 100644 --- a/src/Generated/Planner/Tasks/Item/PlannerTaskItemRequestBuilder.php +++ b/src/Generated/Planner/Tasks/Item/PlannerTaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Planner\Tasks\Item\AssignedToTaskBoardFormat\AssignedToTaskBoardFormatRequestBuilder; @@ -66,59 +65,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a plannerTask object. This API is available in the following national cloud deployments. * @param PlannerTaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertask-delete?view=graph-rest-1.0 Find more info here */ public function delete(?PlannerTaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerTask object. This API is available in the following national cloud deployments. * @param PlannerTaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertask-get?view=graph-rest-1.0 Find more info here */ public function get(?PlannerTaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in planner * @param PlannerTask $body The request body * @param PlannerTaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertask-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerTask $body, ?PlannerTaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -135,6 +125,7 @@ public function toDeleteRequestInformation(?PlannerTaskItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -148,7 +139,6 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -156,6 +146,7 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -170,11 +161,11 @@ public function toPatchRequestInformation(PlannerTask $body, ?PlannerTaskItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php b/src/Generated/Planner/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php index b5895cfd26a..4407177ca31 100644 --- a/src/Generated/Planner/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Planner/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerProgressTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property progressTaskBoardFormat for planner * @param ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerProgressTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property progressTaskBoardFormat in planner * @param PlannerProgressTaskBoardTaskFormat $body The request body * @param ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerProgressTaskBoardTaskFormat $body, ?ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ProgressTaskBoardFormatRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerProgressTaskBoardTaskFormat $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Planner/Tasks/TasksRequestBuilder.php b/src/Generated/Planner/Tasks/TasksRequestBuilder.php index bd29073b79b..069c621d2de 100644 --- a/src/Generated/Planner/Tasks/TasksRequestBuilder.php +++ b/src/Generated/Planner/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Models\PlannerTaskCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannertask objects. This API is available in the following national cloud deployments. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/planner-list-tasks?view=graph-rest-1.0 Find more info here */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new plannerTask. This API is available in the following national cloud deployments. * @param PlannerTask $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/planner-post-tasks?view=graph-rest-1.0 Find more info here */ public function post(PlannerTask $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(PlannerTask $body, ?TasksRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/ActivityBasedTimeoutPolicies/ActivityBasedTimeoutPoliciesRequestBuilder.php b/src/Generated/Policies/ActivityBasedTimeoutPolicies/ActivityBasedTimeoutPoliciesRequestBuilder.php index d4a4fa26bed..f8873195a48 100644 --- a/src/Generated/Policies/ActivityBasedTimeoutPolicies/ActivityBasedTimeoutPoliciesRequestBuilder.php +++ b/src/Generated/Policies/ActivityBasedTimeoutPolicies/ActivityBasedTimeoutPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ActivityBasedTimeoutPolicy; use Microsoft\Graph\Generated\Models\ActivityBasedTimeoutPolicyCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of activityBasedTimeoutPolicy objects. This API is available in the following national cloud deployments. * @param ActivityBasedTimeoutPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/activitybasedtimeoutpolicy-list?view=graph-rest-1.0 Find more info here */ public function get(?ActivityBasedTimeoutPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ActivityBasedTimeoutPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ActivityBasedTimeoutPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new activityBasedTimeoutPolicy object. This API is available in the following national cloud deployments. * @param ActivityBasedTimeoutPolicy $body The request body * @param ActivityBasedTimeoutPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/activitybasedtimeoutpolicy-post-activitybasedtimeoutpolicies?view=graph-rest-1.0 Find more info here */ public function post(ActivityBasedTimeoutPolicy $body, ?ActivityBasedTimeoutPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ActivityBasedTimeoutPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ActivityBasedTimeoutPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ActivityBasedTimeoutPoliciesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ActivityBasedTimeoutPoliciesRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ActivityBasedTimeoutPolicy $body, ?Acti $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/ActivityBasedTimeoutPolicies/Count/CountRequestBuilder.php b/src/Generated/Policies/ActivityBasedTimeoutPolicies/Count/CountRequestBuilder.php index b90f1f8f3fc..3f8b0abea54 100644 --- a/src/Generated/Policies/ActivityBasedTimeoutPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/ActivityBasedTimeoutPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/ActivityBasedTimeoutPolicyItemRequestBuilder.php b/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/ActivityBasedTimeoutPolicyItemRequestBuilder.php index 66172c11ecb..197c6ade4d1 100644 --- a/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/ActivityBasedTimeoutPolicyItemRequestBuilder.php +++ b/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/ActivityBasedTimeoutPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ActivityBasedTimeoutPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\ActivityBasedTimeoutPolicies\Item\AppliesTo\AppliesToRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an activityBasedTimeoutPolicy object. This API is available in the following national cloud deployments. * @param ActivityBasedTimeoutPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/activitybasedtimeoutpolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ActivityBasedTimeoutPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties of an activityBasedTimeoutPolicy object. This API is available in the following national cloud deployments. * @param ActivityBasedTimeoutPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/activitybasedtimeoutpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?ActivityBasedTimeoutPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ActivityBasedTimeoutPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ActivityBasedTimeoutPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an activityBasedTimeoutPolicy object. This API is available in the following national cloud deployments. * @param ActivityBasedTimeoutPolicy $body The request body * @param ActivityBasedTimeoutPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/activitybasedtimeoutpolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(ActivityBasedTimeoutPolicy $body, ?ActivityBasedTimeoutPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ActivityBasedTimeoutPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ActivityBasedTimeoutPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?ActivityBasedTimeoutPolicyItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?ActivityBasedTimeoutPolicyItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?ActivityBasedTimeoutPolicyItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(ActivityBasedTimeoutPolicy $body, ?Act $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/AppliesTo/AppliesToRequestBuilder.php b/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/AppliesTo/AppliesToRequestBuilder.php index df989c4de3b..34bdd3a1c42 100644 --- a/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/AppliesTo/AppliesToRequestBuilder.php +++ b/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/AppliesTo/AppliesToRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\ActivityBasedTimeoutPolicies\Item\AppliesTo\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get appliesTo from policies * @param AppliesToRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppliesToRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/AppliesTo/Count/CountRequestBuilder.php b/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/AppliesTo/Count/CountRequestBuilder.php index cbf882ce2e4..c931497a1d4 100644 --- a/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/AppliesTo/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/AppliesTo/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php index ba355368146..24109a78b4c 100644 --- a/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Policies/ActivityBasedTimeoutPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get appliesTo from policies * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/AdminConsentRequestPolicy/AdminConsentRequestPolicyRequestBuilder.php b/src/Generated/Policies/AdminConsentRequestPolicy/AdminConsentRequestPolicyRequestBuilder.php index af192738020..af6104a67fc 100644 --- a/src/Generated/Policies/AdminConsentRequestPolicy/AdminConsentRequestPolicyRequestBuilder.php +++ b/src/Generated/Policies/AdminConsentRequestPolicy/AdminConsentRequestPolicyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdminConsentRequestPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property adminConsentRequestPolicy for policies * @param AdminConsentRequestPolicyRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AdminConsentRequestPolicyRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an adminConsentRequestPolicy object. This API is available in the following national cloud deployments. * @param AdminConsentRequestPolicyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/adminconsentrequestpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?AdminConsentRequestPolicyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdminConsentRequestPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdminConsentRequestPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an adminConsentRequestPolicy object. * @param AdminConsentRequestPolicy $body The request body * @param AdminConsentRequestPolicyRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/adminconsentrequestpolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(AdminConsentRequestPolicy $body, ?AdminConsentRequestPolicyRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdminConsentRequestPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdminConsentRequestPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AdminConsentRequestPolicyRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AdminConsentRequestPolicyRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AdminConsentRequestPolicyRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(AdminConsentRequestPolicy $body, ?Admi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/AppManagementPolicies/AppManagementPoliciesRequestBuilder.php b/src/Generated/Policies/AppManagementPolicies/AppManagementPoliciesRequestBuilder.php index a84a537eda6..43576e7f189 100644 --- a/src/Generated/Policies/AppManagementPolicies/AppManagementPoliciesRequestBuilder.php +++ b/src/Generated/Policies/AppManagementPolicies/AppManagementPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppManagementPolicy; use Microsoft\Graph\Generated\Models\AppManagementPolicyCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of appManagementPolicy objects. This API is available in the following national cloud deployments. * @param AppManagementPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/appmanagementpolicy-list?view=graph-rest-1.0 Find more info here */ public function get(?AppManagementPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an appManagementPolicy object. This API is available in the following national cloud deployments. * @param AppManagementPolicy $body The request body * @param AppManagementPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/appmanagementpolicy-post?view=graph-rest-1.0 Find more info here */ public function post(AppManagementPolicy $body, ?AppManagementPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AppManagementPoliciesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AppManagementPoliciesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AppManagementPolicy $body, ?AppManageme $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/AppManagementPolicies/Count/CountRequestBuilder.php b/src/Generated/Policies/AppManagementPolicies/Count/CountRequestBuilder.php index fef59157ff6..f144c610646 100644 --- a/src/Generated/Policies/AppManagementPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/AppManagementPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/AppManagementPolicies/Item/AppManagementPolicyItemRequestBuilder.php b/src/Generated/Policies/AppManagementPolicies/Item/AppManagementPolicyItemRequestBuilder.php index a6cb93b2bf7..509aaef4aea 100644 --- a/src/Generated/Policies/AppManagementPolicies/Item/AppManagementPolicyItemRequestBuilder.php +++ b/src/Generated/Policies/AppManagementPolicies/Item/AppManagementPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppManagementPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\AppManagementPolicies\Item\AppliesTo\AppliesToRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an appManagementPolicy object. This API is available in the following national cloud deployments. * @param AppManagementPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/appmanagementpolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AppManagementPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties of an appManagementPolicy object. This API is available in the following national cloud deployments. * @param AppManagementPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/appmanagementpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?AppManagementPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an appManagementPolicy object. This API is available in the following national cloud deployments. * @param AppManagementPolicy $body The request body * @param AppManagementPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/appmanagementpolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(AppManagementPolicy $body, ?AppManagementPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?AppManagementPolicyItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?AppManagementPolicyItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?AppManagementPolicyItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(AppManagementPolicy $body, ?AppManagem $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/AppManagementPolicies/Item/AppliesTo/AppliesToRequestBuilder.php b/src/Generated/Policies/AppManagementPolicies/Item/AppliesTo/AppliesToRequestBuilder.php index b9612339861..4b6181d0622 100644 --- a/src/Generated/Policies/AppManagementPolicies/Item/AppliesTo/AppliesToRequestBuilder.php +++ b/src/Generated/Policies/AppManagementPolicies/Item/AppliesTo/AppliesToRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\AppManagementPolicies\Item\AppliesTo\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List application and service principal objects that are assigned an appManagementPolicy policy object. This API is available in the following national cloud deployments. * @param AppliesToRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/appmanagementpolicy-list-appliesto?view=graph-rest-1.0 Find more info here */ public function get(?AppliesToRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/AppManagementPolicies/Item/AppliesTo/Count/CountRequestBuilder.php b/src/Generated/Policies/AppManagementPolicies/Item/AppliesTo/Count/CountRequestBuilder.php index 0015407566a..0e54c84a24a 100644 --- a/src/Generated/Policies/AppManagementPolicies/Item/AppliesTo/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/AppManagementPolicies/Item/AppliesTo/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/AppManagementPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Policies/AppManagementPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php index 42d27a8228a..4f9b93a0169 100644 --- a/src/Generated/Policies/AppManagementPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Policies/AppManagementPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of applications and service principals to which the policy is applied. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/AuthenticationFlowsPolicy/AuthenticationFlowsPolicyRequestBuilder.php b/src/Generated/Policies/AuthenticationFlowsPolicy/AuthenticationFlowsPolicyRequestBuilder.php index 7ae6b8e71d0..ce6750a1c4c 100644 --- a/src/Generated/Policies/AuthenticationFlowsPolicy/AuthenticationFlowsPolicyRequestBuilder.php +++ b/src/Generated/Policies/AuthenticationFlowsPolicy/AuthenticationFlowsPolicyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationFlowsPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property authenticationFlowsPolicy for policies * @param AuthenticationFlowsPolicyRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AuthenticationFlowsPolicyRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an authenticationFlowsPolicy object. This API is available in the following national cloud deployments. * @param AuthenticationFlowsPolicyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationflowspolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?AuthenticationFlowsPolicyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationFlowsPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationFlowsPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the selfServiceSignUp property of an authenticationFlowsPolicy object. The properties id, type, and description cannot be modified. This API is available in the following national cloud deployments. * @param AuthenticationFlowsPolicy $body The request body * @param AuthenticationFlowsPolicyRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationflowspolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(AuthenticationFlowsPolicy $body, ?AuthenticationFlowsPolicyRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationFlowsPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationFlowsPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AuthenticationFlowsPolicyRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AuthenticationFlowsPolicyRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AuthenticationFlowsPolicyRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(AuthenticationFlowsPolicy $body, ?Auth $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/AuthenticationMethodConfigurationsRequestBuilder.php b/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/AuthenticationMethodConfigurationsRequestBuilder.php index 94fa1b20545..5b8d3bf7b69 100644 --- a/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/AuthenticationMethodConfigurationsRequestBuilder.php +++ b/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/AuthenticationMethodConfigurationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationMethodConfiguration; use Microsoft\Graph\Generated\Models\AuthenticationMethodConfigurationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents the settings for each authentication method. Automatically expanded on GET /policies/authenticationMethodsPolicy. * @param AuthenticationMethodConfigurationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthenticationMethodConfigurationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to authenticationMethodConfigurations for policies * @param AuthenticationMethodConfiguration $body The request body * @param AuthenticationMethodConfigurationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AuthenticationMethodConfiguration $body, ?AuthenticationMethodConfigurationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?AuthenticationMethodConfigurationsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?AuthenticationMethodConfigurationsReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AuthenticationMethodConfiguration $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Count/CountRequestBuilder.php b/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Count/CountRequestBuilder.php index c51196d218e..647c4e99fc1 100644 --- a/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Item/AuthenticationMethodConfigurationItemRequestBuilder.php b/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Item/AuthenticationMethodConfigurationItemRequestBuilder.php index a5e4de3a199..f87d1f853e6 100644 --- a/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Item/AuthenticationMethodConfigurationItemRequestBuilder.php +++ b/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodConfigurations/Item/AuthenticationMethodConfigurationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationMethodConfiguration; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property authenticationMethodConfigurations for policies * @param AuthenticationMethodConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AuthenticationMethodConfigurationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the settings for each authentication method. Automatically expanded on GET /policies/authenticationMethodsPolicy. * @param AuthenticationMethodConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthenticationMethodConfigurationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property authenticationMethodConfigurations in policies * @param AuthenticationMethodConfiguration $body The request body * @param AuthenticationMethodConfigurationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AuthenticationMethodConfiguration $body, ?AuthenticationMethodConfigurationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AuthenticationMethodConfigurationIte $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AuthenticationMethodConfigurationItemRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AuthenticationMethodConfigurationItemRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AuthenticationMethodConfiguration $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodsPolicyRequestBuilder.php b/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodsPolicyRequestBuilder.php index 9fb2d9603f4..c690a467b4a 100644 --- a/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodsPolicyRequestBuilder.php +++ b/src/Generated/Policies/AuthenticationMethodsPolicy/AuthenticationMethodsPolicyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationMethodsPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\AuthenticationMethodsPolicy\AuthenticationMethodConfigurations\AuthenticationMethodConfigurationsRequestBuilder; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property authenticationMethodsPolicy for policies * @param AuthenticationMethodsPolicyRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AuthenticationMethodsPolicyRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an authenticationMethodsPolicy object. This API is available in the following national cloud deployments. * @param AuthenticationMethodsPolicyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationmethodspolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?AuthenticationMethodsPolicyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodsPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodsPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an authenticationMethodsPolicy object. This API is available in the following national cloud deployments. * @param AuthenticationMethodsPolicy $body The request body * @param AuthenticationMethodsPolicyRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationmethodspolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(AuthenticationMethodsPolicy $body, ?AuthenticationMethodsPolicyRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodsPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodsPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?AuthenticationMethodsPolicyRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?AuthenticationMethodsPolicyRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?AuthenticationMethodsPolicyRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(AuthenticationMethodsPolicy $body, ?Au $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/AuthenticationStrengthPolicies/AuthenticationStrengthPoliciesRequestBuilder.php b/src/Generated/Policies/AuthenticationStrengthPolicies/AuthenticationStrengthPoliciesRequestBuilder.php index f569ce5e2a1..2cea73f844a 100644 --- a/src/Generated/Policies/AuthenticationStrengthPolicies/AuthenticationStrengthPoliciesRequestBuilder.php +++ b/src/Generated/Policies/AuthenticationStrengthPolicies/AuthenticationStrengthPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationStrengthPolicy; use Microsoft\Graph\Generated\Models\AuthenticationStrengthPolicyCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the authenticationStrengthPolicy objects and their properties. This API returns both built-in and custom policies. This API is available in the following national cloud deployments. * @param AuthenticationStrengthPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthroot-list-policies?view=graph-rest-1.0 Find more info here */ public function get(?AuthenticationStrengthPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new custom authenticationStrengthPolicy object. This API is available in the following national cloud deployments. * @param AuthenticationStrengthPolicy $body The request body * @param AuthenticationStrengthPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthroot-post-policies?view=graph-rest-1.0 Find more info here */ public function post(AuthenticationStrengthPolicy $body, ?AuthenticationStrengthPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AuthenticationStrengthPoliciesRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AuthenticationStrengthPoliciesRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AuthenticationStrengthPolicy $body, ?Au $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/AuthenticationStrengthPolicies/Count/CountRequestBuilder.php b/src/Generated/Policies/AuthenticationStrengthPolicies/Count/CountRequestBuilder.php index e4582408997..3ebbe994c26 100644 --- a/src/Generated/Policies/AuthenticationStrengthPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/AuthenticationStrengthPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/AuthenticationStrengthPolicies/Item/AuthenticationStrengthPolicyItemRequestBuilder.php b/src/Generated/Policies/AuthenticationStrengthPolicies/Item/AuthenticationStrengthPolicyItemRequestBuilder.php index 1ba8521b04e..15f027db03e 100644 --- a/src/Generated/Policies/AuthenticationStrengthPolicies/Item/AuthenticationStrengthPolicyItemRequestBuilder.php +++ b/src/Generated/Policies/AuthenticationStrengthPolicies/Item/AuthenticationStrengthPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationStrengthPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\AuthenticationStrengthPolicies\Item\CombinationConfigurations\CombinationConfigurationsRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a custom authenticationStrengthPolicy object. This API is available in the following national cloud deployments. * @param AuthenticationStrengthPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthroot-delete-policies?view=graph-rest-1.0 Find more info here */ public function delete(?AuthenticationStrengthPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an authenticationStrengthPolicy object. This API is available in the following national cloud deployments. * @param AuthenticationStrengthPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?AuthenticationStrengthPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an authenticationStrengthPolicy object. You cannot update the allowed auth method combinations using this request. To do so, use the Update allowed combinations action. This API is available in the following national cloud deployments. * @param AuthenticationStrengthPolicy $body The request body * @param AuthenticationStrengthPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthpolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(AuthenticationStrengthPolicy $body, ?AuthenticationStrengthPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?AuthenticationStrengthPolicyItemRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?AuthenticationStrengthPolicyItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?AuthenticationStrengthPolicyItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(AuthenticationStrengthPolicy $body, ?A $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/AuthenticationStrengthPolicies/Item/CombinationConfigurations/CombinationConfigurationsRequestBuilder.php b/src/Generated/Policies/AuthenticationStrengthPolicies/Item/CombinationConfigurations/CombinationConfigurationsRequestBuilder.php index 5ac357b92d4..dc605656de8 100644 --- a/src/Generated/Policies/AuthenticationStrengthPolicies/Item/CombinationConfigurations/CombinationConfigurationsRequestBuilder.php +++ b/src/Generated/Policies/AuthenticationStrengthPolicies/Item/CombinationConfigurations/CombinationConfigurationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationCombinationConfiguration; use Microsoft\Graph\Generated\Models\AuthenticationCombinationConfigurationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the authenticationCombinationConfiguration objects for an authentication strength policy. authenticationCombinationConfiguration represents requirements placed on specific authentication method combinations that require specified variants of those authentication methods to be used when authenticating. Currently, only fido2combinationConfigurations objects are supported. authenticationCombinationConfiguration objects are supported only for custom authentication strengths. This API is available in the following national cloud deployments. * @param CombinationConfigurationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthpolicy-list-combinationconfigurations?view=graph-rest-1.0 Find more info here */ public function get(?CombinationConfigurationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfigurationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new authenticationCombinationConfiguration object. In use, only fido2combinationConfigurations may be created, and these may only be created for custom authentication strength policies. This API is available in the following national cloud deployments. * @param AuthenticationCombinationConfiguration $body The request body * @param CombinationConfigurationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthpolicy-post-combinationconfigurations?view=graph-rest-1.0 Find more info here */ public function post(AuthenticationCombinationConfiguration $body, ?CombinationConfigurationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CombinationConfigurationsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CombinationConfigurationsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AuthenticationCombinationConfiguration $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/AuthenticationStrengthPolicies/Item/CombinationConfigurations/Count/CountRequestBuilder.php b/src/Generated/Policies/AuthenticationStrengthPolicies/Item/CombinationConfigurations/Count/CountRequestBuilder.php index 6170d5c5e0d..090206af525 100644 --- a/src/Generated/Policies/AuthenticationStrengthPolicies/Item/CombinationConfigurations/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/AuthenticationStrengthPolicies/Item/CombinationConfigurations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/AuthenticationStrengthPolicies/Item/CombinationConfigurations/Item/AuthenticationCombinationConfigurationItemRequestBuilder.php b/src/Generated/Policies/AuthenticationStrengthPolicies/Item/CombinationConfigurations/Item/AuthenticationCombinationConfigurationItemRequestBuilder.php index 1f2aeca3fad..867c16563b9 100644 --- a/src/Generated/Policies/AuthenticationStrengthPolicies/Item/CombinationConfigurations/Item/AuthenticationCombinationConfigurationItemRequestBuilder.php +++ b/src/Generated/Policies/AuthenticationStrengthPolicies/Item/CombinationConfigurations/Item/AuthenticationCombinationConfigurationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationCombinationConfiguration; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an authenticationCombinationConfiguration for a custom authenticationStrengthPolicy object. This API is available in the following national cloud deployments. * @param AuthenticationCombinationConfigurationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthpolicy-delete-combinationconfigurations?view=graph-rest-1.0 Find more info here */ public function delete(?AuthenticationCombinationConfigurationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an authenticationCombinationConfiguration object. This API is available in the following national cloud deployments. * @param AuthenticationCombinationConfigurationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationcombinationconfiguration-get?view=graph-rest-1.0 Find more info here */ public function get(?AuthenticationCombinationConfigurationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an authenticationCombinationConfiguration object. In use, only fido2combinationConfigurations may be updated as they're the only type of authenticationCombinationConfiguration that may be created. This API is available in the following national cloud deployments. * @param AuthenticationCombinationConfiguration $body The request body * @param AuthenticationCombinationConfigurationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationcombinationconfiguration-update?view=graph-rest-1.0 Find more info here */ public function patch(AuthenticationCombinationConfiguration $body, ?AuthenticationCombinationConfigurationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationCombinationConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?AuthenticationCombinationConfigurati $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?AuthenticationCombinationConfigurationI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?AuthenticationCombinationConfigurationI } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(AuthenticationCombinationConfiguration $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/AuthenticationStrengthPolicies/Item/UpdateAllowedCombinations/UpdateAllowedCombinationsRequestBuilder.php b/src/Generated/Policies/AuthenticationStrengthPolicies/Item/UpdateAllowedCombinations/UpdateAllowedCombinationsRequestBuilder.php index 1b3956e369b..4c3f998ad8e 100644 --- a/src/Generated/Policies/AuthenticationStrengthPolicies/Item/UpdateAllowedCombinations/UpdateAllowedCombinationsRequestBuilder.php +++ b/src/Generated/Policies/AuthenticationStrengthPolicies/Item/UpdateAllowedCombinations/UpdateAllowedCombinationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UpdateAllowedCombinationsResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Update the allowedCombinations property of an authenticationStrengthPolicy object. To update other properties of an authenticationStrengthPolicy object, use the Update authenticationStrengthPolicy method. This API is available in the following national cloud deployments. * @param UpdateAllowedCombinationsPostRequestBody $body The request body * @param UpdateAllowedCombinationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationstrengthpolicy-updateallowedcombinations?view=graph-rest-1.0 Find more info here */ public function post(UpdateAllowedCombinationsPostRequestBody $body, ?UpdateAllowedCombinationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UpdateAllowedCombinationsResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UpdateAllowedCombinationsResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(UpdateAllowedCombinationsPostRequestBod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/AuthenticationStrengthPolicies/Item/Usage/UsageRequestBuilder.php b/src/Generated/Policies/AuthenticationStrengthPolicies/Item/Usage/UsageRequestBuilder.php index 1469a7184ad..54a0a51b561 100644 --- a/src/Generated/Policies/AuthenticationStrengthPolicies/Item/Usage/UsageRequestBuilder.php +++ b/src/Generated/Policies/AuthenticationStrengthPolicies/Item/Usage/UsageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationStrengthUsage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function usage * @param UsageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UsageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthUsage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationStrengthUsage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?UsageRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/AuthorizationPolicy/AuthorizationPolicyRequestBuilder.php b/src/Generated/Policies/AuthorizationPolicy/AuthorizationPolicyRequestBuilder.php index 6ab0264c27e..bd11d6046e5 100644 --- a/src/Generated/Policies/AuthorizationPolicy/AuthorizationPolicyRequestBuilder.php +++ b/src/Generated/Policies/AuthorizationPolicy/AuthorizationPolicyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthorizationPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property authorizationPolicy for policies * @param AuthorizationPolicyRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AuthorizationPolicyRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of an authorizationPolicy object. This API is available in the following national cloud deployments. * @param AuthorizationPolicyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authorizationpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?AuthorizationPolicyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthorizationPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthorizationPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an authorizationPolicy object. This API is available in the following national cloud deployments. * @param AuthorizationPolicy $body The request body * @param AuthorizationPolicyRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authorizationpolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(AuthorizationPolicy $body, ?AuthorizationPolicyRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthorizationPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthorizationPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AuthorizationPolicyRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AuthorizationPolicyRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AuthorizationPolicyRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(AuthorizationPolicy $body, ?Authorizat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/ClaimsMappingPolicies/ClaimsMappingPoliciesRequestBuilder.php b/src/Generated/Policies/ClaimsMappingPolicies/ClaimsMappingPoliciesRequestBuilder.php index 632bdbd8fd0..b4dac7b288c 100644 --- a/src/Generated/Policies/ClaimsMappingPolicies/ClaimsMappingPoliciesRequestBuilder.php +++ b/src/Generated/Policies/ClaimsMappingPolicies/ClaimsMappingPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ClaimsMappingPolicy; use Microsoft\Graph\Generated\Models\ClaimsMappingPolicyCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of claimsMappingPolicy objects. This API is available in the following national cloud deployments. * @param ClaimsMappingPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/claimsmappingpolicy-list?view=graph-rest-1.0 Find more info here */ public function get(?ClaimsMappingPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ClaimsMappingPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ClaimsMappingPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new claimsMappingPolicy object. This API is available in the following national cloud deployments. * @param ClaimsMappingPolicy $body The request body * @param ClaimsMappingPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/claimsmappingpolicy-post-claimsmappingpolicies?view=graph-rest-1.0 Find more info here */ public function post(ClaimsMappingPolicy $body, ?ClaimsMappingPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ClaimsMappingPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ClaimsMappingPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ClaimsMappingPoliciesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ClaimsMappingPoliciesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ClaimsMappingPolicy $body, ?ClaimsMappi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/ClaimsMappingPolicies/Count/CountRequestBuilder.php b/src/Generated/Policies/ClaimsMappingPolicies/Count/CountRequestBuilder.php index e279f548fa8..2252f96432b 100644 --- a/src/Generated/Policies/ClaimsMappingPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/ClaimsMappingPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/ClaimsMappingPolicies/Item/AppliesTo/AppliesToRequestBuilder.php b/src/Generated/Policies/ClaimsMappingPolicies/Item/AppliesTo/AppliesToRequestBuilder.php index 57f13416653..accb47ca9c5 100644 --- a/src/Generated/Policies/ClaimsMappingPolicies/Item/AppliesTo/AppliesToRequestBuilder.php +++ b/src/Generated/Policies/ClaimsMappingPolicies/Item/AppliesTo/AppliesToRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\ClaimsMappingPolicies\Item\AppliesTo\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get appliesTo from policies * @param AppliesToRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppliesToRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/ClaimsMappingPolicies/Item/AppliesTo/Count/CountRequestBuilder.php b/src/Generated/Policies/ClaimsMappingPolicies/Item/AppliesTo/Count/CountRequestBuilder.php index de56a48744d..9c72983a867 100644 --- a/src/Generated/Policies/ClaimsMappingPolicies/Item/AppliesTo/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/ClaimsMappingPolicies/Item/AppliesTo/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/ClaimsMappingPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Policies/ClaimsMappingPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php index 79f5be1837f..9133e16c9e6 100644 --- a/src/Generated/Policies/ClaimsMappingPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Policies/ClaimsMappingPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get appliesTo from policies * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/ClaimsMappingPolicies/Item/ClaimsMappingPolicyItemRequestBuilder.php b/src/Generated/Policies/ClaimsMappingPolicies/Item/ClaimsMappingPolicyItemRequestBuilder.php index 9ebaa47429f..4bcdc32bdef 100644 --- a/src/Generated/Policies/ClaimsMappingPolicies/Item/ClaimsMappingPolicyItemRequestBuilder.php +++ b/src/Generated/Policies/ClaimsMappingPolicies/Item/ClaimsMappingPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ClaimsMappingPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\ClaimsMappingPolicies\Item\AppliesTo\AppliesToRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a claimsMappingPolicy object. This API is available in the following national cloud deployments. * @param ClaimsMappingPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/claimsmappingpolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ClaimsMappingPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a claimsMappingPolicy object. This API is available in the following national cloud deployments. * @param ClaimsMappingPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/claimsmappingpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?ClaimsMappingPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ClaimsMappingPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ClaimsMappingPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a claimsMappingPolicy object. This API is available in the following national cloud deployments. * @param ClaimsMappingPolicy $body The request body * @param ClaimsMappingPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/claimsmappingpolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(ClaimsMappingPolicy $body, ?ClaimsMappingPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ClaimsMappingPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ClaimsMappingPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?ClaimsMappingPolicyItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?ClaimsMappingPolicyItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?ClaimsMappingPolicyItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(ClaimsMappingPolicy $body, ?ClaimsMapp $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/ConditionalAccessPolicies/ConditionalAccessPoliciesRequestBuilder.php b/src/Generated/Policies/ConditionalAccessPolicies/ConditionalAccessPoliciesRequestBuilder.php index 9abfe5bff88..e39cb6e0e86 100644 --- a/src/Generated/Policies/ConditionalAccessPolicies/ConditionalAccessPoliciesRequestBuilder.php +++ b/src/Generated/Policies/ConditionalAccessPolicies/ConditionalAccessPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConditionalAccessPolicy; use Microsoft\Graph\Generated\Models\ConditionalAccessPolicyCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The custom rules that define an access scenario. * @param ConditionalAccessPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ConditionalAccessPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to conditionalAccessPolicies for policies * @param ConditionalAccessPolicy $body The request body * @param ConditionalAccessPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ConditionalAccessPolicy $body, ?ConditionalAccessPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ConditionalAccessPoliciesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ConditionalAccessPoliciesRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ConditionalAccessPolicy $body, ?Conditi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/ConditionalAccessPolicies/Count/CountRequestBuilder.php b/src/Generated/Policies/ConditionalAccessPolicies/Count/CountRequestBuilder.php index 62270bdeeee..1727de6726f 100644 --- a/src/Generated/Policies/ConditionalAccessPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/ConditionalAccessPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/ConditionalAccessPolicies/Item/ConditionalAccessPolicyItemRequestBuilder.php b/src/Generated/Policies/ConditionalAccessPolicies/Item/ConditionalAccessPolicyItemRequestBuilder.php index f78db51b43a..31ad0caeda2 100644 --- a/src/Generated/Policies/ConditionalAccessPolicies/Item/ConditionalAccessPolicyItemRequestBuilder.php +++ b/src/Generated/Policies/ConditionalAccessPolicies/Item/ConditionalAccessPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConditionalAccessPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property conditionalAccessPolicies for policies * @param ConditionalAccessPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ConditionalAccessPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The custom rules that define an access scenario. * @param ConditionalAccessPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ConditionalAccessPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property conditionalAccessPolicies in policies * @param ConditionalAccessPolicy $body The request body * @param ConditionalAccessPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ConditionalAccessPolicy $body, ?ConditionalAccessPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConditionalAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ConditionalAccessPolicyItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ConditionalAccessPolicyItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ConditionalAccessPolicyItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ConditionalAccessPolicy $body, ?Condit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/CrossTenantAccessPolicy/CrossTenantAccessPolicyRequestBuilder.php b/src/Generated/Policies/CrossTenantAccessPolicy/CrossTenantAccessPolicyRequestBuilder.php index a342f040390..801ee9a9462 100644 --- a/src/Generated/Policies/CrossTenantAccessPolicy/CrossTenantAccessPolicyRequestBuilder.php +++ b/src/Generated/Policies/CrossTenantAccessPolicy/CrossTenantAccessPolicyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CrossTenantAccessPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\CrossTenantAccessPolicy\EscapedDefault\DefaultRequestBuilder; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property crossTenantAccessPolicy for policies * @param CrossTenantAccessPolicyRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CrossTenantAccessPolicyRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a crossTenantAccessPolicy object. This API is available in the following national cloud deployments. * @param CrossTenantAccessPolicyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/crosstenantaccesspolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?CrossTenantAccessPolicyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a cross-tenant access policy. This API is available in the following national cloud deployments. * @param CrossTenantAccessPolicy $body The request body * @param CrossTenantAccessPolicyRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/crosstenantaccesspolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(CrossTenantAccessPolicy $body, ?CrossTenantAccessPolicyRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?CrossTenantAccessPolicyRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?CrossTenantAccessPolicyRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?CrossTenantAccessPolicyRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(CrossTenantAccessPolicy $body, ?CrossT $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/CrossTenantAccessPolicy/EscapedDefault/DefaultRequestBuilder.php b/src/Generated/Policies/CrossTenantAccessPolicy/EscapedDefault/DefaultRequestBuilder.php index 603bdff5d57..582ac3e1dda 100644 --- a/src/Generated/Policies/CrossTenantAccessPolicy/EscapedDefault/DefaultRequestBuilder.php +++ b/src/Generated/Policies/CrossTenantAccessPolicy/EscapedDefault/DefaultRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CrossTenantAccessPolicyConfigurationDefault; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\CrossTenantAccessPolicy\EscapedDefault\ResetToSystemDefault\ResetToSystemDefaultRequestBuilder; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property default for policies * @param DefaultRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DefaultRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read the default configuration of a cross-tenant access policy. This default configuration may be the service default assigned by Azure AD (isServiceDefault is true) or may be customized in your tenant (isServiceDefault is false). This API is available in the following national cloud deployments. + * Read the default configuration of a cross-tenant access policy. This default configuration may be the service default assigned by Microsoft Entra ID (isServiceDefault is true) or may be customized in your tenant (isServiceDefault is false). This API is available in the following national cloud deployments. * @param DefaultRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/crosstenantaccesspolicyconfigurationdefault-get?view=graph-rest-1.0 Find more info here */ public function get(?DefaultRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicyConfigurationDefault::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicyConfigurationDefault::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the default configuration of a cross-tenant access policy. This API is available in the following national cloud deployments. * @param CrossTenantAccessPolicyConfigurationDefault $body The request body * @param DefaultRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/crosstenantaccesspolicyconfigurationdefault-update?view=graph-rest-1.0 Find more info here */ public function patch(CrossTenantAccessPolicyConfigurationDefault $body, ?DefaultRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicyConfigurationDefault::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicyConfigurationDefault::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,11 +100,12 @@ public function toDeleteRequestInformation(?DefaultRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read the default configuration of a cross-tenant access policy. This default configuration may be the service default assigned by Azure AD (isServiceDefault is true) or may be customized in your tenant (isServiceDefault is false). This API is available in the following national cloud deployments. + * Read the default configuration of a cross-tenant access policy. This default configuration may be the service default assigned by Microsoft Entra ID (isServiceDefault is true) or may be customized in your tenant (isServiceDefault is false). This API is available in the following national cloud deployments. * @param DefaultRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -123,7 +114,6 @@ public function toGetRequestInformation(?DefaultRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?DefaultRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(CrossTenantAccessPolicyConfigurationDe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/CrossTenantAccessPolicy/EscapedDefault/DefaultRequestBuilderGetQueryParameters.php b/src/Generated/Policies/CrossTenantAccessPolicy/EscapedDefault/DefaultRequestBuilderGetQueryParameters.php index 9684f6e38ee..8baf6dbee04 100644 --- a/src/Generated/Policies/CrossTenantAccessPolicy/EscapedDefault/DefaultRequestBuilderGetQueryParameters.php +++ b/src/Generated/Policies/CrossTenantAccessPolicy/EscapedDefault/DefaultRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read the default configuration of a cross-tenant access policy. This default configuration may be the service default assigned by Azure AD (isServiceDefault is true) or may be customized in your tenant (isServiceDefault is false). This API is available in the following national cloud deployments. + * Read the default configuration of a cross-tenant access policy. This default configuration may be the service default assigned by Microsoft Entra ID (isServiceDefault is true) or may be customized in your tenant (isServiceDefault is false). This API is available in the following national cloud deployments. */ class DefaultRequestBuilderGetQueryParameters { diff --git a/src/Generated/Policies/CrossTenantAccessPolicy/EscapedDefault/ResetToSystemDefault/ResetToSystemDefaultRequestBuilder.php b/src/Generated/Policies/CrossTenantAccessPolicy/EscapedDefault/ResetToSystemDefault/ResetToSystemDefaultRequestBuilder.php index 6ce28ad4788..ae48306bee4 100644 --- a/src/Generated/Policies/CrossTenantAccessPolicy/EscapedDefault/ResetToSystemDefault/ResetToSystemDefaultRequestBuilder.php +++ b/src/Generated/Policies/CrossTenantAccessPolicy/EscapedDefault/ResetToSystemDefault/ResetToSystemDefaultRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reset any changes made to the default configuration in a cross-tenant access policy back to the system default. This API is available in the following national cloud deployments. * @param ResetToSystemDefaultRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/crosstenantaccesspolicyconfigurationdefault-resettosystemdefault?view=graph-rest-1.0 Find more info here */ public function post(?ResetToSystemDefaultRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ResetToSystemDefaultRequestBuilderPost $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Policies/CrossTenantAccessPolicy/Partners/Count/CountRequestBuilder.php b/src/Generated/Policies/CrossTenantAccessPolicy/Partners/Count/CountRequestBuilder.php index d06582fc822..a54447ddf89 100644 --- a/src/Generated/Policies/CrossTenantAccessPolicy/Partners/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/CrossTenantAccessPolicy/Partners/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/CrossTenantAccessPolicy/Partners/Item/CrossTenantAccessPolicyConfigurationPartnerTenantItemRequestBuilder.php b/src/Generated/Policies/CrossTenantAccessPolicy/Partners/Item/CrossTenantAccessPolicyConfigurationPartnerTenantItemRequestBuilder.php index 075a9d4d703..e642d59d212 100644 --- a/src/Generated/Policies/CrossTenantAccessPolicy/Partners/Item/CrossTenantAccessPolicyConfigurationPartnerTenantItemRequestBuilder.php +++ b/src/Generated/Policies/CrossTenantAccessPolicy/Partners/Item/CrossTenantAccessPolicyConfigurationPartnerTenantItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CrossTenantAccessPolicyConfigurationPartner; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\CrossTenantAccessPolicy\Partners\Item\IdentitySynchronization\IdentitySynchronizationRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a partner-specific configuration in a cross-tenant access policy. If a configuration includes a user synchronization policy, you must first delete the user synchronization policy before you can delete the partner-specific configuration. This API is available in the following national cloud deployments. * @param CrossTenantAccessPolicyConfigurationPartnerTenantItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/crosstenantaccesspolicyconfigurationpartner-delete?view=graph-rest-1.0 Find more info here */ public function delete(?CrossTenantAccessPolicyConfigurationPartnerTenantItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a partner-specific configuration. This API is available in the following national cloud deployments. * @param CrossTenantAccessPolicyConfigurationPartnerTenantItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/crosstenantaccesspolicyconfigurationpartner-get?view=graph-rest-1.0 Find more info here */ public function get(?CrossTenantAccessPolicyConfigurationPartnerTenantItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicyConfigurationPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicyConfigurationPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a partner-specific configuration. This API is available in the following national cloud deployments. * @param CrossTenantAccessPolicyConfigurationPartner $body The request body * @param CrossTenantAccessPolicyConfigurationPartnerTenantItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/crosstenantaccesspolicyconfigurationpartner-update?view=graph-rest-1.0 Find more info here */ public function patch(CrossTenantAccessPolicyConfigurationPartner $body, ?CrossTenantAccessPolicyConfigurationPartnerTenantItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicyConfigurationPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicyConfigurationPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?CrossTenantAccessPolicyConfiguration $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?CrossTenantAccessPolicyConfigurationPar $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?CrossTenantAccessPolicyConfigurationPar } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(CrossTenantAccessPolicyConfigurationPa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/CrossTenantAccessPolicy/Partners/Item/IdentitySynchronization/IdentitySynchronizationRequestBuilder.php b/src/Generated/Policies/CrossTenantAccessPolicy/Partners/Item/IdentitySynchronization/IdentitySynchronizationRequestBuilder.php index c105b218172..8047ff2e63a 100644 --- a/src/Generated/Policies/CrossTenantAccessPolicy/Partners/Item/IdentitySynchronization/IdentitySynchronizationRequestBuilder.php +++ b/src/Generated/Policies/CrossTenantAccessPolicy/Partners/Item/IdentitySynchronization/IdentitySynchronizationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CrossTenantIdentitySyncPolicyPartner; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the user synchronization policy for a partner-specific configuration. This API is available in the following national cloud deployments. * @param IdentitySynchronizationRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/crosstenantidentitysyncpolicypartner-delete?view=graph-rest-1.0 Find more info here */ public function delete(?IdentitySynchronizationRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the user synchronization policy of a partner-specific configuration. This API is available in the following national cloud deployments. * @param IdentitySynchronizationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/crosstenantidentitysyncpolicypartner-get?view=graph-rest-1.0 Find more info here */ public function get(?IdentitySynchronizationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantIdentitySyncPolicyPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantIdentitySyncPolicyPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property identitySynchronization in policies * @param CrossTenantIdentitySyncPolicyPartner $body The request body * @param IdentitySynchronizationRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(CrossTenantIdentitySyncPolicyPartner $body, ?IdentitySynchronizationRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantIdentitySyncPolicyPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantIdentitySyncPolicyPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?IdentitySynchronizationRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?IdentitySynchronizationRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?IdentitySynchronizationRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPutRequestInformation(CrossTenantIdentitySyncPolicyPartner $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/CrossTenantAccessPolicy/Partners/PartnersRequestBuilder.php b/src/Generated/Policies/CrossTenantAccessPolicy/Partners/PartnersRequestBuilder.php index 6b1cce308ac..2c5499b23a7 100644 --- a/src/Generated/Policies/CrossTenantAccessPolicy/Partners/PartnersRequestBuilder.php +++ b/src/Generated/Policies/CrossTenantAccessPolicy/Partners/PartnersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CrossTenantAccessPolicyConfigurationPartner; use Microsoft\Graph\Generated\Models\CrossTenantAccessPolicyConfigurationPartnerCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of all partner configurations within a cross-tenant access policy. You can also use the $expand parameter to list the user synchronization policy for all partner configurations. This API is available in the following national cloud deployments. * @param PartnersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/crosstenantaccesspolicy-list-partners?view=graph-rest-1.0 Find more info here */ public function get(?PartnersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicyConfigurationPartnerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicyConfigurationPartnerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new partner configuration in a cross-tenant access policy. This API is available in the following national cloud deployments. * @param CrossTenantAccessPolicyConfigurationPartner $body The request body * @param PartnersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/crosstenantaccesspolicy-post-partners?view=graph-rest-1.0 Find more info here */ public function post(CrossTenantAccessPolicyConfigurationPartner $body, ?PartnersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicyConfigurationPartner::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CrossTenantAccessPolicyConfigurationPartner::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PartnersRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PartnersRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(CrossTenantAccessPolicyConfigurationPar $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/DefaultAppManagementPolicy/DefaultAppManagementPolicyRequestBuilder.php b/src/Generated/Policies/DefaultAppManagementPolicy/DefaultAppManagementPolicyRequestBuilder.php index 845c5b55cff..2eacae084c2 100644 --- a/src/Generated/Policies/DefaultAppManagementPolicy/DefaultAppManagementPolicyRequestBuilder.php +++ b/src/Generated/Policies/DefaultAppManagementPolicy/DefaultAppManagementPolicyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TenantAppManagementPolicy; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property defaultAppManagementPolicy for policies * @param DefaultAppManagementPolicyRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DefaultAppManagementPolicyRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties of a tenantAppManagementPolicy object. This API is available in the following national cloud deployments. * @param DefaultAppManagementPolicyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tenantappmanagementpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?DefaultAppManagementPolicyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TenantAppManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TenantAppManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a tenantAppManagementPolicy object. This API is available in the following national cloud deployments. * @param TenantAppManagementPolicy $body The request body * @param DefaultAppManagementPolicyRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tenantappmanagementpolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(TenantAppManagementPolicy $body, ?DefaultAppManagementPolicyRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TenantAppManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TenantAppManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DefaultAppManagementPolicyRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DefaultAppManagementPolicyRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DefaultAppManagementPolicyRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(TenantAppManagementPolicy $body, ?Defa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/FeatureRolloutPolicies/Count/CountRequestBuilder.php b/src/Generated/Policies/FeatureRolloutPolicies/Count/CountRequestBuilder.php index b453d972ec2..4e564666d6f 100644 --- a/src/Generated/Policies/FeatureRolloutPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/FeatureRolloutPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/FeatureRolloutPolicies/FeatureRolloutPoliciesRequestBuilder.php b/src/Generated/Policies/FeatureRolloutPolicies/FeatureRolloutPoliciesRequestBuilder.php index 4b873bf299e..0032f6073f5 100644 --- a/src/Generated/Policies/FeatureRolloutPolicies/FeatureRolloutPoliciesRequestBuilder.php +++ b/src/Generated/Policies/FeatureRolloutPolicies/FeatureRolloutPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FeatureRolloutPolicy; use Microsoft\Graph\Generated\Models\FeatureRolloutPolicyCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of featureRolloutPolicy objects. This API is available in the following national cloud deployments. * @param FeatureRolloutPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/featurerolloutpolicies-list?view=graph-rest-1.0 Find more info here */ public function get(?FeatureRolloutPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FeatureRolloutPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FeatureRolloutPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new featureRolloutPolicy object. This API is available in the following national cloud deployments. * @param FeatureRolloutPolicy $body The request body * @param FeatureRolloutPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/featurerolloutpolicies-post?view=graph-rest-1.0 Find more info here */ public function post(FeatureRolloutPolicy $body, ?FeatureRolloutPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FeatureRolloutPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FeatureRolloutPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?FeatureRolloutPoliciesRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?FeatureRolloutPoliciesRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(FeatureRolloutPolicy $body, ?FeatureRol $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/AppliesToRequestBuilder.php b/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/AppliesToRequestBuilder.php index 8c30159b706..1837bcdafe9 100644 --- a/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/AppliesToRequestBuilder.php +++ b/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/AppliesToRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Nullable. Specifies a list of directoryObjects that feature is enabled for. * @param AppliesToRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppliesToRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add an appliesTo on a featureRolloutPolicy object to specify the directoryObject to which the featureRolloutPolicy should be applied. This API is available in the following national cloud deployments. * @param DirectoryObject $body The request body * @param AppliesToRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/featurerolloutpolicy-post-appliesto?view=graph-rest-1.0 Find more info here */ public function post(DirectoryObject $body, ?AppliesToRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(DirectoryObject $body, ?AppliesToReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/Count/CountRequestBuilder.php b/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/Count/CountRequestBuilder.php index 96209bffd3f..ee0fbde2a3e 100644 --- a/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/Item/Ref/RefRequestBuilder.php b/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/Item/Ref/RefRequestBuilder.php index 253a61c3840..e07cd5c8a73 100644 --- a/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an appliesTo on a featureRolloutPolicy object to remove the directoryObject from feature rollout. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/featurerolloutpolicy-delete-appliesto?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/Ref/RefRequestBuilder.php b/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/Ref/RefRequestBuilder.php index dbf9a2d3348..d46de740720 100644 --- a/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/Ref/RefRequestBuilder.php +++ b/src/Generated/Policies/FeatureRolloutPolicies/Item/AppliesTo/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,39 +34,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Nullable. Specifies a list of directoryObjects that feature is enabled for. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add an appliesTo on a featureRolloutPolicy object to specify the directoryObject to which the featureRolloutPolicy should be applied. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/featurerolloutpolicy-post-appliesto?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -80,7 +73,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +80,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -106,6 +99,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/FeatureRolloutPolicies/Item/FeatureRolloutPolicyItemRequestBuilder.php b/src/Generated/Policies/FeatureRolloutPolicies/Item/FeatureRolloutPolicyItemRequestBuilder.php index ea950553200..2a43218c52b 100644 --- a/src/Generated/Policies/FeatureRolloutPolicies/Item/FeatureRolloutPolicyItemRequestBuilder.php +++ b/src/Generated/Policies/FeatureRolloutPolicies/Item/FeatureRolloutPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FeatureRolloutPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\FeatureRolloutPolicies\Item\AppliesTo\AppliesToRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a featureRolloutPolicy object. This API is available in the following national cloud deployments. * @param FeatureRolloutPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/featurerolloutpolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?FeatureRolloutPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a featureRolloutPolicy object. This API is available in the following national cloud deployments. * @param FeatureRolloutPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/featurerolloutpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?FeatureRolloutPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FeatureRolloutPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FeatureRolloutPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of featureRolloutPolicy object. This API is available in the following national cloud deployments. * @param FeatureRolloutPolicy $body The request body * @param FeatureRolloutPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/featurerolloutpolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(FeatureRolloutPolicy $body, ?FeatureRolloutPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FeatureRolloutPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FeatureRolloutPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?FeatureRolloutPolicyItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?FeatureRolloutPolicyItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?FeatureRolloutPolicyItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(FeatureRolloutPolicy $body, ?FeatureRo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/HomeRealmDiscoveryPolicies/Count/CountRequestBuilder.php b/src/Generated/Policies/HomeRealmDiscoveryPolicies/Count/CountRequestBuilder.php index fc38af1b9c4..7932d687b80 100644 --- a/src/Generated/Policies/HomeRealmDiscoveryPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/HomeRealmDiscoveryPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/HomeRealmDiscoveryPolicies/HomeRealmDiscoveryPoliciesRequestBuilder.php b/src/Generated/Policies/HomeRealmDiscoveryPolicies/HomeRealmDiscoveryPoliciesRequestBuilder.php index 6dde32aed24..cbd772094fe 100644 --- a/src/Generated/Policies/HomeRealmDiscoveryPolicies/HomeRealmDiscoveryPoliciesRequestBuilder.php +++ b/src/Generated/Policies/HomeRealmDiscoveryPolicies/HomeRealmDiscoveryPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\HomeRealmDiscoveryPolicy; use Microsoft\Graph\Generated\Models\HomeRealmDiscoveryPolicyCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of homeRealmDiscoveryPolicy objects. This API is available in the following national cloud deployments. * @param HomeRealmDiscoveryPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/homerealmdiscoverypolicy-list?view=graph-rest-1.0 Find more info here */ public function get(?HomeRealmDiscoveryPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new homeRealmDiscoveryPolicy object. This API is available in the following national cloud deployments. * @param HomeRealmDiscoveryPolicy $body The request body * @param HomeRealmDiscoveryPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/homerealmdiscoverypolicy-post-homerealmdiscoverypolicies?view=graph-rest-1.0 Find more info here */ public function post(HomeRealmDiscoveryPolicy $body, ?HomeRealmDiscoveryPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?HomeRealmDiscoveryPoliciesRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?HomeRealmDiscoveryPoliciesRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(HomeRealmDiscoveryPolicy $body, ?HomeRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/AppliesTo/AppliesToRequestBuilder.php b/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/AppliesTo/AppliesToRequestBuilder.php index 6f8bd2c7443..7c0db025b8c 100644 --- a/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/AppliesTo/AppliesToRequestBuilder.php +++ b/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/AppliesTo/AppliesToRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\HomeRealmDiscoveryPolicies\Item\AppliesTo\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get appliesTo from policies * @param AppliesToRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppliesToRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/AppliesTo/Count/CountRequestBuilder.php b/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/AppliesTo/Count/CountRequestBuilder.php index 046f8ae9083..86a9cb60da8 100644 --- a/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/AppliesTo/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/AppliesTo/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php index 99a286ca741..a450b36a86a 100644 --- a/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get appliesTo from policies * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/HomeRealmDiscoveryPolicyItemRequestBuilder.php b/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/HomeRealmDiscoveryPolicyItemRequestBuilder.php index fad73fa4421..1bcdf674b81 100644 --- a/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/HomeRealmDiscoveryPolicyItemRequestBuilder.php +++ b/src/Generated/Policies/HomeRealmDiscoveryPolicies/Item/HomeRealmDiscoveryPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\HomeRealmDiscoveryPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\HomeRealmDiscoveryPolicies\Item\AppliesTo\AppliesToRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a homeRealmDiscoveryPolicy object. This API is available in the following national cloud deployments. * @param HomeRealmDiscoveryPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/homerealmdiscoverypolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?HomeRealmDiscoveryPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a homeRealmDiscoveryPolicy object. This API is available in the following national cloud deployments. * @param HomeRealmDiscoveryPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/homerealmdiscoverypolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?HomeRealmDiscoveryPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a homeRealmDiscoveryPolicy object. This API is available in the following national cloud deployments. * @param HomeRealmDiscoveryPolicy $body The request body * @param HomeRealmDiscoveryPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/homerealmdiscoverypolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(HomeRealmDiscoveryPolicy $body, ?HomeRealmDiscoveryPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?HomeRealmDiscoveryPolicyItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?HomeRealmDiscoveryPolicyItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?HomeRealmDiscoveryPolicyItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(HomeRealmDiscoveryPolicy $body, ?HomeR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/IdentitySecurityDefaultsEnforcementPolicy/IdentitySecurityDefaultsEnforcementPolicyRequestBuilder.php b/src/Generated/Policies/IdentitySecurityDefaultsEnforcementPolicy/IdentitySecurityDefaultsEnforcementPolicyRequestBuilder.php index e35eb4483b7..377ffcad713 100644 --- a/src/Generated/Policies/IdentitySecurityDefaultsEnforcementPolicy/IdentitySecurityDefaultsEnforcementPolicyRequestBuilder.php +++ b/src/Generated/Policies/IdentitySecurityDefaultsEnforcementPolicy/IdentitySecurityDefaultsEnforcementPolicyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\IdentitySecurityDefaultsEnforcementPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property identitySecurityDefaultsEnforcementPolicy for policies * @param IdentitySecurityDefaultsEnforcementPolicyRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?IdentitySecurityDefaultsEnforcementPolicyRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties of an identitySecurityDefaultsEnforcementPolicy object. This API is available in the following national cloud deployments. * @param IdentitySecurityDefaultsEnforcementPolicyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitysecuritydefaultsenforcementpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?IdentitySecurityDefaultsEnforcementPolicyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentitySecurityDefaultsEnforcementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentitySecurityDefaultsEnforcementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an identitySecurityDefaultsEnforcementPolicy object. This API is available in the following national cloud deployments. * @param IdentitySecurityDefaultsEnforcementPolicy $body The request body * @param IdentitySecurityDefaultsEnforcementPolicyRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/identitysecuritydefaultsenforcementpolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(IdentitySecurityDefaultsEnforcementPolicy $body, ?IdentitySecurityDefaultsEnforcementPolicyRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IdentitySecurityDefaultsEnforcementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IdentitySecurityDefaultsEnforcementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?IdentitySecurityDefaultsEnforcementP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?IdentitySecurityDefaultsEnforcementPoli $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?IdentitySecurityDefaultsEnforcementPoli } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(IdentitySecurityDefaultsEnforcementPol $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/PermissionGrantPolicies/Count/CountRequestBuilder.php b/src/Generated/Policies/PermissionGrantPolicies/Count/CountRequestBuilder.php index 102693e8c02..52691cae626 100644 --- a/src/Generated/Policies/PermissionGrantPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/PermissionGrantPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/PermissionGrantPolicies/Item/Excludes/Count/CountRequestBuilder.php b/src/Generated/Policies/PermissionGrantPolicies/Item/Excludes/Count/CountRequestBuilder.php index e30e51f2210..d819359bc9f 100644 --- a/src/Generated/Policies/PermissionGrantPolicies/Item/Excludes/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/PermissionGrantPolicies/Item/Excludes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/PermissionGrantPolicies/Item/Excludes/ExcludesRequestBuilder.php b/src/Generated/Policies/PermissionGrantPolicies/Item/Excludes/ExcludesRequestBuilder.php index 47161f69b9e..9987fde4e08 100644 --- a/src/Generated/Policies/PermissionGrantPolicies/Item/Excludes/ExcludesRequestBuilder.php +++ b/src/Generated/Policies/PermissionGrantPolicies/Item/Excludes/ExcludesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PermissionGrantConditionSet; use Microsoft\Graph\Generated\Models\PermissionGrantConditionSetCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the condition sets which are *excluded* in a permissionGrantPolicy. This API is available in the following national cloud deployments. * @param ExcludesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permissiongrantpolicy-list-excludes?view=graph-rest-1.0 Find more info here */ public function get(?ExcludesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add conditions under which a permission grant event is *excluded* in a permission grant policy. You do this by adding a permissionGrantConditionSet to the excludes collection of a permissionGrantPolicy. This API is available in the following national cloud deployments. * @param PermissionGrantConditionSet $body The request body * @param ExcludesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permissiongrantpolicy-post-excludes?view=graph-rest-1.0 Find more info here */ public function post(PermissionGrantConditionSet $body, ?ExcludesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ExcludesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ExcludesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(PermissionGrantConditionSet $body, ?Exc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/PermissionGrantPolicies/Item/Excludes/Item/PermissionGrantConditionSetItemRequestBuilder.php b/src/Generated/Policies/PermissionGrantPolicies/Item/Excludes/Item/PermissionGrantConditionSetItemRequestBuilder.php index 31aae7f5712..f7a2280e433 100644 --- a/src/Generated/Policies/PermissionGrantPolicies/Item/Excludes/Item/PermissionGrantConditionSetItemRequestBuilder.php +++ b/src/Generated/Policies/PermissionGrantPolicies/Item/Excludes/Item/PermissionGrantConditionSetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PermissionGrantConditionSet; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a permissionGrantConditionSet from the excludes collection of a permissionGrantPolicy. This API is available in the following national cloud deployments. * @param PermissionGrantConditionSetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permissiongrantpolicy-delete-excludes?view=graph-rest-1.0 Find more info here */ public function delete(?PermissionGrantConditionSetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Condition sets which are excluded in this permission grant policy. Automatically expanded on GET. * @param PermissionGrantConditionSetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PermissionGrantConditionSetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property excludes in policies * @param PermissionGrantConditionSet $body The request body * @param PermissionGrantConditionSetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PermissionGrantConditionSet $body, ?PermissionGrantConditionSetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?PermissionGrantConditionSetItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?PermissionGrantConditionSetItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?PermissionGrantConditionSetItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(PermissionGrantConditionSet $body, ?Pe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/PermissionGrantPolicies/Item/Includes/Count/CountRequestBuilder.php b/src/Generated/Policies/PermissionGrantPolicies/Item/Includes/Count/CountRequestBuilder.php index 2bfcefa75c4..b68d4989903 100644 --- a/src/Generated/Policies/PermissionGrantPolicies/Item/Includes/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/PermissionGrantPolicies/Item/Includes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/PermissionGrantPolicies/Item/Includes/IncludesRequestBuilder.php b/src/Generated/Policies/PermissionGrantPolicies/Item/Includes/IncludesRequestBuilder.php index 2858a10aa64..23a1c4c3662 100644 --- a/src/Generated/Policies/PermissionGrantPolicies/Item/Includes/IncludesRequestBuilder.php +++ b/src/Generated/Policies/PermissionGrantPolicies/Item/Includes/IncludesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PermissionGrantConditionSet; use Microsoft\Graph\Generated\Models\PermissionGrantConditionSetCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the condition sets which are *included* in a permissionGrantPolicy. This API is available in the following national cloud deployments. * @param IncludesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permissiongrantpolicy-list-includes?view=graph-rest-1.0 Find more info here */ public function get(?IncludesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add conditions under which a permission grant event is *included* in a permission grant policy. You do this by adding a permissionGrantConditionSet to the includes collection of a permissionGrantPolicy. This API is available in the following national cloud deployments. * @param PermissionGrantConditionSet $body The request body * @param IncludesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permissiongrantpolicy-post-includes?view=graph-rest-1.0 Find more info here */ public function post(PermissionGrantConditionSet $body, ?IncludesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?IncludesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?IncludesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(PermissionGrantConditionSet $body, ?Inc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/PermissionGrantPolicies/Item/Includes/Item/PermissionGrantConditionSetItemRequestBuilder.php b/src/Generated/Policies/PermissionGrantPolicies/Item/Includes/Item/PermissionGrantConditionSetItemRequestBuilder.php index 34d13db7061..c40c8d413b7 100644 --- a/src/Generated/Policies/PermissionGrantPolicies/Item/Includes/Item/PermissionGrantConditionSetItemRequestBuilder.php +++ b/src/Generated/Policies/PermissionGrantPolicies/Item/Includes/Item/PermissionGrantConditionSetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PermissionGrantConditionSet; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a permissionGrantConditionSet from the includes collection of a permissionGrantPolicy. This API is available in the following national cloud deployments. * @param PermissionGrantConditionSetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permissiongrantpolicy-delete-includes?view=graph-rest-1.0 Find more info here */ public function delete(?PermissionGrantConditionSetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Condition sets which are included in this permission grant policy. Automatically expanded on GET. * @param PermissionGrantConditionSetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PermissionGrantConditionSetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property includes in policies * @param PermissionGrantConditionSet $body The request body * @param PermissionGrantConditionSetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PermissionGrantConditionSet $body, ?PermissionGrantConditionSetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantConditionSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?PermissionGrantConditionSetItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?PermissionGrantConditionSetItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?PermissionGrantConditionSetItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(PermissionGrantConditionSet $body, ?Pe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/PermissionGrantPolicies/Item/PermissionGrantPolicyItemRequestBuilder.php b/src/Generated/Policies/PermissionGrantPolicies/Item/PermissionGrantPolicyItemRequestBuilder.php index 10c1e086dc9..daec3f39276 100644 --- a/src/Generated/Policies/PermissionGrantPolicies/Item/PermissionGrantPolicyItemRequestBuilder.php +++ b/src/Generated/Policies/PermissionGrantPolicies/Item/PermissionGrantPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PermissionGrantPolicy; use Microsoft\Graph\Generated\Policies\PermissionGrantPolicies\Item\Excludes\ExcludesRequestBuilder; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a permissionGrantPolicy object. This API is available in the following national cloud deployments. * @param PermissionGrantPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permissiongrantpolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?PermissionGrantPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single permissionGrantPolicy object. This API is available in the following national cloud deployments. * @param PermissionGrantPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permissiongrantpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?PermissionGrantPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update properties of a permissionGrantPolicy. This API is available in the following national cloud deployments. * @param PermissionGrantPolicy $body The request body * @param PermissionGrantPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permissiongrantpolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(PermissionGrantPolicy $body, ?PermissionGrantPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?PermissionGrantPolicyItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?PermissionGrantPolicyItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?PermissionGrantPolicyItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(PermissionGrantPolicy $body, ?Permissi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/PermissionGrantPolicies/PermissionGrantPoliciesRequestBuilder.php b/src/Generated/Policies/PermissionGrantPolicies/PermissionGrantPoliciesRequestBuilder.php index fe3fff5ca96..6d8d9d671ce 100644 --- a/src/Generated/Policies/PermissionGrantPolicies/PermissionGrantPoliciesRequestBuilder.php +++ b/src/Generated/Policies/PermissionGrantPolicies/PermissionGrantPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PermissionGrantPolicy; use Microsoft\Graph\Generated\Models\PermissionGrantPolicyCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of permissionGrantPolicy objects. This API is available in the following national cloud deployments. * @param PermissionGrantPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permissiongrantpolicy-list?view=graph-rest-1.0 Find more info here */ public function get(?PermissionGrantPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Creates a permissionGrantPolicy. A permission grant policy is used to describe the conditions under which permissions can be granted (for example, during application consent). After creating the permission grant policy, you can add include condition sets to add matching rules, and add exclude condition sets to add exclusion rules. This API is available in the following national cloud deployments. * @param PermissionGrantPolicy $body The request body * @param PermissionGrantPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permissiongrantpolicy-post-permissiongrantpolicies?view=graph-rest-1.0 Find more info here */ public function post(PermissionGrantPolicy $body, ?PermissionGrantPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionGrantPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PermissionGrantPoliciesRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PermissionGrantPoliciesRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(PermissionGrantPolicy $body, ?Permissio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/PoliciesRequestBuilder.php b/src/Generated/Policies/PoliciesRequestBuilder.php index 3bd85945019..8c1646b1a21 100644 --- a/src/Generated/Policies/PoliciesRequestBuilder.php +++ b/src/Generated/Policies/PoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PolicyRoot; use Microsoft\Graph\Generated\Policies\ActivityBasedTimeoutPolicies\ActivityBasedTimeoutPoliciesRequestBuilder; @@ -186,38 +185,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get policies * @param PoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PolicyRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PolicyRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update policies * @param PolicyRoot $body The request body * @param PoliciesRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PolicyRoot $body, ?PoliciesRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PolicyRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PolicyRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -230,7 +223,6 @@ public function toGetRequestInformation(?PoliciesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -238,6 +230,7 @@ public function toGetRequestInformation(?PoliciesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -252,11 +245,11 @@ public function toPatchRequestInformation(PolicyRoot $body, ?PoliciesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicies/Count/CountRequestBuilder.php b/src/Generated/Policies/RoleManagementPolicies/Count/CountRequestBuilder.php index be9af6a3177..772e7b23597 100644 --- a/src/Generated/Policies/RoleManagementPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/RoleManagementPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicies/Item/EffectiveRules/Count/CountRequestBuilder.php b/src/Generated/Policies/RoleManagementPolicies/Item/EffectiveRules/Count/CountRequestBuilder.php index 07dacfd9cb4..56da6e91ad0 100644 --- a/src/Generated/Policies/RoleManagementPolicies/Item/EffectiveRules/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/RoleManagementPolicies/Item/EffectiveRules/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicies/Item/EffectiveRules/EffectiveRulesRequestBuilder.php b/src/Generated/Policies/RoleManagementPolicies/Item/EffectiveRules/EffectiveRulesRequestBuilder.php index 2ff0c15b72b..88764c0a82d 100644 --- a/src/Generated/Policies/RoleManagementPolicies/Item/EffectiveRules/EffectiveRulesRequestBuilder.php +++ b/src/Generated/Policies/RoleManagementPolicies/Item/EffectiveRules/EffectiveRulesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleManagementPolicyRule; use Microsoft\Graph\Generated\Models\UnifiedRoleManagementPolicyRuleCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of effective rules like approval rules and expiration rules evaluated based on inherited referenced rules. For example, if there is a tenant-wide policy to enforce enabling an approval rule, the effective rule will be to enable approval even if the policy has a rule to disable approval. Supports $expand. * @param EffectiveRulesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EffectiveRulesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRuleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRuleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to effectiveRules for policies * @param UnifiedRoleManagementPolicyRule $body The request body * @param EffectiveRulesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleManagementPolicyRule $body, ?EffectiveRulesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?EffectiveRulesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?EffectiveRulesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UnifiedRoleManagementPolicyRule $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicies/Item/EffectiveRules/Item/UnifiedRoleManagementPolicyRuleItemRequestBuilder.php b/src/Generated/Policies/RoleManagementPolicies/Item/EffectiveRules/Item/UnifiedRoleManagementPolicyRuleItemRequestBuilder.php index 7428052c109..fef982f7617 100644 --- a/src/Generated/Policies/RoleManagementPolicies/Item/EffectiveRules/Item/UnifiedRoleManagementPolicyRuleItemRequestBuilder.php +++ b/src/Generated/Policies/RoleManagementPolicies/Item/EffectiveRules/Item/UnifiedRoleManagementPolicyRuleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleManagementPolicyRule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property effectiveRules for policies * @param UnifiedRoleManagementPolicyRuleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleManagementPolicyRuleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of effective rules like approval rules and expiration rules evaluated based on inherited referenced rules. For example, if there is a tenant-wide policy to enforce enabling an approval rule, the effective rule will be to enable approval even if the policy has a rule to disable approval. Supports $expand. * @param UnifiedRoleManagementPolicyRuleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UnifiedRoleManagementPolicyRuleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property effectiveRules in policies * @param UnifiedRoleManagementPolicyRule $body The request body * @param UnifiedRoleManagementPolicyRuleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleManagementPolicyRule $body, ?UnifiedRoleManagementPolicyRuleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UnifiedRoleManagementPolicyRuleItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UnifiedRoleManagementPolicyRuleItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UnifiedRoleManagementPolicyRuleItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UnifiedRoleManagementPolicyRule $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicies/Item/Rules/Count/CountRequestBuilder.php b/src/Generated/Policies/RoleManagementPolicies/Item/Rules/Count/CountRequestBuilder.php index acdc2b9a724..6353360efff 100644 --- a/src/Generated/Policies/RoleManagementPolicies/Item/Rules/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/RoleManagementPolicies/Item/Rules/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicies/Item/Rules/Item/UnifiedRoleManagementPolicyRuleItemRequestBuilder.php b/src/Generated/Policies/RoleManagementPolicies/Item/Rules/Item/UnifiedRoleManagementPolicyRuleItemRequestBuilder.php index a513fd85a07..3097417468f 100644 --- a/src/Generated/Policies/RoleManagementPolicies/Item/Rules/Item/UnifiedRoleManagementPolicyRuleItemRequestBuilder.php +++ b/src/Generated/Policies/RoleManagementPolicies/Item/Rules/Item/UnifiedRoleManagementPolicyRuleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleManagementPolicyRule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property rules for policies * @param UnifiedRoleManagementPolicyRuleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleManagementPolicyRuleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a rule or settings defined for a role management policy. The rule can be one of the following types that are derived from the unifiedRoleManagementPolicyRule object: This API is available in the following national cloud deployments. * @param UnifiedRoleManagementPolicyRuleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedrolemanagementpolicyrule-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleManagementPolicyRuleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update a rule defined for a role management policy. The rule can be one of the following types that are derived from the unifiedRoleManagementPolicyRule object: For more information about rules for Azure AD roles and examples of updating rules, see the following articles: This API is available in the following national cloud deployments. + * Update a rule defined for a role management policy. The rule can be one of the following types that are derived from the unifiedRoleManagementPolicyRule object: For more information about rules for Microsoft Entra roles and examples of updating rules, see the following articles: This API is available in the following national cloud deployments. * @param UnifiedRoleManagementPolicyRule $body The request body * @param UnifiedRoleManagementPolicyRuleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedrolemanagementpolicyrule-update?view=graph-rest-1.0 Find more info here */ public function patch(UnifiedRoleManagementPolicyRule $body, ?UnifiedRoleManagementPolicyRuleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?UnifiedRoleManagementPolicyRuleItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?UnifiedRoleManagementPolicyRuleItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,11 +113,12 @@ public function toGetRequestInformation(?UnifiedRoleManagementPolicyRuleItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update a rule defined for a role management policy. The rule can be one of the following types that are derived from the unifiedRoleManagementPolicyRule object: For more information about rules for Azure AD roles and examples of updating rules, see the following articles: This API is available in the following national cloud deployments. + * Update a rule defined for a role management policy. The rule can be one of the following types that are derived from the unifiedRoleManagementPolicyRule object: For more information about rules for Microsoft Entra roles and examples of updating rules, see the following articles: This API is available in the following national cloud deployments. * @param UnifiedRoleManagementPolicyRule $body The request body * @param UnifiedRoleManagementPolicyRuleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -137,11 +128,11 @@ public function toPatchRequestInformation(UnifiedRoleManagementPolicyRule $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicies/Item/Rules/RulesRequestBuilder.php b/src/Generated/Policies/RoleManagementPolicies/Item/Rules/RulesRequestBuilder.php index 629c0ca23c7..831e27ee978 100644 --- a/src/Generated/Policies/RoleManagementPolicies/Item/Rules/RulesRequestBuilder.php +++ b/src/Generated/Policies/RoleManagementPolicies/Item/Rules/RulesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleManagementPolicyRule; use Microsoft\Graph\Generated\Models\UnifiedRoleManagementPolicyRuleCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the rules or settings defined for a role management policy. The rules are a collection of following types that are derived from the unifiedRoleManagementPolicyRule object: This API is available in the following national cloud deployments. * @param RulesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedrolemanagementpolicy-list-rules?view=graph-rest-1.0 Find more info here */ public function get(?RulesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRuleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRuleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to rules for policies * @param UnifiedRoleManagementPolicyRule $body The request body * @param RulesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleManagementPolicyRule $body, ?RulesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RulesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RulesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(UnifiedRoleManagementPolicyRule $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicies/Item/UnifiedRoleManagementPolicyItemRequestBuilder.php b/src/Generated/Policies/RoleManagementPolicies/Item/UnifiedRoleManagementPolicyItemRequestBuilder.php index fa3278d1a53..0426c729c86 100644 --- a/src/Generated/Policies/RoleManagementPolicies/Item/UnifiedRoleManagementPolicyItemRequestBuilder.php +++ b/src/Generated/Policies/RoleManagementPolicies/Item/UnifiedRoleManagementPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleManagementPolicy; use Microsoft\Graph\Generated\Policies\RoleManagementPolicies\Item\EffectiveRules\EffectiveRulesRequestBuilder; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleManagementPolicies for policies * @param UnifiedRoleManagementPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleManagementPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the details of a role management policy. This API is available in the following national cloud deployments. * @param UnifiedRoleManagementPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedrolemanagementpolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleManagementPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleManagementPolicies in policies * @param UnifiedRoleManagementPolicy $body The request body * @param UnifiedRoleManagementPolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleManagementPolicy $body, ?UnifiedRoleManagementPolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?UnifiedRoleManagementPolicyItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?UnifiedRoleManagementPolicyItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?UnifiedRoleManagementPolicyItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(UnifiedRoleManagementPolicy $body, ?Un $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicies/RoleManagementPoliciesRequestBuilder.php b/src/Generated/Policies/RoleManagementPolicies/RoleManagementPoliciesRequestBuilder.php index b0a2383ffc0..765461a9d7f 100644 --- a/src/Generated/Policies/RoleManagementPolicies/RoleManagementPoliciesRequestBuilder.php +++ b/src/Generated/Policies/RoleManagementPolicies/RoleManagementPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleManagementPolicy; use Microsoft\Graph\Generated\Models\UnifiedRoleManagementPolicyCollectionResponse; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get the details of the policies in PIM that can be applied to Azure AD roles or group membership or ownership. To retrieve policies that apply to Azure RBAC, use the Azure REST PIM API for role management policies. This API is available in the following national cloud deployments. + * Get the details of the policies in PIM that can be applied to Microsoft Entra roles or group membership or ownership. To retrieve policies that apply to Azure RBAC, use the Azure REST PIM API for role management policies. This API is available in the following national cloud deployments. * @param RoleManagementPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/policyroot-list-rolemanagementpolicies?view=graph-rest-1.0 Find more info here */ public function get(?RoleManagementPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roleManagementPolicies for policies * @param UnifiedRoleManagementPolicy $body The request body * @param RoleManagementPoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleManagementPolicy $body, ?RoleManagementPoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get the details of the policies in PIM that can be applied to Azure AD roles or group membership or ownership. To retrieve policies that apply to Azure RBAC, use the Azure REST PIM API for role management policies. This API is available in the following national cloud deployments. + * Get the details of the policies in PIM that can be applied to Microsoft Entra roles or group membership or ownership. To retrieve policies that apply to Azure RBAC, use the Azure REST PIM API for role management policies. This API is available in the following national cloud deployments. * @param RoleManagementPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RoleManagementPoliciesRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RoleManagementPoliciesRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(UnifiedRoleManagementPolicy $body, ?Rol $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicies/RoleManagementPoliciesRequestBuilderGetQueryParameters.php b/src/Generated/Policies/RoleManagementPolicies/RoleManagementPoliciesRequestBuilderGetQueryParameters.php index aaa2103eef6..36f6b411906 100644 --- a/src/Generated/Policies/RoleManagementPolicies/RoleManagementPoliciesRequestBuilderGetQueryParameters.php +++ b/src/Generated/Policies/RoleManagementPolicies/RoleManagementPoliciesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get the details of the policies in PIM that can be applied to Azure AD roles or group membership or ownership. To retrieve policies that apply to Azure RBAC, use the Azure REST PIM API for role management policies. This API is available in the following national cloud deployments. + * Get the details of the policies in PIM that can be applied to Microsoft Entra roles or group membership or ownership. To retrieve policies that apply to Azure RBAC, use the Azure REST PIM API for role management policies. This API is available in the following national cloud deployments. */ class RoleManagementPoliciesRequestBuilderGetQueryParameters { diff --git a/src/Generated/Policies/RoleManagementPolicyAssignments/Count/CountRequestBuilder.php b/src/Generated/Policies/RoleManagementPolicyAssignments/Count/CountRequestBuilder.php index e9dbaf0f1e8..a9827d56c9a 100644 --- a/src/Generated/Policies/RoleManagementPolicyAssignments/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/RoleManagementPolicyAssignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicyAssignments/Item/Policy/PolicyRequestBuilder.php b/src/Generated/Policies/RoleManagementPolicyAssignments/Item/Policy/PolicyRequestBuilder.php index 0e9ae617878..8e446f73fb0 100644 --- a/src/Generated/Policies/RoleManagementPolicyAssignments/Item/Policy/PolicyRequestBuilder.php +++ b/src/Generated/Policies/RoleManagementPolicyAssignments/Item/Policy/PolicyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleManagementPolicy; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The policy that's associated with a policy assignment. Supports $expand and a nested $expand of the rules and effectiveRules relationships for the policy. * @param PolicyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PolicyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PolicyRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PolicyRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicyAssignments/Item/UnifiedRoleManagementPolicyAssignmentItemRequestBuilder.php b/src/Generated/Policies/RoleManagementPolicyAssignments/Item/UnifiedRoleManagementPolicyAssignmentItemRequestBuilder.php index 1986c600cb9..334037095b5 100644 --- a/src/Generated/Policies/RoleManagementPolicyAssignments/Item/UnifiedRoleManagementPolicyAssignmentItemRequestBuilder.php +++ b/src/Generated/Policies/RoleManagementPolicyAssignments/Item/UnifiedRoleManagementPolicyAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleManagementPolicyAssignment; use Microsoft\Graph\Generated\Policies\RoleManagementPolicyAssignments\Item\Policy\PolicyRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleManagementPolicyAssignments for policies * @param UnifiedRoleManagementPolicyAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleManagementPolicyAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Get the details of a policy assignment in PIM that's assigned to Azure AD roles or group membership or ownership. This API is available in the following national cloud deployments. + * Get the details of a policy assignment in PIM that's assigned to Microsoft Entra roles or group membership or ownership. This API is available in the following national cloud deployments. * @param UnifiedRoleManagementPolicyAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedrolemanagementpolicyassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleManagementPolicyAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleManagementPolicyAssignments in policies * @param UnifiedRoleManagementPolicyAssignment $body The request body * @param UnifiedRoleManagementPolicyAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleManagementPolicyAssignment $body, ?UnifiedRoleManagementPolicyAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,11 +99,12 @@ public function toDeleteRequestInformation(?UnifiedRoleManagementPolicyAssignmen $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Get the details of a policy assignment in PIM that's assigned to Azure AD roles or group membership or ownership. This API is available in the following national cloud deployments. + * Get the details of a policy assignment in PIM that's assigned to Microsoft Entra roles or group membership or ownership. This API is available in the following national cloud deployments. * @param UnifiedRoleManagementPolicyAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -122,7 +113,6 @@ public function toGetRequestInformation(?UnifiedRoleManagementPolicyAssignmentIt $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?UnifiedRoleManagementPolicyAssignmentIt } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(UnifiedRoleManagementPolicyAssignment $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicyAssignments/Item/UnifiedRoleManagementPolicyAssignmentItemRequestBuilderGetQueryParameters.php b/src/Generated/Policies/RoleManagementPolicyAssignments/Item/UnifiedRoleManagementPolicyAssignmentItemRequestBuilderGetQueryParameters.php index d4503964786..39a6e440999 100644 --- a/src/Generated/Policies/RoleManagementPolicyAssignments/Item/UnifiedRoleManagementPolicyAssignmentItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Policies/RoleManagementPolicyAssignments/Item/UnifiedRoleManagementPolicyAssignmentItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get the details of a policy assignment in PIM that's assigned to Azure AD roles or group membership or ownership. This API is available in the following national cloud deployments. + * Get the details of a policy assignment in PIM that's assigned to Microsoft Entra roles or group membership or ownership. This API is available in the following national cloud deployments. */ class UnifiedRoleManagementPolicyAssignmentItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Policies/RoleManagementPolicyAssignments/RoleManagementPolicyAssignmentsRequestBuilder.php b/src/Generated/Policies/RoleManagementPolicyAssignments/RoleManagementPolicyAssignmentsRequestBuilder.php index 0b59040bacd..d91f8959f27 100644 --- a/src/Generated/Policies/RoleManagementPolicyAssignments/RoleManagementPolicyAssignmentsRequestBuilder.php +++ b/src/Generated/Policies/RoleManagementPolicyAssignments/RoleManagementPolicyAssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleManagementPolicyAssignment; use Microsoft\Graph\Generated\Models\UnifiedRoleManagementPolicyAssignmentCollectionResponse; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get the details of all role management policy assignments made in PIM for Azure AD roles and PIM for groups. This API is available in the following national cloud deployments. + * Get the details of all role management policy assignments made in PIM for Microsoft Entra roles and PIM for groups. This API is available in the following national cloud deployments. * @param RoleManagementPolicyAssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/policyroot-list-rolemanagementpolicyassignments?view=graph-rest-1.0 Find more info here */ public function get(?RoleManagementPolicyAssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roleManagementPolicyAssignments for policies * @param UnifiedRoleManagementPolicyAssignment $body The request body * @param RoleManagementPolicyAssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleManagementPolicyAssignment $body, ?RoleManagementPolicyAssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleManagementPolicyAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get the details of all role management policy assignments made in PIM for Azure AD roles and PIM for groups. This API is available in the following national cloud deployments. + * Get the details of all role management policy assignments made in PIM for Microsoft Entra roles and PIM for groups. This API is available in the following national cloud deployments. * @param RoleManagementPolicyAssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RoleManagementPolicyAssignmentsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RoleManagementPolicyAssignmentsRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(UnifiedRoleManagementPolicyAssignment $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/RoleManagementPolicyAssignments/RoleManagementPolicyAssignmentsRequestBuilderGetQueryParameters.php b/src/Generated/Policies/RoleManagementPolicyAssignments/RoleManagementPolicyAssignmentsRequestBuilderGetQueryParameters.php index 32f2e03eeab..33d7ebb9b2c 100644 --- a/src/Generated/Policies/RoleManagementPolicyAssignments/RoleManagementPolicyAssignmentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Policies/RoleManagementPolicyAssignments/RoleManagementPolicyAssignmentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get the details of all role management policy assignments made in PIM for Azure AD roles and PIM for groups. This API is available in the following national cloud deployments. + * Get the details of all role management policy assignments made in PIM for Microsoft Entra roles and PIM for groups. This API is available in the following national cloud deployments. */ class RoleManagementPolicyAssignmentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Policies/TokenIssuancePolicies/Count/CountRequestBuilder.php b/src/Generated/Policies/TokenIssuancePolicies/Count/CountRequestBuilder.php index 37ece37da96..bcfe84c38d3 100644 --- a/src/Generated/Policies/TokenIssuancePolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/TokenIssuancePolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/TokenIssuancePolicies/Item/AppliesTo/AppliesToRequestBuilder.php b/src/Generated/Policies/TokenIssuancePolicies/Item/AppliesTo/AppliesToRequestBuilder.php index f8e7348b8e2..1654494dd36 100644 --- a/src/Generated/Policies/TokenIssuancePolicies/Item/AppliesTo/AppliesToRequestBuilder.php +++ b/src/Generated/Policies/TokenIssuancePolicies/Item/AppliesTo/AppliesToRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\TokenIssuancePolicies\Item\AppliesTo\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get appliesTo from policies * @param AppliesToRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppliesToRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/TokenIssuancePolicies/Item/AppliesTo/Count/CountRequestBuilder.php b/src/Generated/Policies/TokenIssuancePolicies/Item/AppliesTo/Count/CountRequestBuilder.php index 194b23e2f06..e39580c858e 100644 --- a/src/Generated/Policies/TokenIssuancePolicies/Item/AppliesTo/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/TokenIssuancePolicies/Item/AppliesTo/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/TokenIssuancePolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Policies/TokenIssuancePolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php index f8bb792a89a..2253b27f2b7 100644 --- a/src/Generated/Policies/TokenIssuancePolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Policies/TokenIssuancePolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get appliesTo from policies * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/TokenIssuancePolicies/Item/TokenIssuancePolicyItemRequestBuilder.php b/src/Generated/Policies/TokenIssuancePolicies/Item/TokenIssuancePolicyItemRequestBuilder.php index a8f25c513aa..9ee6c82743c 100644 --- a/src/Generated/Policies/TokenIssuancePolicies/Item/TokenIssuancePolicyItemRequestBuilder.php +++ b/src/Generated/Policies/TokenIssuancePolicies/Item/TokenIssuancePolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TokenIssuancePolicy; use Microsoft\Graph\Generated\Policies\TokenIssuancePolicies\Item\AppliesTo\AppliesToRequestBuilder; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a tokenIssuancePolicy object. This API is available in the following national cloud deployments. * @param TokenIssuancePolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tokenissuancepolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TokenIssuancePolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * The policy that specifies the characteristics of SAML tokens issued by Azure AD. + * The policy that specifies the characteristics of SAML tokens issued by Microsoft Entra ID. * @param TokenIssuancePolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TokenIssuancePolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a tokenIssuancePolicy object. This API is available in the following national cloud deployments. * @param TokenIssuancePolicy $body The request body * @param TokenIssuancePolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tokenissuancepolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(TokenIssuancePolicy $body, ?TokenIssuancePolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,11 +100,12 @@ public function toDeleteRequestInformation(?TokenIssuancePolicyItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * The policy that specifies the characteristics of SAML tokens issued by Azure AD. + * The policy that specifies the characteristics of SAML tokens issued by Microsoft Entra ID. * @param TokenIssuancePolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -123,7 +114,6 @@ public function toGetRequestInformation(?TokenIssuancePolicyItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?TokenIssuancePolicyItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(TokenIssuancePolicy $body, ?TokenIssua $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/TokenIssuancePolicies/Item/TokenIssuancePolicyItemRequestBuilderGetQueryParameters.php b/src/Generated/Policies/TokenIssuancePolicies/Item/TokenIssuancePolicyItemRequestBuilderGetQueryParameters.php index 85582790702..c05c494ec91 100644 --- a/src/Generated/Policies/TokenIssuancePolicies/Item/TokenIssuancePolicyItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Policies/TokenIssuancePolicies/Item/TokenIssuancePolicyItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The policy that specifies the characteristics of SAML tokens issued by Azure AD. + * The policy that specifies the characteristics of SAML tokens issued by Microsoft Entra ID. */ class TokenIssuancePolicyItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Policies/TokenIssuancePolicies/TokenIssuancePoliciesRequestBuilder.php b/src/Generated/Policies/TokenIssuancePolicies/TokenIssuancePoliciesRequestBuilder.php index 32ca7916ed2..10b6eb7ed2b 100644 --- a/src/Generated/Policies/TokenIssuancePolicies/TokenIssuancePoliciesRequestBuilder.php +++ b/src/Generated/Policies/TokenIssuancePolicies/TokenIssuancePoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TokenIssuancePolicy; use Microsoft\Graph\Generated\Models\TokenIssuancePolicyCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of tokenIssuancePolicy objects. This API is available in the following national cloud deployments. * @param TokenIssuancePoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tokenissuancepolicy-list?view=graph-rest-1.0 Find more info here */ public function get(?TokenIssuancePoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new tokenIssuancePolicy object. This API is available in the following national cloud deployments. * @param TokenIssuancePolicy $body The request body * @param TokenIssuancePoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tokenissuancepolicy-post-tokenissuancepolicy?view=graph-rest-1.0 Find more info here */ public function post(TokenIssuancePolicy $body, ?TokenIssuancePoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TokenIssuancePoliciesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TokenIssuancePoliciesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TokenIssuancePolicy $body, ?TokenIssuan $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/TokenLifetimePolicies/Count/CountRequestBuilder.php b/src/Generated/Policies/TokenLifetimePolicies/Count/CountRequestBuilder.php index fd2523d36e4..5e986cddd0a 100644 --- a/src/Generated/Policies/TokenLifetimePolicies/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/TokenLifetimePolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/TokenLifetimePolicies/Item/AppliesTo/AppliesToRequestBuilder.php b/src/Generated/Policies/TokenLifetimePolicies/Item/AppliesTo/AppliesToRequestBuilder.php index e91323b80c9..52393bcc1fd 100644 --- a/src/Generated/Policies/TokenLifetimePolicies/Item/AppliesTo/AppliesToRequestBuilder.php +++ b/src/Generated/Policies/TokenLifetimePolicies/Item/AppliesTo/AppliesToRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Policies\TokenLifetimePolicies\Item\AppliesTo\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get appliesTo from policies * @param AppliesToRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppliesToRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?AppliesToRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/TokenLifetimePolicies/Item/AppliesTo/Count/CountRequestBuilder.php b/src/Generated/Policies/TokenLifetimePolicies/Item/AppliesTo/Count/CountRequestBuilder.php index 59e7e954648..7464d795ef5 100644 --- a/src/Generated/Policies/TokenLifetimePolicies/Item/AppliesTo/Count/CountRequestBuilder.php +++ b/src/Generated/Policies/TokenLifetimePolicies/Item/AppliesTo/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Policies/TokenLifetimePolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Policies/TokenLifetimePolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php index 9c21f3bf800..e627ed73f75 100644 --- a/src/Generated/Policies/TokenLifetimePolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Policies/TokenLifetimePolicies/Item/AppliesTo/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get appliesTo from policies * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Policies/TokenLifetimePolicies/Item/TokenLifetimePolicyItemRequestBuilder.php b/src/Generated/Policies/TokenLifetimePolicies/Item/TokenLifetimePolicyItemRequestBuilder.php index fb538f3b00b..132a18aeb7c 100644 --- a/src/Generated/Policies/TokenLifetimePolicies/Item/TokenLifetimePolicyItemRequestBuilder.php +++ b/src/Generated/Policies/TokenLifetimePolicies/Item/TokenLifetimePolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TokenLifetimePolicy; use Microsoft\Graph\Generated\Policies\TokenLifetimePolicies\Item\AppliesTo\AppliesToRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a tokenLifetimePolicy object. This API is available in the following national cloud deployments. * @param TokenLifetimePolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tokenlifetimepolicy-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TokenLifetimePolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a tokenLifetimePolicy object. This API is available in the following national cloud deployments. * @param TokenLifetimePolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tokenlifetimepolicy-get?view=graph-rest-1.0 Find more info here */ public function get(?TokenLifetimePolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a tokenLifetimePolicy object. This API is available in the following national cloud deployments. * @param TokenLifetimePolicy $body The request body * @param TokenLifetimePolicyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tokenlifetimepolicy-update?view=graph-rest-1.0 Find more info here */ public function patch(TokenLifetimePolicy $body, ?TokenLifetimePolicyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TokenLifetimePolicyItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TokenLifetimePolicyItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TokenLifetimePolicyItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TokenLifetimePolicy $body, ?TokenLifet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Policies/TokenLifetimePolicies/TokenLifetimePoliciesRequestBuilder.php b/src/Generated/Policies/TokenLifetimePolicies/TokenLifetimePoliciesRequestBuilder.php index b1c2373b333..9548458a794 100644 --- a/src/Generated/Policies/TokenLifetimePolicies/TokenLifetimePoliciesRequestBuilder.php +++ b/src/Generated/Policies/TokenLifetimePolicies/TokenLifetimePoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TokenLifetimePolicy; use Microsoft\Graph\Generated\Models\TokenLifetimePolicyCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of tokenLifetimePolicy objects. This API is available in the following national cloud deployments. * @param TokenLifetimePoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tokenlifetimepolicy-list?view=graph-rest-1.0 Find more info here */ public function get(?TokenLifetimePoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new tokenLifetimePolicy object. This API is available in the following national cloud deployments. * @param TokenLifetimePolicy $body The request body * @param TokenLifetimePoliciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tokenlifetimepolicy-post-tokenlifetimepolicies?view=graph-rest-1.0 Find more info here */ public function post(TokenLifetimePolicy $body, ?TokenLifetimePoliciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TokenLifetimePoliciesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TokenLifetimePoliciesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TokenLifetimePolicy $body, ?TokenLifeti $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Privacy/PrivacyRequestBuilder.php b/src/Generated/Privacy/PrivacyRequestBuilder.php index fc31652347c..0b82b3743aa 100644 --- a/src/Generated/Privacy/PrivacyRequestBuilder.php +++ b/src/Generated/Privacy/PrivacyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Privacy; use Microsoft\Graph\Generated\Privacy\SubjectRightsRequests\SubjectRightsRequestsRequestBuilder; @@ -42,38 +41,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get privacy * @param PrivacyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrivacyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Privacy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Privacy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update privacy * @param Privacy $body The request body * @param PrivacyRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Privacy $body, ?PrivacyRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Privacy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Privacy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -86,7 +79,6 @@ public function toGetRequestInformation(?PrivacyRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -94,6 +86,7 @@ public function toGetRequestInformation(?PrivacyRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -108,11 +101,11 @@ public function toPatchRequestInformation(Privacy $body, ?PrivacyRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Count/CountRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Count/CountRequestBuilder.php index 7fa9a921a22..81a6649f529 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/ApproversRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/ApproversRequestBuilder.php index 5190d491748..f0b80d610da 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/ApproversRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/ApproversRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; use Microsoft\Graph\Generated\Privacy\SubjectRightsRequests\Item\Approvers\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of users who can approve the request. Currently only supported for requests of type delete. * @param ApproversRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ApproversRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ApproversRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ApproversRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Count/CountRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Count/CountRequestBuilder.php index 0f2b8b2354f..00b3f2b6057 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Count/CountRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/MailboxSettings/MailboxSettingsRequestBuilder.php index 60bd1df220a..a92f40fdfe7 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php index f33a9d058bd..b3beb4c5428 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index ce488e6efcc..832d2d96b69 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Privacy\SubjectRightsRequests\Item\Approvers\Item\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/UserItemRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/UserItemRequestBuilder.php index 71e043877f5..f2c0bff5643 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/UserItemRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Approvers/Item/UserItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Privacy\SubjectRightsRequests\Item\Approvers\Item\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of users who can approve the request. Currently only supported for requests of type delete. * @param UserItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?UserItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?UserItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/CollaboratorsRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/CollaboratorsRequestBuilder.php index a172be96b44..8c992c387d9 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/CollaboratorsRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/CollaboratorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; use Microsoft\Graph\Generated\Privacy\SubjectRightsRequests\Item\Collaborators\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of users who can collaborate on the request. * @param CollaboratorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CollaboratorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CollaboratorsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CollaboratorsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Count/CountRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Count/CountRequestBuilder.php index c04cd22a051..d1fded059a1 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Count/CountRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/MailboxSettings/MailboxSettingsRequestBuilder.php index 45dd9e5190e..f42c3c924ea 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 7fdea8db214..1a9d7870c70 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 89ee6add564..9e2da8a86ce 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Privacy\SubjectRightsRequests\Item\Collaborators\Item\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/UserItemRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/UserItemRequestBuilder.php index d0b1671f6ec..40dee3f1a82 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/UserItemRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Collaborators/Item/UserItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Privacy\SubjectRightsRequests\Item\Collaborators\Item\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of users who can collaborate on the request. * @param UserItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?UserItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?UserItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/GetFinalAttachment/GetFinalAttachmentRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/GetFinalAttachment/GetFinalAttachmentRequestBuilder.php index c54d88bd479..adc66314b45 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/GetFinalAttachment/GetFinalAttachmentRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/GetFinalAttachment/GetFinalAttachmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getFinalAttachment * @param GetFinalAttachmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetFinalAttachmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -63,6 +61,7 @@ public function toGetRequestInformation(?GetFinalAttachmentRequestBuilderGetRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/GetFinalReport/GetFinalReportRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/GetFinalReport/GetFinalReportRequestBuilder.php index e085c09e7c5..e12d76d72bc 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/GetFinalReport/GetFinalReportRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/GetFinalReport/GetFinalReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getFinalReport * @param GetFinalReportRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetFinalReportRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -63,6 +61,7 @@ public function toGetRequestInformation(?GetFinalReportRequestBuilderGetRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Notes/Count/CountRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Notes/Count/CountRequestBuilder.php index fa725dab997..af505ff00d5 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Notes/Count/CountRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Notes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Notes/Item/AuthoredNoteItemRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Notes/Item/AuthoredNoteItemRequestBuilder.php index 7da2a63b297..23e9192b1f6 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Notes/Item/AuthoredNoteItemRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Notes/Item/AuthoredNoteItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthoredNote; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property notes for privacy * @param AuthoredNoteItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AuthoredNoteItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * List of notes associated with the request. * @param AuthoredNoteItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthoredNoteItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property notes in privacy * @param AuthoredNote $body The request body * @param AuthoredNoteItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AuthoredNote $body, ?AuthoredNoteItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AuthoredNoteItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AuthoredNoteItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AuthoredNoteItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AuthoredNote $body, ?AuthoredNoteItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Notes/NotesRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Notes/NotesRequestBuilder.php index 6770d91e938..1e359654fcc 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Notes/NotesRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Notes/NotesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthoredNote; use Microsoft\Graph\Generated\Models\AuthoredNoteCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of authored notes assoicated with a subject rights request. This API is available in the following national cloud deployments. * @param NotesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subjectrightsrequest-list-notes?view=graph-rest-1.0 Find more info here */ public function get(?NotesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNoteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNoteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new authoredNote object. This API is available in the following national cloud deployments. * @param AuthoredNote $body The request body * @param NotesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subjectrightsrequest-post-notes?view=graph-rest-1.0 Find more info here */ public function post(AuthoredNote $body, ?NotesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?NotesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?NotesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AuthoredNote $body, ?NotesRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/SubjectRightsRequestItemRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/SubjectRightsRequestItemRequestBuilder.php index cca2ab08647..44f5ff2b3c1 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/SubjectRightsRequestItemRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/SubjectRightsRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SubjectRightsRequest; use Microsoft\Graph\Generated\Privacy\SubjectRightsRequests\Item\Approvers\ApproversRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property subjectRightsRequests for privacy * @param SubjectRightsRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SubjectRightsRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a subjectRightsRequest object. This API is available in the following national cloud deployments. * @param SubjectRightsRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subjectrightsrequest-get?view=graph-rest-1.0 Find more info here */ public function get(?SubjectRightsRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a subjectRightsRequest object. This API is available in the following national cloud deployments. * @param SubjectRightsRequest $body The request body * @param SubjectRightsRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subjectrightsrequest-update?view=graph-rest-1.0 Find more info here */ public function patch(SubjectRightsRequest $body, ?SubjectRightsRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?SubjectRightsRequestItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?SubjectRightsRequestItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?SubjectRightsRequestItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(SubjectRightsRequest $body, ?SubjectRi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/Item/Team/TeamRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/Item/Team/TeamRequestBuilder.php index 1a8fb9acb45..4132d29b37e 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/Item/Team/TeamRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/Item/Team/TeamRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Information about the Microsoft Teams team that was created for the request. * @param TeamRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Privacy/SubjectRightsRequests/SubjectRightsRequestsRequestBuilder.php b/src/Generated/Privacy/SubjectRightsRequests/SubjectRightsRequestsRequestBuilder.php index e0508099ab2..5668d6cadd5 100644 --- a/src/Generated/Privacy/SubjectRightsRequests/SubjectRightsRequestsRequestBuilder.php +++ b/src/Generated/Privacy/SubjectRightsRequests/SubjectRightsRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SubjectRightsRequest; use Microsoft\Graph\Generated\Models\SubjectRightsRequestCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of subjectRightsRequest objects and their properties. This API is available in the following national cloud deployments. * @param SubjectRightsRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subjectrightsrequest-list?view=graph-rest-1.0 Find more info here */ public function get(?SubjectRightsRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new subjectRightsRequest object. This API is available in the following national cloud deployments. * @param SubjectRightsRequest $body The request body * @param SubjectRightsRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subjectrightsrequest-post?view=graph-rest-1.0 Find more info here */ public function post(SubjectRightsRequest $body, ?SubjectRightsRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SubjectRightsRequestsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SubjectRightsRequestsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SubjectRightsRequest $body, ?SubjectRig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Reports/AuthenticationMethods/AuthenticationMethodsRequestBuilder.php b/src/Generated/Reports/AuthenticationMethods/AuthenticationMethodsRequestBuilder.php index 27ac6fde5f3..e96b11e139f 100644 --- a/src/Generated/Reports/AuthenticationMethods/AuthenticationMethodsRequestBuilder.php +++ b/src/Generated/Reports/AuthenticationMethods/AuthenticationMethodsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationMethodsRoot; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Reports\AuthenticationMethods\UserRegistrationDetails\UserRegistrationDetailsRequestBuilder; @@ -60,56 +59,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property authenticationMethods for reports * @param AuthenticationMethodsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AuthenticationMethodsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Container for navigation properties for Azure AD authentication methods resources. + * Container for navigation properties for Microsoft Entra authentication methods resources. * @param AuthenticationMethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthenticationMethodsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodsRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodsRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property authenticationMethods in reports * @param AuthenticationMethodsRoot $body The request body * @param AuthenticationMethodsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AuthenticationMethodsRoot $body, ?AuthenticationMethodsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodsRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodsRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -126,11 +116,12 @@ public function toDeleteRequestInformation(?AuthenticationMethodsRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Container for navigation properties for Azure AD authentication methods resources. + * Container for navigation properties for Microsoft Entra authentication methods resources. * @param AuthenticationMethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -139,7 +130,6 @@ public function toGetRequestInformation(?AuthenticationMethodsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +137,7 @@ public function toGetRequestInformation(?AuthenticationMethodsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -161,11 +152,11 @@ public function toPatchRequestInformation(AuthenticationMethodsRoot $body, ?Auth $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Reports/AuthenticationMethods/AuthenticationMethodsRequestBuilderGetQueryParameters.php b/src/Generated/Reports/AuthenticationMethods/AuthenticationMethodsRequestBuilderGetQueryParameters.php index 9abe1f7b037..6e79284f228 100644 --- a/src/Generated/Reports/AuthenticationMethods/AuthenticationMethodsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Reports/AuthenticationMethods/AuthenticationMethodsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Container for navigation properties for Azure AD authentication methods resources. + * Container for navigation properties for Microsoft Entra authentication methods resources. */ class AuthenticationMethodsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Reports/AuthenticationMethods/UserRegistrationDetails/Count/CountRequestBuilder.php b/src/Generated/Reports/AuthenticationMethods/UserRegistrationDetails/Count/CountRequestBuilder.php index 4da2df08e1e..f04582f710a 100644 --- a/src/Generated/Reports/AuthenticationMethods/UserRegistrationDetails/Count/CountRequestBuilder.php +++ b/src/Generated/Reports/AuthenticationMethods/UserRegistrationDetails/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Reports/AuthenticationMethods/UserRegistrationDetails/Item/UserRegistrationDetailsItemRequestBuilder.php b/src/Generated/Reports/AuthenticationMethods/UserRegistrationDetails/Item/UserRegistrationDetailsItemRequestBuilder.php index 98707ecacdb..b517a8344f7 100644 --- a/src/Generated/Reports/AuthenticationMethods/UserRegistrationDetails/Item/UserRegistrationDetailsItemRequestBuilder.php +++ b/src/Generated/Reports/AuthenticationMethods/UserRegistrationDetails/Item/UserRegistrationDetailsItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserRegistrationDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userRegistrationDetails for reports * @param UserRegistrationDetailsItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserRegistrationDetailsItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a userRegistrationDetails object. This API is available in the following national cloud deployments. * @param UserRegistrationDetailsItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/userregistrationdetails-get?view=graph-rest-1.0 Find more info here */ public function get(?UserRegistrationDetailsItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userRegistrationDetails in reports * @param UserRegistrationDetails $body The request body * @param UserRegistrationDetailsItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserRegistrationDetails $body, ?UserRegistrationDetailsItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?UserRegistrationDetailsItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?UserRegistrationDetailsItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?UserRegistrationDetailsItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(UserRegistrationDetails $body, ?UserRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Reports/AuthenticationMethods/UserRegistrationDetails/UserRegistrationDetailsRequestBuilder.php b/src/Generated/Reports/AuthenticationMethods/UserRegistrationDetails/UserRegistrationDetailsRequestBuilder.php index 11ef173029b..ba5fe10f965 100644 --- a/src/Generated/Reports/AuthenticationMethods/UserRegistrationDetails/UserRegistrationDetailsRequestBuilder.php +++ b/src/Generated/Reports/AuthenticationMethods/UserRegistrationDetails/UserRegistrationDetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserRegistrationDetails; use Microsoft\Graph\Generated\Models\UserRegistrationDetailsCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the authentication methods registered for a user as defined in the userRegistrationDetails object. This API is available in the following national cloud deployments. * @param UserRegistrationDetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationmethodsroot-list-userregistrationdetails?view=graph-rest-1.0 Find more info here */ public function get(?UserRegistrationDetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationDetailsCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationDetailsCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to userRegistrationDetails for reports * @param UserRegistrationDetails $body The request body * @param UserRegistrationDetailsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserRegistrationDetails $body, ?UserRegistrationDetailsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?UserRegistrationDetailsRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?UserRegistrationDetailsRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(UserRegistrationDetails $body, ?UserReg $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByFeature/UsersRegisteredByFeatureRequestBuilder.php b/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByFeature/UsersRegisteredByFeatureRequestBuilder.php index aeea3118c91..ae854952dc1 100644 --- a/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByFeature/UsersRegisteredByFeatureRequestBuilder.php +++ b/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByFeature/UsersRegisteredByFeatureRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserRegistrationFeatureSummary; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function usersRegisteredByFeature * @param UsersRegisteredByFeatureRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UsersRegisteredByFeatureRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationFeatureSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationFeatureSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?UsersRegisteredByFeatureRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByFeatureWithIncludedUserTypesWithIncludedUserRoles/UsersRegisteredByFeatureWithIncludedUserTypesWithIncludedUserRolesRequestBuilder.php b/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByFeatureWithIncludedUserTypesWithIncludedUserRoles/UsersRegisteredByFeatureWithIncludedUserTypesWithIncludedUserRolesRequestBuilder.php index f4f8b3dc780..d2749b1ff39 100644 --- a/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByFeatureWithIncludedUserTypesWithIncludedUserRoles/UsersRegisteredByFeatureWithIncludedUserTypesWithIncludedUserRolesRequestBuilder.php +++ b/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByFeatureWithIncludedUserTypesWithIncludedUserRoles/UsersRegisteredByFeatureWithIncludedUserTypesWithIncludedUserRolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserRegistrationFeatureSummary; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -39,19 +38,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function usersRegisteredByFeature * @param UsersRegisteredByFeatureWithIncludedUserTypesWithIncludedUserRolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UsersRegisteredByFeatureWithIncludedUserTypesWithIncludedUserRolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationFeatureSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationFeatureSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -64,11 +60,11 @@ public function toGetRequestInformation(?UsersRegisteredByFeatureWithIncludedUse $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByMethod/UsersRegisteredByMethodRequestBuilder.php b/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByMethod/UsersRegisteredByMethodRequestBuilder.php index 1663e9840ab..53ce5d5971d 100644 --- a/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByMethod/UsersRegisteredByMethodRequestBuilder.php +++ b/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByMethod/UsersRegisteredByMethodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserRegistrationMethodSummary; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function usersRegisteredByMethod * @param UsersRegisteredByMethodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UsersRegisteredByMethodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationMethodSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationMethodSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?UsersRegisteredByMethodRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByMethodWithIncludedUserTypesWithIncludedUserRoles/UsersRegisteredByMethodWithIncludedUserTypesWithIncludedUserRolesRequestBuilder.php b/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByMethodWithIncludedUserTypesWithIncludedUserRoles/UsersRegisteredByMethodWithIncludedUserTypesWithIncludedUserRolesRequestBuilder.php index ad0c8e2b892..7136510504b 100644 --- a/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByMethodWithIncludedUserTypesWithIncludedUserRoles/UsersRegisteredByMethodWithIncludedUserTypesWithIncludedUserRolesRequestBuilder.php +++ b/src/Generated/Reports/AuthenticationMethods/UsersRegisteredByMethodWithIncludedUserTypesWithIncludedUserRoles/UsersRegisteredByMethodWithIncludedUserTypesWithIncludedUserRolesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserRegistrationMethodSummary; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -39,19 +38,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function usersRegisteredByMethod * @param UsersRegisteredByMethodWithIncludedUserTypesWithIncludedUserRolesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UsersRegisteredByMethodWithIncludedUserTypesWithIncludedUserRolesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationMethodSummary::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserRegistrationMethodSummary::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -64,11 +60,11 @@ public function toGetRequestInformation(?UsersRegisteredByMethodWithIncludedUser $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/DailyPrintUsageByPrinter/Count/CountRequestBuilder.php b/src/Generated/Reports/DailyPrintUsageByPrinter/Count/CountRequestBuilder.php index 8b5f2f21e2a..ad393949d3a 100644 --- a/src/Generated/Reports/DailyPrintUsageByPrinter/Count/CountRequestBuilder.php +++ b/src/Generated/Reports/DailyPrintUsageByPrinter/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Reports/DailyPrintUsageByPrinter/DailyPrintUsageByPrinterRequestBuilder.php b/src/Generated/Reports/DailyPrintUsageByPrinter/DailyPrintUsageByPrinterRequestBuilder.php index cd62912012c..d785530b9b2 100644 --- a/src/Generated/Reports/DailyPrintUsageByPrinter/DailyPrintUsageByPrinterRequestBuilder.php +++ b/src/Generated/Reports/DailyPrintUsageByPrinter/DailyPrintUsageByPrinterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintUsageByPrinter; use Microsoft\Graph\Generated\Models\PrintUsageByPrinterCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of daily print usage summaries, grouped by printer. This API is available in the following national cloud deployments. * @param DailyPrintUsageByPrinterRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/reportroot-list-dailyprintusagebyprinter?view=graph-rest-1.0 Find more info here */ public function get(?DailyPrintUsageByPrinterRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinterCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinterCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to dailyPrintUsageByPrinter for reports * @param PrintUsageByPrinter $body The request body * @param DailyPrintUsageByPrinterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintUsageByPrinter $body, ?DailyPrintUsageByPrinterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinter::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinter::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?DailyPrintUsageByPrinterRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?DailyPrintUsageByPrinterRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PrintUsageByPrinter $body, ?DailyPrintU $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Reports/DailyPrintUsageByPrinter/Item/PrintUsageByPrinterItemRequestBuilder.php b/src/Generated/Reports/DailyPrintUsageByPrinter/Item/PrintUsageByPrinterItemRequestBuilder.php index a43a7eae055..101909af198 100644 --- a/src/Generated/Reports/DailyPrintUsageByPrinter/Item/PrintUsageByPrinterItemRequestBuilder.php +++ b/src/Generated/Reports/DailyPrintUsageByPrinter/Item/PrintUsageByPrinterItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintUsageByPrinter; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property dailyPrintUsageByPrinter for reports * @param PrintUsageByPrinterItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintUsageByPrinterItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a usage summary for a printer for a particular time period. For descriptions of each of the endpoints, see printUsageByPrinter. This API is available in the following national cloud deployments. * @param PrintUsageByPrinterItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printusagebyprinter-get?view=graph-rest-1.0 Find more info here */ public function get(?PrintUsageByPrinterItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinter::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinter::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property dailyPrintUsageByPrinter in reports * @param PrintUsageByPrinter $body The request body * @param PrintUsageByPrinterItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintUsageByPrinter $body, ?PrintUsageByPrinterItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinter::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinter::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?PrintUsageByPrinterItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?PrintUsageByPrinterItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?PrintUsageByPrinterItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(PrintUsageByPrinter $body, ?PrintUsage $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Reports/DailyPrintUsageByUser/Count/CountRequestBuilder.php b/src/Generated/Reports/DailyPrintUsageByUser/Count/CountRequestBuilder.php index 35e8c524bff..8131d237a71 100644 --- a/src/Generated/Reports/DailyPrintUsageByUser/Count/CountRequestBuilder.php +++ b/src/Generated/Reports/DailyPrintUsageByUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Reports/DailyPrintUsageByUser/DailyPrintUsageByUserRequestBuilder.php b/src/Generated/Reports/DailyPrintUsageByUser/DailyPrintUsageByUserRequestBuilder.php index 6485229ee8e..6dc07923258 100644 --- a/src/Generated/Reports/DailyPrintUsageByUser/DailyPrintUsageByUserRequestBuilder.php +++ b/src/Generated/Reports/DailyPrintUsageByUser/DailyPrintUsageByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintUsageByUser; use Microsoft\Graph\Generated\Models\PrintUsageByUserCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of daily print usage summaries, grouped by user. This API is available in the following national cloud deployments. * @param DailyPrintUsageByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/reportroot-list-dailyprintusagebyuser?view=graph-rest-1.0 Find more info here */ public function get(?DailyPrintUsageByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to dailyPrintUsageByUser for reports * @param PrintUsageByUser $body The request body * @param DailyPrintUsageByUserRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintUsageByUser $body, ?DailyPrintUsageByUserRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?DailyPrintUsageByUserRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?DailyPrintUsageByUserRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PrintUsageByUser $body, ?DailyPrintUsag $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Reports/DailyPrintUsageByUser/Item/PrintUsageByUserItemRequestBuilder.php b/src/Generated/Reports/DailyPrintUsageByUser/Item/PrintUsageByUserItemRequestBuilder.php index 55e49df8f26..6cdd8cc999e 100644 --- a/src/Generated/Reports/DailyPrintUsageByUser/Item/PrintUsageByUserItemRequestBuilder.php +++ b/src/Generated/Reports/DailyPrintUsageByUser/Item/PrintUsageByUserItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintUsageByUser; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property dailyPrintUsageByUser for reports * @param PrintUsageByUserItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintUsageByUserItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a user's usage summary for a particular time period. For descriptions of each endpoint, see printUsageByUser. This API is available in the following national cloud deployments. * @param PrintUsageByUserItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/printusagebyuser-get?view=graph-rest-1.0 Find more info here */ public function get(?PrintUsageByUserItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property dailyPrintUsageByUser in reports * @param PrintUsageByUser $body The request body * @param PrintUsageByUserItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintUsageByUser $body, ?PrintUsageByUserItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?PrintUsageByUserItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?PrintUsageByUserItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?PrintUsageByUserItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(PrintUsageByUser $body, ?PrintUsageByU $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Reports/DeviceConfigurationDeviceActivity/DeviceConfigurationDeviceActivityRequestBuilder.php b/src/Generated/Reports/DeviceConfigurationDeviceActivity/DeviceConfigurationDeviceActivityRequestBuilder.php index 8b6626e0da0..d87e9983344 100644 --- a/src/Generated/Reports/DeviceConfigurationDeviceActivity/DeviceConfigurationDeviceActivityRequestBuilder.php +++ b/src/Generated/Reports/DeviceConfigurationDeviceActivity/DeviceConfigurationDeviceActivityRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Report; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Metadata for the device configuration device activity report * @param DeviceConfigurationDeviceActivityRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceConfigurationDeviceActivityRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Report::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Report::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?DeviceConfigurationDeviceActivityReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/DeviceConfigurationUserActivity/DeviceConfigurationUserActivityRequestBuilder.php b/src/Generated/Reports/DeviceConfigurationUserActivity/DeviceConfigurationUserActivityRequestBuilder.php index 670594b3884..da8ca2c4d66 100644 --- a/src/Generated/Reports/DeviceConfigurationUserActivity/DeviceConfigurationUserActivityRequestBuilder.php +++ b/src/Generated/Reports/DeviceConfigurationUserActivity/DeviceConfigurationUserActivityRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Report; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Metadata for the device configuration user activity report * @param DeviceConfigurationUserActivityRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceConfigurationUserActivityRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Report::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Report::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?DeviceConfigurationUserActivityRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/GetEmailActivityCountsWithPeriod/GetEmailActivityCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetEmailActivityCountsWithPeriod/GetEmailActivityCountsWithPeriodRequestBuilder.php index cfcbdd74cc0..07296949e57 100644 --- a/src/Generated/Reports/GetEmailActivityCountsWithPeriod/GetEmailActivityCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetEmailActivityCountsWithPeriod/GetEmailActivityCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getEmailActivityCounts * @param GetEmailActivityCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetEmailActivityCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetEmailActivityCountsWithPeriodRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetEmailActivityUserCountsWithPeriod/GetEmailActivityUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetEmailActivityUserCountsWithPeriod/GetEmailActivityUserCountsWithPeriodRequestBuilder.php index 70bfa5b25bd..d87a1bc0b15 100644 --- a/src/Generated/Reports/GetEmailActivityUserCountsWithPeriod/GetEmailActivityUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetEmailActivityUserCountsWithPeriod/GetEmailActivityUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getEmailActivityUserCounts * @param GetEmailActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetEmailActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetEmailActivityUserCountsWithPeriodReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetEmailActivityUserDetailWithDate/GetEmailActivityUserDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetEmailActivityUserDetailWithDate/GetEmailActivityUserDetailWithDateRequestBuilder.php index 5d0f5483936..2599064c75d 100644 --- a/src/Generated/Reports/GetEmailActivityUserDetailWithDate/GetEmailActivityUserDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetEmailActivityUserDetailWithDate/GetEmailActivityUserDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getEmailActivityUserDetail * @param GetEmailActivityUserDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetEmailActivityUserDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetEmailActivityUserDetailWithDateReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetEmailActivityUserDetailWithPeriod/GetEmailActivityUserDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetEmailActivityUserDetailWithPeriod/GetEmailActivityUserDetailWithPeriodRequestBuilder.php index ac10df22348..b5f7a5b7f9a 100644 --- a/src/Generated/Reports/GetEmailActivityUserDetailWithPeriod/GetEmailActivityUserDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetEmailActivityUserDetailWithPeriod/GetEmailActivityUserDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getEmailActivityUserDetail * @param GetEmailActivityUserDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetEmailActivityUserDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetEmailActivityUserDetailWithPeriodReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetEmailAppUsageAppsUserCountsWithPeriod/GetEmailAppUsageAppsUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetEmailAppUsageAppsUserCountsWithPeriod/GetEmailAppUsageAppsUserCountsWithPeriodRequestBuilder.php index 6674947890e..f59eb1a84e2 100644 --- a/src/Generated/Reports/GetEmailAppUsageAppsUserCountsWithPeriod/GetEmailAppUsageAppsUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetEmailAppUsageAppsUserCountsWithPeriod/GetEmailAppUsageAppsUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getEmailAppUsageAppsUserCounts * @param GetEmailAppUsageAppsUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetEmailAppUsageAppsUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetEmailAppUsageAppsUserCountsWithPerio $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetEmailAppUsageUserCountsWithPeriod/GetEmailAppUsageUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetEmailAppUsageUserCountsWithPeriod/GetEmailAppUsageUserCountsWithPeriodRequestBuilder.php index 1eac0e8ae3a..91bc2f4453f 100644 --- a/src/Generated/Reports/GetEmailAppUsageUserCountsWithPeriod/GetEmailAppUsageUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetEmailAppUsageUserCountsWithPeriod/GetEmailAppUsageUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getEmailAppUsageUserCounts * @param GetEmailAppUsageUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetEmailAppUsageUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetEmailAppUsageUserCountsWithPeriodReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetEmailAppUsageUserDetailWithDate/GetEmailAppUsageUserDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetEmailAppUsageUserDetailWithDate/GetEmailAppUsageUserDetailWithDateRequestBuilder.php index 66aa193e018..8f74bd7bd7d 100644 --- a/src/Generated/Reports/GetEmailAppUsageUserDetailWithDate/GetEmailAppUsageUserDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetEmailAppUsageUserDetailWithDate/GetEmailAppUsageUserDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getEmailAppUsageUserDetail * @param GetEmailAppUsageUserDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetEmailAppUsageUserDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetEmailAppUsageUserDetailWithDateReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetEmailAppUsageUserDetailWithPeriod/GetEmailAppUsageUserDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetEmailAppUsageUserDetailWithPeriod/GetEmailAppUsageUserDetailWithPeriodRequestBuilder.php index c29132cab15..3f083783f55 100644 --- a/src/Generated/Reports/GetEmailAppUsageUserDetailWithPeriod/GetEmailAppUsageUserDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetEmailAppUsageUserDetailWithPeriod/GetEmailAppUsageUserDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getEmailAppUsageUserDetail * @param GetEmailAppUsageUserDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetEmailAppUsageUserDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetEmailAppUsageUserDetailWithPeriodReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetEmailAppUsageVersionsUserCountsWithPeriod/GetEmailAppUsageVersionsUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetEmailAppUsageVersionsUserCountsWithPeriod/GetEmailAppUsageVersionsUserCountsWithPeriodRequestBuilder.php index 721891d9ae0..e402a8f238a 100644 --- a/src/Generated/Reports/GetEmailAppUsageVersionsUserCountsWithPeriod/GetEmailAppUsageVersionsUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetEmailAppUsageVersionsUserCountsWithPeriod/GetEmailAppUsageVersionsUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getEmailAppUsageVersionsUserCounts * @param GetEmailAppUsageVersionsUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetEmailAppUsageVersionsUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetEmailAppUsageVersionsUserCountsWithP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetGroupArchivedPrintJobsWithGroupIdWithStartDateTimeWithEndDateTime/GetGroupArchivedPrintJobsWithGroupIdWithStartDateTimeWithEndDateTimeRequestBuilder.php b/src/Generated/Reports/GetGroupArchivedPrintJobsWithGroupIdWithStartDateTimeWithEndDateTime/GetGroupArchivedPrintJobsWithGroupIdWithStartDateTimeWithEndDateTimeRequestBuilder.php index a8be97cbcf7..bce3801d73f 100644 --- a/src/Generated/Reports/GetGroupArchivedPrintJobsWithGroupIdWithStartDateTimeWithEndDateTime/GetGroupArchivedPrintJobsWithGroupIdWithStartDateTimeWithEndDateTimeRequestBuilder.php +++ b/src/Generated/Reports/GetGroupArchivedPrintJobsWithGroupIdWithStartDateTimeWithEndDateTime/GetGroupArchivedPrintJobsWithGroupIdWithStartDateTimeWithEndDateTimeRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -41,19 +40,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getGroupArchivedPrintJobs * @param GetGroupArchivedPrintJobsWithGroupIdWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetGroupArchivedPrintJobsWithGroupIdWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetGroupArchivedPrintJobsWithGroupIdWithStartDateTimeWithEndDateTimeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetGroupArchivedPrintJobsWithGroupIdWithStartDateTimeWithEndDateTimeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -66,7 +62,6 @@ public function toGetRequestInformation(?GetGroupArchivedPrintJobsWithGroupIdWit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -74,6 +69,7 @@ public function toGetRequestInformation(?GetGroupArchivedPrintJobsWithGroupIdWit } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/GetM365AppPlatformUserCountsWithPeriod/GetM365AppPlatformUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetM365AppPlatformUserCountsWithPeriod/GetM365AppPlatformUserCountsWithPeriodRequestBuilder.php index bdb2229d9f5..74ee63dbaa3 100644 --- a/src/Generated/Reports/GetM365AppPlatformUserCountsWithPeriod/GetM365AppPlatformUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetM365AppPlatformUserCountsWithPeriod/GetM365AppPlatformUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getM365AppPlatformUserCounts * @param GetM365AppPlatformUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetM365AppPlatformUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetM365AppPlatformUserCountsWithPeriodR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetM365AppUserCountsWithPeriod/GetM365AppUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetM365AppUserCountsWithPeriod/GetM365AppUserCountsWithPeriodRequestBuilder.php index 31e91553544..0a78b5aff93 100644 --- a/src/Generated/Reports/GetM365AppUserCountsWithPeriod/GetM365AppUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetM365AppUserCountsWithPeriod/GetM365AppUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getM365AppUserCounts * @param GetM365AppUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetM365AppUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetM365AppUserCountsWithPeriodRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetM365AppUserDetailWithDate/GetM365AppUserDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetM365AppUserDetailWithDate/GetM365AppUserDetailWithDateRequestBuilder.php index 7e08219e000..226ba4a4998 100644 --- a/src/Generated/Reports/GetM365AppUserDetailWithDate/GetM365AppUserDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetM365AppUserDetailWithDate/GetM365AppUserDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getM365AppUserDetail * @param GetM365AppUserDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetM365AppUserDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetM365AppUserDetailWithDateRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetM365AppUserDetailWithPeriod/GetM365AppUserDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetM365AppUserDetailWithPeriod/GetM365AppUserDetailWithPeriodRequestBuilder.php index 659105b9a03..5182f3887d1 100644 --- a/src/Generated/Reports/GetM365AppUserDetailWithPeriod/GetM365AppUserDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetM365AppUserDetailWithPeriod/GetM365AppUserDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getM365AppUserDetail * @param GetM365AppUserDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetM365AppUserDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetM365AppUserDetailWithPeriodRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetMailboxUsageDetailWithPeriod/GetMailboxUsageDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetMailboxUsageDetailWithPeriod/GetMailboxUsageDetailWithPeriodRequestBuilder.php index 09ae2a94cda..f3df9085758 100644 --- a/src/Generated/Reports/GetMailboxUsageDetailWithPeriod/GetMailboxUsageDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetMailboxUsageDetailWithPeriod/GetMailboxUsageDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getMailboxUsageDetail * @param GetMailboxUsageDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetMailboxUsageDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetMailboxUsageDetailWithPeriodRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetMailboxUsageMailboxCountsWithPeriod/GetMailboxUsageMailboxCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetMailboxUsageMailboxCountsWithPeriod/GetMailboxUsageMailboxCountsWithPeriodRequestBuilder.php index 0e38538fe0f..a355016caa5 100644 --- a/src/Generated/Reports/GetMailboxUsageMailboxCountsWithPeriod/GetMailboxUsageMailboxCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetMailboxUsageMailboxCountsWithPeriod/GetMailboxUsageMailboxCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getMailboxUsageMailboxCounts * @param GetMailboxUsageMailboxCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetMailboxUsageMailboxCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetMailboxUsageMailboxCountsWithPeriodR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetMailboxUsageQuotaStatusMailboxCountsWithPeriod/GetMailboxUsageQuotaStatusMailboxCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetMailboxUsageQuotaStatusMailboxCountsWithPeriod/GetMailboxUsageQuotaStatusMailboxCountsWithPeriodRequestBuilder.php index 096157d9db3..52ffde32841 100644 --- a/src/Generated/Reports/GetMailboxUsageQuotaStatusMailboxCountsWithPeriod/GetMailboxUsageQuotaStatusMailboxCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetMailboxUsageQuotaStatusMailboxCountsWithPeriod/GetMailboxUsageQuotaStatusMailboxCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getMailboxUsageQuotaStatusMailboxCounts * @param GetMailboxUsageQuotaStatusMailboxCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetMailboxUsageQuotaStatusMailboxCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetMailboxUsageQuotaStatusMailboxCounts $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetMailboxUsageStorageWithPeriod/GetMailboxUsageStorageWithPeriodRequestBuilder.php b/src/Generated/Reports/GetMailboxUsageStorageWithPeriod/GetMailboxUsageStorageWithPeriodRequestBuilder.php index 9177fa4aad0..2af3256ea3b 100644 --- a/src/Generated/Reports/GetMailboxUsageStorageWithPeriod/GetMailboxUsageStorageWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetMailboxUsageStorageWithPeriod/GetMailboxUsageStorageWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getMailboxUsageStorage * @param GetMailboxUsageStorageWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetMailboxUsageStorageWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetMailboxUsageStorageWithPeriodRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOffice365ActivationCounts/GetOffice365ActivationCountsRequestBuilder.php b/src/Generated/Reports/GetOffice365ActivationCounts/GetOffice365ActivationCountsRequestBuilder.php index 42366eb71d1..14eed6ceb04 100644 --- a/src/Generated/Reports/GetOffice365ActivationCounts/GetOffice365ActivationCountsRequestBuilder.php +++ b/src/Generated/Reports/GetOffice365ActivationCounts/GetOffice365ActivationCountsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOffice365ActivationCounts * @param GetOffice365ActivationCountsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOffice365ActivationCountsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -63,6 +61,7 @@ public function toGetRequestInformation(?GetOffice365ActivationCountsRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOffice365ActivationsUserCounts/GetOffice365ActivationsUserCountsRequestBuilder.php b/src/Generated/Reports/GetOffice365ActivationsUserCounts/GetOffice365ActivationsUserCountsRequestBuilder.php index 9aed54d399f..f73f46e387c 100644 --- a/src/Generated/Reports/GetOffice365ActivationsUserCounts/GetOffice365ActivationsUserCountsRequestBuilder.php +++ b/src/Generated/Reports/GetOffice365ActivationsUserCounts/GetOffice365ActivationsUserCountsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOffice365ActivationsUserCounts * @param GetOffice365ActivationsUserCountsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOffice365ActivationsUserCountsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -63,6 +61,7 @@ public function toGetRequestInformation(?GetOffice365ActivationsUserCountsReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOffice365ActivationsUserDetail/GetOffice365ActivationsUserDetailRequestBuilder.php b/src/Generated/Reports/GetOffice365ActivationsUserDetail/GetOffice365ActivationsUserDetailRequestBuilder.php index 0894abb0fb2..c1d5ca989b4 100644 --- a/src/Generated/Reports/GetOffice365ActivationsUserDetail/GetOffice365ActivationsUserDetailRequestBuilder.php +++ b/src/Generated/Reports/GetOffice365ActivationsUserDetail/GetOffice365ActivationsUserDetailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOffice365ActivationsUserDetail * @param GetOffice365ActivationsUserDetailRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOffice365ActivationsUserDetailRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -63,6 +61,7 @@ public function toGetRequestInformation(?GetOffice365ActivationsUserDetailReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOffice365ActiveUserCountsWithPeriod/GetOffice365ActiveUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOffice365ActiveUserCountsWithPeriod/GetOffice365ActiveUserCountsWithPeriodRequestBuilder.php index f85a6b1181b..d093ab4dee1 100644 --- a/src/Generated/Reports/GetOffice365ActiveUserCountsWithPeriod/GetOffice365ActiveUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOffice365ActiveUserCountsWithPeriod/GetOffice365ActiveUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOffice365ActiveUserCounts * @param GetOffice365ActiveUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOffice365ActiveUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOffice365ActiveUserCountsWithPeriodR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOffice365ActiveUserDetailWithDate/GetOffice365ActiveUserDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetOffice365ActiveUserDetailWithDate/GetOffice365ActiveUserDetailWithDateRequestBuilder.php index 4fd9e2af67c..0ee4f061b4c 100644 --- a/src/Generated/Reports/GetOffice365ActiveUserDetailWithDate/GetOffice365ActiveUserDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetOffice365ActiveUserDetailWithDate/GetOffice365ActiveUserDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOffice365ActiveUserDetail * @param GetOffice365ActiveUserDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOffice365ActiveUserDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetOffice365ActiveUserDetailWithDateReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOffice365ActiveUserDetailWithPeriod/GetOffice365ActiveUserDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOffice365ActiveUserDetailWithPeriod/GetOffice365ActiveUserDetailWithPeriodRequestBuilder.php index 117e2e9a05a..51371d80a2e 100644 --- a/src/Generated/Reports/GetOffice365ActiveUserDetailWithPeriod/GetOffice365ActiveUserDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOffice365ActiveUserDetailWithPeriod/GetOffice365ActiveUserDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOffice365ActiveUserDetail * @param GetOffice365ActiveUserDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOffice365ActiveUserDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOffice365ActiveUserDetailWithPeriodR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOffice365GroupsActivityCountsWithPeriod/GetOffice365GroupsActivityCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOffice365GroupsActivityCountsWithPeriod/GetOffice365GroupsActivityCountsWithPeriodRequestBuilder.php index 3eced4352e2..9f053a60a6a 100644 --- a/src/Generated/Reports/GetOffice365GroupsActivityCountsWithPeriod/GetOffice365GroupsActivityCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOffice365GroupsActivityCountsWithPeriod/GetOffice365GroupsActivityCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOffice365GroupsActivityCounts * @param GetOffice365GroupsActivityCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOffice365GroupsActivityCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOffice365GroupsActivityCountsWithPer $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOffice365GroupsActivityDetailWithDate/GetOffice365GroupsActivityDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetOffice365GroupsActivityDetailWithDate/GetOffice365GroupsActivityDetailWithDateRequestBuilder.php index 8a7152759c8..85bf2bbd934 100644 --- a/src/Generated/Reports/GetOffice365GroupsActivityDetailWithDate/GetOffice365GroupsActivityDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetOffice365GroupsActivityDetailWithDate/GetOffice365GroupsActivityDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOffice365GroupsActivityDetail * @param GetOffice365GroupsActivityDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOffice365GroupsActivityDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetOffice365GroupsActivityDetailWithDat $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOffice365GroupsActivityDetailWithPeriod/GetOffice365GroupsActivityDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOffice365GroupsActivityDetailWithPeriod/GetOffice365GroupsActivityDetailWithPeriodRequestBuilder.php index 9a9ea0c32fd..2a877e14c2f 100644 --- a/src/Generated/Reports/GetOffice365GroupsActivityDetailWithPeriod/GetOffice365GroupsActivityDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOffice365GroupsActivityDetailWithPeriod/GetOffice365GroupsActivityDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOffice365GroupsActivityDetail * @param GetOffice365GroupsActivityDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOffice365GroupsActivityDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOffice365GroupsActivityDetailWithPer $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOffice365GroupsActivityFileCountsWithPeriod/GetOffice365GroupsActivityFileCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOffice365GroupsActivityFileCountsWithPeriod/GetOffice365GroupsActivityFileCountsWithPeriodRequestBuilder.php index 6caf586c2d6..695fa46974d 100644 --- a/src/Generated/Reports/GetOffice365GroupsActivityFileCountsWithPeriod/GetOffice365GroupsActivityFileCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOffice365GroupsActivityFileCountsWithPeriod/GetOffice365GroupsActivityFileCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOffice365GroupsActivityFileCounts * @param GetOffice365GroupsActivityFileCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOffice365GroupsActivityFileCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOffice365GroupsActivityFileCountsWit $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOffice365GroupsActivityGroupCountsWithPeriod/GetOffice365GroupsActivityGroupCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOffice365GroupsActivityGroupCountsWithPeriod/GetOffice365GroupsActivityGroupCountsWithPeriodRequestBuilder.php index baa59919614..e255f488213 100644 --- a/src/Generated/Reports/GetOffice365GroupsActivityGroupCountsWithPeriod/GetOffice365GroupsActivityGroupCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOffice365GroupsActivityGroupCountsWithPeriod/GetOffice365GroupsActivityGroupCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOffice365GroupsActivityGroupCounts * @param GetOffice365GroupsActivityGroupCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOffice365GroupsActivityGroupCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOffice365GroupsActivityGroupCountsWi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOffice365GroupsActivityStorageWithPeriod/GetOffice365GroupsActivityStorageWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOffice365GroupsActivityStorageWithPeriod/GetOffice365GroupsActivityStorageWithPeriodRequestBuilder.php index 17fc827aa18..2ce6c808410 100644 --- a/src/Generated/Reports/GetOffice365GroupsActivityStorageWithPeriod/GetOffice365GroupsActivityStorageWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOffice365GroupsActivityStorageWithPeriod/GetOffice365GroupsActivityStorageWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOffice365GroupsActivityStorage * @param GetOffice365GroupsActivityStorageWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOffice365GroupsActivityStorageWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOffice365GroupsActivityStorageWithPe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOffice365ServicesUserCountsWithPeriod/GetOffice365ServicesUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOffice365ServicesUserCountsWithPeriod/GetOffice365ServicesUserCountsWithPeriodRequestBuilder.php index 19f912f5d73..7b7422aad31 100644 --- a/src/Generated/Reports/GetOffice365ServicesUserCountsWithPeriod/GetOffice365ServicesUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOffice365ServicesUserCountsWithPeriod/GetOffice365ServicesUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOffice365ServicesUserCounts * @param GetOffice365ServicesUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOffice365ServicesUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOffice365ServicesUserCountsWithPerio $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOneDriveActivityFileCountsWithPeriod/GetOneDriveActivityFileCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOneDriveActivityFileCountsWithPeriod/GetOneDriveActivityFileCountsWithPeriodRequestBuilder.php index 588cc503da7..21b416ddab8 100644 --- a/src/Generated/Reports/GetOneDriveActivityFileCountsWithPeriod/GetOneDriveActivityFileCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOneDriveActivityFileCountsWithPeriod/GetOneDriveActivityFileCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOneDriveActivityFileCounts * @param GetOneDriveActivityFileCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOneDriveActivityFileCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOneDriveActivityFileCountsWithPeriod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOneDriveActivityUserCountsWithPeriod/GetOneDriveActivityUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOneDriveActivityUserCountsWithPeriod/GetOneDriveActivityUserCountsWithPeriodRequestBuilder.php index 58b59267b8b..9ab7ff9a6d9 100644 --- a/src/Generated/Reports/GetOneDriveActivityUserCountsWithPeriod/GetOneDriveActivityUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOneDriveActivityUserCountsWithPeriod/GetOneDriveActivityUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOneDriveActivityUserCounts * @param GetOneDriveActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOneDriveActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOneDriveActivityUserCountsWithPeriod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOneDriveActivityUserDetailWithDate/GetOneDriveActivityUserDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetOneDriveActivityUserDetailWithDate/GetOneDriveActivityUserDetailWithDateRequestBuilder.php index df79f0fc530..a0540a28ca4 100644 --- a/src/Generated/Reports/GetOneDriveActivityUserDetailWithDate/GetOneDriveActivityUserDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetOneDriveActivityUserDetailWithDate/GetOneDriveActivityUserDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOneDriveActivityUserDetail * @param GetOneDriveActivityUserDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOneDriveActivityUserDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetOneDriveActivityUserDetailWithDateRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOneDriveActivityUserDetailWithPeriod/GetOneDriveActivityUserDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOneDriveActivityUserDetailWithPeriod/GetOneDriveActivityUserDetailWithPeriodRequestBuilder.php index 8c403af89f8..e38c196ab31 100644 --- a/src/Generated/Reports/GetOneDriveActivityUserDetailWithPeriod/GetOneDriveActivityUserDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOneDriveActivityUserDetailWithPeriod/GetOneDriveActivityUserDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOneDriveActivityUserDetail * @param GetOneDriveActivityUserDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOneDriveActivityUserDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOneDriveActivityUserDetailWithPeriod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOneDriveUsageAccountCountsWithPeriod/GetOneDriveUsageAccountCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOneDriveUsageAccountCountsWithPeriod/GetOneDriveUsageAccountCountsWithPeriodRequestBuilder.php index ee783924e5b..ebdbcd545a7 100644 --- a/src/Generated/Reports/GetOneDriveUsageAccountCountsWithPeriod/GetOneDriveUsageAccountCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOneDriveUsageAccountCountsWithPeriod/GetOneDriveUsageAccountCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOneDriveUsageAccountCounts * @param GetOneDriveUsageAccountCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOneDriveUsageAccountCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOneDriveUsageAccountCountsWithPeriod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOneDriveUsageAccountDetailWithDate/GetOneDriveUsageAccountDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetOneDriveUsageAccountDetailWithDate/GetOneDriveUsageAccountDetailWithDateRequestBuilder.php index a2f33e2d9d2..fde549e57c0 100644 --- a/src/Generated/Reports/GetOneDriveUsageAccountDetailWithDate/GetOneDriveUsageAccountDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetOneDriveUsageAccountDetailWithDate/GetOneDriveUsageAccountDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOneDriveUsageAccountDetail * @param GetOneDriveUsageAccountDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOneDriveUsageAccountDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetOneDriveUsageAccountDetailWithDateRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOneDriveUsageAccountDetailWithPeriod/GetOneDriveUsageAccountDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOneDriveUsageAccountDetailWithPeriod/GetOneDriveUsageAccountDetailWithPeriodRequestBuilder.php index 767c3344500..58d16e10e39 100644 --- a/src/Generated/Reports/GetOneDriveUsageAccountDetailWithPeriod/GetOneDriveUsageAccountDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOneDriveUsageAccountDetailWithPeriod/GetOneDriveUsageAccountDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOneDriveUsageAccountDetail * @param GetOneDriveUsageAccountDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOneDriveUsageAccountDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOneDriveUsageAccountDetailWithPeriod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOneDriveUsageFileCountsWithPeriod/GetOneDriveUsageFileCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOneDriveUsageFileCountsWithPeriod/GetOneDriveUsageFileCountsWithPeriodRequestBuilder.php index a43cbd2684d..4be449ab1b8 100644 --- a/src/Generated/Reports/GetOneDriveUsageFileCountsWithPeriod/GetOneDriveUsageFileCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOneDriveUsageFileCountsWithPeriod/GetOneDriveUsageFileCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOneDriveUsageFileCounts * @param GetOneDriveUsageFileCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOneDriveUsageFileCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOneDriveUsageFileCountsWithPeriodReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetOneDriveUsageStorageWithPeriod/GetOneDriveUsageStorageWithPeriodRequestBuilder.php b/src/Generated/Reports/GetOneDriveUsageStorageWithPeriod/GetOneDriveUsageStorageWithPeriodRequestBuilder.php index b84d92dae25..aee3ed87ae3 100644 --- a/src/Generated/Reports/GetOneDriveUsageStorageWithPeriod/GetOneDriveUsageStorageWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetOneDriveUsageStorageWithPeriod/GetOneDriveUsageStorageWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getOneDriveUsageStorage * @param GetOneDriveUsageStorageWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetOneDriveUsageStorageWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetOneDriveUsageStorageWithPeriodReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetPrinterArchivedPrintJobsWithPrinterIdWithStartDateTimeWithEndDateTime/GetPrinterArchivedPrintJobsWithPrinterIdWithStartDateTimeWithEndDateTimeRequestBuilder.php b/src/Generated/Reports/GetPrinterArchivedPrintJobsWithPrinterIdWithStartDateTimeWithEndDateTime/GetPrinterArchivedPrintJobsWithPrinterIdWithStartDateTimeWithEndDateTimeRequestBuilder.php index 72352f97e05..9e916fd172e 100644 --- a/src/Generated/Reports/GetPrinterArchivedPrintJobsWithPrinterIdWithStartDateTimeWithEndDateTime/GetPrinterArchivedPrintJobsWithPrinterIdWithStartDateTimeWithEndDateTimeRequestBuilder.php +++ b/src/Generated/Reports/GetPrinterArchivedPrintJobsWithPrinterIdWithStartDateTimeWithEndDateTime/GetPrinterArchivedPrintJobsWithPrinterIdWithStartDateTimeWithEndDateTimeRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -41,19 +40,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getPrinterArchivedPrintJobs * @param GetPrinterArchivedPrintJobsWithPrinterIdWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetPrinterArchivedPrintJobsWithPrinterIdWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetPrinterArchivedPrintJobsWithPrinterIdWithStartDateTimeWithEndDateTimeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetPrinterArchivedPrintJobsWithPrinterIdWithStartDateTimeWithEndDateTimeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -66,7 +62,6 @@ public function toGetRequestInformation(?GetPrinterArchivedPrintJobsWithPrinterI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -74,6 +69,7 @@ public function toGetRequestInformation(?GetPrinterArchivedPrintJobsWithPrinterI } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSharePointActivityFileCountsWithPeriod/GetSharePointActivityFileCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSharePointActivityFileCountsWithPeriod/GetSharePointActivityFileCountsWithPeriodRequestBuilder.php index fa691520f4c..253bf661dcf 100644 --- a/src/Generated/Reports/GetSharePointActivityFileCountsWithPeriod/GetSharePointActivityFileCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSharePointActivityFileCountsWithPeriod/GetSharePointActivityFileCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSharePointActivityFileCounts * @param GetSharePointActivityFileCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSharePointActivityFileCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSharePointActivityFileCountsWithPeri $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSharePointActivityPagesWithPeriod/GetSharePointActivityPagesWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSharePointActivityPagesWithPeriod/GetSharePointActivityPagesWithPeriodRequestBuilder.php index 3877a707fcc..c08d7e53692 100644 --- a/src/Generated/Reports/GetSharePointActivityPagesWithPeriod/GetSharePointActivityPagesWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSharePointActivityPagesWithPeriod/GetSharePointActivityPagesWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSharePointActivityPages * @param GetSharePointActivityPagesWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSharePointActivityPagesWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSharePointActivityPagesWithPeriodReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSharePointActivityUserCountsWithPeriod/GetSharePointActivityUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSharePointActivityUserCountsWithPeriod/GetSharePointActivityUserCountsWithPeriodRequestBuilder.php index 7a8e8a22dad..e46e98e544d 100644 --- a/src/Generated/Reports/GetSharePointActivityUserCountsWithPeriod/GetSharePointActivityUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSharePointActivityUserCountsWithPeriod/GetSharePointActivityUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSharePointActivityUserCounts * @param GetSharePointActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSharePointActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSharePointActivityUserCountsWithPeri $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSharePointActivityUserDetailWithDate/GetSharePointActivityUserDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetSharePointActivityUserDetailWithDate/GetSharePointActivityUserDetailWithDateRequestBuilder.php index 5b24a7a53db..5da6e6fffcc 100644 --- a/src/Generated/Reports/GetSharePointActivityUserDetailWithDate/GetSharePointActivityUserDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetSharePointActivityUserDetailWithDate/GetSharePointActivityUserDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSharePointActivityUserDetail * @param GetSharePointActivityUserDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSharePointActivityUserDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetSharePointActivityUserDetailWithDate $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSharePointActivityUserDetailWithPeriod/GetSharePointActivityUserDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSharePointActivityUserDetailWithPeriod/GetSharePointActivityUserDetailWithPeriodRequestBuilder.php index 7850e1cb9a8..cae8f870956 100644 --- a/src/Generated/Reports/GetSharePointActivityUserDetailWithPeriod/GetSharePointActivityUserDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSharePointActivityUserDetailWithPeriod/GetSharePointActivityUserDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSharePointActivityUserDetail * @param GetSharePointActivityUserDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSharePointActivityUserDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSharePointActivityUserDetailWithPeri $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSharePointSiteUsageDetailWithDate/GetSharePointSiteUsageDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetSharePointSiteUsageDetailWithDate/GetSharePointSiteUsageDetailWithDateRequestBuilder.php index 29ce074695a..dd7a29a6953 100644 --- a/src/Generated/Reports/GetSharePointSiteUsageDetailWithDate/GetSharePointSiteUsageDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetSharePointSiteUsageDetailWithDate/GetSharePointSiteUsageDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSharePointSiteUsageDetail * @param GetSharePointSiteUsageDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSharePointSiteUsageDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetSharePointSiteUsageDetailWithDateReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSharePointSiteUsageDetailWithPeriod/GetSharePointSiteUsageDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSharePointSiteUsageDetailWithPeriod/GetSharePointSiteUsageDetailWithPeriodRequestBuilder.php index 1d6548c5f4f..df589b6e927 100644 --- a/src/Generated/Reports/GetSharePointSiteUsageDetailWithPeriod/GetSharePointSiteUsageDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSharePointSiteUsageDetailWithPeriod/GetSharePointSiteUsageDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSharePointSiteUsageDetail * @param GetSharePointSiteUsageDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSharePointSiteUsageDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSharePointSiteUsageDetailWithPeriodR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSharePointSiteUsageFileCountsWithPeriod/GetSharePointSiteUsageFileCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSharePointSiteUsageFileCountsWithPeriod/GetSharePointSiteUsageFileCountsWithPeriodRequestBuilder.php index 791afe9c490..e88371f470d 100644 --- a/src/Generated/Reports/GetSharePointSiteUsageFileCountsWithPeriod/GetSharePointSiteUsageFileCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSharePointSiteUsageFileCountsWithPeriod/GetSharePointSiteUsageFileCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSharePointSiteUsageFileCounts * @param GetSharePointSiteUsageFileCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSharePointSiteUsageFileCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSharePointSiteUsageFileCountsWithPer $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSharePointSiteUsagePagesWithPeriod/GetSharePointSiteUsagePagesWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSharePointSiteUsagePagesWithPeriod/GetSharePointSiteUsagePagesWithPeriodRequestBuilder.php index d0235f4490a..ff0c1c56aba 100644 --- a/src/Generated/Reports/GetSharePointSiteUsagePagesWithPeriod/GetSharePointSiteUsagePagesWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSharePointSiteUsagePagesWithPeriod/GetSharePointSiteUsagePagesWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSharePointSiteUsagePages * @param GetSharePointSiteUsagePagesWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSharePointSiteUsagePagesWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSharePointSiteUsagePagesWithPeriodRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSharePointSiteUsageSiteCountsWithPeriod/GetSharePointSiteUsageSiteCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSharePointSiteUsageSiteCountsWithPeriod/GetSharePointSiteUsageSiteCountsWithPeriodRequestBuilder.php index 141daa6104e..d1d1d5df602 100644 --- a/src/Generated/Reports/GetSharePointSiteUsageSiteCountsWithPeriod/GetSharePointSiteUsageSiteCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSharePointSiteUsageSiteCountsWithPeriod/GetSharePointSiteUsageSiteCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSharePointSiteUsageSiteCounts * @param GetSharePointSiteUsageSiteCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSharePointSiteUsageSiteCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSharePointSiteUsageSiteCountsWithPer $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSharePointSiteUsageStorageWithPeriod/GetSharePointSiteUsageStorageWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSharePointSiteUsageStorageWithPeriod/GetSharePointSiteUsageStorageWithPeriodRequestBuilder.php index 867e55bf4e5..0b3a6983baf 100644 --- a/src/Generated/Reports/GetSharePointSiteUsageStorageWithPeriod/GetSharePointSiteUsageStorageWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSharePointSiteUsageStorageWithPeriod/GetSharePointSiteUsageStorageWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSharePointSiteUsageStorage * @param GetSharePointSiteUsageStorageWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSharePointSiteUsageStorageWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSharePointSiteUsageStorageWithPeriod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessActivityCountsWithPeriod/GetSkypeForBusinessActivityCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessActivityCountsWithPeriod/GetSkypeForBusinessActivityCountsWithPeriodRequestBuilder.php index 5c7f25011b2..74b676a383a 100644 --- a/src/Generated/Reports/GetSkypeForBusinessActivityCountsWithPeriod/GetSkypeForBusinessActivityCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessActivityCountsWithPeriod/GetSkypeForBusinessActivityCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessActivityCounts * @param GetSkypeForBusinessActivityCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessActivityCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessActivityCountsWithPe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessActivityUserCountsWithPeriod/GetSkypeForBusinessActivityUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessActivityUserCountsWithPeriod/GetSkypeForBusinessActivityUserCountsWithPeriodRequestBuilder.php index 2257f307b4d..37ed09efa54 100644 --- a/src/Generated/Reports/GetSkypeForBusinessActivityUserCountsWithPeriod/GetSkypeForBusinessActivityUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessActivityUserCountsWithPeriod/GetSkypeForBusinessActivityUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessActivityUserCounts * @param GetSkypeForBusinessActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessActivityUserCountsWi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessActivityUserDetailWithDate/GetSkypeForBusinessActivityUserDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessActivityUserDetailWithDate/GetSkypeForBusinessActivityUserDetailWithDateRequestBuilder.php index 52458ad3604..68703523fbd 100644 --- a/src/Generated/Reports/GetSkypeForBusinessActivityUserDetailWithDate/GetSkypeForBusinessActivityUserDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessActivityUserDetailWithDate/GetSkypeForBusinessActivityUserDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessActivityUserDetail * @param GetSkypeForBusinessActivityUserDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessActivityUserDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessActivityUserDetailWi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessActivityUserDetailWithPeriod/GetSkypeForBusinessActivityUserDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessActivityUserDetailWithPeriod/GetSkypeForBusinessActivityUserDetailWithPeriodRequestBuilder.php index a270823dc10..8944f56cc3d 100644 --- a/src/Generated/Reports/GetSkypeForBusinessActivityUserDetailWithPeriod/GetSkypeForBusinessActivityUserDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessActivityUserDetailWithPeriod/GetSkypeForBusinessActivityUserDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessActivityUserDetail * @param GetSkypeForBusinessActivityUserDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessActivityUserDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessActivityUserDetailWi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessDeviceUsageDistributionUserCountsWithPeriod/GetSkypeForBusinessDeviceUsageDistributionUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessDeviceUsageDistributionUserCountsWithPeriod/GetSkypeForBusinessDeviceUsageDistributionUserCountsWithPeriodRequestBuilder.php index c53a8e7602c..674fd006ae2 100644 --- a/src/Generated/Reports/GetSkypeForBusinessDeviceUsageDistributionUserCountsWithPeriod/GetSkypeForBusinessDeviceUsageDistributionUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessDeviceUsageDistributionUserCountsWithPeriod/GetSkypeForBusinessDeviceUsageDistributionUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessDeviceUsageDistributionUserCounts * @param GetSkypeForBusinessDeviceUsageDistributionUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessDeviceUsageDistributionUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessDeviceUsageDistribut $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessDeviceUsageUserCountsWithPeriod/GetSkypeForBusinessDeviceUsageUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessDeviceUsageUserCountsWithPeriod/GetSkypeForBusinessDeviceUsageUserCountsWithPeriodRequestBuilder.php index cb5817b0902..dfe4b50c497 100644 --- a/src/Generated/Reports/GetSkypeForBusinessDeviceUsageUserCountsWithPeriod/GetSkypeForBusinessDeviceUsageUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessDeviceUsageUserCountsWithPeriod/GetSkypeForBusinessDeviceUsageUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessDeviceUsageUserCounts * @param GetSkypeForBusinessDeviceUsageUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessDeviceUsageUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessDeviceUsageUserCount $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessDeviceUsageUserDetailWithDate/GetSkypeForBusinessDeviceUsageUserDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessDeviceUsageUserDetailWithDate/GetSkypeForBusinessDeviceUsageUserDetailWithDateRequestBuilder.php index 0d07b6e9b80..4ac44937a78 100644 --- a/src/Generated/Reports/GetSkypeForBusinessDeviceUsageUserDetailWithDate/GetSkypeForBusinessDeviceUsageUserDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessDeviceUsageUserDetailWithDate/GetSkypeForBusinessDeviceUsageUserDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessDeviceUsageUserDetail * @param GetSkypeForBusinessDeviceUsageUserDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessDeviceUsageUserDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessDeviceUsageUserDetai $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessDeviceUsageUserDetailWithPeriod/GetSkypeForBusinessDeviceUsageUserDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessDeviceUsageUserDetailWithPeriod/GetSkypeForBusinessDeviceUsageUserDetailWithPeriodRequestBuilder.php index 395cb92571f..231873701ec 100644 --- a/src/Generated/Reports/GetSkypeForBusinessDeviceUsageUserDetailWithPeriod/GetSkypeForBusinessDeviceUsageUserDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessDeviceUsageUserDetailWithPeriod/GetSkypeForBusinessDeviceUsageUserDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessDeviceUsageUserDetail * @param GetSkypeForBusinessDeviceUsageUserDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessDeviceUsageUserDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessDeviceUsageUserDetai $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessOrganizerActivityCountsWithPeriod/GetSkypeForBusinessOrganizerActivityCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessOrganizerActivityCountsWithPeriod/GetSkypeForBusinessOrganizerActivityCountsWithPeriodRequestBuilder.php index 79be28a69c8..23d1abd00e6 100644 --- a/src/Generated/Reports/GetSkypeForBusinessOrganizerActivityCountsWithPeriod/GetSkypeForBusinessOrganizerActivityCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessOrganizerActivityCountsWithPeriod/GetSkypeForBusinessOrganizerActivityCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessOrganizerActivityCounts * @param GetSkypeForBusinessOrganizerActivityCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessOrganizerActivityCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessOrganizerActivityCou $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessOrganizerActivityMinuteCountsWithPeriod/GetSkypeForBusinessOrganizerActivityMinuteCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessOrganizerActivityMinuteCountsWithPeriod/GetSkypeForBusinessOrganizerActivityMinuteCountsWithPeriodRequestBuilder.php index f155f4d5bd9..dc7c173338c 100644 --- a/src/Generated/Reports/GetSkypeForBusinessOrganizerActivityMinuteCountsWithPeriod/GetSkypeForBusinessOrganizerActivityMinuteCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessOrganizerActivityMinuteCountsWithPeriod/GetSkypeForBusinessOrganizerActivityMinuteCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessOrganizerActivityMinuteCounts * @param GetSkypeForBusinessOrganizerActivityMinuteCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessOrganizerActivityMinuteCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessOrganizerActivityMin $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessOrganizerActivityUserCountsWithPeriod/GetSkypeForBusinessOrganizerActivityUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessOrganizerActivityUserCountsWithPeriod/GetSkypeForBusinessOrganizerActivityUserCountsWithPeriodRequestBuilder.php index cff50cd6155..d366ac980b1 100644 --- a/src/Generated/Reports/GetSkypeForBusinessOrganizerActivityUserCountsWithPeriod/GetSkypeForBusinessOrganizerActivityUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessOrganizerActivityUserCountsWithPeriod/GetSkypeForBusinessOrganizerActivityUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessOrganizerActivityUserCounts * @param GetSkypeForBusinessOrganizerActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessOrganizerActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessOrganizerActivityUse $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessParticipantActivityCountsWithPeriod/GetSkypeForBusinessParticipantActivityCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessParticipantActivityCountsWithPeriod/GetSkypeForBusinessParticipantActivityCountsWithPeriodRequestBuilder.php index a44c26b6af4..c1d39cfb6de 100644 --- a/src/Generated/Reports/GetSkypeForBusinessParticipantActivityCountsWithPeriod/GetSkypeForBusinessParticipantActivityCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessParticipantActivityCountsWithPeriod/GetSkypeForBusinessParticipantActivityCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessParticipantActivityCounts * @param GetSkypeForBusinessParticipantActivityCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessParticipantActivityCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessParticipantActivityC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessParticipantActivityMinuteCountsWithPeriod/GetSkypeForBusinessParticipantActivityMinuteCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessParticipantActivityMinuteCountsWithPeriod/GetSkypeForBusinessParticipantActivityMinuteCountsWithPeriodRequestBuilder.php index b77cfd37d5b..d6451c9de70 100644 --- a/src/Generated/Reports/GetSkypeForBusinessParticipantActivityMinuteCountsWithPeriod/GetSkypeForBusinessParticipantActivityMinuteCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessParticipantActivityMinuteCountsWithPeriod/GetSkypeForBusinessParticipantActivityMinuteCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessParticipantActivityMinuteCounts * @param GetSkypeForBusinessParticipantActivityMinuteCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessParticipantActivityMinuteCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessParticipantActivityM $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessParticipantActivityUserCountsWithPeriod/GetSkypeForBusinessParticipantActivityUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessParticipantActivityUserCountsWithPeriod/GetSkypeForBusinessParticipantActivityUserCountsWithPeriodRequestBuilder.php index 89b415831b1..aa778371d1f 100644 --- a/src/Generated/Reports/GetSkypeForBusinessParticipantActivityUserCountsWithPeriod/GetSkypeForBusinessParticipantActivityUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessParticipantActivityUserCountsWithPeriod/GetSkypeForBusinessParticipantActivityUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessParticipantActivityUserCounts * @param GetSkypeForBusinessParticipantActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessParticipantActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessParticipantActivityU $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessPeerToPeerActivityCountsWithPeriod/GetSkypeForBusinessPeerToPeerActivityCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessPeerToPeerActivityCountsWithPeriod/GetSkypeForBusinessPeerToPeerActivityCountsWithPeriodRequestBuilder.php index 7749810e4d3..c81dd9af9bc 100644 --- a/src/Generated/Reports/GetSkypeForBusinessPeerToPeerActivityCountsWithPeriod/GetSkypeForBusinessPeerToPeerActivityCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessPeerToPeerActivityCountsWithPeriod/GetSkypeForBusinessPeerToPeerActivityCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessPeerToPeerActivityCounts * @param GetSkypeForBusinessPeerToPeerActivityCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessPeerToPeerActivityCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessPeerToPeerActivityCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessPeerToPeerActivityMinuteCountsWithPeriod/GetSkypeForBusinessPeerToPeerActivityMinuteCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessPeerToPeerActivityMinuteCountsWithPeriod/GetSkypeForBusinessPeerToPeerActivityMinuteCountsWithPeriodRequestBuilder.php index 455615032c1..d8a1cd8d559 100644 --- a/src/Generated/Reports/GetSkypeForBusinessPeerToPeerActivityMinuteCountsWithPeriod/GetSkypeForBusinessPeerToPeerActivityMinuteCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessPeerToPeerActivityMinuteCountsWithPeriod/GetSkypeForBusinessPeerToPeerActivityMinuteCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessPeerToPeerActivityMinuteCounts * @param GetSkypeForBusinessPeerToPeerActivityMinuteCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessPeerToPeerActivityMinuteCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessPeerToPeerActivityMi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetSkypeForBusinessPeerToPeerActivityUserCountsWithPeriod/GetSkypeForBusinessPeerToPeerActivityUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetSkypeForBusinessPeerToPeerActivityUserCountsWithPeriod/GetSkypeForBusinessPeerToPeerActivityUserCountsWithPeriodRequestBuilder.php index 905e7e6de30..93052e24766 100644 --- a/src/Generated/Reports/GetSkypeForBusinessPeerToPeerActivityUserCountsWithPeriod/GetSkypeForBusinessPeerToPeerActivityUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetSkypeForBusinessPeerToPeerActivityUserCountsWithPeriod/GetSkypeForBusinessPeerToPeerActivityUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getSkypeForBusinessPeerToPeerActivityUserCounts * @param GetSkypeForBusinessPeerToPeerActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetSkypeForBusinessPeerToPeerActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetSkypeForBusinessPeerToPeerActivityUs $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetTeamsDeviceUsageDistributionUserCountsWithPeriod/GetTeamsDeviceUsageDistributionUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetTeamsDeviceUsageDistributionUserCountsWithPeriod/GetTeamsDeviceUsageDistributionUserCountsWithPeriodRequestBuilder.php index 27f1128f891..6f0149a2037 100644 --- a/src/Generated/Reports/GetTeamsDeviceUsageDistributionUserCountsWithPeriod/GetTeamsDeviceUsageDistributionUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetTeamsDeviceUsageDistributionUserCountsWithPeriod/GetTeamsDeviceUsageDistributionUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getTeamsDeviceUsageDistributionUserCounts * @param GetTeamsDeviceUsageDistributionUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetTeamsDeviceUsageDistributionUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetTeamsDeviceUsageDistributionUserCoun $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetTeamsDeviceUsageUserCountsWithPeriod/GetTeamsDeviceUsageUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetTeamsDeviceUsageUserCountsWithPeriod/GetTeamsDeviceUsageUserCountsWithPeriodRequestBuilder.php index 6378aceeff0..5c837ac334e 100644 --- a/src/Generated/Reports/GetTeamsDeviceUsageUserCountsWithPeriod/GetTeamsDeviceUsageUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetTeamsDeviceUsageUserCountsWithPeriod/GetTeamsDeviceUsageUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getTeamsDeviceUsageUserCounts * @param GetTeamsDeviceUsageUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetTeamsDeviceUsageUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetTeamsDeviceUsageUserCountsWithPeriod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetTeamsDeviceUsageUserDetailWithDate/GetTeamsDeviceUsageUserDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetTeamsDeviceUsageUserDetailWithDate/GetTeamsDeviceUsageUserDetailWithDateRequestBuilder.php index 62804b01a92..8ee08702393 100644 --- a/src/Generated/Reports/GetTeamsDeviceUsageUserDetailWithDate/GetTeamsDeviceUsageUserDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetTeamsDeviceUsageUserDetailWithDate/GetTeamsDeviceUsageUserDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getTeamsDeviceUsageUserDetail * @param GetTeamsDeviceUsageUserDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetTeamsDeviceUsageUserDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetTeamsDeviceUsageUserDetailWithDateRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetTeamsDeviceUsageUserDetailWithPeriod/GetTeamsDeviceUsageUserDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetTeamsDeviceUsageUserDetailWithPeriod/GetTeamsDeviceUsageUserDetailWithPeriodRequestBuilder.php index 868090efe06..7f457b59f1d 100644 --- a/src/Generated/Reports/GetTeamsDeviceUsageUserDetailWithPeriod/GetTeamsDeviceUsageUserDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetTeamsDeviceUsageUserDetailWithPeriod/GetTeamsDeviceUsageUserDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getTeamsDeviceUsageUserDetail * @param GetTeamsDeviceUsageUserDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetTeamsDeviceUsageUserDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetTeamsDeviceUsageUserDetailWithPeriod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetTeamsTeamActivityCountsWithPeriod/GetTeamsTeamActivityCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetTeamsTeamActivityCountsWithPeriod/GetTeamsTeamActivityCountsWithPeriodRequestBuilder.php index 382ff8e1f79..a2ee359d9ef 100644 --- a/src/Generated/Reports/GetTeamsTeamActivityCountsWithPeriod/GetTeamsTeamActivityCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetTeamsTeamActivityCountsWithPeriod/GetTeamsTeamActivityCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getTeamsTeamActivityCounts * @param GetTeamsTeamActivityCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetTeamsTeamActivityCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetTeamsTeamActivityCountsWithPeriodReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetTeamsTeamActivityDetailWithDate/GetTeamsTeamActivityDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetTeamsTeamActivityDetailWithDate/GetTeamsTeamActivityDetailWithDateRequestBuilder.php index 522c9e156ff..60ffe0624b5 100644 --- a/src/Generated/Reports/GetTeamsTeamActivityDetailWithDate/GetTeamsTeamActivityDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetTeamsTeamActivityDetailWithDate/GetTeamsTeamActivityDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getTeamsTeamActivityDetail * @param GetTeamsTeamActivityDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetTeamsTeamActivityDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetTeamsTeamActivityDetailWithDateReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetTeamsTeamActivityDetailWithPeriod/GetTeamsTeamActivityDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetTeamsTeamActivityDetailWithPeriod/GetTeamsTeamActivityDetailWithPeriodRequestBuilder.php index 35b938ab0fa..83a033a7a52 100644 --- a/src/Generated/Reports/GetTeamsTeamActivityDetailWithPeriod/GetTeamsTeamActivityDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetTeamsTeamActivityDetailWithPeriod/GetTeamsTeamActivityDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getTeamsTeamActivityDetail * @param GetTeamsTeamActivityDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetTeamsTeamActivityDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetTeamsTeamActivityDetailWithPeriodReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetTeamsTeamActivityDistributionCountsWithPeriod/GetTeamsTeamActivityDistributionCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetTeamsTeamActivityDistributionCountsWithPeriod/GetTeamsTeamActivityDistributionCountsWithPeriodRequestBuilder.php index 6566e6d5965..abe6f0f73f8 100644 --- a/src/Generated/Reports/GetTeamsTeamActivityDistributionCountsWithPeriod/GetTeamsTeamActivityDistributionCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetTeamsTeamActivityDistributionCountsWithPeriod/GetTeamsTeamActivityDistributionCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getTeamsTeamActivityDistributionCounts * @param GetTeamsTeamActivityDistributionCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetTeamsTeamActivityDistributionCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetTeamsTeamActivityDistributionCountsW $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetTeamsTeamCountsWithPeriod/GetTeamsTeamCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetTeamsTeamCountsWithPeriod/GetTeamsTeamCountsWithPeriodRequestBuilder.php index 00169aafb96..06025080e80 100644 --- a/src/Generated/Reports/GetTeamsTeamCountsWithPeriod/GetTeamsTeamCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetTeamsTeamCountsWithPeriod/GetTeamsTeamCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getTeamsTeamCounts * @param GetTeamsTeamCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetTeamsTeamCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetTeamsTeamCountsWithPeriodRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetTeamsUserActivityCountsWithPeriod/GetTeamsUserActivityCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetTeamsUserActivityCountsWithPeriod/GetTeamsUserActivityCountsWithPeriodRequestBuilder.php index 9c85b0c5a07..e051381a69b 100644 --- a/src/Generated/Reports/GetTeamsUserActivityCountsWithPeriod/GetTeamsUserActivityCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetTeamsUserActivityCountsWithPeriod/GetTeamsUserActivityCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getTeamsUserActivityCounts * @param GetTeamsUserActivityCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetTeamsUserActivityCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetTeamsUserActivityCountsWithPeriodReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetTeamsUserActivityUserCountsWithPeriod/GetTeamsUserActivityUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetTeamsUserActivityUserCountsWithPeriod/GetTeamsUserActivityUserCountsWithPeriodRequestBuilder.php index 17ab96342dd..a4221caeaac 100644 --- a/src/Generated/Reports/GetTeamsUserActivityUserCountsWithPeriod/GetTeamsUserActivityUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetTeamsUserActivityUserCountsWithPeriod/GetTeamsUserActivityUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getTeamsUserActivityUserCounts * @param GetTeamsUserActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetTeamsUserActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetTeamsUserActivityUserCountsWithPerio $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetTeamsUserActivityUserDetailWithDate/GetTeamsUserActivityUserDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetTeamsUserActivityUserDetailWithDate/GetTeamsUserActivityUserDetailWithDateRequestBuilder.php index 93d27cce495..f38cf1c7c4b 100644 --- a/src/Generated/Reports/GetTeamsUserActivityUserDetailWithDate/GetTeamsUserActivityUserDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetTeamsUserActivityUserDetailWithDate/GetTeamsUserActivityUserDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getTeamsUserActivityUserDetail * @param GetTeamsUserActivityUserDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetTeamsUserActivityUserDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetTeamsUserActivityUserDetailWithDateR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetTeamsUserActivityUserDetailWithPeriod/GetTeamsUserActivityUserDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetTeamsUserActivityUserDetailWithPeriod/GetTeamsUserActivityUserDetailWithPeriodRequestBuilder.php index b52a0d6f645..7d4de8f3c37 100644 --- a/src/Generated/Reports/GetTeamsUserActivityUserDetailWithPeriod/GetTeamsUserActivityUserDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetTeamsUserActivityUserDetailWithPeriod/GetTeamsUserActivityUserDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getTeamsUserActivityUserDetail * @param GetTeamsUserActivityUserDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetTeamsUserActivityUserDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetTeamsUserActivityUserDetailWithPerio $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetUserArchivedPrintJobsWithUserIdWithStartDateTimeWithEndDateTime/GetUserArchivedPrintJobsWithUserIdWithStartDateTimeWithEndDateTimeRequestBuilder.php b/src/Generated/Reports/GetUserArchivedPrintJobsWithUserIdWithStartDateTimeWithEndDateTime/GetUserArchivedPrintJobsWithUserIdWithStartDateTimeWithEndDateTimeRequestBuilder.php index 923227107ff..7deacf29f6a 100644 --- a/src/Generated/Reports/GetUserArchivedPrintJobsWithUserIdWithStartDateTimeWithEndDateTime/GetUserArchivedPrintJobsWithUserIdWithStartDateTimeWithEndDateTimeRequestBuilder.php +++ b/src/Generated/Reports/GetUserArchivedPrintJobsWithUserIdWithStartDateTimeWithEndDateTime/GetUserArchivedPrintJobsWithUserIdWithStartDateTimeWithEndDateTimeRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -41,19 +40,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getUserArchivedPrintJobs * @param GetUserArchivedPrintJobsWithUserIdWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetUserArchivedPrintJobsWithUserIdWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetUserArchivedPrintJobsWithUserIdWithStartDateTimeWithEndDateTimeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetUserArchivedPrintJobsWithUserIdWithStartDateTimeWithEndDateTimeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -66,7 +62,6 @@ public function toGetRequestInformation(?GetUserArchivedPrintJobsWithUserIdWithS $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -74,6 +69,7 @@ public function toGetRequestInformation(?GetUserArchivedPrintJobsWithUserIdWithS } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/GetYammerActivityCountsWithPeriod/GetYammerActivityCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetYammerActivityCountsWithPeriod/GetYammerActivityCountsWithPeriodRequestBuilder.php index f46107425b8..38e9a5ae26a 100644 --- a/src/Generated/Reports/GetYammerActivityCountsWithPeriod/GetYammerActivityCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetYammerActivityCountsWithPeriod/GetYammerActivityCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getYammerActivityCounts * @param GetYammerActivityCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetYammerActivityCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetYammerActivityCountsWithPeriodReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetYammerActivityUserCountsWithPeriod/GetYammerActivityUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetYammerActivityUserCountsWithPeriod/GetYammerActivityUserCountsWithPeriodRequestBuilder.php index 043db235750..e5d7963fa10 100644 --- a/src/Generated/Reports/GetYammerActivityUserCountsWithPeriod/GetYammerActivityUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetYammerActivityUserCountsWithPeriod/GetYammerActivityUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getYammerActivityUserCounts * @param GetYammerActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetYammerActivityUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetYammerActivityUserCountsWithPeriodRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetYammerActivityUserDetailWithDate/GetYammerActivityUserDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetYammerActivityUserDetailWithDate/GetYammerActivityUserDetailWithDateRequestBuilder.php index 3167a9884ca..6734cdecc4e 100644 --- a/src/Generated/Reports/GetYammerActivityUserDetailWithDate/GetYammerActivityUserDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetYammerActivityUserDetailWithDate/GetYammerActivityUserDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getYammerActivityUserDetail * @param GetYammerActivityUserDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetYammerActivityUserDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetYammerActivityUserDetailWithDateRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetYammerActivityUserDetailWithPeriod/GetYammerActivityUserDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetYammerActivityUserDetailWithPeriod/GetYammerActivityUserDetailWithPeriodRequestBuilder.php index 8b270f33dc3..e656d8099fd 100644 --- a/src/Generated/Reports/GetYammerActivityUserDetailWithPeriod/GetYammerActivityUserDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetYammerActivityUserDetailWithPeriod/GetYammerActivityUserDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getYammerActivityUserDetail * @param GetYammerActivityUserDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetYammerActivityUserDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetYammerActivityUserDetailWithPeriodRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetYammerDeviceUsageDistributionUserCountsWithPeriod/GetYammerDeviceUsageDistributionUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetYammerDeviceUsageDistributionUserCountsWithPeriod/GetYammerDeviceUsageDistributionUserCountsWithPeriodRequestBuilder.php index e18e1268f4b..03d33c9f570 100644 --- a/src/Generated/Reports/GetYammerDeviceUsageDistributionUserCountsWithPeriod/GetYammerDeviceUsageDistributionUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetYammerDeviceUsageDistributionUserCountsWithPeriod/GetYammerDeviceUsageDistributionUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getYammerDeviceUsageDistributionUserCounts * @param GetYammerDeviceUsageDistributionUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetYammerDeviceUsageDistributionUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetYammerDeviceUsageDistributionUserCou $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetYammerDeviceUsageUserCountsWithPeriod/GetYammerDeviceUsageUserCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetYammerDeviceUsageUserCountsWithPeriod/GetYammerDeviceUsageUserCountsWithPeriodRequestBuilder.php index 376326a8880..b185f2e66d8 100644 --- a/src/Generated/Reports/GetYammerDeviceUsageUserCountsWithPeriod/GetYammerDeviceUsageUserCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetYammerDeviceUsageUserCountsWithPeriod/GetYammerDeviceUsageUserCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getYammerDeviceUsageUserCounts * @param GetYammerDeviceUsageUserCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetYammerDeviceUsageUserCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetYammerDeviceUsageUserCountsWithPerio $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetYammerDeviceUsageUserDetailWithDate/GetYammerDeviceUsageUserDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetYammerDeviceUsageUserDetailWithDate/GetYammerDeviceUsageUserDetailWithDateRequestBuilder.php index 70dc80becdd..267f408ae12 100644 --- a/src/Generated/Reports/GetYammerDeviceUsageUserDetailWithDate/GetYammerDeviceUsageUserDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetYammerDeviceUsageUserDetailWithDate/GetYammerDeviceUsageUserDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getYammerDeviceUsageUserDetail * @param GetYammerDeviceUsageUserDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetYammerDeviceUsageUserDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetYammerDeviceUsageUserDetailWithDateR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetYammerDeviceUsageUserDetailWithPeriod/GetYammerDeviceUsageUserDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetYammerDeviceUsageUserDetailWithPeriod/GetYammerDeviceUsageUserDetailWithPeriodRequestBuilder.php index 9b17d6b7e45..fd9ee7411e7 100644 --- a/src/Generated/Reports/GetYammerDeviceUsageUserDetailWithPeriod/GetYammerDeviceUsageUserDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetYammerDeviceUsageUserDetailWithPeriod/GetYammerDeviceUsageUserDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getYammerDeviceUsageUserDetail * @param GetYammerDeviceUsageUserDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetYammerDeviceUsageUserDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetYammerDeviceUsageUserDetailWithPerio $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetYammerGroupsActivityCountsWithPeriod/GetYammerGroupsActivityCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetYammerGroupsActivityCountsWithPeriod/GetYammerGroupsActivityCountsWithPeriodRequestBuilder.php index b4c6e914954..a26a7868cf4 100644 --- a/src/Generated/Reports/GetYammerGroupsActivityCountsWithPeriod/GetYammerGroupsActivityCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetYammerGroupsActivityCountsWithPeriod/GetYammerGroupsActivityCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getYammerGroupsActivityCounts * @param GetYammerGroupsActivityCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetYammerGroupsActivityCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetYammerGroupsActivityCountsWithPeriod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetYammerGroupsActivityDetailWithDate/GetYammerGroupsActivityDetailWithDateRequestBuilder.php b/src/Generated/Reports/GetYammerGroupsActivityDetailWithDate/GetYammerGroupsActivityDetailWithDateRequestBuilder.php index 11a5a2d0cc1..f2b4db3336b 100644 --- a/src/Generated/Reports/GetYammerGroupsActivityDetailWithDate/GetYammerGroupsActivityDetailWithDateRequestBuilder.php +++ b/src/Generated/Reports/GetYammerGroupsActivityDetailWithDate/GetYammerGroupsActivityDetailWithDateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getYammerGroupsActivityDetail * @param GetYammerGroupsActivityDetailWithDateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetYammerGroupsActivityDetailWithDateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -67,6 +65,7 @@ public function toGetRequestInformation(?GetYammerGroupsActivityDetailWithDateRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetYammerGroupsActivityDetailWithPeriod/GetYammerGroupsActivityDetailWithPeriodRequestBuilder.php b/src/Generated/Reports/GetYammerGroupsActivityDetailWithPeriod/GetYammerGroupsActivityDetailWithPeriodRequestBuilder.php index a4e389e2e42..46b541ef824 100644 --- a/src/Generated/Reports/GetYammerGroupsActivityDetailWithPeriod/GetYammerGroupsActivityDetailWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetYammerGroupsActivityDetailWithPeriod/GetYammerGroupsActivityDetailWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getYammerGroupsActivityDetail * @param GetYammerGroupsActivityDetailWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetYammerGroupsActivityDetailWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetYammerGroupsActivityDetailWithPeriod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/GetYammerGroupsActivityGroupCountsWithPeriod/GetYammerGroupsActivityGroupCountsWithPeriodRequestBuilder.php b/src/Generated/Reports/GetYammerGroupsActivityGroupCountsWithPeriod/GetYammerGroupsActivityGroupCountsWithPeriodRequestBuilder.php index 22530faf7bc..0a996ddb97a 100644 --- a/src/Generated/Reports/GetYammerGroupsActivityGroupCountsWithPeriod/GetYammerGroupsActivityGroupCountsWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/GetYammerGroupsActivityGroupCountsWithPeriod/GetYammerGroupsActivityGroupCountsWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -37,19 +36,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getYammerGroupsActivityGroupCounts * @param GetYammerGroupsActivityGroupCountsWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetYammerGroupsActivityGroupCountsWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -66,6 +64,7 @@ public function toGetRequestInformation(?GetYammerGroupsActivityGroupCountsWithP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Reports/ManagedDeviceEnrollmentFailureDetails/ManagedDeviceEnrollmentFailureDetailsRequestBuilder.php b/src/Generated/Reports/ManagedDeviceEnrollmentFailureDetails/ManagedDeviceEnrollmentFailureDetailsRequestBuilder.php index 433f04c6558..328475038cf 100644 --- a/src/Generated/Reports/ManagedDeviceEnrollmentFailureDetails/ManagedDeviceEnrollmentFailureDetailsRequestBuilder.php +++ b/src/Generated/Reports/ManagedDeviceEnrollmentFailureDetails/ManagedDeviceEnrollmentFailureDetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Report; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function managedDeviceEnrollmentFailureDetails * @param ManagedDeviceEnrollmentFailureDetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedDeviceEnrollmentFailureDetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Report::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Report::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?ManagedDeviceEnrollmentFailureDetailsRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/ManagedDeviceEnrollmentFailureDetailsWithSkipWithTopWithFilterWithSkipToken/ManagedDeviceEnrollmentFailureDetailsWithSkipWithTopWithFilterWithSkipTokenRequestBuilder.php b/src/Generated/Reports/ManagedDeviceEnrollmentFailureDetailsWithSkipWithTopWithFilterWithSkipToken/ManagedDeviceEnrollmentFailureDetailsWithSkipWithTopWithFilterWithSkipTokenRequestBuilder.php index 22fd8123b60..caa92cbda2e 100644 --- a/src/Generated/Reports/ManagedDeviceEnrollmentFailureDetailsWithSkipWithTopWithFilterWithSkipToken/ManagedDeviceEnrollmentFailureDetailsWithSkipWithTopWithFilterWithSkipTokenRequestBuilder.php +++ b/src/Generated/Reports/ManagedDeviceEnrollmentFailureDetailsWithSkipWithTopWithFilterWithSkipToken/ManagedDeviceEnrollmentFailureDetailsWithSkipWithTopWithFilterWithSkipTokenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Report; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -43,19 +42,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function managedDeviceEnrollmentFailureDetails * @param ManagedDeviceEnrollmentFailureDetailsWithSkipWithTopWithFilterWithSkipTokenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedDeviceEnrollmentFailureDetailsWithSkipWithTopWithFilterWithSkipTokenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Report::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Report::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -68,11 +64,11 @@ public function toGetRequestInformation(?ManagedDeviceEnrollmentFailureDetailsWi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/ManagedDeviceEnrollmentTopFailures/ManagedDeviceEnrollmentTopFailuresRequestBuilder.php b/src/Generated/Reports/ManagedDeviceEnrollmentTopFailures/ManagedDeviceEnrollmentTopFailuresRequestBuilder.php index b1011fccfa6..71bfd309cb4 100644 --- a/src/Generated/Reports/ManagedDeviceEnrollmentTopFailures/ManagedDeviceEnrollmentTopFailuresRequestBuilder.php +++ b/src/Generated/Reports/ManagedDeviceEnrollmentTopFailures/ManagedDeviceEnrollmentTopFailuresRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Report; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function managedDeviceEnrollmentTopFailures * @param ManagedDeviceEnrollmentTopFailuresRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedDeviceEnrollmentTopFailuresRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Report::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Report::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?ManagedDeviceEnrollmentTopFailuresReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/ManagedDeviceEnrollmentTopFailuresWithPeriod/ManagedDeviceEnrollmentTopFailuresWithPeriodRequestBuilder.php b/src/Generated/Reports/ManagedDeviceEnrollmentTopFailuresWithPeriod/ManagedDeviceEnrollmentTopFailuresWithPeriodRequestBuilder.php index d7ef9b22ee4..951b85aff67 100644 --- a/src/Generated/Reports/ManagedDeviceEnrollmentTopFailuresWithPeriod/ManagedDeviceEnrollmentTopFailuresWithPeriodRequestBuilder.php +++ b/src/Generated/Reports/ManagedDeviceEnrollmentTopFailuresWithPeriod/ManagedDeviceEnrollmentTopFailuresWithPeriodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Report; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function managedDeviceEnrollmentTopFailures * @param ManagedDeviceEnrollmentTopFailuresWithPeriodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedDeviceEnrollmentTopFailuresWithPeriodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Report::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Report::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?ManagedDeviceEnrollmentTopFailuresWithP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/MonthlyPrintUsageByPrinter/Count/CountRequestBuilder.php b/src/Generated/Reports/MonthlyPrintUsageByPrinter/Count/CountRequestBuilder.php index 666455841fe..fd0a9d6ba2f 100644 --- a/src/Generated/Reports/MonthlyPrintUsageByPrinter/Count/CountRequestBuilder.php +++ b/src/Generated/Reports/MonthlyPrintUsageByPrinter/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Reports/MonthlyPrintUsageByPrinter/Item/PrintUsageByPrinterItemRequestBuilder.php b/src/Generated/Reports/MonthlyPrintUsageByPrinter/Item/PrintUsageByPrinterItemRequestBuilder.php index 65492ccf7d0..74f5039b585 100644 --- a/src/Generated/Reports/MonthlyPrintUsageByPrinter/Item/PrintUsageByPrinterItemRequestBuilder.php +++ b/src/Generated/Reports/MonthlyPrintUsageByPrinter/Item/PrintUsageByPrinterItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintUsageByPrinter; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property monthlyPrintUsageByPrinter for reports * @param PrintUsageByPrinterItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintUsageByPrinterItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a list of monthly print usage summaries, grouped by printer. * @param PrintUsageByPrinterItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrintUsageByPrinterItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinter::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinter::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property monthlyPrintUsageByPrinter in reports * @param PrintUsageByPrinter $body The request body * @param PrintUsageByPrinterItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintUsageByPrinter $body, ?PrintUsageByPrinterItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinter::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinter::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?PrintUsageByPrinterItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?PrintUsageByPrinterItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?PrintUsageByPrinterItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(PrintUsageByPrinter $body, ?PrintUsage $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Reports/MonthlyPrintUsageByPrinter/MonthlyPrintUsageByPrinterRequestBuilder.php b/src/Generated/Reports/MonthlyPrintUsageByPrinter/MonthlyPrintUsageByPrinterRequestBuilder.php index 428e9a97674..5afe4cf6d3b 100644 --- a/src/Generated/Reports/MonthlyPrintUsageByPrinter/MonthlyPrintUsageByPrinterRequestBuilder.php +++ b/src/Generated/Reports/MonthlyPrintUsageByPrinter/MonthlyPrintUsageByPrinterRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintUsageByPrinter; use Microsoft\Graph\Generated\Models\PrintUsageByPrinterCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of monthly print usage summaries, grouped by printer. This API is available in the following national cloud deployments. * @param MonthlyPrintUsageByPrinterRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/reportroot-list-monthlyprintusagebyprinter?view=graph-rest-1.0 Find more info here */ public function get(?MonthlyPrintUsageByPrinterRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinterCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinterCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to monthlyPrintUsageByPrinter for reports * @param PrintUsageByPrinter $body The request body * @param MonthlyPrintUsageByPrinterRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintUsageByPrinter $body, ?MonthlyPrintUsageByPrinterRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinter::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByPrinter::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?MonthlyPrintUsageByPrinterRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?MonthlyPrintUsageByPrinterRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PrintUsageByPrinter $body, ?MonthlyPrin $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Reports/MonthlyPrintUsageByUser/Count/CountRequestBuilder.php b/src/Generated/Reports/MonthlyPrintUsageByUser/Count/CountRequestBuilder.php index d937e57904f..17d72e61e0e 100644 --- a/src/Generated/Reports/MonthlyPrintUsageByUser/Count/CountRequestBuilder.php +++ b/src/Generated/Reports/MonthlyPrintUsageByUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Reports/MonthlyPrintUsageByUser/Item/PrintUsageByUserItemRequestBuilder.php b/src/Generated/Reports/MonthlyPrintUsageByUser/Item/PrintUsageByUserItemRequestBuilder.php index c9e75c763bb..025ac1ab79e 100644 --- a/src/Generated/Reports/MonthlyPrintUsageByUser/Item/PrintUsageByUserItemRequestBuilder.php +++ b/src/Generated/Reports/MonthlyPrintUsageByUser/Item/PrintUsageByUserItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintUsageByUser; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property monthlyPrintUsageByUser for reports * @param PrintUsageByUserItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrintUsageByUserItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a list of monthly print usage summaries, grouped by user. * @param PrintUsageByUserItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrintUsageByUserItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property monthlyPrintUsageByUser in reports * @param PrintUsageByUser $body The request body * @param PrintUsageByUserItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PrintUsageByUser $body, ?PrintUsageByUserItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?PrintUsageByUserItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?PrintUsageByUserItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?PrintUsageByUserItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(PrintUsageByUser $body, ?PrintUsageByU $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Reports/MonthlyPrintUsageByUser/MonthlyPrintUsageByUserRequestBuilder.php b/src/Generated/Reports/MonthlyPrintUsageByUser/MonthlyPrintUsageByUserRequestBuilder.php index 2ce17d5c658..f94fb9e8917 100644 --- a/src/Generated/Reports/MonthlyPrintUsageByUser/MonthlyPrintUsageByUserRequestBuilder.php +++ b/src/Generated/Reports/MonthlyPrintUsageByUser/MonthlyPrintUsageByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PrintUsageByUser; use Microsoft\Graph\Generated\Models\PrintUsageByUserCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of monthly print usage summaries, grouped by user. This API is available in the following national cloud deployments. * @param MonthlyPrintUsageByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/reportroot-list-monthlyprintusagebyuser?view=graph-rest-1.0 Find more info here */ public function get(?MonthlyPrintUsageByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to monthlyPrintUsageByUser for reports * @param PrintUsageByUser $body The request body * @param MonthlyPrintUsageByUserRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PrintUsageByUser $body, ?MonthlyPrintUsageByUserRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PrintUsageByUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?MonthlyPrintUsageByUserRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?MonthlyPrintUsageByUserRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PrintUsageByUser $body, ?MonthlyPrintUs $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Reports/ReportsRequestBuilder.php b/src/Generated/Reports/ReportsRequestBuilder.php index 09948b81b24..35efa00cca2 100644 --- a/src/Generated/Reports/ReportsRequestBuilder.php +++ b/src/Generated/Reports/ReportsRequestBuilder.php @@ -5,7 +5,6 @@ use DateTime; use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReportRoot; use Microsoft\Graph\Generated\Reports\AuthenticationMethods\AuthenticationMethodsRequestBuilder; @@ -234,20 +233,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read properties and relationships of the reportRoot object. * @param ReportsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-reportroot-get?view=graph-rest-1.0 Find more info here */ public function get(?ReportsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ReportRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ReportRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -1109,20 +1105,17 @@ public function managedDeviceEnrollmentTopFailuresWithPeriod(string $period): Ma * Update the properties of a reportRoot object. * @param ReportRoot $body The request body * @param ReportsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-deviceconfig-reportroot-update?view=graph-rest-1.0 Find more info here */ public function patch(ReportRoot $body, ?ReportsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ReportRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ReportRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -1135,7 +1128,6 @@ public function toGetRequestInformation(?ReportsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -1143,6 +1135,7 @@ public function toGetRequestInformation(?ReportsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -1157,11 +1150,11 @@ public function toPatchRequestInformation(ReportRoot $body, ?ReportsRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Reports/Security/GetAttackSimulationRepeatOffenders/GetAttackSimulationRepeatOffendersRequestBuilder.php b/src/Generated/Reports/Security/GetAttackSimulationRepeatOffenders/GetAttackSimulationRepeatOffendersRequestBuilder.php index d67ede341b1..1a252629289 100644 --- a/src/Generated/Reports/Security/GetAttackSimulationRepeatOffenders/GetAttackSimulationRepeatOffendersRequestBuilder.php +++ b/src/Generated/Reports/Security/GetAttackSimulationRepeatOffenders/GetAttackSimulationRepeatOffendersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAttackSimulationRepeatOffenders * @param GetAttackSimulationRepeatOffendersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAttackSimulationRepeatOffendersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAttackSimulationRepeatOffendersGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAttackSimulationRepeatOffendersGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAttackSimulationRepeatOffendersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAttackSimulationRepeatOffendersReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/Security/GetAttackSimulationSimulationUserCoverage/GetAttackSimulationSimulationUserCoverageRequestBuilder.php b/src/Generated/Reports/Security/GetAttackSimulationSimulationUserCoverage/GetAttackSimulationSimulationUserCoverageRequestBuilder.php index a5026da585b..257af12f6a5 100644 --- a/src/Generated/Reports/Security/GetAttackSimulationSimulationUserCoverage/GetAttackSimulationSimulationUserCoverageRequestBuilder.php +++ b/src/Generated/Reports/Security/GetAttackSimulationSimulationUserCoverage/GetAttackSimulationSimulationUserCoverageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAttackSimulationSimulationUserCoverage * @param GetAttackSimulationSimulationUserCoverageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAttackSimulationSimulationUserCoverageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAttackSimulationSimulationUserCoverageGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAttackSimulationSimulationUserCoverageGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAttackSimulationSimulationUserCovera $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAttackSimulationSimulationUserCovera } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/Security/GetAttackSimulationTrainingUserCoverage/GetAttackSimulationTrainingUserCoverageRequestBuilder.php b/src/Generated/Reports/Security/GetAttackSimulationTrainingUserCoverage/GetAttackSimulationTrainingUserCoverageRequestBuilder.php index f019223e921..26f7074466e 100644 --- a/src/Generated/Reports/Security/GetAttackSimulationTrainingUserCoverage/GetAttackSimulationTrainingUserCoverageRequestBuilder.php +++ b/src/Generated/Reports/Security/GetAttackSimulationTrainingUserCoverage/GetAttackSimulationTrainingUserCoverageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAttackSimulationTrainingUserCoverage * @param GetAttackSimulationTrainingUserCoverageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAttackSimulationTrainingUserCoverageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAttackSimulationTrainingUserCoverageGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAttackSimulationTrainingUserCoverageGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAttackSimulationTrainingUserCoverage $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAttackSimulationTrainingUserCoverage } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Reports/Security/SecurityRequestBuilder.php b/src/Generated/Reports/Security/SecurityRequestBuilder.php index fad61af34d5..02f197c7345 100644 --- a/src/Generated/Reports/Security/SecurityRequestBuilder.php +++ b/src/Generated/Reports/Security/SecurityRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SecurityReportsRoot; use Microsoft\Graph\Generated\Reports\Security\GetAttackSimulationRepeatOffenders\GetAttackSimulationRepeatOffendersRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property security for reports * @param SecurityRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SecurityRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents an abstract type that contains resources for attack simulation and training reports. * @param SecurityRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SecurityRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SecurityReportsRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SecurityReportsRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property security in reports * @param SecurityReportsRoot $body The request body * @param SecurityRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SecurityReportsRoot $body, ?SecurityRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SecurityReportsRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SecurityReportsRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?SecurityRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?SecurityRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?SecurityRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(SecurityReportsRoot $body, ?SecurityRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/DirectoryRequestBuilder.php b/src/Generated/RoleManagement/Directory/DirectoryRequestBuilder.php index 913bcb1537d..5cef67b4e10 100644 --- a/src/Generated/RoleManagement/Directory/DirectoryRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/DirectoryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RbacApplication; use Microsoft\Graph\Generated\RoleManagement\Directory\ResourceNamespaces\ResourceNamespacesRequestBuilder; @@ -106,56 +105,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property directory for roleManagement * @param DirectoryRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DirectoryRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get directory from roleManagement * @param DirectoryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RbacApplication::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RbacApplication::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property directory in roleManagement * @param RbacApplication $body The request body * @param DirectoryRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RbacApplication $body, ?DirectoryRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RbacApplication::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RbacApplication::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -172,6 +162,7 @@ public function toDeleteRequestInformation(?DirectoryRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -185,7 +176,6 @@ public function toGetRequestInformation(?DirectoryRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -193,6 +183,7 @@ public function toGetRequestInformation(?DirectoryRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -207,11 +198,11 @@ public function toPatchRequestInformation(RbacApplication $body, ?DirectoryReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/ResourceNamespaces/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/Directory/ResourceNamespaces/Count/CountRequestBuilder.php index 5bbeb3005ac..4ec741cf51a 100644 --- a/src/Generated/RoleManagement/Directory/ResourceNamespaces/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/ResourceNamespaces/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/ResourceActions/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/ResourceActions/Count/CountRequestBuilder.php index 40a11746f20..7dbdd71ee11 100644 --- a/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/ResourceActions/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/ResourceActions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/ResourceActions/Item/UnifiedRbacResourceActionItemRequestBuilder.php b/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/ResourceActions/Item/UnifiedRbacResourceActionItemRequestBuilder.php index db206c317a9..c1dae6d2834 100644 --- a/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/ResourceActions/Item/UnifiedRbacResourceActionItemRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/ResourceActions/Item/UnifiedRbacResourceActionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRbacResourceAction; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resourceActions for roleManagement * @param UnifiedRbacResourceActionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRbacResourceActionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resourceActions from roleManagement * @param UnifiedRbacResourceActionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UnifiedRbacResourceActionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceAction::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceAction::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resourceActions in roleManagement * @param UnifiedRbacResourceAction $body The request body * @param UnifiedRbacResourceActionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRbacResourceAction $body, ?UnifiedRbacResourceActionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceAction::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceAction::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UnifiedRbacResourceActionItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UnifiedRbacResourceActionItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UnifiedRbacResourceActionItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UnifiedRbacResourceAction $body, ?Unif $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/ResourceActions/ResourceActionsRequestBuilder.php b/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/ResourceActions/ResourceActionsRequestBuilder.php index fdc0484f761..3a8cda91026 100644 --- a/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/ResourceActions/ResourceActionsRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/ResourceActions/ResourceActionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRbacResourceAction; use Microsoft\Graph\Generated\Models\UnifiedRbacResourceActionCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get resourceActions from roleManagement * @param ResourceActionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceActionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceActionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceActionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resourceActions for roleManagement * @param UnifiedRbacResourceAction $body The request body * @param ResourceActionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRbacResourceAction $body, ?ResourceActionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceAction::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceAction::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResourceActionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResourceActionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UnifiedRbacResourceAction $body, ?Resou $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/UnifiedRbacResourceNamespaceItemRequestBuilder.php b/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/UnifiedRbacResourceNamespaceItemRequestBuilder.php index 1633820dd4e..9396ce63931 100644 --- a/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/UnifiedRbacResourceNamespaceItemRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/ResourceNamespaces/Item/UnifiedRbacResourceNamespaceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRbacResourceNamespace; use Microsoft\Graph\Generated\RoleManagement\Directory\ResourceNamespaces\Item\ResourceActions\ResourceActionsRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resourceNamespaces for roleManagement * @param UnifiedRbacResourceNamespaceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRbacResourceNamespaceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resourceNamespaces from roleManagement * @param UnifiedRbacResourceNamespaceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UnifiedRbacResourceNamespaceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespace::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespace::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resourceNamespaces in roleManagement * @param UnifiedRbacResourceNamespace $body The request body * @param UnifiedRbacResourceNamespaceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRbacResourceNamespace $body, ?UnifiedRbacResourceNamespaceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespace::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespace::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?UnifiedRbacResourceNamespaceItemRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?UnifiedRbacResourceNamespaceItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?UnifiedRbacResourceNamespaceItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(UnifiedRbacResourceNamespace $body, ?U $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/ResourceNamespaces/ResourceNamespacesRequestBuilder.php b/src/Generated/RoleManagement/Directory/ResourceNamespaces/ResourceNamespacesRequestBuilder.php index 9e1b82d9196..e21d6d0a84d 100644 --- a/src/Generated/RoleManagement/Directory/ResourceNamespaces/ResourceNamespacesRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/ResourceNamespaces/ResourceNamespacesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRbacResourceNamespace; use Microsoft\Graph\Generated\Models\UnifiedRbacResourceNamespaceCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get resourceNamespaces from roleManagement * @param ResourceNamespacesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceNamespacesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespaceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespaceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resourceNamespaces for roleManagement * @param UnifiedRbacResourceNamespace $body The request body * @param ResourceNamespacesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRbacResourceNamespace $body, ?ResourceNamespacesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespace::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespace::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResourceNamespacesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResourceNamespacesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UnifiedRbacResourceNamespace $body, ?Re $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Count/CountRequestBuilder.php index c530a5827e6..18f0febe9ff 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index eb47689ba8b..653f0d9d524 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php index 10d892b0505..bc62a1b9732 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleInstance; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * If the request is from an eligible administrator to activate a role, this parameter will show the related eligible assignment for that activation. Otherwise, it is null. Supports $expand. * @param ActivatedUsingRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivatedUsingRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php index 1873eb35b72..e517d8f454c 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only property with details of the app-specific scope when the assignment or role eligibility is scoped to an app. Nullable. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index 4cea6287a00..11a43579073 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the assignment or role eligibility. Read-only. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/Principal/PrincipalRequestBuilder.php index 50c89705cd7..e383c88ab36 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The principal that's getting a role assignment or role eligibility through the request. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index bb678d6fe95..a4328905081 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Detailed information for the roleDefinition object that is referenced through the roleDefinitionId property. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/UnifiedRoleAssignmentScheduleInstanceItemRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/UnifiedRoleAssignmentScheduleInstanceItemRequestBuilder.php index 7595e5f82a5..2b433d385c0 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/UnifiedRoleAssignmentScheduleInstanceItemRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/Item/UnifiedRoleAssignmentScheduleInstanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleInstance; use Microsoft\Graph\Generated\RoleManagement\Directory\RoleAssignmentScheduleInstances\Item\ActivatedUsing\ActivatedUsingRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleAssignmentScheduleInstances for roleManagement * @param UnifiedRoleAssignmentScheduleInstanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleAssignmentScheduleInstanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the instance of an active role assignment. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentScheduleInstanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleassignmentscheduleinstance-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleAssignmentScheduleInstanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleAssignmentScheduleInstances in roleManagement * @param UnifiedRoleAssignmentScheduleInstance $body The request body * @param UnifiedRoleAssignmentScheduleInstanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleAssignmentScheduleInstance $body, ?UnifiedRoleAssignmentScheduleInstanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?UnifiedRoleAssignmentScheduleInstanc $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentScheduleInstanceIt $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentScheduleInstanceIt } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(UnifiedRoleAssignmentScheduleInstance $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/RoleAssignmentScheduleInstancesRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/RoleAssignmentScheduleInstancesRequestBuilder.php index 013428e123f..f88fd9a71a1 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/RoleAssignmentScheduleInstancesRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleInstances/RoleAssignmentScheduleInstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleInstance; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleInstanceCollectionResponse; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Get the instances of active role assignments in your tenant. The active assignments include those made through assignments and activation requests, and directly through the role assignments API. This API is available in the following national cloud deployments. * @param RoleAssignmentScheduleInstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleassignmentscheduleinstances?view=graph-rest-1.0 Find more info here */ public function get(?RoleAssignmentScheduleInstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roleAssignmentScheduleInstances for roleManagement * @param UnifiedRoleAssignmentScheduleInstance $body The request body * @param RoleAssignmentScheduleInstancesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleAssignmentScheduleInstance $body, ?RoleAssignmentScheduleInstancesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?RoleAssignmentScheduleInstancesRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?RoleAssignmentScheduleInstancesRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(UnifiedRoleAssignmentScheduleInstance $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Count/CountRequestBuilder.php index 553e0d8f1f2..1f07402fc52 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 6157195500b..0c65b886fc1 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php index fa0db96fbc1..1359e282a02 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilitySchedule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * If the request is from an eligible administrator to activate a role, this parameter will show the related eligible assignment for that activation. Otherwise, it's null. Supports $expand. * @param ActivatedUsingRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivatedUsingRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php index 347efc60ed7..f87a8bc5ed5 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only property with details of the app-specific scope when the assignment is scoped to an app. Nullable. Supports $expand. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/Cancel/CancelRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/Cancel/CancelRequestBuilder.php index d4b8e45f787..32c223ea5d9 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Immediately cancel a unifiedRoleAssignmentScheduleRequest object that is in a Granted status, and have the system automatically delete the canceled request after 30 days. After calling this action, the status of the canceled unifiedRoleAssignmentScheduleRequest changes to Canceled. This API is available in the following national cloud deployments. * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleassignmentschedulerequest-cancel?view=graph-rest-1.0 Find more info here */ public function post(?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CancelRequestBuilderPostRequestConfigu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index bceeff0d503..36972ada270 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the assignment. Read-only. Supports $expand. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/Principal/PrincipalRequestBuilder.php index 4aa7517c8e8..f458fb42223 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The principal that's getting a role assignment through the request. Supports $expand. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index a106e8051b4..17cfdac0c1b 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Detailed information for the unifiedRoleDefinition object that is referenced through the roleDefinitionId property. Supports $expand. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php index 86b4be885f1..58e925ea1c2 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentSchedule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The schedule for an eligible role assignment that is referenced through the targetScheduleId property. Supports $expand. * @param TargetScheduleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TargetScheduleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TargetScheduleRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TargetScheduleRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/UnifiedRoleAssignmentScheduleRequestItemRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/UnifiedRoleAssignmentScheduleRequestItemRequestBuilder.php index 23f0dac3611..9a79a1e2100 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/UnifiedRoleAssignmentScheduleRequestItemRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/Item/UnifiedRoleAssignmentScheduleRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleRequest; use Microsoft\Graph\Generated\RoleManagement\Directory\RoleAssignmentScheduleRequests\Item\ActivatedUsing\ActivatedUsingRequestBuilder; @@ -90,57 +89,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleAssignmentScheduleRequests for roleManagement * @param UnifiedRoleAssignmentScheduleRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleAssignmentScheduleRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * In PIM, read the details of a request for an active and persistent role assignment made through the unifiedRoleAssignmentScheduleRequest object. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentScheduleRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleassignmentschedulerequest-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleAssignmentScheduleRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleAssignmentScheduleRequests in roleManagement * @param UnifiedRoleAssignmentScheduleRequest $body The request body * @param UnifiedRoleAssignmentScheduleRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleAssignmentScheduleRequest $body, ?UnifiedRoleAssignmentScheduleRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -157,6 +147,7 @@ public function toDeleteRequestInformation(?UnifiedRoleAssignmentScheduleRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -170,7 +161,6 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentScheduleRequestIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -178,6 +168,7 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentScheduleRequestIte } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -192,11 +183,11 @@ public function toPatchRequestInformation(UnifiedRoleAssignmentScheduleRequest $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/RoleAssignmentScheduleRequestsRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/RoleAssignmentScheduleRequestsRequestBuilder.php index 4202dec3958..e62da287e64 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/RoleAssignmentScheduleRequestsRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentScheduleRequests/RoleAssignmentScheduleRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleRequest; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleRequestCollectionResponse; @@ -65,40 +64,34 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Retrieve the requests for active role assignments to principals. The active assignments include those made through assignments and activation requests, and directly through the role assignments API. The role assignments can be permanently active with or without an expiry date, or temporarily active after user activation of eligible assignments. This API is available in the following national cloud deployments. * @param RoleAssignmentScheduleRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleassignmentschedulerequests?view=graph-rest-1.0 Find more info here */ public function get(?RoleAssignmentScheduleRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * In PIM, carry out the following operations through the unifiedRoleAssignmentScheduleRequest object: To call this API to update, renew, and extend assignments for yourself, you must have multi-factor authentication (MFA) enforced, and running the query in a session in which they were challenged for MFA. See Enable per-user Azure AD Multi-Factor Authentication to secure sign-in events. This API is available in the following national cloud deployments. + * In PIM, carry out the following operations through the unifiedRoleAssignmentScheduleRequest object: To call this API to update, renew, and extend assignments for yourself, you must have multifactor authentication (MFA) enforced, and running the query in a session in which they were challenged for MFA. See Enable per-user Microsoft Entra multifactor authentication to secure sign-in events. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentScheduleRequest $body The request body * @param RoleAssignmentScheduleRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-post-roleassignmentschedulerequests?view=graph-rest-1.0 Find more info here */ public function post(UnifiedRoleAssignmentScheduleRequest $body, ?RoleAssignmentScheduleRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,7 +104,6 @@ public function toGetRequestInformation(?RoleAssignmentScheduleRequestsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -119,11 +111,12 @@ public function toGetRequestInformation(?RoleAssignmentScheduleRequestsRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * In PIM, carry out the following operations through the unifiedRoleAssignmentScheduleRequest object: To call this API to update, renew, and extend assignments for yourself, you must have multi-factor authentication (MFA) enforced, and running the query in a session in which they were challenged for MFA. See Enable per-user Azure AD Multi-Factor Authentication to secure sign-in events. This API is available in the following national cloud deployments. + * In PIM, carry out the following operations through the unifiedRoleAssignmentScheduleRequest object: To call this API to update, renew, and extend assignments for yourself, you must have multifactor authentication (MFA) enforced, and running the query in a session in which they were challenged for MFA. See Enable per-user Microsoft Entra multifactor authentication to secure sign-in events. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentScheduleRequest $body The request body * @param RoleAssignmentScheduleRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -133,11 +126,11 @@ public function toPostRequestInformation(UnifiedRoleAssignmentScheduleRequest $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Count/CountRequestBuilder.php index 42d8e1e84ca..add18da89ee 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index e5c1309534d..f125c834206 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php index b61c1c645ca..fddec662c41 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilitySchedule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * If the request is from an eligible administrator to activate a role, this parameter will show the related eligible assignment for that activation. Otherwise, it is null. Supports $expand. * @param ActivatedUsingRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivatedUsingRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/AppScope/AppScopeRequestBuilder.php index 2360654309e..124d202e6d8 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only property with details of the app-specific scope when the role eligibility or assignment is scoped to an app. Nullable. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index 7865e29f5c8..0e38cbbb0c0 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the role eligibility or assignment. Read-only. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/Principal/PrincipalRequestBuilder.php index 99dc09452c9..e7a500b3849 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The principal that's getting a role assignment or that's eligible for a role through the request. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index da37b4212b1..320629f6620 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Detailed information for the roleDefinition object that is referenced through the roleDefinitionId property. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/UnifiedRoleAssignmentScheduleItemRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/UnifiedRoleAssignmentScheduleItemRequestBuilder.php index 4e70b3afb56..550021fcd6d 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/UnifiedRoleAssignmentScheduleItemRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/Item/UnifiedRoleAssignmentScheduleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentSchedule; use Microsoft\Graph\Generated\RoleManagement\Directory\RoleAssignmentSchedules\Item\ActivatedUsing\ActivatedUsingRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleAssignmentSchedules for roleManagement * @param UnifiedRoleAssignmentScheduleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleAssignmentScheduleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the schedule for an active role assignment operation. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentScheduleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleassignmentschedule-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleAssignmentScheduleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleAssignmentSchedules in roleManagement * @param UnifiedRoleAssignmentSchedule $body The request body * @param UnifiedRoleAssignmentScheduleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleAssignmentSchedule $body, ?UnifiedRoleAssignmentScheduleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?UnifiedRoleAssignmentScheduleItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentScheduleItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentScheduleItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(UnifiedRoleAssignmentSchedule $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/RoleAssignmentSchedulesRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/RoleAssignmentSchedulesRequestBuilder.php index 2341fd49196..2e3469628e1 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/RoleAssignmentSchedulesRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignmentSchedules/RoleAssignmentSchedulesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentSchedule; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleCollectionResponse; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Get the schedules for active role assignment operations. This API is available in the following national cloud deployments. * @param RoleAssignmentSchedulesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleassignmentschedules?view=graph-rest-1.0 Find more info here */ public function get(?RoleAssignmentSchedulesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roleAssignmentSchedules for roleManagement * @param UnifiedRoleAssignmentSchedule $body The request body * @param RoleAssignmentSchedulesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleAssignmentSchedule $body, ?RoleAssignmentSchedulesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?RoleAssignmentSchedulesRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?RoleAssignmentSchedulesRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(UnifiedRoleAssignmentSchedule $body, ?R $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignments/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignments/Count/CountRequestBuilder.php index 492e7fa02cb..1867c3a52ae 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignments/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignments/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignments/Item/AppScope/AppScopeRequestBuilder.php index 2b011cf6282..8913b759d18 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignments/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignments/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property appScope for roleManagement * @param AppScopeRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AppScopeRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only property with details of the app specific scope when the assignment scope is app specific. Containment entity. Supports $expand. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property appScope in roleManagement * @param AppScope $body The request body * @param AppScopeRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AppScope $body, ?AppScopeRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AppScopeRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AppScope $body, ?AppScopeRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignments/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignments/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index c007d5212ec..8b03aa53b72 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignments/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignments/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the assignment. Read-only. Supports $expand. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignments/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignments/Item/Principal/PrincipalRequestBuilder.php index 4d0eb7908c1..27332156100 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignments/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignments/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Referencing the assigned principal. Read-only. Supports $expand. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index a2b461102c5..33d51109426 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The roleDefinition the assignment is for. Supports $expand. roleDefinition.Id will be auto expanded. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignments/Item/UnifiedRoleAssignmentItemRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignments/Item/UnifiedRoleAssignmentItemRequestBuilder.php index 42797b3067c..2b2bcf33351 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignments/Item/UnifiedRoleAssignmentItemRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignments/Item/UnifiedRoleAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignment; use Microsoft\Graph\Generated\RoleManagement\Directory\RoleAssignments\Item\AppScope\AppScopeRequestBuilder; @@ -66,58 +65,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a unifiedRoleAssignment object. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?UnifiedRoleAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a unifiedRoleAssignment object. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleAssignments in roleManagement * @param UnifiedRoleAssignment $body The request body * @param UnifiedRoleAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleAssignment $body, ?UnifiedRoleAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -134,6 +124,7 @@ public function toDeleteRequestInformation(?UnifiedRoleAssignmentItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -147,7 +138,6 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -155,6 +145,7 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -169,11 +160,11 @@ public function toPatchRequestInformation(UnifiedRoleAssignment $body, ?UnifiedR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignments/RoleAssignmentsRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleAssignments/RoleAssignmentsRequestBuilder.php index 5f320f52fe4..f5187348bc6 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignments/RoleAssignmentsRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignments/RoleAssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignment; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentCollectionResponse; @@ -53,46 +52,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get a list of unifiedRoleAssignment objects for the RBAC provider. The following RBAC providers are currently supported:- directory (Azure AD)- entitlement management (Azure AD) This API is available in the following national cloud deployments. + * Get a list of unifiedRoleAssignment objects for the RBAC provider. The following RBAC providers are currently supported:- directory (Microsoft Entra ID)- entitlement management (Microsoft Entra Entitlement Management) This API is available in the following national cloud deployments. * @param RoleAssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleassignments?view=graph-rest-1.0 Find more info here */ public function get(?RoleAssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new unifiedRoleAssignment object. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignment $body The request body * @param RoleAssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-post-roleassignments?view=graph-rest-1.0 Find more info here */ public function post(UnifiedRoleAssignment $body, ?RoleAssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get a list of unifiedRoleAssignment objects for the RBAC provider. The following RBAC providers are currently supported:- directory (Azure AD)- entitlement management (Azure AD) This API is available in the following national cloud deployments. + * Get a list of unifiedRoleAssignment objects for the RBAC provider. The following RBAC providers are currently supported:- directory (Microsoft Entra ID)- entitlement management (Microsoft Entra Entitlement Management) This API is available in the following national cloud deployments. * @param RoleAssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -101,7 +94,6 @@ public function toGetRequestInformation(?RoleAssignmentsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?RoleAssignmentsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(UnifiedRoleAssignment $body, ?RoleAssig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleAssignments/RoleAssignmentsRequestBuilderGetQueryParameters.php b/src/Generated/RoleManagement/Directory/RoleAssignments/RoleAssignmentsRequestBuilderGetQueryParameters.php index 70ca57c7775..9e3fed9a9d0 100644 --- a/src/Generated/RoleManagement/Directory/RoleAssignments/RoleAssignmentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/RoleManagement/Directory/RoleAssignments/RoleAssignmentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get a list of unifiedRoleAssignment objects for the RBAC provider. The following RBAC providers are currently supported:- directory (Azure AD)- entitlement management (Azure AD) This API is available in the following national cloud deployments. + * Get a list of unifiedRoleAssignment objects for the RBAC provider. The following RBAC providers are currently supported:- directory (Microsoft Entra ID)- entitlement management (Microsoft Entra Entitlement Management) This API is available in the following national cloud deployments. */ class RoleAssignmentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/RoleManagement/Directory/RoleDefinitions/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleDefinitions/Count/CountRequestBuilder.php index 35c605f7ec0..dee01fa8c97 100644 --- a/src/Generated/RoleManagement/Directory/RoleDefinitions/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleDefinitions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/Count/CountRequestBuilder.php index e9467cd1f31..0c6044b1410 100644 --- a/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilder.php index fc370df4e1d..f9870baec92 100644 --- a/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinitionCollectionResponse; @@ -53,44 +52,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. * @param InheritsPermissionsFromRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InheritsPermissionsFromRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to inheritsPermissionsFrom for roleManagement * @param UnifiedRoleDefinition $body The request body * @param InheritsPermissionsFromRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleDefinition $body, ?InheritsPermissionsFromRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. * @param InheritsPermissionsFromRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +92,6 @@ public function toGetRequestInformation(?InheritsPermissionsFromRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?InheritsPermissionsFromRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UnifiedRoleDefinition $body, ?InheritsP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilderGetQueryParameters.php b/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilderGetQueryParameters.php index 85f7d454e0c..a1fc0e6b7f4 100644 --- a/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilderGetQueryParameters.php +++ b/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. */ class InheritsPermissionsFromRequestBuilderGetQueryParameters { diff --git a/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilder.php index cd97ed52f98..8399bb4f995 100644 --- a/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property inheritsPermissionsFrom for roleManagement * @param UnifiedRoleDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. * @param UnifiedRoleDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UnifiedRoleDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property inheritsPermissionsFrom in roleManagement * @param UnifiedRoleDefinition $body The request body * @param UnifiedRoleDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleDefinition $body, ?UnifiedRoleDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,11 +90,12 @@ public function toDeleteRequestInformation(?UnifiedRoleDefinitionItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. * @param UnifiedRoleDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UnifiedRoleDefinitionItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UnifiedRoleDefinitionItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UnifiedRoleDefinition $body, ?UnifiedR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilderGetQueryParameters.php b/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilderGetQueryParameters.php index 934bdb50356..81ced1b10bf 100644 --- a/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. */ class UnifiedRoleDefinitionItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/UnifiedRoleDefinitionItemRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/UnifiedRoleDefinitionItemRequestBuilder.php index 5750c0421f9..86a2c09d7a5 100644 --- a/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/UnifiedRoleDefinitionItemRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleDefinitions/Item/UnifiedRoleDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Graph\Generated\RoleManagement\Directory\RoleDefinitions\Item\InheritsPermissionsFrom\InheritsPermissionsFromRequestBuilder; @@ -40,65 +39,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Delete a unifiedRoleDefinition object. You can't delete built-in roles. This feature requires an Azure AD Premium P1 or P2 license. This API is available in the following national cloud deployments. + * Delete a unifiedRoleDefinition object. You can't delete built-in roles. This feature requires a Microsoft Entra ID P1 or P2 license. This API is available in the following national cloud deployments. * @param UnifiedRoleDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroledefinition-delete?view=graph-rest-1.0 Find more info here */ public function delete(?UnifiedRoleDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a unifiedRoleDefinition object. The following role-based access control (RBAC) providers are currently supported: This API is available in the following national cloud deployments. * @param UnifiedRoleDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroledefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update the properties of a unifiedRoleDefinition object. You cannot update built-in roles. This feature requires an Azure AD Premium P1 or P2 license. This API is available in the following national cloud deployments. + * Update the properties of a unifiedRoleDefinition object. You cannot update built-in roles. This feature requires a Microsoft Entra ID P1 or P2 license. This API is available in the following national cloud deployments. * @param UnifiedRoleDefinition $body The request body * @param UnifiedRoleDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroledefinition-update?view=graph-rest-1.0 Find more info here */ public function patch(UnifiedRoleDefinition $body, ?UnifiedRoleDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Delete a unifiedRoleDefinition object. You can't delete built-in roles. This feature requires an Azure AD Premium P1 or P2 license. This API is available in the following national cloud deployments. + * Delete a unifiedRoleDefinition object. You can't delete built-in roles. This feature requires a Microsoft Entra ID P1 or P2 license. This API is available in the following national cloud deployments. * @param UnifiedRoleDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?UnifiedRoleDefinitionItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?UnifiedRoleDefinitionItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,11 +122,12 @@ public function toGetRequestInformation(?UnifiedRoleDefinitionItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the properties of a unifiedRoleDefinition object. You cannot update built-in roles. This feature requires an Azure AD Premium P1 or P2 license. This API is available in the following national cloud deployments. + * Update the properties of a unifiedRoleDefinition object. You cannot update built-in roles. This feature requires a Microsoft Entra ID P1 or P2 license. This API is available in the following national cloud deployments. * @param UnifiedRoleDefinition $body The request body * @param UnifiedRoleDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -146,11 +137,11 @@ public function toPatchRequestInformation(UnifiedRoleDefinition $body, ?UnifiedR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleDefinitions/RoleDefinitionsRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleDefinitions/RoleDefinitionsRequestBuilder.php index a2c22792fbf..f83f8bedd10 100644 --- a/src/Generated/RoleManagement/Directory/RoleDefinitions/RoleDefinitionsRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleDefinitions/RoleDefinitionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinitionCollectionResponse; @@ -53,46 +52,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get a list of unifiedRoleDefinition objects for the provider. The following RBAC providers are currently supported:- directory (Azure AD)- entitlement management (Azure AD) This API is available in the following national cloud deployments. + * Get a list of unifiedRoleDefinition objects for the provider. The following RBAC providers are currently supported:- directory (Microsoft Entra ID)- entitlement management (Microsoft Entra Entitlement Management) This API is available in the following national cloud deployments. * @param RoleDefinitionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roledefinitions?view=graph-rest-1.0 Find more info here */ public function get(?RoleDefinitionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create a new custom unifiedRoleDefinition object. This feature requires an Azure AD Premium P1 or P2 license. This API is available in the following national cloud deployments. + * Create a new custom unifiedRoleDefinition object. This feature requires a Microsoft Entra ID P1 or P2 license. This API is available in the following national cloud deployments. * @param UnifiedRoleDefinition $body The request body * @param RoleDefinitionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-post-roledefinitions?view=graph-rest-1.0 Find more info here */ public function post(UnifiedRoleDefinition $body, ?RoleDefinitionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get a list of unifiedRoleDefinition objects for the provider. The following RBAC providers are currently supported:- directory (Azure AD)- entitlement management (Azure AD) This API is available in the following national cloud deployments. + * Get a list of unifiedRoleDefinition objects for the provider. The following RBAC providers are currently supported:- directory (Microsoft Entra ID)- entitlement management (Microsoft Entra Entitlement Management) This API is available in the following national cloud deployments. * @param RoleDefinitionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -101,7 +94,6 @@ public function toGetRequestInformation(?RoleDefinitionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,11 +101,12 @@ public function toGetRequestInformation(?RoleDefinitionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create a new custom unifiedRoleDefinition object. This feature requires an Azure AD Premium P1 or P2 license. This API is available in the following national cloud deployments. + * Create a new custom unifiedRoleDefinition object. This feature requires a Microsoft Entra ID P1 or P2 license. This API is available in the following national cloud deployments. * @param UnifiedRoleDefinition $body The request body * @param RoleDefinitionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -123,11 +116,11 @@ public function toPostRequestInformation(UnifiedRoleDefinition $body, ?RoleDefin $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleDefinitions/RoleDefinitionsRequestBuilderGetQueryParameters.php b/src/Generated/RoleManagement/Directory/RoleDefinitions/RoleDefinitionsRequestBuilderGetQueryParameters.php index 067e8d54fa3..651f509084c 100644 --- a/src/Generated/RoleManagement/Directory/RoleDefinitions/RoleDefinitionsRequestBuilderGetQueryParameters.php +++ b/src/Generated/RoleManagement/Directory/RoleDefinitions/RoleDefinitionsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get a list of unifiedRoleDefinition objects for the provider. The following RBAC providers are currently supported:- directory (Azure AD)- entitlement management (Azure AD) This API is available in the following national cloud deployments. + * Get a list of unifiedRoleDefinition objects for the provider. The following RBAC providers are currently supported:- directory (Microsoft Entra ID)- entitlement management (Microsoft Entra Entitlement Management) This API is available in the following national cloud deployments. */ class RoleDefinitionsRequestBuilderGetQueryParameters { diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Count/CountRequestBuilder.php index 3639d2585ef..bdb675d879e 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index bf2fc422639..a342aa705ba 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php index c12262d9fd3..5f2df41b717 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only property with details of the app-specific scope when the assignment or role eligibility is scoped to an app. Nullable. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index 7b28747b972..a674ca0aed5 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the assignment or role eligibility. Read-only. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/Principal/PrincipalRequestBuilder.php index 8ab9c99794d..0d49e4e283f 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The principal that's getting a role assignment or role eligibility through the request. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index 065cef5c968..7a5b7c58f61 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Detailed information for the roleDefinition object that is referenced through the roleDefinitionId property. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/UnifiedRoleEligibilityScheduleInstanceItemRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/UnifiedRoleEligibilityScheduleInstanceItemRequestBuilder.php index d8c52a19406..f8b93d6b68f 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/UnifiedRoleEligibilityScheduleInstanceItemRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/Item/UnifiedRoleEligibilityScheduleInstanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleInstance; use Microsoft\Graph\Generated\RoleManagement\Directory\RoleEligibilityScheduleInstances\Item\AppScope\AppScopeRequestBuilder; @@ -66,57 +65,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleEligibilityScheduleInstances for roleManagement * @param UnifiedRoleEligibilityScheduleInstanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleEligibilityScheduleInstanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the instance of a role eligibility. This API is available in the following national cloud deployments. * @param UnifiedRoleEligibilityScheduleInstanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleeligibilityscheduleinstance-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleEligibilityScheduleInstanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleEligibilityScheduleInstances in roleManagement * @param UnifiedRoleEligibilityScheduleInstance $body The request body * @param UnifiedRoleEligibilityScheduleInstanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleEligibilityScheduleInstance $body, ?UnifiedRoleEligibilityScheduleInstanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,6 +123,7 @@ public function toDeleteRequestInformation(?UnifiedRoleEligibilityScheduleInstan $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -146,7 +137,6 @@ public function toGetRequestInformation(?UnifiedRoleEligibilityScheduleInstanceI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -154,6 +144,7 @@ public function toGetRequestInformation(?UnifiedRoleEligibilityScheduleInstanceI } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -168,11 +159,11 @@ public function toPatchRequestInformation(UnifiedRoleEligibilityScheduleInstance $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/RoleEligibilityScheduleInstancesRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/RoleEligibilityScheduleInstancesRequestBuilder.php index fb1f95e9b82..885b4526a52 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/RoleEligibilityScheduleInstancesRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleInstances/RoleEligibilityScheduleInstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleInstance; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleInstanceCollectionResponse; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Get the instances of role eligibilities. This API is available in the following national cloud deployments. * @param RoleEligibilityScheduleInstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleeligibilityscheduleinstances?view=graph-rest-1.0 Find more info here */ public function get(?RoleEligibilityScheduleInstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roleEligibilityScheduleInstances for roleManagement * @param UnifiedRoleEligibilityScheduleInstance $body The request body * @param RoleEligibilityScheduleInstancesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleEligibilityScheduleInstance $body, ?RoleEligibilityScheduleInstancesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?RoleEligibilityScheduleInstancesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?RoleEligibilityScheduleInstancesRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(UnifiedRoleEligibilityScheduleInstance $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Count/CountRequestBuilder.php index 21a90ec1813..0548bb8854b 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 4858c6d0fa9..4134d4c725c 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php index a6c7ea22adf..a1a90d6f716 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only property with details of the app-specific scope when the role eligibility is scoped to an app. Nullable. Supports $expand. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/Cancel/CancelRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/Cancel/CancelRequestBuilder.php index deb4c723161..7ec786fd422 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Immediately cancel a unifiedRoleEligibilityScheduleRequest object whose status is Granted and have the system automatically delete the cancelled request after 30 days. After calling this action, the status of the cancelled unifiedRoleEligibilityScheduleRequest changes to Revoked. This API is available in the following national cloud deployments. * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleeligibilityschedulerequest-cancel?view=graph-rest-1.0 Find more info here */ public function post(?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CancelRequestBuilderPostRequestConfigu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index 1aeb2581952..ed4bdc74dce 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the role eligibility. Read-only. Supports $expand. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/Principal/PrincipalRequestBuilder.php index 6d8155b01b3..8b23494217b 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The principal that's getting a role eligibility through the request. Supports $expand. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index c45c8b8e461..df7fbd7996e 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Detailed information for the unifiedRoleDefinition object that is referenced through the roleDefinitionId property. Supports $expand. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php index 65c6eac8e6c..b1be8f62fb7 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilitySchedule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The schedule for a role eligibility that is referenced through the targetScheduleId property. Supports $expand. * @param TargetScheduleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TargetScheduleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TargetScheduleRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TargetScheduleRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/UnifiedRoleEligibilityScheduleRequestItemRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/UnifiedRoleEligibilityScheduleRequestItemRequestBuilder.php index 72261b0f5bb..dd40ec24005 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/UnifiedRoleEligibilityScheduleRequestItemRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/Item/UnifiedRoleEligibilityScheduleRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleRequest; use Microsoft\Graph\Generated\RoleManagement\Directory\RoleEligibilityScheduleRequests\Item\AppScope\AppScopeRequestBuilder; @@ -82,57 +81,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleEligibilityScheduleRequests for roleManagement * @param UnifiedRoleEligibilityScheduleRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleEligibilityScheduleRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * In PIM, read the details of a request for for a role eligibility request made through the unifiedRoleEligibilityScheduleRequest object. This API is available in the following national cloud deployments. * @param UnifiedRoleEligibilityScheduleRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleeligibilityschedulerequest-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleEligibilityScheduleRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleEligibilityScheduleRequests in roleManagement * @param UnifiedRoleEligibilityScheduleRequest $body The request body * @param UnifiedRoleEligibilityScheduleRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleEligibilityScheduleRequest $body, ?UnifiedRoleEligibilityScheduleRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -149,6 +139,7 @@ public function toDeleteRequestInformation(?UnifiedRoleEligibilityScheduleReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -162,7 +153,6 @@ public function toGetRequestInformation(?UnifiedRoleEligibilityScheduleRequestIt $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -170,6 +160,7 @@ public function toGetRequestInformation(?UnifiedRoleEligibilityScheduleRequestIt } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -184,11 +175,11 @@ public function toPatchRequestInformation(UnifiedRoleEligibilityScheduleRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/RoleEligibilityScheduleRequestsRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/RoleEligibilityScheduleRequestsRequestBuilder.php index e52b8a4c7c4..54159600af6 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/RoleEligibilityScheduleRequestsRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilityScheduleRequests/RoleEligibilityScheduleRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleRequest; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleRequestCollectionResponse; @@ -65,40 +64,34 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * In PIM, retrieve the requests for role eligibilities for principals made through the unifiedRoleEligibilityScheduleRequest object. This API is available in the following national cloud deployments. * @param RoleEligibilityScheduleRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleeligibilityschedulerequests?view=graph-rest-1.0 Find more info here */ public function get(?RoleEligibilityScheduleRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * In PIM, request for a role eligibility for a principal through the unifiedRoleEligibilityScheduleRequest object. This operation allows both admins and eligible users to add, revoke, or extend eligible assignments. This API is available in the following national cloud deployments. * @param UnifiedRoleEligibilityScheduleRequest $body The request body * @param RoleEligibilityScheduleRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-post-roleeligibilityschedulerequests?view=graph-rest-1.0 Find more info here */ public function post(UnifiedRoleEligibilityScheduleRequest $body, ?RoleEligibilityScheduleRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,7 +104,6 @@ public function toGetRequestInformation(?RoleEligibilityScheduleRequestsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -119,6 +111,7 @@ public function toGetRequestInformation(?RoleEligibilityScheduleRequestsRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -133,11 +126,11 @@ public function toPostRequestInformation(UnifiedRoleEligibilityScheduleRequest $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Count/CountRequestBuilder.php index d371e2c58ba..d50ae08c677 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index f078c9ea26c..f36a39eb3d0 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/AppScope/AppScopeRequestBuilder.php index 7cc726319ca..9f1a0a87038 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only property with details of the app-specific scope when the role eligibility or assignment is scoped to an app. Nullable. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index a26ddf30857..aba760d1e7d 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the role eligibility or assignment. Read-only. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/Principal/PrincipalRequestBuilder.php index 6fc0867da7c..86ce7f50eb6 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The principal that's getting a role assignment or that's eligible for a role through the request. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index 082896e93f8..cbebfcdc64d 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Detailed information for the roleDefinition object that is referenced through the roleDefinitionId property. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/UnifiedRoleEligibilityScheduleItemRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/UnifiedRoleEligibilityScheduleItemRequestBuilder.php index 3074a0c3473..7cc86abb258 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/UnifiedRoleEligibilityScheduleItemRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/Item/UnifiedRoleEligibilityScheduleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilitySchedule; use Microsoft\Graph\Generated\RoleManagement\Directory\RoleEligibilitySchedules\Item\AppScope\AppScopeRequestBuilder; @@ -66,57 +65,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleEligibilitySchedules for roleManagement * @param UnifiedRoleEligibilityScheduleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleEligibilityScheduleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the schedule for a role eligibility operation. This API is available in the following national cloud deployments. * @param UnifiedRoleEligibilityScheduleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleeligibilityschedule-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleEligibilityScheduleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleEligibilitySchedules in roleManagement * @param UnifiedRoleEligibilitySchedule $body The request body * @param UnifiedRoleEligibilityScheduleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleEligibilitySchedule $body, ?UnifiedRoleEligibilityScheduleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,6 +123,7 @@ public function toDeleteRequestInformation(?UnifiedRoleEligibilityScheduleItemRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -146,7 +137,6 @@ public function toGetRequestInformation(?UnifiedRoleEligibilityScheduleItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -154,6 +144,7 @@ public function toGetRequestInformation(?UnifiedRoleEligibilityScheduleItemReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -168,11 +159,11 @@ public function toPatchRequestInformation(UnifiedRoleEligibilitySchedule $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/RoleEligibilitySchedulesRequestBuilder.php b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/RoleEligibilitySchedulesRequestBuilder.php index a8e7b1a2c12..8d308b1ec9e 100644 --- a/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/RoleEligibilitySchedulesRequestBuilder.php +++ b/src/Generated/RoleManagement/Directory/RoleEligibilitySchedules/RoleEligibilitySchedulesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilitySchedule; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleCollectionResponse; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Get the unifiedRoleEligibilitySchedule resources from the roleEligibilitySchedules navigation property. This API is available in the following national cloud deployments. * @param RoleEligibilitySchedulesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleeligibilityschedules?view=graph-rest-1.0 Find more info here */ public function get(?RoleEligibilitySchedulesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roleEligibilitySchedules for roleManagement * @param UnifiedRoleEligibilitySchedule $body The request body * @param RoleEligibilitySchedulesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleEligibilitySchedule $body, ?RoleEligibilitySchedulesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?RoleEligibilitySchedulesRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?RoleEligibilitySchedulesRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(UnifiedRoleEligibilitySchedule $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/EntitlementManagementRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/EntitlementManagementRequestBuilder.php index 31117c4062b..a87993f3faf 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/EntitlementManagementRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/EntitlementManagementRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RbacApplication; use Microsoft\Graph\Generated\RoleManagement\EntitlementManagement\ResourceNamespaces\ResourceNamespacesRequestBuilder; @@ -106,56 +105,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property entitlementManagement for roleManagement * @param EntitlementManagementRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EntitlementManagementRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Container for roles and assignments for entitlement management resources. * @param EntitlementManagementRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EntitlementManagementRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RbacApplication::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RbacApplication::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property entitlementManagement in roleManagement * @param RbacApplication $body The request body * @param EntitlementManagementRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RbacApplication $body, ?EntitlementManagementRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RbacApplication::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RbacApplication::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -172,6 +162,7 @@ public function toDeleteRequestInformation(?EntitlementManagementRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -185,7 +176,6 @@ public function toGetRequestInformation(?EntitlementManagementRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -193,6 +183,7 @@ public function toGetRequestInformation(?EntitlementManagementRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -207,11 +198,11 @@ public function toPatchRequestInformation(RbacApplication $body, ?EntitlementMan $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Count/CountRequestBuilder.php index d2f6ddbd7e4..dd159f001f5 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/ResourceActions/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/ResourceActions/Count/CountRequestBuilder.php index 0208bc880ee..034e3f97e03 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/ResourceActions/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/ResourceActions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/ResourceActions/Item/UnifiedRbacResourceActionItemRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/ResourceActions/Item/UnifiedRbacResourceActionItemRequestBuilder.php index 647eb83822d..dfeb665f83e 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/ResourceActions/Item/UnifiedRbacResourceActionItemRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/ResourceActions/Item/UnifiedRbacResourceActionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRbacResourceAction; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resourceActions for roleManagement * @param UnifiedRbacResourceActionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRbacResourceActionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resourceActions from roleManagement * @param UnifiedRbacResourceActionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UnifiedRbacResourceActionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceAction::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceAction::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resourceActions in roleManagement * @param UnifiedRbacResourceAction $body The request body * @param UnifiedRbacResourceActionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRbacResourceAction $body, ?UnifiedRbacResourceActionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceAction::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceAction::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UnifiedRbacResourceActionItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UnifiedRbacResourceActionItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UnifiedRbacResourceActionItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UnifiedRbacResourceAction $body, ?Unif $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/ResourceActions/ResourceActionsRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/ResourceActions/ResourceActionsRequestBuilder.php index 942731c056c..4cf99e5a1c5 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/ResourceActions/ResourceActionsRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/ResourceActions/ResourceActionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRbacResourceAction; use Microsoft\Graph\Generated\Models\UnifiedRbacResourceActionCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get resourceActions from roleManagement * @param ResourceActionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceActionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceActionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceActionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resourceActions for roleManagement * @param UnifiedRbacResourceAction $body The request body * @param ResourceActionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRbacResourceAction $body, ?ResourceActionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceAction::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceAction::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResourceActionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResourceActionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UnifiedRbacResourceAction $body, ?Resou $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/UnifiedRbacResourceNamespaceItemRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/UnifiedRbacResourceNamespaceItemRequestBuilder.php index 9cb522293ee..9b265a83048 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/UnifiedRbacResourceNamespaceItemRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/Item/UnifiedRbacResourceNamespaceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRbacResourceNamespace; use Microsoft\Graph\Generated\RoleManagement\EntitlementManagement\ResourceNamespaces\Item\ResourceActions\ResourceActionsRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resourceNamespaces for roleManagement * @param UnifiedRbacResourceNamespaceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRbacResourceNamespaceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get resourceNamespaces from roleManagement * @param UnifiedRbacResourceNamespaceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UnifiedRbacResourceNamespaceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespace::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespace::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resourceNamespaces in roleManagement * @param UnifiedRbacResourceNamespace $body The request body * @param UnifiedRbacResourceNamespaceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRbacResourceNamespace $body, ?UnifiedRbacResourceNamespaceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespace::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespace::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?UnifiedRbacResourceNamespaceItemRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?UnifiedRbacResourceNamespaceItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?UnifiedRbacResourceNamespaceItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(UnifiedRbacResourceNamespace $body, ?U $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/ResourceNamespacesRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/ResourceNamespacesRequestBuilder.php index 72fbe6ec02c..11e4a4614d2 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/ResourceNamespacesRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/ResourceNamespaces/ResourceNamespacesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRbacResourceNamespace; use Microsoft\Graph\Generated\Models\UnifiedRbacResourceNamespaceCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get resourceNamespaces from roleManagement * @param ResourceNamespacesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceNamespacesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespaceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespaceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resourceNamespaces for roleManagement * @param UnifiedRbacResourceNamespace $body The request body * @param ResourceNamespacesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRbacResourceNamespace $body, ?ResourceNamespacesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespace::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRbacResourceNamespace::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResourceNamespacesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResourceNamespacesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UnifiedRbacResourceNamespace $body, ?Re $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Count/CountRequestBuilder.php index 4a8ae7a49f5..1376c7147cc 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 566516299c8..cad096811fd 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php index 7cde31332cd..0356104600e 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleInstance; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * If the request is from an eligible administrator to activate a role, this parameter will show the related eligible assignment for that activation. Otherwise, it is null. Supports $expand. * @param ActivatedUsingRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivatedUsingRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php index 4de9c4fa4a2..e69387c8f54 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only property with details of the app-specific scope when the assignment or role eligibility is scoped to an app. Nullable. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index 003e318065d..d2d89c72e0b 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the assignment or role eligibility. Read-only. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/Principal/PrincipalRequestBuilder.php index 56a37a88ca6..38e80ca686f 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The principal that's getting a role assignment or role eligibility through the request. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index 9f5eadf4f2d..4d63ac227e8 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Detailed information for the roleDefinition object that is referenced through the roleDefinitionId property. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/UnifiedRoleAssignmentScheduleInstanceItemRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/UnifiedRoleAssignmentScheduleInstanceItemRequestBuilder.php index edaac1fa643..651a2a84045 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/UnifiedRoleAssignmentScheduleInstanceItemRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/Item/UnifiedRoleAssignmentScheduleInstanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleInstance; use Microsoft\Graph\Generated\RoleManagement\EntitlementManagement\RoleAssignmentScheduleInstances\Item\ActivatedUsing\ActivatedUsingRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleAssignmentScheduleInstances for roleManagement * @param UnifiedRoleAssignmentScheduleInstanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleAssignmentScheduleInstanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the instance of an active role assignment. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentScheduleInstanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleassignmentscheduleinstance-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleAssignmentScheduleInstanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleAssignmentScheduleInstances in roleManagement * @param UnifiedRoleAssignmentScheduleInstance $body The request body * @param UnifiedRoleAssignmentScheduleInstanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleAssignmentScheduleInstance $body, ?UnifiedRoleAssignmentScheduleInstanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?UnifiedRoleAssignmentScheduleInstanc $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentScheduleInstanceIt $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentScheduleInstanceIt } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(UnifiedRoleAssignmentScheduleInstance $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/RoleAssignmentScheduleInstancesRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/RoleAssignmentScheduleInstancesRequestBuilder.php index 646489df887..de284e5a56f 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/RoleAssignmentScheduleInstancesRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleInstances/RoleAssignmentScheduleInstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleInstance; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleInstanceCollectionResponse; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Get the instances of active role assignments in your tenant. The active assignments include those made through assignments and activation requests, and directly through the role assignments API. This API is available in the following national cloud deployments. * @param RoleAssignmentScheduleInstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleassignmentscheduleinstances?view=graph-rest-1.0 Find more info here */ public function get(?RoleAssignmentScheduleInstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roleAssignmentScheduleInstances for roleManagement * @param UnifiedRoleAssignmentScheduleInstance $body The request body * @param RoleAssignmentScheduleInstancesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleAssignmentScheduleInstance $body, ?RoleAssignmentScheduleInstancesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?RoleAssignmentScheduleInstancesRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?RoleAssignmentScheduleInstancesRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(UnifiedRoleAssignmentScheduleInstance $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Count/CountRequestBuilder.php index cdf236a3689..73e5a20f451 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 73b3123886d..a48f4b1e755 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php index fbc925f5b98..8f383bb972b 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilitySchedule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * If the request is from an eligible administrator to activate a role, this parameter will show the related eligible assignment for that activation. Otherwise, it's null. Supports $expand. * @param ActivatedUsingRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivatedUsingRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php index 2519445081b..3eb5675b2e2 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only property with details of the app-specific scope when the assignment is scoped to an app. Nullable. Supports $expand. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/Cancel/CancelRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/Cancel/CancelRequestBuilder.php index f7773b21204..e9affd4ca60 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Immediately cancel a unifiedRoleAssignmentScheduleRequest object that is in a Granted status, and have the system automatically delete the canceled request after 30 days. After calling this action, the status of the canceled unifiedRoleAssignmentScheduleRequest changes to Canceled. This API is available in the following national cloud deployments. * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleassignmentschedulerequest-cancel?view=graph-rest-1.0 Find more info here */ public function post(?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CancelRequestBuilderPostRequestConfigu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index 9d0d7f98a66..603e18f78aa 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the assignment. Read-only. Supports $expand. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/Principal/PrincipalRequestBuilder.php index 8b307baefa9..4a0f16ad19f 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The principal that's getting a role assignment through the request. Supports $expand. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index cadcc6ebae8..4b6d49a23da 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Detailed information for the unifiedRoleDefinition object that is referenced through the roleDefinitionId property. Supports $expand. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php index b1d29c27ce6..9f55f51ccc9 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentSchedule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The schedule for an eligible role assignment that is referenced through the targetScheduleId property. Supports $expand. * @param TargetScheduleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TargetScheduleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TargetScheduleRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TargetScheduleRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/UnifiedRoleAssignmentScheduleRequestItemRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/UnifiedRoleAssignmentScheduleRequestItemRequestBuilder.php index 15e393f2c2b..1049b9ebcc8 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/UnifiedRoleAssignmentScheduleRequestItemRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/Item/UnifiedRoleAssignmentScheduleRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleRequest; use Microsoft\Graph\Generated\RoleManagement\EntitlementManagement\RoleAssignmentScheduleRequests\Item\ActivatedUsing\ActivatedUsingRequestBuilder; @@ -90,57 +89,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleAssignmentScheduleRequests for roleManagement * @param UnifiedRoleAssignmentScheduleRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleAssignmentScheduleRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * In PIM, read the details of a request for an active and persistent role assignment made through the unifiedRoleAssignmentScheduleRequest object. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentScheduleRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleassignmentschedulerequest-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleAssignmentScheduleRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleAssignmentScheduleRequests in roleManagement * @param UnifiedRoleAssignmentScheduleRequest $body The request body * @param UnifiedRoleAssignmentScheduleRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleAssignmentScheduleRequest $body, ?UnifiedRoleAssignmentScheduleRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -157,6 +147,7 @@ public function toDeleteRequestInformation(?UnifiedRoleAssignmentScheduleRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -170,7 +161,6 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentScheduleRequestIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -178,6 +168,7 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentScheduleRequestIte } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -192,11 +183,11 @@ public function toPatchRequestInformation(UnifiedRoleAssignmentScheduleRequest $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/RoleAssignmentScheduleRequestsRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/RoleAssignmentScheduleRequestsRequestBuilder.php index 13d6d16fb08..eeb1c666afa 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/RoleAssignmentScheduleRequestsRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentScheduleRequests/RoleAssignmentScheduleRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleRequest; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleRequestCollectionResponse; @@ -65,40 +64,34 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Retrieve the requests for active role assignments to principals. The active assignments include those made through assignments and activation requests, and directly through the role assignments API. The role assignments can be permanently active with or without an expiry date, or temporarily active after user activation of eligible assignments. This API is available in the following national cloud deployments. * @param RoleAssignmentScheduleRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleassignmentschedulerequests?view=graph-rest-1.0 Find more info here */ public function get(?RoleAssignmentScheduleRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * In PIM, carry out the following operations through the unifiedRoleAssignmentScheduleRequest object: To call this API to update, renew, and extend assignments for yourself, you must have multi-factor authentication (MFA) enforced, and running the query in a session in which they were challenged for MFA. See Enable per-user Azure AD Multi-Factor Authentication to secure sign-in events. This API is available in the following national cloud deployments. + * In PIM, carry out the following operations through the unifiedRoleAssignmentScheduleRequest object: To call this API to update, renew, and extend assignments for yourself, you must have multifactor authentication (MFA) enforced, and running the query in a session in which they were challenged for MFA. See Enable per-user Microsoft Entra multifactor authentication to secure sign-in events. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentScheduleRequest $body The request body * @param RoleAssignmentScheduleRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-post-roleassignmentschedulerequests?view=graph-rest-1.0 Find more info here */ public function post(UnifiedRoleAssignmentScheduleRequest $body, ?RoleAssignmentScheduleRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,7 +104,6 @@ public function toGetRequestInformation(?RoleAssignmentScheduleRequestsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -119,11 +111,12 @@ public function toGetRequestInformation(?RoleAssignmentScheduleRequestsRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * In PIM, carry out the following operations through the unifiedRoleAssignmentScheduleRequest object: To call this API to update, renew, and extend assignments for yourself, you must have multi-factor authentication (MFA) enforced, and running the query in a session in which they were challenged for MFA. See Enable per-user Azure AD Multi-Factor Authentication to secure sign-in events. This API is available in the following national cloud deployments. + * In PIM, carry out the following operations through the unifiedRoleAssignmentScheduleRequest object: To call this API to update, renew, and extend assignments for yourself, you must have multifactor authentication (MFA) enforced, and running the query in a session in which they were challenged for MFA. See Enable per-user Microsoft Entra multifactor authentication to secure sign-in events. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentScheduleRequest $body The request body * @param RoleAssignmentScheduleRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -133,11 +126,11 @@ public function toPostRequestInformation(UnifiedRoleAssignmentScheduleRequest $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Count/CountRequestBuilder.php index 1fa20530de9..5eb96df0ce3 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 2208c7616ff..820affad906 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php index 20c9c4d317f..4943099fc8d 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/ActivatedUsing/ActivatedUsingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilitySchedule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * If the request is from an eligible administrator to activate a role, this parameter will show the related eligible assignment for that activation. Otherwise, it is null. Supports $expand. * @param ActivatedUsingRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivatedUsingRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ActivatedUsingRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/AppScope/AppScopeRequestBuilder.php index 69602a2636d..39e963425df 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only property with details of the app-specific scope when the role eligibility or assignment is scoped to an app. Nullable. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index 019d8f6f519..5275e6b1805 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the role eligibility or assignment. Read-only. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/Principal/PrincipalRequestBuilder.php index 0b1fe88e0ec..aaa228af450 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The principal that's getting a role assignment or that's eligible for a role through the request. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index 39cb86267da..6875ded03ce 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Detailed information for the roleDefinition object that is referenced through the roleDefinitionId property. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/UnifiedRoleAssignmentScheduleItemRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/UnifiedRoleAssignmentScheduleItemRequestBuilder.php index 9bad99c7e06..3862211b768 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/UnifiedRoleAssignmentScheduleItemRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/Item/UnifiedRoleAssignmentScheduleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentSchedule; use Microsoft\Graph\Generated\RoleManagement\EntitlementManagement\RoleAssignmentSchedules\Item\ActivatedUsing\ActivatedUsingRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleAssignmentSchedules for roleManagement * @param UnifiedRoleAssignmentScheduleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleAssignmentScheduleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the schedule for an active role assignment operation. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentScheduleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleassignmentschedule-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleAssignmentScheduleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleAssignmentSchedules in roleManagement * @param UnifiedRoleAssignmentSchedule $body The request body * @param UnifiedRoleAssignmentScheduleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleAssignmentSchedule $body, ?UnifiedRoleAssignmentScheduleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?UnifiedRoleAssignmentScheduleItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentScheduleItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentScheduleItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(UnifiedRoleAssignmentSchedule $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/RoleAssignmentSchedulesRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/RoleAssignmentSchedulesRequestBuilder.php index b887ed36e7b..19ffd3cc450 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/RoleAssignmentSchedulesRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignmentSchedules/RoleAssignmentSchedulesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentSchedule; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleCollectionResponse; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Get the schedules for active role assignment operations. This API is available in the following national cloud deployments. * @param RoleAssignmentSchedulesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleassignmentschedules?view=graph-rest-1.0 Find more info here */ public function get(?RoleAssignmentSchedulesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentScheduleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roleAssignmentSchedules for roleManagement * @param UnifiedRoleAssignmentSchedule $body The request body * @param RoleAssignmentSchedulesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleAssignmentSchedule $body, ?RoleAssignmentSchedulesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentSchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?RoleAssignmentSchedulesRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?RoleAssignmentSchedulesRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(UnifiedRoleAssignmentSchedule $body, ?R $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Count/CountRequestBuilder.php index cd18715252d..c852dcfd2dd 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/AppScope/AppScopeRequestBuilder.php index ed8c9940528..1dd83d162e0 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property appScope for roleManagement * @param AppScopeRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AppScopeRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only property with details of the app specific scope when the assignment scope is app specific. Containment entity. Supports $expand. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property appScope in roleManagement * @param AppScope $body The request body * @param AppScopeRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AppScope $body, ?AppScopeRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AppScopeRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AppScope $body, ?AppScopeRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index 755931063ca..1d5761799f3 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the assignment. Read-only. Supports $expand. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/Principal/PrincipalRequestBuilder.php index 67ce78d93e2..a0d60566fd4 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Referencing the assigned principal. Read-only. Supports $expand. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index 3185f2509bc..d89c25cc50a 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The roleDefinition the assignment is for. Supports $expand. roleDefinition.Id will be auto expanded. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/UnifiedRoleAssignmentItemRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/UnifiedRoleAssignmentItemRequestBuilder.php index 89d3cab8454..c03837f80a4 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/UnifiedRoleAssignmentItemRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/Item/UnifiedRoleAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignment; use Microsoft\Graph\Generated\RoleManagement\EntitlementManagement\RoleAssignments\Item\AppScope\AppScopeRequestBuilder; @@ -66,58 +65,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a unifiedRoleAssignment object. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?UnifiedRoleAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a unifiedRoleAssignment object. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleAssignments in roleManagement * @param UnifiedRoleAssignment $body The request body * @param UnifiedRoleAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleAssignment $body, ?UnifiedRoleAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -134,6 +124,7 @@ public function toDeleteRequestInformation(?UnifiedRoleAssignmentItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -147,7 +138,6 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -155,6 +145,7 @@ public function toGetRequestInformation(?UnifiedRoleAssignmentItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -169,11 +160,11 @@ public function toPatchRequestInformation(UnifiedRoleAssignment $body, ?UnifiedR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/RoleAssignmentsRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/RoleAssignmentsRequestBuilder.php index 9cfbd58fcb9..2ca044273e7 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/RoleAssignmentsRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/RoleAssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignment; use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentCollectionResponse; @@ -53,46 +52,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get a list of unifiedRoleAssignment objects for the RBAC provider. The following RBAC providers are currently supported:- directory (Azure AD)- entitlement management (Azure AD) This API is available in the following national cloud deployments. + * Get a list of unifiedRoleAssignment objects for the RBAC provider. The following RBAC providers are currently supported:- directory (Microsoft Entra ID)- entitlement management (Microsoft Entra Entitlement Management) This API is available in the following national cloud deployments. * @param RoleAssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleassignments?view=graph-rest-1.0 Find more info here */ public function get(?RoleAssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new unifiedRoleAssignment object. This API is available in the following national cloud deployments. * @param UnifiedRoleAssignment $body The request body * @param RoleAssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-post-roleassignments?view=graph-rest-1.0 Find more info here */ public function post(UnifiedRoleAssignment $body, ?RoleAssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get a list of unifiedRoleAssignment objects for the RBAC provider. The following RBAC providers are currently supported:- directory (Azure AD)- entitlement management (Azure AD) This API is available in the following national cloud deployments. + * Get a list of unifiedRoleAssignment objects for the RBAC provider. The following RBAC providers are currently supported:- directory (Microsoft Entra ID)- entitlement management (Microsoft Entra Entitlement Management) This API is available in the following national cloud deployments. * @param RoleAssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -101,7 +94,6 @@ public function toGetRequestInformation(?RoleAssignmentsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?RoleAssignmentsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(UnifiedRoleAssignment $body, ?RoleAssig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/RoleAssignmentsRequestBuilderGetQueryParameters.php b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/RoleAssignmentsRequestBuilderGetQueryParameters.php index 44784650476..27969178525 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/RoleAssignmentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleAssignments/RoleAssignmentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get a list of unifiedRoleAssignment objects for the RBAC provider. The following RBAC providers are currently supported:- directory (Azure AD)- entitlement management (Azure AD) This API is available in the following national cloud deployments. + * Get a list of unifiedRoleAssignment objects for the RBAC provider. The following RBAC providers are currently supported:- directory (Microsoft Entra ID)- entitlement management (Microsoft Entra Entitlement Management) This API is available in the following national cloud deployments. */ class RoleAssignmentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Count/CountRequestBuilder.php index b3d99c76bb6..3cc15f8c1d8 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/Count/CountRequestBuilder.php index d73f799e98a..b4bb9e783e1 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilder.php index de225f63009..abf994d2daf 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinitionCollectionResponse; @@ -53,44 +52,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. * @param InheritsPermissionsFromRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InheritsPermissionsFromRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to inheritsPermissionsFrom for roleManagement * @param UnifiedRoleDefinition $body The request body * @param InheritsPermissionsFromRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleDefinition $body, ?InheritsPermissionsFromRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. * @param InheritsPermissionsFromRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +92,6 @@ public function toGetRequestInformation(?InheritsPermissionsFromRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?InheritsPermissionsFromRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(UnifiedRoleDefinition $body, ?InheritsP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilderGetQueryParameters.php b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilderGetQueryParameters.php index 3494412c231..0ef913e87a1 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilderGetQueryParameters.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/InheritsPermissionsFromRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. */ class InheritsPermissionsFromRequestBuilderGetQueryParameters { diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilder.php index 35d5b8309d6..a9d75a162de 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property inheritsPermissionsFrom for roleManagement * @param UnifiedRoleDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. * @param UnifiedRoleDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UnifiedRoleDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property inheritsPermissionsFrom in roleManagement * @param UnifiedRoleDefinition $body The request body * @param UnifiedRoleDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleDefinition $body, ?UnifiedRoleDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,11 +90,12 @@ public function toDeleteRequestInformation(?UnifiedRoleDefinitionItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. * @param UnifiedRoleDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UnifiedRoleDefinitionItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UnifiedRoleDefinitionItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UnifiedRoleDefinition $body, ?UnifiedR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilderGetQueryParameters.php b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilderGetQueryParameters.php index 4adea8e2050..38e54410293 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/InheritsPermissionsFrom/Item/UnifiedRoleDefinitionItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read-only collection of role definitions that the given role definition inherits from. Only Azure AD built-in roles (isBuiltIn is true) support this attribute. Supports $expand. + * Read-only collection of role definitions that the given role definition inherits from. Only Microsoft Entra built-in roles (isBuiltIn is true) support this attribute. Supports $expand. */ class UnifiedRoleDefinitionItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/UnifiedRoleDefinitionItemRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/UnifiedRoleDefinitionItemRequestBuilder.php index 27f87e443cb..aea1a2e1360 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/UnifiedRoleDefinitionItemRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/Item/UnifiedRoleDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Graph\Generated\RoleManagement\EntitlementManagement\RoleDefinitions\Item\InheritsPermissionsFrom\InheritsPermissionsFromRequestBuilder; @@ -40,65 +39,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Delete a unifiedRoleDefinition object. You can't delete built-in roles. This feature requires an Azure AD Premium P1 or P2 license. This API is available in the following national cloud deployments. + * Delete a unifiedRoleDefinition object. You can't delete built-in roles. This feature requires a Microsoft Entra ID P1 or P2 license. This API is available in the following national cloud deployments. * @param UnifiedRoleDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroledefinition-delete?view=graph-rest-1.0 Find more info here */ public function delete(?UnifiedRoleDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a unifiedRoleDefinition object. The following role-based access control (RBAC) providers are currently supported: This API is available in the following national cloud deployments. * @param UnifiedRoleDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroledefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update the properties of a unifiedRoleDefinition object. You cannot update built-in roles. This feature requires an Azure AD Premium P1 or P2 license. This API is available in the following national cloud deployments. + * Update the properties of a unifiedRoleDefinition object. You cannot update built-in roles. This feature requires a Microsoft Entra ID P1 or P2 license. This API is available in the following national cloud deployments. * @param UnifiedRoleDefinition $body The request body * @param UnifiedRoleDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroledefinition-update?view=graph-rest-1.0 Find more info here */ public function patch(UnifiedRoleDefinition $body, ?UnifiedRoleDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Delete a unifiedRoleDefinition object. You can't delete built-in roles. This feature requires an Azure AD Premium P1 or P2 license. This API is available in the following national cloud deployments. + * Delete a unifiedRoleDefinition object. You can't delete built-in roles. This feature requires a Microsoft Entra ID P1 or P2 license. This API is available in the following national cloud deployments. * @param UnifiedRoleDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?UnifiedRoleDefinitionItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?UnifiedRoleDefinitionItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,11 +122,12 @@ public function toGetRequestInformation(?UnifiedRoleDefinitionItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the properties of a unifiedRoleDefinition object. You cannot update built-in roles. This feature requires an Azure AD Premium P1 or P2 license. This API is available in the following national cloud deployments. + * Update the properties of a unifiedRoleDefinition object. You cannot update built-in roles. This feature requires a Microsoft Entra ID P1 or P2 license. This API is available in the following national cloud deployments. * @param UnifiedRoleDefinition $body The request body * @param UnifiedRoleDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -146,11 +137,11 @@ public function toPatchRequestInformation(UnifiedRoleDefinition $body, ?UnifiedR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/RoleDefinitionsRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/RoleDefinitionsRequestBuilder.php index fa9573d29a9..dd0a93d38fd 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/RoleDefinitionsRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/RoleDefinitionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinitionCollectionResponse; @@ -53,46 +52,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get a list of unifiedRoleDefinition objects for the provider. The following RBAC providers are currently supported:- directory (Azure AD)- entitlement management (Azure AD) This API is available in the following national cloud deployments. + * Get a list of unifiedRoleDefinition objects for the provider. The following RBAC providers are currently supported:- directory (Microsoft Entra ID)- entitlement management (Microsoft Entra Entitlement Management) This API is available in the following national cloud deployments. * @param RoleDefinitionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roledefinitions?view=graph-rest-1.0 Find more info here */ public function get(?RoleDefinitionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create a new custom unifiedRoleDefinition object. This feature requires an Azure AD Premium P1 or P2 license. This API is available in the following national cloud deployments. + * Create a new custom unifiedRoleDefinition object. This feature requires a Microsoft Entra ID P1 or P2 license. This API is available in the following national cloud deployments. * @param UnifiedRoleDefinition $body The request body * @param RoleDefinitionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-post-roledefinitions?view=graph-rest-1.0 Find more info here */ public function post(UnifiedRoleDefinition $body, ?RoleDefinitionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get a list of unifiedRoleDefinition objects for the provider. The following RBAC providers are currently supported:- directory (Azure AD)- entitlement management (Azure AD) This API is available in the following national cloud deployments. + * Get a list of unifiedRoleDefinition objects for the provider. The following RBAC providers are currently supported:- directory (Microsoft Entra ID)- entitlement management (Microsoft Entra Entitlement Management) This API is available in the following national cloud deployments. * @param RoleDefinitionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -101,7 +94,6 @@ public function toGetRequestInformation(?RoleDefinitionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,11 +101,12 @@ public function toGetRequestInformation(?RoleDefinitionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create a new custom unifiedRoleDefinition object. This feature requires an Azure AD Premium P1 or P2 license. This API is available in the following national cloud deployments. + * Create a new custom unifiedRoleDefinition object. This feature requires a Microsoft Entra ID P1 or P2 license. This API is available in the following national cloud deployments. * @param UnifiedRoleDefinition $body The request body * @param RoleDefinitionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -123,11 +116,11 @@ public function toPostRequestInformation(UnifiedRoleDefinition $body, ?RoleDefin $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/RoleDefinitionsRequestBuilderGetQueryParameters.php b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/RoleDefinitionsRequestBuilderGetQueryParameters.php index 4029bc9a6d8..ad457cf1944 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/RoleDefinitionsRequestBuilderGetQueryParameters.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleDefinitions/RoleDefinitionsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get a list of unifiedRoleDefinition objects for the provider. The following RBAC providers are currently supported:- directory (Azure AD)- entitlement management (Azure AD) This API is available in the following national cloud deployments. + * Get a list of unifiedRoleDefinition objects for the provider. The following RBAC providers are currently supported:- directory (Microsoft Entra ID)- entitlement management (Microsoft Entra Entitlement Management) This API is available in the following national cloud deployments. */ class RoleDefinitionsRequestBuilderGetQueryParameters { diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Count/CountRequestBuilder.php index d411b831b86..ef7dd323906 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 2c5d41ab5ae..a422cf7b359 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php index 63222437bff..8fd6beab373 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only property with details of the app-specific scope when the assignment or role eligibility is scoped to an app. Nullable. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index 483528d59d4..d6fc6a9f0c9 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the assignment or role eligibility. Read-only. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/Principal/PrincipalRequestBuilder.php index 31623d53e3c..5e022a96775 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The principal that's getting a role assignment or role eligibility through the request. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index 71eba3899f6..cb2596d3a70 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Detailed information for the roleDefinition object that is referenced through the roleDefinitionId property. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/UnifiedRoleEligibilityScheduleInstanceItemRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/UnifiedRoleEligibilityScheduleInstanceItemRequestBuilder.php index a26de502aa8..80022f310b4 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/UnifiedRoleEligibilityScheduleInstanceItemRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/Item/UnifiedRoleEligibilityScheduleInstanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleInstance; use Microsoft\Graph\Generated\RoleManagement\EntitlementManagement\RoleEligibilityScheduleInstances\Item\AppScope\AppScopeRequestBuilder; @@ -66,57 +65,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleEligibilityScheduleInstances for roleManagement * @param UnifiedRoleEligibilityScheduleInstanceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleEligibilityScheduleInstanceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the instance of a role eligibility. This API is available in the following national cloud deployments. * @param UnifiedRoleEligibilityScheduleInstanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleeligibilityscheduleinstance-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleEligibilityScheduleInstanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleEligibilityScheduleInstances in roleManagement * @param UnifiedRoleEligibilityScheduleInstance $body The request body * @param UnifiedRoleEligibilityScheduleInstanceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleEligibilityScheduleInstance $body, ?UnifiedRoleEligibilityScheduleInstanceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,6 +123,7 @@ public function toDeleteRequestInformation(?UnifiedRoleEligibilityScheduleInstan $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -146,7 +137,6 @@ public function toGetRequestInformation(?UnifiedRoleEligibilityScheduleInstanceI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -154,6 +144,7 @@ public function toGetRequestInformation(?UnifiedRoleEligibilityScheduleInstanceI } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -168,11 +159,11 @@ public function toPatchRequestInformation(UnifiedRoleEligibilityScheduleInstance $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/RoleEligibilityScheduleInstancesRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/RoleEligibilityScheduleInstancesRequestBuilder.php index 4c5e78538a7..104dbc842e2 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/RoleEligibilityScheduleInstancesRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleInstances/RoleEligibilityScheduleInstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleInstance; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleInstanceCollectionResponse; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Get the instances of role eligibilities. This API is available in the following national cloud deployments. * @param RoleEligibilityScheduleInstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleeligibilityscheduleinstances?view=graph-rest-1.0 Find more info here */ public function get(?RoleEligibilityScheduleInstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roleEligibilityScheduleInstances for roleManagement * @param UnifiedRoleEligibilityScheduleInstance $body The request body * @param RoleEligibilityScheduleInstancesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleEligibilityScheduleInstance $body, ?RoleEligibilityScheduleInstancesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleInstance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?RoleEligibilityScheduleInstancesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?RoleEligibilityScheduleInstancesRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(UnifiedRoleEligibilityScheduleInstance $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Count/CountRequestBuilder.php index 4cbf12915be..76b09a19eba 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index 8fa3ead2bf6..be4c85b0833 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php index 596696699e5..ecff66b3d6f 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only property with details of the app-specific scope when the role eligibility is scoped to an app. Nullable. Supports $expand. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/Cancel/CancelRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/Cancel/CancelRequestBuilder.php index 54f03765b12..310142fcafc 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Immediately cancel a unifiedRoleEligibilityScheduleRequest object whose status is Granted and have the system automatically delete the cancelled request after 30 days. After calling this action, the status of the cancelled unifiedRoleEligibilityScheduleRequest changes to Revoked. This API is available in the following national cloud deployments. * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleeligibilityschedulerequest-cancel?view=graph-rest-1.0 Find more info here */ public function post(?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CancelRequestBuilderPostRequestConfigu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index 11916ab9710..5a32791e23e 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the role eligibility. Read-only. Supports $expand. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/Principal/PrincipalRequestBuilder.php index 4a642e807e4..41f746e215b 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The principal that's getting a role eligibility through the request. Supports $expand. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index 5f351c6ac3b..7183686bd17 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Detailed information for the unifiedRoleDefinition object that is referenced through the roleDefinitionId property. Supports $expand. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php index 4097c02810a..6452c1c2a83 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/TargetSchedule/TargetScheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilitySchedule; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The schedule for a role eligibility that is referenced through the targetScheduleId property. Supports $expand. * @param TargetScheduleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TargetScheduleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TargetScheduleRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TargetScheduleRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/UnifiedRoleEligibilityScheduleRequestItemRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/UnifiedRoleEligibilityScheduleRequestItemRequestBuilder.php index 00267883c41..adc5938de30 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/UnifiedRoleEligibilityScheduleRequestItemRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/Item/UnifiedRoleEligibilityScheduleRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleRequest; use Microsoft\Graph\Generated\RoleManagement\EntitlementManagement\RoleEligibilityScheduleRequests\Item\AppScope\AppScopeRequestBuilder; @@ -82,57 +81,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleEligibilityScheduleRequests for roleManagement * @param UnifiedRoleEligibilityScheduleRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleEligibilityScheduleRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * In PIM, read the details of a request for for a role eligibility request made through the unifiedRoleEligibilityScheduleRequest object. This API is available in the following national cloud deployments. * @param UnifiedRoleEligibilityScheduleRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleeligibilityschedulerequest-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleEligibilityScheduleRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleEligibilityScheduleRequests in roleManagement * @param UnifiedRoleEligibilityScheduleRequest $body The request body * @param UnifiedRoleEligibilityScheduleRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleEligibilityScheduleRequest $body, ?UnifiedRoleEligibilityScheduleRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -149,6 +139,7 @@ public function toDeleteRequestInformation(?UnifiedRoleEligibilityScheduleReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -162,7 +153,6 @@ public function toGetRequestInformation(?UnifiedRoleEligibilityScheduleRequestIt $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -170,6 +160,7 @@ public function toGetRequestInformation(?UnifiedRoleEligibilityScheduleRequestIt } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -184,11 +175,11 @@ public function toPatchRequestInformation(UnifiedRoleEligibilityScheduleRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/RoleEligibilityScheduleRequestsRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/RoleEligibilityScheduleRequestsRequestBuilder.php index 292267b29b0..3a5f7761d94 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/RoleEligibilityScheduleRequestsRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilityScheduleRequests/RoleEligibilityScheduleRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleRequest; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleRequestCollectionResponse; @@ -65,40 +64,34 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * In PIM, retrieve the requests for role eligibilities for principals made through the unifiedRoleEligibilityScheduleRequest object. This API is available in the following national cloud deployments. * @param RoleEligibilityScheduleRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleeligibilityschedulerequests?view=graph-rest-1.0 Find more info here */ public function get(?RoleEligibilityScheduleRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * In PIM, request for a role eligibility for a principal through the unifiedRoleEligibilityScheduleRequest object. This operation allows both admins and eligible users to add, revoke, or extend eligible assignments. This API is available in the following national cloud deployments. * @param UnifiedRoleEligibilityScheduleRequest $body The request body * @param RoleEligibilityScheduleRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-post-roleeligibilityschedulerequests?view=graph-rest-1.0 Find more info here */ public function post(UnifiedRoleEligibilityScheduleRequest $body, ?RoleEligibilityScheduleRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,7 +104,6 @@ public function toGetRequestInformation(?RoleEligibilityScheduleRequestsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -119,6 +111,7 @@ public function toGetRequestInformation(?RoleEligibilityScheduleRequestsRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -133,11 +126,11 @@ public function toPostRequestInformation(UnifiedRoleEligibilityScheduleRequest $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Count/CountRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Count/CountRequestBuilder.php index 55319ae563a..f9dcef5b09f 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Count/CountRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php index d1e342c9311..e266e1030fe 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/FilterByCurrentUserWithOn/FilterByCurrentUserWithOnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterByCurrentUser * @param FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterByCurrentUserWithOnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterByCurrentUserWithOnGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?FilterByCurrentUserWithOnRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/AppScope/AppScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/AppScope/AppScopeRequestBuilder.php index 3144b9b8f0a..0fc31c52da8 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/AppScope/AppScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/AppScope/AppScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppScope; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read-only property with details of the app-specific scope when the role eligibility or assignment is scoped to an app. Nullable. * @param AppScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppScope::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AppScopeRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php index e386e39cf51..d2b6c2d8bb0 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/DirectoryScope/DirectoryScopeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The directory object that is the scope of the role eligibility or assignment. Read-only. * @param DirectoryScopeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryScopeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DirectoryScopeRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/Principal/PrincipalRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/Principal/PrincipalRequestBuilder.php index 73691bae7b8..d5d9e676d7f 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/Principal/PrincipalRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/Principal/PrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The principal that's getting a role assignment or that's eligible for a role through the request. * @param PrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PrincipalRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php index 68c1e0cef65..cb8e3fd2bfe 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/RoleDefinition/RoleDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Detailed information for the roleDefinition object that is referenced through the roleDefinitionId property. * @param RoleDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RoleDefinitionRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/UnifiedRoleEligibilityScheduleItemRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/UnifiedRoleEligibilityScheduleItemRequestBuilder.php index f1c280b53c5..3ee1d13b031 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/UnifiedRoleEligibilityScheduleItemRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/Item/UnifiedRoleEligibilityScheduleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilitySchedule; use Microsoft\Graph\Generated\RoleManagement\EntitlementManagement\RoleEligibilitySchedules\Item\AppScope\AppScopeRequestBuilder; @@ -66,57 +65,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property roleEligibilitySchedules for roleManagement * @param UnifiedRoleEligibilityScheduleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedRoleEligibilityScheduleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the schedule for a role eligibility operation. This API is available in the following national cloud deployments. * @param UnifiedRoleEligibilityScheduleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/unifiedroleeligibilityschedule-get?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedRoleEligibilityScheduleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property roleEligibilitySchedules in roleManagement * @param UnifiedRoleEligibilitySchedule $body The request body * @param UnifiedRoleEligibilityScheduleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedRoleEligibilitySchedule $body, ?UnifiedRoleEligibilityScheduleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,6 +123,7 @@ public function toDeleteRequestInformation(?UnifiedRoleEligibilityScheduleItemRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -146,7 +137,6 @@ public function toGetRequestInformation(?UnifiedRoleEligibilityScheduleItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -154,6 +144,7 @@ public function toGetRequestInformation(?UnifiedRoleEligibilityScheduleItemReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -168,11 +159,11 @@ public function toPatchRequestInformation(UnifiedRoleEligibilitySchedule $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/RoleEligibilitySchedulesRequestBuilder.php b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/RoleEligibilitySchedulesRequestBuilder.php index 8b3f0693b71..84ab1d18359 100644 --- a/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/RoleEligibilitySchedulesRequestBuilder.php +++ b/src/Generated/RoleManagement/EntitlementManagement/RoleEligibilitySchedules/RoleEligibilitySchedulesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilitySchedule; use Microsoft\Graph\Generated\Models\UnifiedRoleEligibilityScheduleCollectionResponse; @@ -65,39 +64,33 @@ public function filterByCurrentUserWithOn(string $on): FilterByCurrentUserWithOn /** * Get the unifiedRoleEligibilitySchedule resources from the roleEligibilitySchedules navigation property. This API is available in the following national cloud deployments. * @param RoleEligibilitySchedulesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/rbacapplication-list-roleeligibilityschedules?view=graph-rest-1.0 Find more info here */ public function get(?RoleEligibilitySchedulesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilityScheduleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to roleEligibilitySchedules for roleManagement * @param UnifiedRoleEligibilitySchedule $body The request body * @param RoleEligibilitySchedulesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnifiedRoleEligibilitySchedule $body, ?RoleEligibilitySchedulesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedRoleEligibilitySchedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?RoleEligibilitySchedulesRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?RoleEligibilitySchedulesRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPostRequestInformation(UnifiedRoleEligibilitySchedule $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/RoleManagement/RoleManagementRequestBuilder.php b/src/Generated/RoleManagement/RoleManagementRequestBuilder.php index 5294e7dd0c6..2095791f26f 100644 --- a/src/Generated/RoleManagement/RoleManagementRequestBuilder.php +++ b/src/Generated/RoleManagement/RoleManagementRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RoleManagement; use Microsoft\Graph\Generated\RoleManagement\Directory\DirectoryRequestBuilder; @@ -50,38 +49,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get roleManagement * @param RoleManagementRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RoleManagementRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoleManagement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoleManagement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update roleManagement * @param RoleManagement $body The request body * @param RoleManagementRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RoleManagement $body, ?RoleManagementRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RoleManagement::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RoleManagement::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -94,7 +87,6 @@ public function toGetRequestInformation(?RoleManagementRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -102,6 +94,7 @@ public function toGetRequestInformation(?RoleManagementRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -116,11 +109,11 @@ public function toPatchRequestInformation(RoleManagement $body, ?RoleManagementR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/SchemaExtensions/Count/CountRequestBuilder.php b/src/Generated/SchemaExtensions/Count/CountRequestBuilder.php index 8bc4bfc908c..22ac19bf00c 100644 --- a/src/Generated/SchemaExtensions/Count/CountRequestBuilder.php +++ b/src/Generated/SchemaExtensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/SchemaExtensions/Item/SchemaExtensionItemRequestBuilder.php b/src/Generated/SchemaExtensions/Item/SchemaExtensionItemRequestBuilder.php index 346f5e38eae..c7a11e8b752 100644 --- a/src/Generated/SchemaExtensions/Item/SchemaExtensionItemRequestBuilder.php +++ b/src/Generated/SchemaExtensions/Item/SchemaExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SchemaExtension; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the definition of a schema extension. Only the app that created the schema extension (owner app) can delete the schema extension definition, and only when the extension is in the InDevelopment state. Deleting a schema extension definition does not affect accessing custom data that has been added to resource instances based on that definition. This API is available in the following national cloud deployments. * @param SchemaExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schemaextension-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SchemaExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * This API is available in the following national cloud deployments. * @param SchemaExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schemaextension-get?view=graph-rest-1.0 Find more info here */ public function get(?SchemaExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchemaExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchemaExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update properties in the definition of the specified schemaExtension. Additive updates to the extension can only be made when the extension is in the InDevelopment or Available status. This means custom properties or target resource types cannot be removed from the definition, but new custom properties can be added and the description of the extension changed. The update applies to all the resources that are included in the targetTypes property of the extension. These resources are among the supporting resource types. For delegated flows, the signed-in user can update a schema extension as long as the owner property of the extension is set to the appId of an application the signed-in user owns. That application can be the one that initially created the extension, or some other application owned by the signed-in user. This criteria for the owner property allows a signed-in user to make updates through other applications they don't own, such as Microsoft Graph Explorer. When using Graph Explorer to update a schemaExtension resource, include the owner property in the PATCH request body. This API is available in the following national cloud deployments. * @param SchemaExtension $body The request body * @param SchemaExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schemaextension-update?view=graph-rest-1.0 Find more info here */ public function patch(SchemaExtension $body, ?SchemaExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchemaExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchemaExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?SchemaExtensionItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?SchemaExtensionItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?SchemaExtensionItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(SchemaExtension $body, ?SchemaExtensio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/SchemaExtensions/SchemaExtensionsRequestBuilder.php b/src/Generated/SchemaExtensions/SchemaExtensionsRequestBuilder.php index 3ca6f599fea..de1b72fbdc5 100644 --- a/src/Generated/SchemaExtensions/SchemaExtensionsRequestBuilder.php +++ b/src/Generated/SchemaExtensions/SchemaExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SchemaExtension; use Microsoft\Graph\Generated\Models\SchemaExtensionCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of schemaExtension objects in your tenant. The schema extensions can be InDevelopment, Available, or Deprecated and includes schema extensions: This API is available in the following national cloud deployments. * @param SchemaExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schemaextension-list?view=graph-rest-1.0 Find more info here */ public function get(?SchemaExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchemaExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchemaExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new schemaExtension definition and its associated schema extension property to extend a supporting resource type. Schema extensions let you add strongly-typed custom data to a resource. The app that creates a schema extension is the owner app. Depending on the state of the extension, the owner app, and only the owner app, may update or delete the extension. See examples of how to define a schema extension that describes a training course, use the schema extension definition to create a new group with training course data, and add training course data to an existing group. This API is available in the following national cloud deployments. * @param SchemaExtension $body The request body * @param SchemaExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schemaextension-post-schemaextensions?view=graph-rest-1.0 Find more info here */ public function post(SchemaExtension $body, ?SchemaExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchemaExtension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchemaExtension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SchemaExtensionsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SchemaExtensionsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SchemaExtension $body, ?SchemaExtension $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ScopedRoleMemberships/Count/CountRequestBuilder.php b/src/Generated/ScopedRoleMemberships/Count/CountRequestBuilder.php index e6d09683128..8e36c558b06 100644 --- a/src/Generated/ScopedRoleMemberships/Count/CountRequestBuilder.php +++ b/src/Generated/ScopedRoleMemberships/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ScopedRoleMemberships/Item/ScopedRoleMembershipItemRequestBuilder.php b/src/Generated/ScopedRoleMemberships/Item/ScopedRoleMembershipItemRequestBuilder.php index 2a29e4d5051..6ea0b7cddef 100644 --- a/src/Generated/ScopedRoleMemberships/Item/ScopedRoleMembershipItemRequestBuilder.php +++ b/src/Generated/ScopedRoleMemberships/Item/ScopedRoleMembershipItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ScopedRoleMembership; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from scopedRoleMemberships * @param ScopedRoleMembershipItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ScopedRoleMembershipItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entity from scopedRoleMemberships by key * @param ScopedRoleMembershipItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopedRoleMembershipItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in scopedRoleMemberships * @param ScopedRoleMembership $body The request body * @param ScopedRoleMembershipItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ScopedRoleMembership $body, ?ScopedRoleMembershipItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ScopedRoleMembershipItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ScopedRoleMembershipItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ScopedRoleMembershipItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ScopedRoleMembership $body, ?ScopedRol $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ScopedRoleMemberships/ScopedRoleMembershipsRequestBuilder.php b/src/Generated/ScopedRoleMemberships/ScopedRoleMembershipsRequestBuilder.php index d0e19e2dc3a..6f9281126c8 100644 --- a/src/Generated/ScopedRoleMemberships/ScopedRoleMembershipsRequestBuilder.php +++ b/src/Generated/ScopedRoleMemberships/ScopedRoleMembershipsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ScopedRoleMembership; use Microsoft\Graph\Generated\Models\ScopedRoleMembershipCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from scopedRoleMemberships * @param ScopedRoleMembershipsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopedRoleMembershipsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembershipCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembershipCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to scopedRoleMemberships * @param ScopedRoleMembership $body The request body * @param ScopedRoleMembershipsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ScopedRoleMembership $body, ?ScopedRoleMembershipsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopedRoleMembershipsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopedRoleMembershipsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ScopedRoleMembership $body, ?ScopedRole $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Search/Query/QueryRequestBuilder.php b/src/Generated/Search/Query/QueryRequestBuilder.php index 9b6caa661d0..44bd79e26f0 100644 --- a/src/Generated/Search/Query/QueryRequestBuilder.php +++ b/src/Generated/Search/Query/QueryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Runs the query specified in the request body. Search results are provided in the response. This API is available in the following national cloud deployments. * @param QueryPostRequestBody $body The request body * @param QueryRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/search-query?view=graph-rest-1.0 Find more info here */ public function post(QueryPostRequestBody $body, ?QueryRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [QueryPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [QueryPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(QueryPostRequestBody $body, ?QueryReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Search/SearchRequestBuilder.php b/src/Generated/Search/SearchRequestBuilder.php index 2649d85768d..06a23162be5 100644 --- a/src/Generated/Search/SearchRequestBuilder.php +++ b/src/Generated/Search/SearchRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SearchEntity; use Microsoft\Graph\Generated\Search\Query\QueryRequestBuilder; @@ -42,38 +41,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get search * @param SearchRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SearchRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SearchEntity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SearchEntity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update search * @param SearchEntity $body The request body * @param SearchRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SearchEntity $body, ?SearchRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SearchEntity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SearchEntity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -86,7 +79,6 @@ public function toGetRequestInformation(?SearchRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -94,6 +86,7 @@ public function toGetRequestInformation(?SearchRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -108,11 +101,11 @@ public function toPatchRequestInformation(SearchEntity $body, ?SearchRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Alerts/AlertsRequestBuilder.php b/src/Generated/Security/Alerts/AlertsRequestBuilder.php index 07f3a62b375..cec99ba5247 100644 --- a/src/Generated/Security/Alerts/AlertsRequestBuilder.php +++ b/src/Generated/Security/Alerts/AlertsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Alert; use Microsoft\Graph\Generated\Models\AlertCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of alert objects. This API is available in the following national cloud deployments. * @param AlertsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/alert-list?view=graph-rest-1.0 Find more info here */ public function get(?AlertsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AlertCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AlertCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to alerts for security * @param Alert $body The request body * @param AlertsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Alert $body, ?AlertsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?AlertsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?AlertsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Alert $body, ?AlertsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Alerts/Count/CountRequestBuilder.php b/src/Generated/Security/Alerts/Count/CountRequestBuilder.php index 10eb63362c7..5007b436b65 100644 --- a/src/Generated/Security/Alerts/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Alerts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Alerts/Item/AlertItemRequestBuilder.php b/src/Generated/Security/Alerts/Item/AlertItemRequestBuilder.php index febed5b0220..c84bf4b40be 100644 --- a/src/Generated/Security/Alerts/Item/AlertItemRequestBuilder.php +++ b/src/Generated/Security/Alerts/Item/AlertItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Alert; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,40 +33,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of an alert object. This API is available in the following national cloud deployments. * @param AlertItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/alert-get?view=graph-rest-1.0 Find more info here */ public function get(?AlertItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an editable alert property within any integrated solution to keep alert status and assignments in sync across solutions. This method updates any solution that has a record of the referenced alert ID. This API is available in the following national cloud deployments. * @param Alert $body The request body * @param AlertItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/alert-update?view=graph-rest-1.0 Find more info here */ public function patch(Alert $body, ?AlertItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +73,6 @@ public function toGetRequestInformation(?AlertItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +80,7 @@ public function toGetRequestInformation(?AlertItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -102,11 +95,11 @@ public function toPatchRequestInformation(Alert $body, ?AlertItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Alerts_v2/Alerts_v2RequestBuilder.php b/src/Generated/Security/Alerts_v2/Alerts_v2RequestBuilder.php index 4f6747bbbc0..5e77fe9b6e6 100644 --- a/src/Generated/Security/Alerts_v2/Alerts_v2RequestBuilder.php +++ b/src/Generated/Security/Alerts_v2/Alerts_v2RequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Alert; use Microsoft\Graph\Generated\Models\Security\AlertCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of alert resources that have been created to track suspicious activities in an organization. This operation lets you filter and sort through alerts to create an informed cyber security response. It exposes a collection of alerts that were flagged in your network, within the time range you specified in your environment retention policy. The most recent alerts are displayed at the top of the list. This API is available in the following national cloud deployments. * @param Alerts_v2RequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-list-alerts_v2?view=graph-rest-1.0 Find more info here */ public function get(?Alerts_v2RequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AlertCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AlertCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to alerts_v2 for security * @param Alert $body The request body * @param Alerts_v2RequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Alert $body, ?Alerts_v2RequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?Alerts_v2RequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?Alerts_v2RequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Alert $body, ?Alerts_v2RequestBuilderPo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Alerts_v2/Count/CountRequestBuilder.php b/src/Generated/Security/Alerts_v2/Count/CountRequestBuilder.php index 21559b7e1bc..26003b14903 100644 --- a/src/Generated/Security/Alerts_v2/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Alerts_v2/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Alerts_v2/Item/AlertItemRequestBuilder.php b/src/Generated/Security/Alerts_v2/Item/AlertItemRequestBuilder.php index 93931f7c349..d4b63e76244 100644 --- a/src/Generated/Security/Alerts_v2/Item/AlertItemRequestBuilder.php +++ b/src/Generated/Security/Alerts_v2/Item/AlertItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Alert; use Microsoft\Graph\Generated\Security\Alerts_v2\Item\Comments\CommentsRequestBuilder; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property alerts_v2 for security * @param AlertItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AlertItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of an alert in an organization based on the specified alert id property. This API is available in the following national cloud deployments. * @param AlertItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-alert-get?view=graph-rest-1.0 Find more info here */ public function get(?AlertItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an alert object in an organization based on the specified alert id property. This API is available in the following national cloud deployments. * @param Alert $body The request body * @param AlertItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-alert-update?view=graph-rest-1.0 Find more info here */ public function patch(Alert $body, ?AlertItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?AlertItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?AlertItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?AlertItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(Alert $body, ?AlertItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Alerts_v2/Item/Comments/CommentsRequestBuilder.php b/src/Generated/Security/Alerts_v2/Item/Comments/CommentsRequestBuilder.php index 304e9e67a96..737b55b2abf 100644 --- a/src/Generated/Security/Alerts_v2/Item/Comments/CommentsRequestBuilder.php +++ b/src/Generated/Security/Alerts_v2/Item/Comments/CommentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\AlertComment; use Microsoft\Graph\Generated\Security\Alerts_v2\Item\Comments\Count\CountRequestBuilder; @@ -43,19 +42,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Sets a new value for the collection of alertComment. * @param array $body The request body * @param CommentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise|null> + * @throws Exception */ public function post(array $body, ?CommentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendCollectionAsync($requestInfo, [AlertComment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendCollectionAsync($requestInfo, [AlertComment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -69,11 +65,11 @@ public function toPostRequestInformation(array $body, ?CommentsRequestBuilderPos $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsableCollection($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Alerts_v2/Item/Comments/Count/CountRequestBuilder.php b/src/Generated/Security/Alerts_v2/Item/Comments/Count/CountRequestBuilder.php index cf780690fd2..23635cb33ba 100644 --- a/src/Generated/Security/Alerts_v2/Item/Comments/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Alerts_v2/Item/Comments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/AttackSimulationRequestBuilder.php b/src/Generated/Security/AttackSimulation/AttackSimulationRequestBuilder.php index 11fa38f1b35..8856631449e 100644 --- a/src/Generated/Security/AttackSimulation/AttackSimulationRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/AttackSimulationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AttackSimulationRoot; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Security\AttackSimulation\EndUserNotifications\EndUserNotificationsRequestBuilder; @@ -98,56 +97,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attackSimulation for security * @param AttackSimulationRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttackSimulationRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get attackSimulation from security * @param AttackSimulationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttackSimulationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttackSimulationRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttackSimulationRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property attackSimulation in security * @param AttackSimulationRoot $body The request body * @param AttackSimulationRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AttackSimulationRoot $body, ?AttackSimulationRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttackSimulationRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttackSimulationRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -164,6 +154,7 @@ public function toDeleteRequestInformation(?AttackSimulationRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -177,7 +168,6 @@ public function toGetRequestInformation(?AttackSimulationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -185,6 +175,7 @@ public function toGetRequestInformation(?AttackSimulationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -199,11 +190,11 @@ public function toPatchRequestInformation(AttackSimulationRoot $body, ?AttackSim $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/EndUserNotifications/Count/CountRequestBuilder.php b/src/Generated/Security/AttackSimulation/EndUserNotifications/Count/CountRequestBuilder.php index 5ba2923a222..cf57a440950 100644 --- a/src/Generated/Security/AttackSimulation/EndUserNotifications/Count/CountRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/EndUserNotifications/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/EndUserNotifications/EndUserNotificationsRequestBuilder.php b/src/Generated/Security/AttackSimulation/EndUserNotifications/EndUserNotificationsRequestBuilder.php index 6e69ac44560..d7cdfadbf67 100644 --- a/src/Generated/Security/AttackSimulation/EndUserNotifications/EndUserNotificationsRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/EndUserNotifications/EndUserNotificationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EndUserNotification; use Microsoft\Graph\Generated\Models\EndUserNotificationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,44 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get endUserNotifications from security + * Get a list of endUserNotification objects and their properties. * @param EndUserNotificationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/attacksimulationroot-list-endusernotifications?view=graph-rest-1.0 Find more info here */ public function get(?EndUserNotificationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotificationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotificationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to endUserNotifications for security * @param EndUserNotification $body The request body * @param EndUserNotificationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EndUserNotification $body, ?EndUserNotificationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotification::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotification::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get endUserNotifications from security + * Get a list of endUserNotification objects and their properties. * @param EndUserNotificationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +93,6 @@ public function toGetRequestInformation(?EndUserNotificationsRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +100,7 @@ public function toGetRequestInformation(?EndUserNotificationsRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +115,11 @@ public function toPostRequestInformation(EndUserNotification $body, ?EndUserNoti $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/EndUserNotifications/EndUserNotificationsRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/EndUserNotifications/EndUserNotificationsRequestBuilderGetQueryParameters.php index 678aace2917..f02a590502a 100644 --- a/src/Generated/Security/AttackSimulation/EndUserNotifications/EndUserNotificationsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/EndUserNotifications/EndUserNotificationsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get endUserNotifications from security + * Get a list of endUserNotification objects and their properties. */ class EndUserNotificationsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/Details/Count/CountRequestBuilder.php b/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/Details/Count/CountRequestBuilder.php index 22805977c80..55291938c00 100644 --- a/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/Details/Count/CountRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/Details/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/Details/DetailsRequestBuilder.php b/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/Details/DetailsRequestBuilder.php index 1f96fee3a1a..963e443a0a5 100644 --- a/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EndUserNotificationDetail; use Microsoft\Graph\Generated\Models\EndUserNotificationDetailCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get details from security * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotificationDetailCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotificationDetailCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to details for security * @param EndUserNotificationDetail $body The request body * @param DetailsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(EndUserNotificationDetail $body, ?DetailsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotificationDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotificationDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(EndUserNotificationDetail $body, ?Detai $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/Details/Item/EndUserNotificationDetailItemRequestBuilder.php b/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/Details/Item/EndUserNotificationDetailItemRequestBuilder.php index 9db49000809..2e92e9bcdf2 100644 --- a/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/Details/Item/EndUserNotificationDetailItemRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/Details/Item/EndUserNotificationDetailItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EndUserNotificationDetail; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for security * @param EndUserNotificationDetailItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EndUserNotificationDetailItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get details from security * @param EndUserNotificationDetailItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EndUserNotificationDetailItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotificationDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotificationDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in security * @param EndUserNotificationDetail $body The request body * @param EndUserNotificationDetailItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EndUserNotificationDetail $body, ?EndUserNotificationDetailItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotificationDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotificationDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?EndUserNotificationDetailItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?EndUserNotificationDetailItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?EndUserNotificationDetailItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(EndUserNotificationDetail $body, ?EndU $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/EndUserNotificationItemRequestBuilder.php b/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/EndUserNotificationItemRequestBuilder.php index 10416ea88f9..65687132e6d 100644 --- a/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/EndUserNotificationItemRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/EndUserNotificationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EndUserNotification; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Security\AttackSimulation\EndUserNotifications\Item\Details\DetailsRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property endUserNotifications for security * @param EndUserNotificationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EndUserNotificationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Get endUserNotifications from security + * Represents an end user's notification for an attack simulation training. * @param EndUserNotificationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EndUserNotificationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotification::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotification::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property endUserNotifications in security * @param EndUserNotification $body The request body * @param EndUserNotificationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EndUserNotification $body, ?EndUserNotificationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotification::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndUserNotification::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,11 +98,12 @@ public function toDeleteRequestInformation(?EndUserNotificationItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Get endUserNotifications from security + * Represents an end user's notification for an attack simulation training. * @param EndUserNotificationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -121,7 +112,6 @@ public function toGetRequestInformation(?EndUserNotificationItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?EndUserNotificationItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(EndUserNotification $body, ?EndUserNot $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/EndUserNotificationItemRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/EndUserNotificationItemRequestBuilderGetQueryParameters.php index f4def5f85cb..43f23c9fdaa 100644 --- a/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/EndUserNotificationItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/EndUserNotifications/Item/EndUserNotificationItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get endUserNotifications from security + * Represents an end user's notification for an attack simulation training. */ class EndUserNotificationItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/LandingPages/Count/CountRequestBuilder.php b/src/Generated/Security/AttackSimulation/LandingPages/Count/CountRequestBuilder.php index e78248c6602..73929e70f73 100644 --- a/src/Generated/Security/AttackSimulation/LandingPages/Count/CountRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/LandingPages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/Count/CountRequestBuilder.php b/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/Count/CountRequestBuilder.php index fb5c16cd805..61557507636 100644 --- a/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/Count/CountRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/DetailsRequestBuilder.php b/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/DetailsRequestBuilder.php index da1ccc3df53..6957875360e 100644 --- a/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LandingPageDetail; use Microsoft\Graph\Generated\Models\LandingPageDetailCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,44 +52,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get details from security + * The detail information for a landing page associated with a simulation during its creation. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LandingPageDetailCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LandingPageDetailCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to details for security * @param LandingPageDetail $body The request body * @param DetailsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LandingPageDetail $body, ?DetailsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LandingPageDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LandingPageDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get details from security + * The detail information for a landing page associated with a simulation during its creation. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(LandingPageDetail $body, ?DetailsReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/DetailsRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/DetailsRequestBuilderGetQueryParameters.php index 8295aac4b38..1c02ce227ac 100644 --- a/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/DetailsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/DetailsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get details from security + * The detail information for a landing page associated with a simulation during its creation. */ class DetailsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/Item/LandingPageDetailItemRequestBuilder.php b/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/Item/LandingPageDetailItemRequestBuilder.php index bfb6ddc7092..93a099db3ca 100644 --- a/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/Item/LandingPageDetailItemRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/Item/LandingPageDetailItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LandingPageDetail; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for security * @param LandingPageDetailItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LandingPageDetailItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Get details from security + * The detail information for a landing page associated with a simulation during its creation. * @param LandingPageDetailItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LandingPageDetailItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LandingPageDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LandingPageDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in security * @param LandingPageDetail $body The request body * @param LandingPageDetailItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(LandingPageDetail $body, ?LandingPageDetailItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LandingPageDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LandingPageDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,11 +90,12 @@ public function toDeleteRequestInformation(?LandingPageDetailItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Get details from security + * The detail information for a landing page associated with a simulation during its creation. * @param LandingPageDetailItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -113,7 +104,6 @@ public function toGetRequestInformation(?LandingPageDetailItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?LandingPageDetailItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(LandingPageDetail $body, ?LandingPageD $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/Item/LandingPageDetailItemRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/Item/LandingPageDetailItemRequestBuilderGetQueryParameters.php index 793c23aba90..11d1ba5906b 100644 --- a/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/Item/LandingPageDetailItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/LandingPages/Item/Details/Item/LandingPageDetailItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get details from security + * The detail information for a landing page associated with a simulation during its creation. */ class LandingPageDetailItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/LandingPages/Item/LandingPageItemRequestBuilder.php b/src/Generated/Security/AttackSimulation/LandingPages/Item/LandingPageItemRequestBuilder.php index e6bf2ec1fbf..65fbc36406d 100644 --- a/src/Generated/Security/AttackSimulation/LandingPages/Item/LandingPageItemRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/LandingPages/Item/LandingPageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LandingPage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Security\AttackSimulation\LandingPages\Item\Details\DetailsRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property landingPages for security * @param LandingPageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LandingPageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Get landingPages from security + * Represents an attack simulation training landing page. * @param LandingPageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LandingPageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LandingPage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LandingPage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property landingPages in security * @param LandingPage $body The request body * @param LandingPageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(LandingPage $body, ?LandingPageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LandingPage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LandingPage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,11 +98,12 @@ public function toDeleteRequestInformation(?LandingPageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Get landingPages from security + * Represents an attack simulation training landing page. * @param LandingPageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -121,7 +112,6 @@ public function toGetRequestInformation(?LandingPageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?LandingPageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(LandingPage $body, ?LandingPageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/LandingPages/Item/LandingPageItemRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/LandingPages/Item/LandingPageItemRequestBuilderGetQueryParameters.php index 04986bdc1f0..8378b043296 100644 --- a/src/Generated/Security/AttackSimulation/LandingPages/Item/LandingPageItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/LandingPages/Item/LandingPageItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get landingPages from security + * Represents an attack simulation training landing page. */ class LandingPageItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/LandingPages/LandingPagesRequestBuilder.php b/src/Generated/Security/AttackSimulation/LandingPages/LandingPagesRequestBuilder.php index f6b15602b77..7f0084d2a49 100644 --- a/src/Generated/Security/AttackSimulation/LandingPages/LandingPagesRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/LandingPages/LandingPagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LandingPage; use Microsoft\Graph\Generated\Models\LandingPageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,44 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get landingPages from security + * Get a list of the landingPage objects and their properties. * @param LandingPagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/attacksimulationroot-list-landingpage?view=graph-rest-1.0 Find more info here */ public function get(?LandingPagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LandingPageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LandingPageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to landingPages for security * @param LandingPage $body The request body * @param LandingPagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LandingPage $body, ?LandingPagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LandingPage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LandingPage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get landingPages from security + * Get a list of the landingPage objects and their properties. * @param LandingPagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +93,6 @@ public function toGetRequestInformation(?LandingPagesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +100,7 @@ public function toGetRequestInformation(?LandingPagesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +115,11 @@ public function toPostRequestInformation(LandingPage $body, ?LandingPagesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/LandingPages/LandingPagesRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/LandingPages/LandingPagesRequestBuilderGetQueryParameters.php index d69ab8b222a..8c6dd326ffa 100644 --- a/src/Generated/Security/AttackSimulation/LandingPages/LandingPagesRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/LandingPages/LandingPagesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get landingPages from security + * Get a list of the landingPage objects and their properties. */ class LandingPagesRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/LoginPages/Count/CountRequestBuilder.php b/src/Generated/Security/AttackSimulation/LoginPages/Count/CountRequestBuilder.php index 958f282bc53..e2aee667db8 100644 --- a/src/Generated/Security/AttackSimulation/LoginPages/Count/CountRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/LoginPages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/LoginPages/Item/LoginPageItemRequestBuilder.php b/src/Generated/Security/AttackSimulation/LoginPages/Item/LoginPageItemRequestBuilder.php index 449950fb6b8..32653778f42 100644 --- a/src/Generated/Security/AttackSimulation/LoginPages/Item/LoginPageItemRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/LoginPages/Item/LoginPageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LoginPage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property loginPages for security * @param LoginPageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LoginPageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Get loginPages from security + * Represents an attack simulation training login page. * @param LoginPageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LoginPageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LoginPage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LoginPage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property loginPages in security * @param LoginPage $body The request body * @param LoginPageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(LoginPage $body, ?LoginPageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LoginPage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LoginPage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,11 +90,12 @@ public function toDeleteRequestInformation(?LoginPageItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Get loginPages from security + * Represents an attack simulation training login page. * @param LoginPageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -113,7 +104,6 @@ public function toGetRequestInformation(?LoginPageItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?LoginPageItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(LoginPage $body, ?LoginPageItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/LoginPages/Item/LoginPageItemRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/LoginPages/Item/LoginPageItemRequestBuilderGetQueryParameters.php index 1fadcac3402..c273a0fb7b0 100644 --- a/src/Generated/Security/AttackSimulation/LoginPages/Item/LoginPageItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/LoginPages/Item/LoginPageItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get loginPages from security + * Represents an attack simulation training login page. */ class LoginPageItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/LoginPages/LoginPagesRequestBuilder.php b/src/Generated/Security/AttackSimulation/LoginPages/LoginPagesRequestBuilder.php index 9e5968d4996..3d035eefbd6 100644 --- a/src/Generated/Security/AttackSimulation/LoginPages/LoginPagesRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/LoginPages/LoginPagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LoginPage; use Microsoft\Graph\Generated\Models\LoginPageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,44 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get loginPages from security + * Get a list of the loginPage objects and their properties. * @param LoginPagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/attacksimulationroot-list-loginpage?view=graph-rest-1.0 Find more info here */ public function get(?LoginPagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LoginPageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LoginPageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to loginPages for security * @param LoginPage $body The request body * @param LoginPagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LoginPage $body, ?LoginPagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LoginPage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LoginPage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get loginPages from security + * Get a list of the loginPage objects and their properties. * @param LoginPagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +93,6 @@ public function toGetRequestInformation(?LoginPagesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +100,7 @@ public function toGetRequestInformation(?LoginPagesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +115,11 @@ public function toPostRequestInformation(LoginPage $body, ?LoginPagesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/LoginPages/LoginPagesRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/LoginPages/LoginPagesRequestBuilderGetQueryParameters.php index 1d32283ae3d..ed11bdcf328 100644 --- a/src/Generated/Security/AttackSimulation/LoginPages/LoginPagesRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/LoginPages/LoginPagesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get loginPages from security + * Get a list of the loginPage objects and their properties. */ class LoginPagesRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/Operations/Count/CountRequestBuilder.php b/src/Generated/Security/AttackSimulation/Operations/Count/CountRequestBuilder.php index ef9abad489b..42dae225659 100644 --- a/src/Generated/Security/AttackSimulation/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Operations/Item/AttackSimulationOperationItemRequestBuilder.php b/src/Generated/Security/AttackSimulation/Operations/Item/AttackSimulationOperationItemRequestBuilder.php index 32cd4344f06..b1752723325 100644 --- a/src/Generated/Security/AttackSimulation/Operations/Item/AttackSimulationOperationItemRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Operations/Item/AttackSimulationOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AttackSimulationOperation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for security * @param AttackSimulationOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttackSimulationOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Get operations from security + * Get an attack simulation operation to track a long-running operation request for a tenant. * @param AttackSimulationOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/attacksimulationoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?AttackSimulationOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttackSimulationOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttackSimulationOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in security * @param AttackSimulationOperation $body The request body * @param AttackSimulationOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AttackSimulationOperation $body, ?AttackSimulationOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttackSimulationOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttackSimulationOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,11 +91,12 @@ public function toDeleteRequestInformation(?AttackSimulationOperationItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Get operations from security + * Get an attack simulation operation to track a long-running operation request for a tenant. * @param AttackSimulationOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -113,7 +105,6 @@ public function toGetRequestInformation(?AttackSimulationOperationItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +112,7 @@ public function toGetRequestInformation(?AttackSimulationOperationItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +127,11 @@ public function toPatchRequestInformation(AttackSimulationOperation $body, ?Atta $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Operations/Item/AttackSimulationOperationItemRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/Operations/Item/AttackSimulationOperationItemRequestBuilderGetQueryParameters.php index 79c137c6cf7..8030dda1c8f 100644 --- a/src/Generated/Security/AttackSimulation/Operations/Item/AttackSimulationOperationItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/Operations/Item/AttackSimulationOperationItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get operations from security + * Get an attack simulation operation to track a long-running operation request for a tenant. */ class AttackSimulationOperationItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/Operations/OperationsRequestBuilder.php b/src/Generated/Security/AttackSimulation/Operations/OperationsRequestBuilder.php index 7a87869e60c..5d70105bfc7 100644 --- a/src/Generated/Security/AttackSimulation/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AttackSimulationOperation; use Microsoft\Graph\Generated\Models\AttackSimulationOperationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,44 +52,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get operations from security + * Get an attack simulation operation to track a long-running operation request for a tenant. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttackSimulationOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttackSimulationOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for security * @param AttackSimulationOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AttackSimulationOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttackSimulationOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttackSimulationOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get operations from security + * Get an attack simulation operation to track a long-running operation request for a tenant. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(AttackSimulationOperation $body, ?Opera $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Operations/OperationsRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/Operations/OperationsRequestBuilderGetQueryParameters.php index 35fda095046..897096dd192 100644 --- a/src/Generated/Security/AttackSimulation/Operations/OperationsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/Operations/OperationsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get operations from security + * Get an attack simulation operation to track a long-running operation request for a tenant. */ class OperationsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/Payloads/Count/CountRequestBuilder.php b/src/Generated/Security/AttackSimulation/Payloads/Count/CountRequestBuilder.php index 412705a9019..968dab07c5a 100644 --- a/src/Generated/Security/AttackSimulation/Payloads/Count/CountRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Payloads/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Payloads/Item/PayloadItemRequestBuilder.php b/src/Generated/Security/AttackSimulation/Payloads/Item/PayloadItemRequestBuilder.php index 525314de237..aaa667fcecd 100644 --- a/src/Generated/Security/AttackSimulation/Payloads/Item/PayloadItemRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Payloads/Item/PayloadItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Payload; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property payloads for security * @param PayloadItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PayloadItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Get payloads from security + * Represents an attack simulation training campaign payload in a tenant. * @param PayloadItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PayloadItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Payload::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Payload::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property payloads in security * @param Payload $body The request body * @param PayloadItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Payload $body, ?PayloadItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Payload::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Payload::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,11 +90,12 @@ public function toDeleteRequestInformation(?PayloadItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Get payloads from security + * Represents an attack simulation training campaign payload in a tenant. * @param PayloadItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -113,7 +104,6 @@ public function toGetRequestInformation(?PayloadItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?PayloadItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Payload $body, ?PayloadItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Payloads/Item/PayloadItemRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/Payloads/Item/PayloadItemRequestBuilderGetQueryParameters.php index 51e76af881c..ea522749a8b 100644 --- a/src/Generated/Security/AttackSimulation/Payloads/Item/PayloadItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/Payloads/Item/PayloadItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get payloads from security + * Represents an attack simulation training campaign payload in a tenant. */ class PayloadItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/Payloads/PayloadsRequestBuilder.php b/src/Generated/Security/AttackSimulation/Payloads/PayloadsRequestBuilder.php index 52e32c2de81..9cce8c9ea6e 100644 --- a/src/Generated/Security/AttackSimulation/Payloads/PayloadsRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Payloads/PayloadsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Payload; use Microsoft\Graph\Generated\Models\PayloadCollectionResponse; @@ -53,44 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get payloads from security + * Get a list of payloads for attack simulation campaigns. This operation expects the mandatory parameter source to filter and query the respective data source. * @param PayloadsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/attacksimulationroot-list-payloads?view=graph-rest-1.0 Find more info here */ public function get(?PayloadsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PayloadCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PayloadCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to payloads for security * @param Payload $body The request body * @param PayloadsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Payload $body, ?PayloadsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Payload::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Payload::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get payloads from security + * Get a list of payloads for attack simulation campaigns. This operation expects the mandatory parameter source to filter and query the respective data source. * @param PayloadsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +93,6 @@ public function toGetRequestInformation(?PayloadsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +100,7 @@ public function toGetRequestInformation(?PayloadsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +115,11 @@ public function toPostRequestInformation(Payload $body, ?PayloadsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Payloads/PayloadsRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/Payloads/PayloadsRequestBuilderGetQueryParameters.php index 602fa06e68b..b0d7ab3af7a 100644 --- a/src/Generated/Security/AttackSimulation/Payloads/PayloadsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/Payloads/PayloadsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get payloads from security + * Get a list of payloads for attack simulation campaigns. This operation expects the mandatory parameter source to filter and query the respective data source. */ class PayloadsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/SimulationAutomations/Count/CountRequestBuilder.php b/src/Generated/Security/AttackSimulation/SimulationAutomations/Count/CountRequestBuilder.php index cc3d82919ab..ae169e0ab2f 100644 --- a/src/Generated/Security/AttackSimulation/SimulationAutomations/Count/CountRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/SimulationAutomations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/Runs/Count/CountRequestBuilder.php b/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/Runs/Count/CountRequestBuilder.php index f852d528068..a1553769400 100644 --- a/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/Runs/Count/CountRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/Runs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/Runs/Item/SimulationAutomationRunItemRequestBuilder.php b/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/Runs/Item/SimulationAutomationRunItemRequestBuilder.php index 69e51e1699b..4fb8a9daa32 100644 --- a/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/Runs/Item/SimulationAutomationRunItemRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/Runs/Item/SimulationAutomationRunItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SimulationAutomationRun; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property runs for security * @param SimulationAutomationRunItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SimulationAutomationRunItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of simulation automation runs. * @param SimulationAutomationRunItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SimulationAutomationRunItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomationRun::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomationRun::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property runs in security * @param SimulationAutomationRun $body The request body * @param SimulationAutomationRunItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SimulationAutomationRun $body, ?SimulationAutomationRunItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomationRun::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomationRun::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?SimulationAutomationRunItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?SimulationAutomationRunItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?SimulationAutomationRunItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(SimulationAutomationRun $body, ?Simula $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/Runs/RunsRequestBuilder.php b/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/Runs/RunsRequestBuilder.php index 1aec9009a8a..c7939485e13 100644 --- a/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/Runs/RunsRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/Runs/RunsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SimulationAutomationRun; use Microsoft\Graph\Generated\Models\SimulationAutomationRunCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the attack simulation automation runs for a tenant. This API is available in the following national cloud deployments. * @param RunsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/simulationautomation-list-runs?view=graph-rest-1.0 Find more info here */ public function get(?RunsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomationRunCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomationRunCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to runs for security * @param SimulationAutomationRun $body The request body * @param RunsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SimulationAutomationRun $body, ?RunsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomationRun::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomationRun::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RunsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RunsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SimulationAutomationRun $body, ?RunsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/SimulationAutomationItemRequestBuilder.php b/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/SimulationAutomationItemRequestBuilder.php index 1f449a6aabb..e9a91465480 100644 --- a/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/SimulationAutomationItemRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/SimulationAutomations/Item/SimulationAutomationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SimulationAutomation; use Microsoft\Graph\Generated\Security\AttackSimulation\SimulationAutomations\Item\Runs\RunsRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property simulationAutomations for security * @param SimulationAutomationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SimulationAutomationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an attack simulation automation for a tenant. This API is available in the following national cloud deployments. * @param SimulationAutomationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/simulationautomation-get?view=graph-rest-1.0 Find more info here */ public function get(?SimulationAutomationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property simulationAutomations in security * @param SimulationAutomation $body The request body * @param SimulationAutomationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SimulationAutomation $body, ?SimulationAutomationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?SimulationAutomationItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?SimulationAutomationItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?SimulationAutomationItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(SimulationAutomation $body, ?Simulatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/SimulationAutomations/SimulationAutomationsRequestBuilder.php b/src/Generated/Security/AttackSimulation/SimulationAutomations/SimulationAutomationsRequestBuilder.php index 103646d6b65..a5eb61cda1d 100644 --- a/src/Generated/Security/AttackSimulation/SimulationAutomations/SimulationAutomationsRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/SimulationAutomations/SimulationAutomationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SimulationAutomation; use Microsoft\Graph\Generated\Models\SimulationAutomationCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of attack simulation automations for a tenant. This API is available in the following national cloud deployments. * @param SimulationAutomationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attacksimulationroot-list-simulationautomations?view=graph-rest-1.0 Find more info here */ public function get(?SimulationAutomationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to simulationAutomations for security * @param SimulationAutomation $body The request body * @param SimulationAutomationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SimulationAutomation $body, ?SimulationAutomationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SimulationAutomation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SimulationAutomationsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SimulationAutomationsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SimulationAutomation $body, ?Simulation $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Simulations/Count/CountRequestBuilder.php b/src/Generated/Security/AttackSimulation/Simulations/Count/CountRequestBuilder.php index ff39fbb53be..28fae9f4cbc 100644 --- a/src/Generated/Security/AttackSimulation/Simulations/Count/CountRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Simulations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Simulations/Item/LandingPage/LandingPageRequestBuilder.php b/src/Generated/Security/AttackSimulation/Simulations/Item/LandingPage/LandingPageRequestBuilder.php index 6fe18b70819..e3cbd6044fc 100644 --- a/src/Generated/Security/AttackSimulation/Simulations/Item/LandingPage/LandingPageRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Simulations/Item/LandingPage/LandingPageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LandingPage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,25 +31,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get landingPage from security + * The landing page associated with a simulation during its creation. * @param LandingPageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LandingPageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LandingPage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LandingPage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get landingPage from security + * The landing page associated with a simulation during its creation. * @param LandingPageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -59,7 +55,6 @@ public function toGetRequestInformation(?LandingPageRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?LandingPageRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Simulations/Item/LandingPage/LandingPageRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/Simulations/Item/LandingPage/LandingPageRequestBuilderGetQueryParameters.php index 6bfefb6928c..39ba791276b 100644 --- a/src/Generated/Security/AttackSimulation/Simulations/Item/LandingPage/LandingPageRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/Simulations/Item/LandingPage/LandingPageRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get landingPage from security + * The landing page associated with a simulation during its creation. */ class LandingPageRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/Simulations/Item/LoginPage/LoginPageRequestBuilder.php b/src/Generated/Security/AttackSimulation/Simulations/Item/LoginPage/LoginPageRequestBuilder.php index 8fed312d42a..d48bbb6b04f 100644 --- a/src/Generated/Security/AttackSimulation/Simulations/Item/LoginPage/LoginPageRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Simulations/Item/LoginPage/LoginPageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LoginPage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,25 +31,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get loginPage from security + * The login page associated with a simulation during its creation. * @param LoginPageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LoginPageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LoginPage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LoginPage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get loginPage from security + * The login page associated with a simulation during its creation. * @param LoginPageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -59,7 +55,6 @@ public function toGetRequestInformation(?LoginPageRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?LoginPageRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Simulations/Item/LoginPage/LoginPageRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/Simulations/Item/LoginPage/LoginPageRequestBuilderGetQueryParameters.php index b86efa04ada..5a0478ab79d 100644 --- a/src/Generated/Security/AttackSimulation/Simulations/Item/LoginPage/LoginPageRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/Simulations/Item/LoginPage/LoginPageRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get loginPage from security + * The login page associated with a simulation during its creation. */ class LoginPageRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/Simulations/Item/Payload/PayloadRequestBuilder.php b/src/Generated/Security/AttackSimulation/Simulations/Item/Payload/PayloadRequestBuilder.php index e9ef00135e1..0e0782c1e53 100644 --- a/src/Generated/Security/AttackSimulation/Simulations/Item/Payload/PayloadRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Simulations/Item/Payload/PayloadRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Payload; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,25 +31,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get payload from security + * The payload associated with a simulation during its creation. * @param PayloadRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PayloadRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Payload::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Payload::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get payload from security + * The payload associated with a simulation during its creation. * @param PayloadRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PayloadRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PayloadRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Simulations/Item/Payload/PayloadRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/Simulations/Item/Payload/PayloadRequestBuilderGetQueryParameters.php index 34c2a7373b7..55373320ee5 100644 --- a/src/Generated/Security/AttackSimulation/Simulations/Item/Payload/PayloadRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/Simulations/Item/Payload/PayloadRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get payload from security + * The payload associated with a simulation during its creation. */ class PayloadRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/Simulations/Item/SimulationItemRequestBuilder.php b/src/Generated/Security/AttackSimulation/Simulations/Item/SimulationItemRequestBuilder.php index 2bfb5bf138d..c67c59e0185 100644 --- a/src/Generated/Security/AttackSimulation/Simulations/Item/SimulationItemRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Simulations/Item/SimulationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Simulation; use Microsoft\Graph\Generated\Security\AttackSimulation\Simulations\Item\LandingPage\LandingPageRequestBuilder; @@ -56,63 +55,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Delete navigation property simulations for security + * Delete an attack simulation campaign for a tenant. * @param SimulationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/simulation-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SimulationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an attack simulation campaign for a tenant. This API is available in the following national cloud deployments. * @param SimulationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/simulation-get?view=graph-rest-1.0 Find more info here */ public function get(?SimulationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Simulation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Simulation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update the navigation property simulations in security + * Update an attack simulation campaign for a tenant. * @param Simulation $body The request body * @param SimulationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/simulation-update?view=graph-rest-1.0 Find more info here */ public function patch(Simulation $body, ?SimulationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Simulation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Simulation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Delete navigation property simulations for security + * Delete an attack simulation campaign for a tenant. * @param SimulationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -125,6 +117,7 @@ public function toDeleteRequestInformation(?SimulationItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -138,7 +131,6 @@ public function toGetRequestInformation(?SimulationItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -146,11 +138,12 @@ public function toGetRequestInformation(?SimulationItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the navigation property simulations in security + * Update an attack simulation campaign for a tenant. * @param Simulation $body The request body * @param SimulationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -160,11 +153,11 @@ public function toPatchRequestInformation(Simulation $body, ?SimulationItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Simulations/SimulationsRequestBuilder.php b/src/Generated/Security/AttackSimulation/Simulations/SimulationsRequestBuilder.php index 88a495d7e80..e2357a7bc09 100644 --- a/src/Generated/Security/AttackSimulation/Simulations/SimulationsRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Simulations/SimulationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Simulation; use Microsoft\Graph\Generated\Models\SimulationCollectionResponse; @@ -55,39 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of attack simulation campaigns for a tenant. This API is available in the following national cloud deployments. * @param SimulationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attacksimulationroot-list-simulations?view=graph-rest-1.0 Find more info here */ public function get(?SimulationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SimulationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SimulationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create new navigation property to simulations for security + * Create an attack simulation campaign for a tenant. * @param Simulation $body The request body * @param SimulationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/attacksimulationroot-post-simulation?view=graph-rest-1.0 Find more info here */ public function post(Simulation $body, ?SimulationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Simulation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Simulation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +94,6 @@ public function toGetRequestInformation(?SimulationsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,11 +101,12 @@ public function toGetRequestInformation(?SimulationsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create new navigation property to simulations for security + * Create an attack simulation campaign for a tenant. * @param Simulation $body The request body * @param SimulationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -122,11 +116,11 @@ public function toPostRequestInformation(Simulation $body, ?SimulationsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Trainings/Count/CountRequestBuilder.php b/src/Generated/Security/AttackSimulation/Trainings/Count/CountRequestBuilder.php index cb02d3788b2..a573736fdfd 100644 --- a/src/Generated/Security/AttackSimulation/Trainings/Count/CountRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Trainings/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/Count/CountRequestBuilder.php b/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/Count/CountRequestBuilder.php index 4f2fc3f4f66..c095ba6a78f 100644 --- a/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/Count/CountRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/Item/TrainingLanguageDetailItemRequestBuilder.php b/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/Item/TrainingLanguageDetailItemRequestBuilder.php index 9443f5711f4..249c9ef054e 100644 --- a/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/Item/TrainingLanguageDetailItemRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/Item/TrainingLanguageDetailItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TrainingLanguageDetail; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property languageDetails for security * @param TrainingLanguageDetailItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TrainingLanguageDetailItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Get languageDetails from security + * Language specific details on a training. * @param TrainingLanguageDetailItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TrainingLanguageDetailItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TrainingLanguageDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TrainingLanguageDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property languageDetails in security * @param TrainingLanguageDetail $body The request body * @param TrainingLanguageDetailItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TrainingLanguageDetail $body, ?TrainingLanguageDetailItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TrainingLanguageDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TrainingLanguageDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,11 +90,12 @@ public function toDeleteRequestInformation(?TrainingLanguageDetailItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Get languageDetails from security + * Language specific details on a training. * @param TrainingLanguageDetailItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -113,7 +104,6 @@ public function toGetRequestInformation(?TrainingLanguageDetailItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?TrainingLanguageDetailItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(TrainingLanguageDetail $body, ?Trainin $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/Item/TrainingLanguageDetailItemRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/Item/TrainingLanguageDetailItemRequestBuilderGetQueryParameters.php index 7f552d510bf..4065d1205e1 100644 --- a/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/Item/TrainingLanguageDetailItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/Item/TrainingLanguageDetailItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get languageDetails from security + * Language specific details on a training. */ class TrainingLanguageDetailItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/LanguageDetailsRequestBuilder.php b/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/LanguageDetailsRequestBuilder.php index ae64b231c6b..b51f17a687a 100644 --- a/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/LanguageDetailsRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/LanguageDetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TrainingLanguageDetail; use Microsoft\Graph\Generated\Models\TrainingLanguageDetailCollectionResponse; @@ -53,44 +52,38 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get languageDetails from security + * Language specific details on a training. * @param LanguageDetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LanguageDetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TrainingLanguageDetailCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TrainingLanguageDetailCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to languageDetails for security * @param TrainingLanguageDetail $body The request body * @param LanguageDetailsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TrainingLanguageDetail $body, ?LanguageDetailsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TrainingLanguageDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TrainingLanguageDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get languageDetails from security + * Language specific details on a training. * @param LanguageDetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +92,6 @@ public function toGetRequestInformation(?LanguageDetailsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?LanguageDetailsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(TrainingLanguageDetail $body, ?Language $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/LanguageDetailsRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/LanguageDetailsRequestBuilderGetQueryParameters.php index 3895ed30026..f5bf1995e6d 100644 --- a/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/LanguageDetailsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/Trainings/Item/LanguageDetails/LanguageDetailsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get languageDetails from security + * Language specific details on a training. */ class LanguageDetailsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/Trainings/Item/TrainingItemRequestBuilder.php b/src/Generated/Security/AttackSimulation/Trainings/Item/TrainingItemRequestBuilder.php index 0f834a726f7..ff8b2b75804 100644 --- a/src/Generated/Security/AttackSimulation/Trainings/Item/TrainingItemRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Trainings/Item/TrainingItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Training; use Microsoft\Graph\Generated\Security\AttackSimulation\Trainings\Item\LanguageDetails\LanguageDetailsRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property trainings for security * @param TrainingItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TrainingItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Get trainings from security + * Represents details about attack simulation trainings. * @param TrainingItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TrainingItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Training::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Training::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property trainings in security * @param Training $body The request body * @param TrainingItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Training $body, ?TrainingItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Training::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Training::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,11 +98,12 @@ public function toDeleteRequestInformation(?TrainingItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Get trainings from security + * Represents details about attack simulation trainings. * @param TrainingItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -121,7 +112,6 @@ public function toGetRequestInformation(?TrainingItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?TrainingItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Training $body, ?TrainingItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Trainings/Item/TrainingItemRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/Trainings/Item/TrainingItemRequestBuilderGetQueryParameters.php index a6842525795..457d5c4ab62 100644 --- a/src/Generated/Security/AttackSimulation/Trainings/Item/TrainingItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/Trainings/Item/TrainingItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get trainings from security + * Represents details about attack simulation trainings. */ class TrainingItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/AttackSimulation/Trainings/TrainingsRequestBuilder.php b/src/Generated/Security/AttackSimulation/Trainings/TrainingsRequestBuilder.php index ebb6fbaaa54..e62bfab582e 100644 --- a/src/Generated/Security/AttackSimulation/Trainings/TrainingsRequestBuilder.php +++ b/src/Generated/Security/AttackSimulation/Trainings/TrainingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Training; use Microsoft\Graph\Generated\Models\TrainingCollectionResponse; @@ -53,44 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get trainings from security + * Get a list of the training objects and their properties. * @param TrainingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/attacksimulationroot-list-trainings?view=graph-rest-1.0 Find more info here */ public function get(?TrainingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TrainingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TrainingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to trainings for security * @param Training $body The request body * @param TrainingsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Training $body, ?TrainingsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Training::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Training::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get trainings from security + * Get a list of the training objects and their properties. * @param TrainingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -99,7 +93,6 @@ public function toGetRequestInformation(?TrainingsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +100,7 @@ public function toGetRequestInformation(?TrainingsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +115,11 @@ public function toPostRequestInformation(Training $body, ?TrainingsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/AttackSimulation/Trainings/TrainingsRequestBuilderGetQueryParameters.php b/src/Generated/Security/AttackSimulation/Trainings/TrainingsRequestBuilderGetQueryParameters.php index 8af35fa829e..55a2ef7c8f9 100644 --- a/src/Generated/Security/AttackSimulation/Trainings/TrainingsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/AttackSimulation/Trainings/TrainingsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get trainings from security + * Get a list of the training objects and their properties. */ class TrainingsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/Cases/CasesRequestBuilder.php b/src/Generated/Security/Cases/CasesRequestBuilder.php index f753e7076a5..b1d2a4e9d66 100644 --- a/src/Generated/Security/Cases/CasesRequestBuilder.php +++ b/src/Generated/Security/Cases/CasesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\CasesRoot; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\EdiscoveryCasesRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property cases for security * @param CasesRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CasesRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get cases from security * @param CasesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CasesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CasesRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CasesRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property cases in security * @param CasesRoot $body The request body * @param CasesRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(CasesRoot $body, ?CasesRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CasesRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CasesRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?CasesRequestBuilderDeleteRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?CasesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?CasesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(CasesRoot $body, ?CasesRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Count/CountRequestBuilder.php index 11156f47924..7948e223d50 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/EdiscoveryCasesRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/EdiscoveryCasesRequestBuilder.php index 55a1a2c5c74..e3e352c596d 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/EdiscoveryCasesRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/EdiscoveryCasesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryCase; use Microsoft\Graph\Generated\Models\Security\EdiscoveryCaseCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the ediscoveryCase objects and their properties. This API is available in the following national cloud deployments. * @param EdiscoveryCasesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-casesroot-list-ediscoverycases?view=graph-rest-1.0 Find more info here */ public function get(?EdiscoveryCasesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new ediscoveryCase object. This API is available in the following national cloud deployments. * @param EdiscoveryCase $body The request body * @param EdiscoveryCasesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-casesroot-post-ediscoverycases?view=graph-rest-1.0 Find more info here */ public function post(EdiscoveryCase $body, ?EdiscoveryCasesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?EdiscoveryCasesRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?EdiscoveryCasesRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EdiscoveryCase $body, ?EdiscoveryCasesR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Count/CountRequestBuilder.php index 7865022f612..dd05c45a10f 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/CustodiansRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/CustodiansRequestBuilder.php index e2aeaec087a..5d51a971317 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/CustodiansRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/CustodiansRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryCustodian; use Microsoft\Graph\Generated\Models\Security\EdiscoveryCustodianCollectionResponse; @@ -71,40 +70,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the custodian objects and their properties. This API is available in the following national cloud deployments. * @param CustodiansRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-list-custodians?view=graph-rest-1.0 Find more info here */ public function get(?CustodiansRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCustodianCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCustodianCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new ediscoveryCustodian object.After the custodian object is created, you will need to create the custodian's userSource to reference their mailbox and OneDrive for Business site. This API is available in the following national cloud deployments. * @param EdiscoveryCustodian $body The request body * @param CustodiansRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-post-custodians?view=graph-rest-1.0 Find more info here */ public function post(EdiscoveryCustodian $body, ?CustodiansRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCustodian::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCustodian::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,7 +110,6 @@ public function toGetRequestInformation(?CustodiansRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -125,6 +117,7 @@ public function toGetRequestInformation(?CustodiansRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -139,11 +132,11 @@ public function toPostRequestInformation(EdiscoveryCustodian $body, ?CustodiansR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/EdiscoveryCustodianItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/EdiscoveryCustodianItemRequestBuilder.php index e81f92caf82..196a466cf43 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/EdiscoveryCustodianItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/EdiscoveryCustodianItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryCustodian; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\Custodians\Item\LastIndexOperation\LastIndexOperationRequestBuilder; @@ -106,57 +105,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property custodians for security * @param EdiscoveryCustodianItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EdiscoveryCustodianItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an ediscoveryCustodian object. This API is available in the following national cloud deployments. * @param EdiscoveryCustodianItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycustodian-get?view=graph-rest-1.0 Find more info here */ public function get(?EdiscoveryCustodianItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCustodian::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCustodian::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property custodians in security * @param EdiscoveryCustodian $body The request body * @param EdiscoveryCustodianItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EdiscoveryCustodian $body, ?EdiscoveryCustodianItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCustodian::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCustodian::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -173,6 +163,7 @@ public function toDeleteRequestInformation(?EdiscoveryCustodianItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -186,7 +177,6 @@ public function toGetRequestInformation(?EdiscoveryCustodianItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -194,6 +184,7 @@ public function toGetRequestInformation(?EdiscoveryCustodianItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -208,11 +199,11 @@ public function toPatchRequestInformation(EdiscoveryCustodian $body, ?Ediscovery $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/LastIndexOperation/LastIndexOperationRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/LastIndexOperation/LastIndexOperationRequestBuilder.php index aadb09d8591..7e698a1894f 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/LastIndexOperation/LastIndexOperationRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/LastIndexOperation/LastIndexOperationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryIndexOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the ediscoveryIndexOperations associated with an ediscoveryCustodian. This API is available in the following national cloud deployments. * @param LastIndexOperationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycustodian-list-lastindexoperation?view=graph-rest-1.0 Find more info here */ public function get(?LastIndexOperationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryIndexOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryIndexOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?LastIndexOperationRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?LastIndexOperationRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityActivate/MicrosoftGraphSecurityActivateRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityActivate/MicrosoftGraphSecurityActivateRequestBuilder.php index c64fc70a38c..6e6a98e8714 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityActivate/MicrosoftGraphSecurityActivateRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityActivate/MicrosoftGraphSecurityActivateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Activate a custodian that has been released from a case to make them part of the case again. For details, see Manage custodians in an eDiscovery (Premium) case. This API is available in the following national cloud deployments. * @param MicrosoftGraphSecurityActivateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycustodian-activate?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphSecurityActivateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?MicrosoftGraphSecurityActivateRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php index 64ffedca10c..4dc152b11d5 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Start the process of applying hold on eDiscovery custodians. After the operation is created, you can get the status by retrieving the Location parameter from the response headers. The location provides a URL that will return an eDiscoveryHoldOperation object. This API is available in the following national cloud deployments. * @param MicrosoftGraphSecurityApplyHoldRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycustodian-applyhold?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphSecurityApplyHoldRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?MicrosoftGraphSecurityApplyHoldRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityRelease/MicrosoftGraphSecurityReleaseRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityRelease/MicrosoftGraphSecurityReleaseRequestBuilder.php index 875e1b03a05..a84592cbc37 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityRelease/MicrosoftGraphSecurityReleaseRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityRelease/MicrosoftGraphSecurityReleaseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Release a custodian from a case. For details, see Release a custodian from a case. This API is available in the following national cloud deployments. * @param MicrosoftGraphSecurityReleaseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycustodian-release?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphSecurityReleaseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?MicrosoftGraphSecurityReleaseRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php index 7c0526417cf..3df983ea8fc 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Start the process of removing hold from eDiscovery custodians. After the operation is created, you can get the status by retrieving the Location parameter from the response headers. The location provides a URL that will return an eDiscoveryHoldOperation object. This API is available in the following national cloud deployments. * @param MicrosoftGraphSecurityRemoveHoldRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycustodian-removehold?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphSecurityRemoveHoldRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?MicrosoftGraphSecurityRemoveHoldReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityUpdateIndex/MicrosoftGraphSecurityUpdateIndexRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityUpdateIndex/MicrosoftGraphSecurityUpdateIndexRequestBuilder.php index 5b0490bba76..51f7a23244e 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityUpdateIndex/MicrosoftGraphSecurityUpdateIndexRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/MicrosoftGraphSecurityUpdateIndex/MicrosoftGraphSecurityUpdateIndexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Trigger an indexOperation to make a custodian and associated sources searchable. This API is available in the following national cloud deployments. * @param MicrosoftGraphSecurityUpdateIndexRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycustodian-updateindex?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphSecurityUpdateIndexRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?MicrosoftGraphSecurityUpdateIndexReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/Count/CountRequestBuilder.php index bf7205d4c6e..3b6106b3464 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/Item/Site/SiteRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/Item/Site/SiteRequestBuilder.php index 51f79718384..36e957e9223 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/Item/Site/SiteRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/Item/Site/SiteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Site; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The SharePoint site associated with the siteSource. * @param SiteRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SiteRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SiteRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SiteRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/Item/SiteSourceItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/Item/SiteSourceItemRequestBuilder.php index a7e5f248f39..91783d4ef67 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/Item/SiteSourceItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/Item/SiteSourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\SiteSource; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\Custodians\Item\SiteSources\Item\Site\SiteRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property siteSources for security * @param SiteSourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SiteSourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Data source entity for SharePoint sites associated with the custodian. * @param SiteSourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SiteSourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SiteSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SiteSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property siteSources in security * @param SiteSource $body The request body * @param SiteSourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SiteSource $body, ?SiteSourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SiteSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SiteSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?SiteSourceItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?SiteSourceItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?SiteSourceItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(SiteSource $body, ?SiteSourceItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/SiteSourcesRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/SiteSourcesRequestBuilder.php index 46e3d39537e..dae34f08994 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/SiteSourcesRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/SiteSources/SiteSourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\SiteSource; use Microsoft\Graph\Generated\Models\Security\SiteSourceCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the siteSource objects associated with an ediscoveryCustodian. This API is available in the following national cloud deployments. * @param SiteSourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycustodian-list-sitesources?view=graph-rest-1.0 Find more info here */ public function get(?SiteSourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SiteSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SiteSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new siteSource object associated with an eDiscovery custodian. This API is available in the following national cloud deployments. * @param SiteSource $body The request body * @param SiteSourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycustodian-post-sitesources?view=graph-rest-1.0 Find more info here */ public function post(SiteSource $body, ?SiteSourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SiteSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SiteSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SiteSourcesRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SiteSourcesRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SiteSource $body, ?SiteSourcesRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Count/CountRequestBuilder.php index 02b2bcece4e..7d589318026 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/Group/GroupRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/Group/GroupRequestBuilder.php index ead16a641f2..10ba6c7a741 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/Group/GroupRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/Group/GroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\Custodians\Item\UnifiedGroupSources\Item\Group\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents a group. * @param GroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 59a66cd4b60..148a48c103f 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 2ddc784a110..54ee98dd7e4 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\Custodians\Item\UnifiedGroupSources\Item\Group\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/UnifiedGroupSourceItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/UnifiedGroupSourceItemRequestBuilder.php index 4c168015ac2..0b6a8d5c55c 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/UnifiedGroupSourceItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/Item/UnifiedGroupSourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\UnifiedGroupSource; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\Custodians\Item\UnifiedGroupSources\Item\Group\GroupRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property unifiedGroupSources for security * @param UnifiedGroupSourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UnifiedGroupSourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Data source entity for groups associated with the custodian. * @param UnifiedGroupSourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UnifiedGroupSourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedGroupSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedGroupSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property unifiedGroupSources in security * @param UnifiedGroupSource $body The request body * @param UnifiedGroupSourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UnifiedGroupSource $body, ?UnifiedGroupSourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedGroupSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedGroupSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?UnifiedGroupSourceItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?UnifiedGroupSourceItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?UnifiedGroupSourceItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(UnifiedGroupSource $body, ?UnifiedGrou $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/UnifiedGroupSourcesRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/UnifiedGroupSourcesRequestBuilder.php index 6c63eed16e4..c81a42c74b5 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/UnifiedGroupSourcesRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UnifiedGroupSources/UnifiedGroupSourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\UnifiedGroupSource; use Microsoft\Graph\Generated\Models\Security\UnifiedGroupSourceCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the unifiedGroupSource objects associated with an ediscoveryCustodian. This API is available in the following national cloud deployments. * @param UnifiedGroupSourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycustodian-list-unifiedgroupsources?view=graph-rest-1.0 Find more info here */ public function get(?UnifiedGroupSourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedGroupSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedGroupSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new unifiedGroupSource object associated with an eDiscovery custodian. This API is available in the following national cloud deployments. * @param UnifiedGroupSource $body The request body * @param UnifiedGroupSourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycustodian-post-unifiedgroupsources?view=graph-rest-1.0 Find more info here */ public function post(UnifiedGroupSource $body, ?UnifiedGroupSourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UnifiedGroupSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UnifiedGroupSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?UnifiedGroupSourcesRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?UnifiedGroupSourcesRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(UnifiedGroupSource $body, ?UnifiedGroup $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UserSources/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UserSources/Count/CountRequestBuilder.php index cf99eac1a36..b4d5d2181cd 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UserSources/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UserSources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UserSources/Item/UserSourceItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UserSources/Item/UserSourceItemRequestBuilder.php index 7beecb82bd3..769db93ba61 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UserSources/Item/UserSourceItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UserSources/Item/UserSourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\UserSource; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property userSources for security * @param UserSourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UserSourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Data source entity for a the custodian. This is the container for a custodian's mailbox and OneDrive for Business site. * @param UserSourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserSourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property userSources in security * @param UserSource $body The request body * @param UserSourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserSource $body, ?UserSourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?UserSourceItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?UserSourceItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?UserSourceItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(UserSource $body, ?UserSourceItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UserSources/UserSourcesRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UserSources/UserSourcesRequestBuilder.php index 58f4c69c0e9..e28ffbc7d93 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UserSources/UserSourcesRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/Item/UserSources/UserSourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\UserSource; use Microsoft\Graph\Generated\Models\Security\UserSourceCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the userSource objects associated with an ediscoveryCustodian. This API is available in the following national cloud deployments. * @param UserSourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycustodian-list-usersources?view=graph-rest-1.0 Find more info here */ public function get(?UserSourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new userSource object associated with an eDiscovery custodian. This API is available in the following national cloud deployments. * @param UserSource $body The request body * @param UserSourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycustodian-post-usersources?view=graph-rest-1.0 Find more info here */ public function post(UserSource $body, ?UserSourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?UserSourcesRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?UserSourcesRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(UserSource $body, ?UserSourcesRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php index 38e370595e0..0a44eeebd9a 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyHold * @param ApplyHoldPostRequestBody $body The request body * @param MicrosoftGraphSecurityApplyHoldRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyHoldPostRequestBody $body, ?MicrosoftGraphSecurityApplyHoldRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyHoldPostRequestBody $body, ?Micros $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php index 10526b61df5..1bf81e24c14 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Custodians/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action removeHold * @param RemoveHoldPostRequestBody $body The request body * @param MicrosoftGraphSecurityRemoveHoldRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RemoveHoldPostRequestBody $body, ?MicrosoftGraphSecurityRemoveHoldRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(RemoveHoldPostRequestBody $body, ?Micro $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/EdiscoveryCaseItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/EdiscoveryCaseItemRequestBuilder.php index ec9cb779189..12a3a95ca5d 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/EdiscoveryCaseItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/EdiscoveryCaseItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryCase; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\Custodians\CustodiansRequestBuilder; @@ -106,59 +105,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an ediscoveryCase object. This API is available in the following national cloud deployments. * @param EdiscoveryCaseItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-casesroot-delete-ediscoverycases?view=graph-rest-1.0 Find more info here */ public function delete(?EdiscoveryCaseItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an ediscoveryCase object. This API is available in the following national cloud deployments. * @param EdiscoveryCaseItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-get?view=graph-rest-1.0 Find more info here */ public function get(?EdiscoveryCaseItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an ediscoveryCase object. This API is available in the following national cloud deployments. * @param EdiscoveryCase $body The request body * @param EdiscoveryCaseItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-update?view=graph-rest-1.0 Find more info here */ public function patch(EdiscoveryCase $body, ?EdiscoveryCaseItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -175,6 +165,7 @@ public function toDeleteRequestInformation(?EdiscoveryCaseItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -188,7 +179,6 @@ public function toGetRequestInformation(?EdiscoveryCaseItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -196,6 +186,7 @@ public function toGetRequestInformation(?EdiscoveryCaseItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -210,11 +201,11 @@ public function toPatchRequestInformation(EdiscoveryCase $body, ?EdiscoveryCaseI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/MicrosoftGraphSecurityClose/MicrosoftGraphSecurityCloseRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/MicrosoftGraphSecurityClose/MicrosoftGraphSecurityCloseRequestBuilder.php index d8803e05d7b..e8459a8fb1e 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/MicrosoftGraphSecurityClose/MicrosoftGraphSecurityCloseRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/MicrosoftGraphSecurityClose/MicrosoftGraphSecurityCloseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Close an eDiscovery case. For details, see Close a case. This API is available in the following national cloud deployments. * @param MicrosoftGraphSecurityCloseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-close?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphSecurityCloseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?MicrosoftGraphSecurityCloseRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/MicrosoftGraphSecurityReopen/MicrosoftGraphSecurityReopenRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/MicrosoftGraphSecurityReopen/MicrosoftGraphSecurityReopenRequestBuilder.php index 60517b5bed7..4978e7c2b6c 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/MicrosoftGraphSecurityReopen/MicrosoftGraphSecurityReopenRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/MicrosoftGraphSecurityReopen/MicrosoftGraphSecurityReopenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reopen an eDiscovery case that was closed. For details, see Reopen a closed case. This API is available in the following national cloud deployments. * @param MicrosoftGraphSecurityReopenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-reopen?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphSecurityReopenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?MicrosoftGraphSecurityReopenRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Count/CountRequestBuilder.php index 1e0cde405ab..9b53436b76b 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/DataSource/DataSourceRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/DataSource/DataSourceRequestBuilder.php index 032935ec63a..799532400ff 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/DataSource/DataSourceRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/DataSource/DataSourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\DataSource; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property dataSource for security * @param DataSourceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DataSourceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * User source or SharePoint site data source as noncustodial data source. * @param DataSourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DataSourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DataSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DataSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property dataSource in security * @param DataSource $body The request body * @param DataSourceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DataSource $body, ?DataSourceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DataSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DataSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DataSourceRequestBuilderDeleteReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DataSourceRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DataSourceRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(DataSource $body, ?DataSourceRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/EdiscoveryNoncustodialDataSourceItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/EdiscoveryNoncustodialDataSourceItemRequestBuilder.php index 933c945c35b..777465a46bb 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/EdiscoveryNoncustodialDataSourceItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/EdiscoveryNoncustodialDataSourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryNoncustodialDataSource; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\NoncustodialDataSources\Item\DataSource\DataSourceRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property noncustodialDataSources for security * @param EdiscoveryNoncustodialDataSourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EdiscoveryNoncustodialDataSourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns a list of case ediscoveryNoncustodialDataSource objects for this case. * @param EdiscoveryNoncustodialDataSourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EdiscoveryNoncustodialDataSourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryNoncustodialDataSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryNoncustodialDataSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property noncustodialDataSources in security * @param EdiscoveryNoncustodialDataSource $body The request body * @param EdiscoveryNoncustodialDataSourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EdiscoveryNoncustodialDataSource $body, ?EdiscoveryNoncustodialDataSourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryNoncustodialDataSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryNoncustodialDataSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?EdiscoveryNoncustodialDataSourceItem $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?EdiscoveryNoncustodialDataSourceItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?EdiscoveryNoncustodialDataSourceItemReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(EdiscoveryNoncustodialDataSource $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/LastIndexOperation/LastIndexOperationRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/LastIndexOperation/LastIndexOperationRequestBuilder.php index c841d3d1edf..37a77bcfbdf 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/LastIndexOperation/LastIndexOperationRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/LastIndexOperation/LastIndexOperationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryIndexOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Operation entity that represents the latest indexing for the noncustodial data source. * @param LastIndexOperationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastIndexOperationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryIndexOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryIndexOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?LastIndexOperationRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?LastIndexOperationRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php index 63a474c1a39..13643a53a3c 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Start the process of applying hold on eDiscovery non-custodial data sources. After the operation is created, you can get the status by retrieving the Location parameter from the response headers. The location provides a URL that returns an eDiscoveryHoldOperation object. This API is available in the following national cloud deployments. * @param MicrosoftGraphSecurityApplyHoldRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverynoncustodialdatasource-applyhold?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphSecurityApplyHoldRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?MicrosoftGraphSecurityApplyHoldRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityRelease/MicrosoftGraphSecurityReleaseRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityRelease/MicrosoftGraphSecurityReleaseRequestBuilder.php index 7c10cb2b8d1..88803e22dcc 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityRelease/MicrosoftGraphSecurityReleaseRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityRelease/MicrosoftGraphSecurityReleaseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Release the non-custodial data source from the case. This API is available in the following national cloud deployments. * @param MicrosoftGraphSecurityReleaseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverynoncustodialdatasource-release?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphSecurityReleaseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?MicrosoftGraphSecurityReleaseRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php index 68c09dc7a62..e2fe896962b 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Start the process of removing hold from eDiscovery non-custodial data sources. After the operation is created, you can get the status by retrieving the Location parameter from the response headers. The location provides a URL that returns an eDiscoveryHoldOperation object. This API is available in the following national cloud deployments. * @param MicrosoftGraphSecurityRemoveHoldRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverynoncustodialdatasource-removehold?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphSecurityRemoveHoldRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?MicrosoftGraphSecurityRemoveHoldReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityUpdateIndex/MicrosoftGraphSecurityUpdateIndexRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityUpdateIndex/MicrosoftGraphSecurityUpdateIndexRequestBuilder.php index 6205831aeae..ac7f975b985 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityUpdateIndex/MicrosoftGraphSecurityUpdateIndexRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/Item/MicrosoftGraphSecurityUpdateIndex/MicrosoftGraphSecurityUpdateIndexRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Trigger an indexOperation to make a non-custodial data source and its associated data source searchable. This API is available in the following national cloud deployments. * @param MicrosoftGraphSecurityUpdateIndexRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverynoncustodialdatasource-updateindex?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphSecurityUpdateIndexRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?MicrosoftGraphSecurityUpdateIndexReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php index 71e692a83e7..3723a53ae67 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/MicrosoftGraphSecurityApplyHold/MicrosoftGraphSecurityApplyHoldRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action applyHold * @param ApplyHoldPostRequestBody $body The request body * @param MicrosoftGraphSecurityApplyHoldRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ApplyHoldPostRequestBody $body, ?MicrosoftGraphSecurityApplyHoldRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ApplyHoldPostRequestBody $body, ?Micros $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php index faa0bf9555f..61e4f634619 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/MicrosoftGraphSecurityRemoveHold/MicrosoftGraphSecurityRemoveHoldRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action removeHold * @param RemoveHoldPostRequestBody $body The request body * @param MicrosoftGraphSecurityRemoveHoldRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RemoveHoldPostRequestBody $body, ?MicrosoftGraphSecurityRemoveHoldRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(RemoveHoldPostRequestBody $body, ?Micro $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/NoncustodialDataSourcesRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/NoncustodialDataSourcesRequestBuilder.php index eef72210e6d..26788637971 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/NoncustodialDataSourcesRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/NoncustodialDataSources/NoncustodialDataSourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryNoncustodialDataSource; use Microsoft\Graph\Generated\Models\Security\EdiscoveryNoncustodialDataSourceCollectionResponse; @@ -71,39 +70,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Returns a list of case ediscoveryNoncustodialDataSource objects for this case. * @param NoncustodialDataSourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?NoncustodialDataSourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryNoncustodialDataSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryNoncustodialDataSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new ediscoveryNoncustodialDataSource object. This API is available in the following national cloud deployments. * @param EdiscoveryNoncustodialDataSource $body The request body * @param NoncustodialDataSourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-post-noncustodialdatasources?view=graph-rest-1.0 Find more info here */ public function post(EdiscoveryNoncustodialDataSource $body, ?NoncustodialDataSourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryNoncustodialDataSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryNoncustodialDataSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,7 +109,6 @@ public function toGetRequestInformation(?NoncustodialDataSourcesRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +116,7 @@ public function toGetRequestInformation(?NoncustodialDataSourcesRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +131,11 @@ public function toPostRequestInformation(EdiscoveryNoncustodialDataSource $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Operations/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Operations/Count/CountRequestBuilder.php index 7cebcc98d19..c17f4a8886d 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Operations/Item/CaseOperationItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Operations/Item/CaseOperationItemRequestBuilder.php index d9977515b12..cbc158108ef 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Operations/Item/CaseOperationItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Operations/Item/CaseOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\CaseOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for security * @param CaseOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CaseOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a caseOperation object. This API is available in the following national cloud deployments. * @param CaseOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-caseoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?CaseOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CaseOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CaseOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in security * @param CaseOperation $body The request body * @param CaseOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(CaseOperation $body, ?CaseOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CaseOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CaseOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?CaseOperationItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?CaseOperationItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?CaseOperationItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(CaseOperation $body, ?CaseOperationIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Operations/OperationsRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Operations/OperationsRequestBuilder.php index 9b88179ab12..580a01fba19 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\CaseOperation; use Microsoft\Graph\Generated\Models\Security\CaseOperationCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the caseOperation objects and their properties. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-list-operations?view=graph-rest-1.0 Find more info here */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CaseOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CaseOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for security * @param CaseOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CaseOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CaseOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CaseOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(CaseOperation $body, ?OperationsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Count/CountRequestBuilder.php index ca8f141f7d9..9ce32801cf0 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/EdiscoveryReviewSetItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/EdiscoveryReviewSetItemRequestBuilder.php index e73542b8157..24f7fcaefb5 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/EdiscoveryReviewSetItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/EdiscoveryReviewSetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryReviewSet; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\ReviewSets\Item\MicrosoftGraphSecurityAddToReviewSet\MicrosoftGraphSecurityAddToReviewSetRequestBuilder; @@ -58,57 +57,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property reviewSets for security * @param EdiscoveryReviewSetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EdiscoveryReviewSetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an ediscoveryReviewSet object. This API is available in the following national cloud deployments. * @param EdiscoveryReviewSetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoveryreviewset-get?view=graph-rest-1.0 Find more info here */ public function get(?EdiscoveryReviewSetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property reviewSets in security * @param EdiscoveryReviewSet $body The request body * @param EdiscoveryReviewSetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EdiscoveryReviewSet $body, ?EdiscoveryReviewSetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -125,6 +115,7 @@ public function toDeleteRequestInformation(?EdiscoveryReviewSetItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -138,7 +129,6 @@ public function toGetRequestInformation(?EdiscoveryReviewSetItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -146,6 +136,7 @@ public function toGetRequestInformation(?EdiscoveryReviewSetItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -160,11 +151,11 @@ public function toPatchRequestInformation(EdiscoveryReviewSet $body, ?Ediscovery $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/MicrosoftGraphSecurityAddToReviewSet/MicrosoftGraphSecurityAddToReviewSetRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/MicrosoftGraphSecurityAddToReviewSet/MicrosoftGraphSecurityAddToReviewSetRequestBuilder.php index ce830e55f0b..86ed45f0fa8 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/MicrosoftGraphSecurityAddToReviewSet/MicrosoftGraphSecurityAddToReviewSetRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/MicrosoftGraphSecurityAddToReviewSet/MicrosoftGraphSecurityAddToReviewSetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Start the process of adding a collection from Microsoft 365 services to a review set. After the operation is created, you can get the status of the operation by retrieving the Location parameter from the response headers. The location provides a URL that will return a Add to review set operation. This API is available in the following national cloud deployments. * @param AddToReviewSetPostRequestBody $body The request body * @param MicrosoftGraphSecurityAddToReviewSetRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoveryreviewset-addtoreviewset?view=graph-rest-1.0 Find more info here */ public function post(AddToReviewSetPostRequestBody $body, ?MicrosoftGraphSecurityAddToReviewSetRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AddToReviewSetPostRequestBody $body, ?M $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/MicrosoftGraphSecurityExport/MicrosoftGraphSecurityExportRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/MicrosoftGraphSecurityExport/MicrosoftGraphSecurityExportRequestBuilder.php index 19f70f845d6..a8a4e95a0d2 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/MicrosoftGraphSecurityExport/MicrosoftGraphSecurityExportRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/MicrosoftGraphSecurityExport/MicrosoftGraphSecurityExportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Initiate an export from a ediscoveryReviewSet. For details, see Export documents from a review set in eDiscovery (Premium). This API is available in the following national cloud deployments. * @param ExportPostRequestBody $body The request body * @param MicrosoftGraphSecurityExportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoveryreviewset-export?view=graph-rest-1.0 Find more info here */ public function post(ExportPostRequestBody $body, ?MicrosoftGraphSecurityExportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ExportPostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Count/CountRequestBuilder.php index 87bddc31b12..ca293857c5b 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Item/EdiscoveryReviewSetQueryItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Item/EdiscoveryReviewSetQueryItemRequestBuilder.php index a149cbb454a..a76c6d53300 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Item/EdiscoveryReviewSetQueryItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Item/EdiscoveryReviewSetQueryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryReviewSetQuery; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\ReviewSets\Item\Queries\Item\MicrosoftGraphSecurityApplyTags\MicrosoftGraphSecurityApplyTagsRequestBuilder; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an ediscoveryReviewSetQuery object. This API is available in the following national cloud deployments. * @param EdiscoveryReviewSetQueryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoveryreviewset-delete-queries?view=graph-rest-1.0 Find more info here */ public function delete(?EdiscoveryReviewSetQueryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an ediscoveryReviewSetQuery object. This API is available in the following national cloud deployments. * @param EdiscoveryReviewSetQueryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoveryreviewsetquery-get?view=graph-rest-1.0 Find more info here */ public function get(?EdiscoveryReviewSetQueryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSetQuery::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSetQuery::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an ediscoveryReviewSetQuery object. This API is available in the following national cloud deployments. * @param EdiscoveryReviewSetQuery $body The request body * @param EdiscoveryReviewSetQueryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoveryreviewsetquery-update?view=graph-rest-1.0 Find more info here */ public function patch(EdiscoveryReviewSetQuery $body, ?EdiscoveryReviewSetQueryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSetQuery::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSetQuery::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?EdiscoveryReviewSetQueryItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?EdiscoveryReviewSetQueryItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?EdiscoveryReviewSetQueryItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(EdiscoveryReviewSetQuery $body, ?Edisc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Item/MicrosoftGraphSecurityApplyTags/MicrosoftGraphSecurityApplyTagsRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Item/MicrosoftGraphSecurityApplyTags/MicrosoftGraphSecurityApplyTagsRequestBuilder.php index 834ca02db2d..01ebf674319 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Item/MicrosoftGraphSecurityApplyTags/MicrosoftGraphSecurityApplyTagsRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Item/MicrosoftGraphSecurityApplyTags/MicrosoftGraphSecurityApplyTagsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Apply tags to files in an eDiscovery review set. For details, see Tag documents in a review set in eDiscovery. This API is available in the following national cloud deployments. * @param ApplyTagsPostRequestBody $body The request body * @param MicrosoftGraphSecurityApplyTagsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoveryreviewsetquery-applytags?view=graph-rest-1.0 Find more info here */ public function post(ApplyTagsPostRequestBody $body, ?MicrosoftGraphSecurityApplyTagsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ApplyTagsPostRequestBody $body, ?Micros $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Item/MicrosoftGraphSecurityExport/MicrosoftGraphSecurityExportRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Item/MicrosoftGraphSecurityExport/MicrosoftGraphSecurityExportRequestBuilder.php index 827b1b08d42..89c39ee33f6 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Item/MicrosoftGraphSecurityExport/MicrosoftGraphSecurityExportRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/Item/MicrosoftGraphSecurityExport/MicrosoftGraphSecurityExportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Initiate an export from a ediscoveryReviewSetQuery. For details, see Export documents from a review set in eDiscovery (Premium). This API is available in the following national cloud deployments. * @param ExportPostRequestBody $body The request body * @param MicrosoftGraphSecurityExportRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoveryreviewsetquery-export?view=graph-rest-1.0 Find more info here */ public function post(ExportPostRequestBody $body, ?MicrosoftGraphSecurityExportRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ExportPostRequestBody $body, ?Microsoft $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/QueriesRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/QueriesRequestBuilder.php index 9808c674de1..352d451315d 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/QueriesRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/Item/Queries/QueriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryReviewSetQuery; use Microsoft\Graph\Generated\Models\Security\EdiscoveryReviewSetQueryCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of queries associated with an eDiscovery review set. This API is available in the following national cloud deployments. * @param QueriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoveryreviewset-list-queries?view=graph-rest-1.0 Find more info here */ public function get(?QueriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSetQueryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSetQueryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new ediscoveryReviewSetQuery object. This API is available in the following national cloud deployments. * @param EdiscoveryReviewSetQuery $body The request body * @param QueriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoveryreviewset-post-queries?view=graph-rest-1.0 Find more info here */ public function post(EdiscoveryReviewSetQuery $body, ?QueriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSetQuery::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSetQuery::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?QueriesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?QueriesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EdiscoveryReviewSetQuery $body, ?Querie $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/ReviewSetsRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/ReviewSetsRequestBuilder.php index 2bd6fa216ec..ac2ce075d73 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/ReviewSetsRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/ReviewSets/ReviewSetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryReviewSet; use Microsoft\Graph\Generated\Models\Security\EdiscoveryReviewSetCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of ediscoveryReviewSet objects associated with an eDiscovery case. This API is available in the following national cloud deployments. * @param ReviewSetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-list-reviewsets?view=graph-rest-1.0 Find more info here */ public function get(?ReviewSetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new ediscoveryReviewSet object. This API is available in the following national cloud deployments. * @param EdiscoveryReviewSet $body The request body * @param ReviewSetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-post-reviewsets?view=graph-rest-1.0 Find more info here */ public function post(EdiscoveryReviewSet $body, ?ReviewSetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ReviewSetsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ReviewSetsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EdiscoveryReviewSet $body, ?ReviewSetsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Count/CountRequestBuilder.php index 390b710df54..7c877390e31 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AddToReviewSetOperation/AddToReviewSetOperationRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AddToReviewSetOperation/AddToReviewSetOperationRequestBuilder.php index 7a51ffc4a3c..cee01cacc01 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AddToReviewSetOperation/AddToReviewSetOperationRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AddToReviewSetOperation/AddToReviewSetOperationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryAddToReviewSetOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Adds the results of the eDiscovery search to the specified reviewSet. * @param AddToReviewSetOperationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AddToReviewSetOperationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryAddToReviewSetOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryAddToReviewSetOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AddToReviewSetOperationRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AddToReviewSetOperationRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AdditionalSources/AdditionalSourcesRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AdditionalSources/AdditionalSourcesRequestBuilder.php index 5643eeca44e..889253de295 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AdditionalSources/AdditionalSourcesRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AdditionalSources/AdditionalSourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\DataSource; use Microsoft\Graph\Generated\Models\Security\DataSourceCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of additional sources associated with an eDiscovery search. This API is available in the following national cloud deployments. * @param AdditionalSourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverysearch-list-additionalsources?view=graph-rest-1.0 Find more info here */ public function get(?AdditionalSourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DataSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DataSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new additional source associated with an eDiscovery search. This API is available in the following national cloud deployments. * @param DataSource $body The request body * @param AdditionalSourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverysearch-post-additionalsources?view=graph-rest-1.0 Find more info here */ public function post(DataSource $body, ?AdditionalSourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DataSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DataSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AdditionalSourcesRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AdditionalSourcesRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DataSource $body, ?AdditionalSourcesReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AdditionalSources/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AdditionalSources/Count/CountRequestBuilder.php index eb7e3d54bb0..f38dbe7a0aa 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AdditionalSources/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AdditionalSources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AdditionalSources/Item/DataSourceItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AdditionalSources/Item/DataSourceItemRequestBuilder.php index 1a134f109bc..5c907634d47 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AdditionalSources/Item/DataSourceItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/AdditionalSources/Item/DataSourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\DataSource; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property additionalSources for security * @param DataSourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DataSourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Adds an additional source to the eDiscovery search. * @param DataSourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DataSourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DataSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DataSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property additionalSources in security * @param DataSource $body The request body * @param DataSourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DataSource $body, ?DataSourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DataSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DataSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DataSourceItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DataSourceItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DataSourceItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(DataSource $body, ?DataSourceItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/CustodianSources/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/CustodianSources/Count/CountRequestBuilder.php index 0cb829dd34b..56e7ec1c2ed 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/CustodianSources/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/CustodianSources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/CustodianSources/CustodianSourcesRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/CustodianSources/CustodianSourcesRequestBuilder.php index 0f6cb976acd..178a447a8a7 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/CustodianSources/CustodianSourcesRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/CustodianSources/CustodianSourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\DataSourceCollectionResponse; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\Searches\Item\CustodianSources\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of custodial data sources associated with an eDiscovery search. This API is available in the following national cloud deployments. * @param CustodianSourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverysearch-list-custodiansources?view=graph-rest-1.0 Find more info here */ public function get(?CustodianSourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DataSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DataSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?CustodianSourcesRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?CustodianSourcesRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/CustodianSources/Item/DataSourceItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/CustodianSources/Item/DataSourceItemRequestBuilder.php index 3b32eeb42d2..bea35d74183 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/CustodianSources/Item/DataSourceItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/CustodianSources/Item/DataSourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\DataSource; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a dataSource object. * @param DataSourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverysearch-delete-custodiansources?view=graph-rest-1.0 Find more info here */ public function delete(?DataSourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Custodian sources that are included in the eDiscovery search. * @param DataSourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DataSourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DataSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DataSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?DataSourceItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?DataSourceItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?DataSourceItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/EdiscoverySearchItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/EdiscoverySearchItemRequestBuilder.php index f99b041e3e9..bebe03711f2 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/EdiscoverySearchItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/EdiscoverySearchItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoverySearch; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\Searches\Item\AdditionalSources\AdditionalSourcesRequestBuilder; @@ -90,59 +89,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an ediscoverySearch object. This API is available in the following national cloud deployments. * @param EdiscoverySearchItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-delete-searches?view=graph-rest-1.0 Find more info here */ public function delete(?EdiscoverySearchItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an ediscoverySearch object. This API is available in the following national cloud deployments. * @param EdiscoverySearchItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverysearch-get?view=graph-rest-1.0 Find more info here */ public function get(?EdiscoverySearchItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoverySearch::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoverySearch::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an ediscoverySearch object. This API is available in the following national cloud deployments. * @param EdiscoverySearch $body The request body * @param EdiscoverySearchItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverysearch-update?view=graph-rest-1.0 Find more info here */ public function patch(EdiscoverySearch $body, ?EdiscoverySearchItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoverySearch::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoverySearch::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -159,6 +149,7 @@ public function toDeleteRequestInformation(?EdiscoverySearchItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -172,7 +163,6 @@ public function toGetRequestInformation(?EdiscoverySearchItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -180,6 +170,7 @@ public function toGetRequestInformation(?EdiscoverySearchItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -194,11 +185,11 @@ public function toPatchRequestInformation(EdiscoverySearch $body, ?EdiscoverySea $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/LastEstimateStatisticsOperation/LastEstimateStatisticsOperationRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/LastEstimateStatisticsOperation/LastEstimateStatisticsOperationRequestBuilder.php index 130d0e537b2..e5027095631 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/LastEstimateStatisticsOperation/LastEstimateStatisticsOperationRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/LastEstimateStatisticsOperation/LastEstimateStatisticsOperationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryEstimateOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the last ediscoveryEstimateOperation objects and their properties. This API is available in the following national cloud deployments. * @param LastEstimateStatisticsOperationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverysearch-list-lastestimatestatisticsoperation?view=graph-rest-1.0 Find more info here */ public function get(?LastEstimateStatisticsOperationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryEstimateOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryEstimateOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?LastEstimateStatisticsOperationRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?LastEstimateStatisticsOperationRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/MicrosoftGraphSecurityEstimateStatistics/MicrosoftGraphSecurityEstimateStatisticsRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/MicrosoftGraphSecurityEstimateStatistics/MicrosoftGraphSecurityEstimateStatisticsRequestBuilder.php index b55261a161b..0c5fab912fd 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/MicrosoftGraphSecurityEstimateStatistics/MicrosoftGraphSecurityEstimateStatisticsRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/MicrosoftGraphSecurityEstimateStatistics/MicrosoftGraphSecurityEstimateStatisticsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Run an estimate of the number of emails and documents in the eDiscovery search. To learn more about searches in eDiscovery, see Collect data for a case in eDiscovery (Premium). This API is available in the following national cloud deployments. * @param MicrosoftGraphSecurityEstimateStatisticsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverysearch-estimatestatistics?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphSecurityEstimateStatisticsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?MicrosoftGraphSecurityEstimateStatisti $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/MicrosoftGraphSecurityPurgeData/MicrosoftGraphSecurityPurgeDataRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/MicrosoftGraphSecurityPurgeData/MicrosoftGraphSecurityPurgeDataRequestBuilder.php index 486b2835f97..b6a7934b082 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/MicrosoftGraphSecurityPurgeData/MicrosoftGraphSecurityPurgeDataRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/MicrosoftGraphSecurityPurgeData/MicrosoftGraphSecurityPurgeDataRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Delete Microsoft Teams messages contained in an eDiscovery search. You can collect and purge the following categories of Teams content:- Teams 1:1 chats - Chat messages, posts, and attachments shared in a Teams conversation between two people. Teams 1:1 chats are also called *conversations*.- Teams group chats - Chat messages, posts, and attachments shared in a Teams conversation between three or more people. Also called *1:N* chats or *group conversations*.- Teams channels - Chat messages, posts, replies, and attachments shared in a standard Teams channel.- Private channels - Message posts, replies, and attachments shared in a private Teams channel.- Shared channels - Message posts, replies, and attachments shared in a shared Teams channel. For more information about purging Teams messages, see:- eDiscovery solution series: Data spillage scenario - Search and purge- eDiscovery (Premium) workflow for content in Microsoft Teams This API is available in the following national cloud deployments. * @param PurgeDataPostRequestBody $body The request body * @param MicrosoftGraphSecurityPurgeDataRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverysearch-purgedata?view=graph-rest-1.0 Find more info here */ public function post(PurgeDataPostRequestBody $body, ?MicrosoftGraphSecurityPurgeDataRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(PurgeDataPostRequestBody $body, ?Micros $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/NoncustodialSources/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/NoncustodialSources/Count/CountRequestBuilder.php index 49a09ad91aa..2ff2287183b 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/NoncustodialSources/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/NoncustodialSources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/NoncustodialSources/Item/EdiscoveryNoncustodialDataSourceItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/NoncustodialSources/Item/EdiscoveryNoncustodialDataSourceItemRequestBuilder.php index 0a5efac0dee..4a80c3d7d2d 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/NoncustodialSources/Item/EdiscoveryNoncustodialDataSourceItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/NoncustodialSources/Item/EdiscoveryNoncustodialDataSourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryNoncustodialDataSource; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an ediscoveryNoncustodialDataSource object. * @param EdiscoveryNoncustodialDataSourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverysearch-delete-noncustodialsources?view=graph-rest-1.0 Find more info here */ public function delete(?EdiscoveryNoncustodialDataSourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * noncustodialDataSource sources that are included in the eDiscovery search * @param EdiscoveryNoncustodialDataSourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EdiscoveryNoncustodialDataSourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryNoncustodialDataSource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryNoncustodialDataSource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?EdiscoveryNoncustodialDataSourceItem $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?EdiscoveryNoncustodialDataSourceItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?EdiscoveryNoncustodialDataSourceItemReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/NoncustodialSources/NoncustodialSourcesRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/NoncustodialSources/NoncustodialSourcesRequestBuilder.php index 75bb9e60b54..370dcaa8d19 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/NoncustodialSources/NoncustodialSourcesRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/Item/NoncustodialSources/NoncustodialSourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryNoncustodialDataSourceCollectionResponse; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\Searches\Item\NoncustodialSources\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * noncustodialDataSource sources that are included in the eDiscovery search * @param NoncustodialSourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?NoncustodialSourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryNoncustodialDataSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryNoncustodialDataSourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?NoncustodialSourcesRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?NoncustodialSourcesRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/SearchesRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/SearchesRequestBuilder.php index 097fe47c49c..93998e8efdd 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/SearchesRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Searches/SearchesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoverySearch; use Microsoft\Graph\Generated\Models\Security\EdiscoverySearchCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of ediscoverySearch resources from an eDiscoveryCase object. This API is available in the following national cloud deployments. * @param SearchesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-list-searches?view=graph-rest-1.0 Find more info here */ public function get(?SearchesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoverySearchCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoverySearchCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new ediscoverySearch object. This API is available in the following national cloud deployments. * @param EdiscoverySearch $body The request body * @param SearchesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-post-searches?view=graph-rest-1.0 Find more info here */ public function post(EdiscoverySearch $body, ?SearchesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoverySearch::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoverySearch::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SearchesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SearchesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EdiscoverySearch $body, ?SearchesReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Settings/MicrosoftGraphSecurityResetToDefault/MicrosoftGraphSecurityResetToDefaultRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Settings/MicrosoftGraphSecurityResetToDefault/MicrosoftGraphSecurityResetToDefaultRequestBuilder.php index 98dd6e0ace9..b5c9857be94 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Settings/MicrosoftGraphSecurityResetToDefault/MicrosoftGraphSecurityResetToDefaultRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Settings/MicrosoftGraphSecurityResetToDefault/MicrosoftGraphSecurityResetToDefaultRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reset a caseSettings object to the default values. This API is available in the following national cloud deployments. * @param MicrosoftGraphSecurityResetToDefaultRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycasesettings-resettodefault?view=graph-rest-1.0 Find more info here */ public function post(?MicrosoftGraphSecurityResetToDefaultRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?MicrosoftGraphSecurityResetToDefaultRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Settings/SettingsRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Settings/SettingsRequestBuilder.php index f0f83d47349..626560d81f4 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Settings/SettingsRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Settings/SettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryCaseSettings; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\Settings\MicrosoftGraphSecurityResetToDefault\MicrosoftGraphSecurityResetToDefaultRequestBuilder; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property settings for security * @param SettingsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SettingsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an ediscoveryCaseSettings object. This API is available in the following national cloud deployments. * @param SettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycasesettings-get?view=graph-rest-1.0 Find more info here */ public function get(?SettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCaseSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCaseSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an ediscoveryCaseSettings object. This API is available in the following national cloud deployments. * @param EdiscoveryCaseSettings $body The request body * @param SettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycasesettings-update?view=graph-rest-1.0 Find more info here */ public function patch(EdiscoveryCaseSettings $body, ?SettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCaseSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryCaseSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?SettingsRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?SettingsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?SettingsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(EdiscoveryCaseSettings $body, ?Setting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Count/CountRequestBuilder.php index c19df3b32c9..7442b4a84e1 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/ChildTags/ChildTagsRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/ChildTags/ChildTagsRequestBuilder.php index 53f921e2bf9..7ef3573a2f1 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/ChildTags/ChildTagsRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/ChildTags/ChildTagsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryReviewTagCollectionResponse; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\Tags\Item\ChildTags\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Returns the tags that are a child of a tag. * @param ChildTagsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildTagsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTagCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTagCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ChildTagsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ChildTagsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/ChildTags/Count/CountRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/ChildTags/Count/CountRequestBuilder.php index d40aeeb673d..4a4e7262a1d 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/ChildTags/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/ChildTags/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/ChildTags/Item/EdiscoveryReviewTagItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/ChildTags/Item/EdiscoveryReviewTagItemRequestBuilder.php index ed71b39f9c6..914f5fb4d7b 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/ChildTags/Item/EdiscoveryReviewTagItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/ChildTags/Item/EdiscoveryReviewTagItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryReviewTag; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Returns the tags that are a child of a tag. * @param EdiscoveryReviewTagItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EdiscoveryReviewTagItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?EdiscoveryReviewTagItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?EdiscoveryReviewTagItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/EdiscoveryReviewTagItemRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/EdiscoveryReviewTagItemRequestBuilder.php index 22b3ec3d5d3..6069d1eef76 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/EdiscoveryReviewTagItemRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/EdiscoveryReviewTagItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryReviewTag; use Microsoft\Graph\Generated\Security\Cases\EdiscoveryCases\Item\Tags\Item\ChildTags\ChildTagsRequestBuilder; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an ediscoveryReviewTag object. This API is available in the following national cloud deployments. * @param EdiscoveryReviewTagItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-delete-tags?view=graph-rest-1.0 Find more info here */ public function delete(?EdiscoveryReviewTagItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an ediscoveryReviewTag object. This API is available in the following national cloud deployments. * @param EdiscoveryReviewTagItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoveryreviewtag-get?view=graph-rest-1.0 Find more info here */ public function get(?EdiscoveryReviewTagItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an ediscoveryReviewTag object. This API is available in the following national cloud deployments. * @param EdiscoveryReviewTag $body The request body * @param EdiscoveryReviewTagItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoveryreviewtag-update?view=graph-rest-1.0 Find more info here */ public function patch(EdiscoveryReviewTag $body, ?EdiscoveryReviewTagItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?EdiscoveryReviewTagItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?EdiscoveryReviewTagItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?EdiscoveryReviewTagItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(EdiscoveryReviewTag $body, ?Ediscovery $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/Parent/ParentRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/Parent/ParentRequestBuilder.php index 68f16f2f354..3684a1353c4 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/Parent/ParentRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/Item/Parent/ParentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryReviewTag; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Returns the parent tag of the specified tag. * @param ParentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/MicrosoftGraphSecurityAsHierarchy/MicrosoftGraphSecurityAsHierarchyRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/MicrosoftGraphSecurityAsHierarchy/MicrosoftGraphSecurityAsHierarchyRequestBuilder.php index 21d20beffa4..fd3a0d1405a 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/MicrosoftGraphSecurityAsHierarchy/MicrosoftGraphSecurityAsHierarchyRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/MicrosoftGraphSecurityAsHierarchy/MicrosoftGraphSecurityAsHierarchyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function asHierarchy * @param MicrosoftGraphSecurityAsHierarchyRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MicrosoftGraphSecurityAsHierarchyRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AsHierarchyGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AsHierarchyGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?MicrosoftGraphSecurityAsHierarchyReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?MicrosoftGraphSecurityAsHierarchyReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/TagsRequestBuilder.php b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/TagsRequestBuilder.php index be268e8e50c..52750529f1d 100644 --- a/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/TagsRequestBuilder.php +++ b/src/Generated/Security/Cases/EdiscoveryCases/Item/Tags/TagsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\EdiscoveryReviewTag; use Microsoft\Graph\Generated\Models\Security\EdiscoveryReviewTagCollectionResponse; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of eDiscoveryReviewTag objects and their properties. This API is available in the following national cloud deployments. * @param TagsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-list-tags?view=graph-rest-1.0 Find more info here */ public function get(?TagsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTagCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTagCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new ediscoveryReviewTag object. This API is available in the following national cloud deployments. * @param EdiscoveryReviewTag $body The request body * @param TagsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-ediscoverycase-post-tags?view=graph-rest-1.0 Find more info here */ public function post(EdiscoveryReviewTag $body, ?TagsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EdiscoveryReviewTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?TagsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?TagsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(EdiscoveryReviewTag $body, ?TagsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Incidents/Count/CountRequestBuilder.php b/src/Generated/Security/Incidents/Count/CountRequestBuilder.php index 0d2bf75f1eb..1e926cf2adf 100644 --- a/src/Generated/Security/Incidents/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Incidents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Incidents/IncidentsRequestBuilder.php b/src/Generated/Security/Incidents/IncidentsRequestBuilder.php index 2d577d9000f..c576e95dad3 100644 --- a/src/Generated/Security/Incidents/IncidentsRequestBuilder.php +++ b/src/Generated/Security/Incidents/IncidentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Incident; use Microsoft\Graph\Generated\Models\Security\IncidentCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of incident objects that Microsoft 365 Defender has created to track attacks in an organization. Attacks are typically inflicted on different types of entities, such as devices, users, and mailboxes, resulting in multiple alert objects. Microsoft 365 Defender correlates alerts with the same attack techniques or the same attacker into an incident. This operation allows you to filter and sort through incidents to create an informed cyber security response. It exposes a collection of incidents that were flagged in your network, within the time range you specified in your environment retention policy. The most recent incidents are displayed at the top of the list. This API is available in the following national cloud deployments. * @param IncidentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-list-incidents?view=graph-rest-1.0 Find more info here */ public function get(?IncidentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IncidentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IncidentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to incidents for security * @param Incident $body The request body * @param IncidentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Incident $body, ?IncidentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Incident::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Incident::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?IncidentsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?IncidentsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Incident $body, ?IncidentsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Incidents/Item/Alerts/AlertsRequestBuilder.php b/src/Generated/Security/Incidents/Item/Alerts/AlertsRequestBuilder.php index 2240aa24bda..a3e04222a5d 100644 --- a/src/Generated/Security/Incidents/Item/Alerts/AlertsRequestBuilder.php +++ b/src/Generated/Security/Incidents/Item/Alerts/AlertsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\AlertCollectionResponse; use Microsoft\Graph\Generated\Security\Incidents\Item\Alerts\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of related alerts. Supports $expand. * @param AlertsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AlertsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AlertCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AlertCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?AlertsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?AlertsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Incidents/Item/Alerts/Count/CountRequestBuilder.php b/src/Generated/Security/Incidents/Item/Alerts/Count/CountRequestBuilder.php index c19bf8fd633..53f14e26704 100644 --- a/src/Generated/Security/Incidents/Item/Alerts/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Incidents/Item/Alerts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Incidents/Item/Alerts/Item/AlertItemRequestBuilder.php b/src/Generated/Security/Incidents/Item/Alerts/Item/AlertItemRequestBuilder.php index 8d3be595a21..e9d902a73e9 100644 --- a/src/Generated/Security/Incidents/Item/Alerts/Item/AlertItemRequestBuilder.php +++ b/src/Generated/Security/Incidents/Item/Alerts/Item/AlertItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Alert; use Microsoft\Graph\Generated\Security\Incidents\Item\Alerts\Item\Comments\CommentsRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of related alerts. Supports $expand. * @param AlertItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AlertItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Alert::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?AlertItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?AlertItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Incidents/Item/Alerts/Item/Comments/CommentsRequestBuilder.php b/src/Generated/Security/Incidents/Item/Alerts/Item/Comments/CommentsRequestBuilder.php index 0cac887b39e..2a39dff8b0a 100644 --- a/src/Generated/Security/Incidents/Item/Alerts/Item/Comments/CommentsRequestBuilder.php +++ b/src/Generated/Security/Incidents/Item/Alerts/Item/Comments/CommentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\AlertComment; use Microsoft\Graph\Generated\Security\Incidents\Item\Alerts\Item\Comments\Count\CountRequestBuilder; @@ -43,19 +42,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Sets a new value for the collection of alertComment. * @param array $body The request body * @param CommentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise|null> + * @throws Exception */ public function post(array $body, ?CommentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendCollectionAsync($requestInfo, [AlertComment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendCollectionAsync($requestInfo, [AlertComment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -69,11 +65,11 @@ public function toPostRequestInformation(array $body, ?CommentsRequestBuilderPos $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsableCollection($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Incidents/Item/Alerts/Item/Comments/Count/CountRequestBuilder.php b/src/Generated/Security/Incidents/Item/Alerts/Item/Comments/Count/CountRequestBuilder.php index 7d092f1f15b..0702ba202f2 100644 --- a/src/Generated/Security/Incidents/Item/Alerts/Item/Comments/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Incidents/Item/Alerts/Item/Comments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Incidents/Item/IncidentItemRequestBuilder.php b/src/Generated/Security/Incidents/Item/IncidentItemRequestBuilder.php index d7b59e25dc8..15aa76b3351 100644 --- a/src/Generated/Security/Incidents/Item/IncidentItemRequestBuilder.php +++ b/src/Generated/Security/Incidents/Item/IncidentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Incident; use Microsoft\Graph\Generated\Security\Incidents\Item\Alerts\AlertsRequestBuilder; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property incidents for security * @param IncidentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?IncidentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an incident object. Attacks are typically inflicted on different types of entities, such as devices, users, and mailboxes, resulting in multiple alert objects. Microsoft 365 Defender correlates alerts with the same attack techniques or the same attacker into an incident. This API is available in the following national cloud deployments. * @param IncidentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-incident-get?view=graph-rest-1.0 Find more info here */ public function get(?IncidentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Incident::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Incident::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an incident object. This API is available in the following national cloud deployments. * @param Incident $body The request body * @param IncidentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-incident-update?view=graph-rest-1.0 Find more info here */ public function patch(Incident $body, ?IncidentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Incident::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Incident::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?IncidentItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?IncidentItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?IncidentItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(Incident $body, ?IncidentItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/MicrosoftGraphSecurityRunHuntingQuery/MicrosoftGraphSecurityRunHuntingQueryRequestBuilder.php b/src/Generated/Security/MicrosoftGraphSecurityRunHuntingQuery/MicrosoftGraphSecurityRunHuntingQueryRequestBuilder.php index e521db2b816..daea61b1257 100644 --- a/src/Generated/Security/MicrosoftGraphSecurityRunHuntingQuery/MicrosoftGraphSecurityRunHuntingQueryRequestBuilder.php +++ b/src/Generated/Security/MicrosoftGraphSecurityRunHuntingQuery/MicrosoftGraphSecurityRunHuntingQueryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HuntingQueryResults; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,19 +34,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action runHuntingQuery * @param RunHuntingQueryPostRequestBody $body The request body * @param MicrosoftGraphSecurityRunHuntingQueryRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RunHuntingQueryPostRequestBody $body, ?MicrosoftGraphSecurityRunHuntingQueryRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HuntingQueryResults::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HuntingQueryResults::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RunHuntingQueryPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/SecureScoreControlProfiles/Count/CountRequestBuilder.php b/src/Generated/Security/SecureScoreControlProfiles/Count/CountRequestBuilder.php index feefa89a7c7..6a38bce8302 100644 --- a/src/Generated/Security/SecureScoreControlProfiles/Count/CountRequestBuilder.php +++ b/src/Generated/Security/SecureScoreControlProfiles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/SecureScoreControlProfiles/Item/SecureScoreControlProfileItemRequestBuilder.php b/src/Generated/Security/SecureScoreControlProfiles/Item/SecureScoreControlProfileItemRequestBuilder.php index 73d11191056..6394b4214f8 100644 --- a/src/Generated/Security/SecureScoreControlProfiles/Item/SecureScoreControlProfileItemRequestBuilder.php +++ b/src/Generated/Security/SecureScoreControlProfiles/Item/SecureScoreControlProfileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SecureScoreControlProfile; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property secureScoreControlProfiles for security * @param SecureScoreControlProfileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SecureScoreControlProfileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an securescorecontrolprofile object. This API is available in the following national cloud deployments. * @param SecureScoreControlProfileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/securescorecontrolprofile-get?view=graph-rest-1.0 Find more info here */ public function get(?SecureScoreControlProfileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SecureScoreControlProfile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SecureScoreControlProfile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an editable secureScoreControlProfile object within any integrated solution to change various properties, such as assignedTo or tenantNote. This API is available in the following national cloud deployments. * @param SecureScoreControlProfile $body The request body * @param SecureScoreControlProfileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/securescorecontrolprofile-update?view=graph-rest-1.0 Find more info here */ public function patch(SecureScoreControlProfile $body, ?SecureScoreControlProfileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SecureScoreControlProfile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SecureScoreControlProfile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?SecureScoreControlProfileItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?SecureScoreControlProfileItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?SecureScoreControlProfileItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(SecureScoreControlProfile $body, ?Secu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/SecureScoreControlProfiles/SecureScoreControlProfilesRequestBuilder.php b/src/Generated/Security/SecureScoreControlProfiles/SecureScoreControlProfilesRequestBuilder.php index 94d35c39e0d..b11b91832fe 100644 --- a/src/Generated/Security/SecureScoreControlProfiles/SecureScoreControlProfilesRequestBuilder.php +++ b/src/Generated/Security/SecureScoreControlProfiles/SecureScoreControlProfilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SecureScoreControlProfile; use Microsoft\Graph\Generated\Models\SecureScoreControlProfileCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of a secureScoreControlProfiles object. This API is available in the following national cloud deployments. * @param SecureScoreControlProfilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-list-securescorecontrolprofiles?view=graph-rest-1.0 Find more info here */ public function get(?SecureScoreControlProfilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SecureScoreControlProfileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SecureScoreControlProfileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to secureScoreControlProfiles for security * @param SecureScoreControlProfile $body The request body * @param SecureScoreControlProfilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SecureScoreControlProfile $body, ?SecureScoreControlProfilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SecureScoreControlProfile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SecureScoreControlProfile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SecureScoreControlProfilesRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SecureScoreControlProfilesRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SecureScoreControlProfile $body, ?Secur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/SecureScores/Count/CountRequestBuilder.php b/src/Generated/Security/SecureScores/Count/CountRequestBuilder.php index ad06ca936c7..ad80918d9f1 100644 --- a/src/Generated/Security/SecureScores/Count/CountRequestBuilder.php +++ b/src/Generated/Security/SecureScores/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/SecureScores/Item/SecureScoreItemRequestBuilder.php b/src/Generated/Security/SecureScores/Item/SecureScoreItemRequestBuilder.php index d909b4f2942..830936d230f 100644 --- a/src/Generated/Security/SecureScores/Item/SecureScoreItemRequestBuilder.php +++ b/src/Generated/Security/SecureScores/Item/SecureScoreItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SecureScore; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property secureScores for security * @param SecureScoreItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SecureScoreItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a secureScore object. This API is available in the following national cloud deployments. * @param SecureScoreItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/securescore-get?view=graph-rest-1.0 Find more info here */ public function get(?SecureScoreItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SecureScore::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SecureScore::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property secureScores in security * @param SecureScore $body The request body * @param SecureScoreItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SecureScore $body, ?SecureScoreItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SecureScore::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SecureScore::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?SecureScoreItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?SecureScoreItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?SecureScoreItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(SecureScore $body, ?SecureScoreItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/SecureScores/SecureScoresRequestBuilder.php b/src/Generated/Security/SecureScores/SecureScoresRequestBuilder.php index a878d577bb1..36599ef5741 100644 --- a/src/Generated/Security/SecureScores/SecureScoresRequestBuilder.php +++ b/src/Generated/Security/SecureScores/SecureScoresRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SecureScore; use Microsoft\Graph\Generated\Models\SecureScoreCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of secureScore objects. This API is available in the following national cloud deployments. * @param SecureScoresRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-list-securescores?view=graph-rest-1.0 Find more info here */ public function get(?SecureScoresRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SecureScoreCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SecureScoreCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to secureScores for security * @param SecureScore $body The request body * @param SecureScoresRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SecureScore $body, ?SecureScoresRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SecureScore::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SecureScore::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SecureScoresRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SecureScoresRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SecureScore $body, ?SecureScoresRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/SecurityRequestBuilder.php b/src/Generated/Security/SecurityRequestBuilder.php index 5fd6ffc4bb5..286399d4913 100644 --- a/src/Generated/Security/SecurityRequestBuilder.php +++ b/src/Generated/Security/SecurityRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Security; use Microsoft\Graph\Generated\Security\Alerts_v2\Alerts_v2RequestBuilder; @@ -130,38 +129,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get security * @param SecurityRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SecurityRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Security::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Security::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update security * @param Security $body The request body * @param SecurityRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Security $body, ?SecurityRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Security::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Security::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -174,7 +167,6 @@ public function toGetRequestInformation(?SecurityRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -182,6 +174,7 @@ public function toGetRequestInformation(?SecurityRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -196,11 +189,11 @@ public function toPatchRequestInformation(Security $body, ?SecurityRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Count/CountRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Count/CountRequestBuilder.php index baabe64d66a..5eac93f7084 100644 --- a/src/Generated/Security/SubjectRightsRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Approvers/ApproversRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Approvers/ApproversRequestBuilder.php index 57c3adbb095..8a146a2dbf6 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Approvers/ApproversRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Approvers/ApproversRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; use Microsoft\Graph\Generated\Security\SubjectRightsRequests\Item\Approvers\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of users who can approve the request. Currently only supported for requests of type delete. * @param ApproversRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ApproversRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ApproversRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ApproversRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Count/CountRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Count/CountRequestBuilder.php index 02a0eb7f0a5..094ca93be4f 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Count/CountRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/MailboxSettings/MailboxSettingsRequestBuilder.php index 5c7a199c764..5662c99f1e6 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php index ca8ae03d916..0edd5f7a0b7 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 0f39b040007..539cf1cc2c0 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Security\SubjectRightsRequests\Item\Approvers\Item\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/UserItemRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/UserItemRequestBuilder.php index 2b28f9dbd7c..cb4c944fc5b 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/UserItemRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Approvers/Item/UserItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Security\SubjectRightsRequests\Item\Approvers\Item\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of users who can approve the request. Currently only supported for requests of type delete. * @param UserItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?UserItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?UserItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/CollaboratorsRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/CollaboratorsRequestBuilder.php index 685cc33955d..da439b07550 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/CollaboratorsRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/CollaboratorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; use Microsoft\Graph\Generated\Security\SubjectRightsRequests\Item\Collaborators\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of users who can collaborate on the request. * @param CollaboratorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CollaboratorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?CollaboratorsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?CollaboratorsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Count/CountRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Count/CountRequestBuilder.php index 59cf5fe25ca..7dadf06f3d6 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Count/CountRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/MailboxSettings/MailboxSettingsRequestBuilder.php index 47f98711e13..7d6882ae65b 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php index b7f89a81b54..dfc5983d816 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 4681d327972..82216d96c60 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Security\SubjectRightsRequests\Item\Collaborators\Item\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/UserItemRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/UserItemRequestBuilder.php index d80ac0d98dd..d2e7d1e9c56 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/UserItemRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Collaborators/Item/UserItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Security\SubjectRightsRequests\Item\Collaborators\Item\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Collection of users who can collaborate on the request. * @param UserItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?UserItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?UserItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/GetFinalAttachment/GetFinalAttachmentRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/GetFinalAttachment/GetFinalAttachmentRequestBuilder.php index c997ec6663d..6fad99564e0 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/GetFinalAttachment/GetFinalAttachmentRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/GetFinalAttachment/GetFinalAttachmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getFinalAttachment * @param GetFinalAttachmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetFinalAttachmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -63,6 +61,7 @@ public function toGetRequestInformation(?GetFinalAttachmentRequestBuilderGetRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/GetFinalReport/GetFinalReportRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/GetFinalReport/GetFinalReportRequestBuilder.php index 9a3ac701760..7ae003e91fb 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/GetFinalReport/GetFinalReportRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/GetFinalReport/GetFinalReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getFinalReport * @param GetFinalReportRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetFinalReportRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -63,6 +61,7 @@ public function toGetRequestInformation(?GetFinalReportRequestBuilderGetRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Notes/Count/CountRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Notes/Count/CountRequestBuilder.php index c658611f463..9c7a62f8b39 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Notes/Count/CountRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Notes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Notes/Item/AuthoredNoteItemRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Notes/Item/AuthoredNoteItemRequestBuilder.php index 591335bde7f..5db4ba6eeeb 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Notes/Item/AuthoredNoteItemRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Notes/Item/AuthoredNoteItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthoredNote; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property notes for security * @param AuthoredNoteItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AuthoredNoteItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * List of notes associated with the request. * @param AuthoredNoteItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthoredNoteItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property notes in security * @param AuthoredNote $body The request body * @param AuthoredNoteItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AuthoredNote $body, ?AuthoredNoteItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AuthoredNoteItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AuthoredNoteItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AuthoredNoteItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AuthoredNote $body, ?AuthoredNoteItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Notes/NotesRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Notes/NotesRequestBuilder.php index 08fa9c5af08..23cf0ccaa6b 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Notes/NotesRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Notes/NotesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthoredNote; use Microsoft\Graph\Generated\Models\AuthoredNoteCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of authored notes assoicated with a subject rights request. This API is available in the following national cloud deployments. * @param NotesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subjectrightsrequest-list-notes?view=graph-rest-1.0 Find more info here */ public function get(?NotesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNoteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNoteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new authoredNote object. This API is available in the following national cloud deployments. * @param AuthoredNote $body The request body * @param NotesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subjectrightsrequest-post-notes?view=graph-rest-1.0 Find more info here */ public function post(AuthoredNote $body, ?NotesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthoredNote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?NotesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?NotesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AuthoredNote $body, ?NotesRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/SubjectRightsRequestItemRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/SubjectRightsRequestItemRequestBuilder.php index 4d8f8dbfa26..c0184d7674c 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/SubjectRightsRequestItemRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/SubjectRightsRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SubjectRightsRequest; use Microsoft\Graph\Generated\Security\SubjectRightsRequests\Item\Approvers\ApproversRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property subjectRightsRequests for security * @param SubjectRightsRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SubjectRightsRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get subjectRightsRequests from security * @param SubjectRightsRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRightsRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property subjectRightsRequests in security * @param SubjectRightsRequest $body The request body * @param SubjectRightsRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SubjectRightsRequest $body, ?SubjectRightsRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?SubjectRightsRequestItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?SubjectRightsRequestItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?SubjectRightsRequestItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(SubjectRightsRequest $body, ?SubjectRi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/Item/Team/TeamRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/Item/Team/TeamRequestBuilder.php index 69785580cee..2df65bebe07 100644 --- a/src/Generated/Security/SubjectRightsRequests/Item/Team/TeamRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/Item/Team/TeamRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Information about the Microsoft Teams team that was created for the request. * @param TeamRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/SubjectRightsRequests/SubjectRightsRequestsRequestBuilder.php b/src/Generated/Security/SubjectRightsRequests/SubjectRightsRequestsRequestBuilder.php index ba5b7a83c01..1fba935c931 100644 --- a/src/Generated/Security/SubjectRightsRequests/SubjectRightsRequestsRequestBuilder.php +++ b/src/Generated/Security/SubjectRightsRequests/SubjectRightsRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SubjectRightsRequest; use Microsoft\Graph\Generated\Models\SubjectRightsRequestCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get subjectRightsRequests from security * @param SubjectRightsRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubjectRightsRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to subjectRightsRequests for security * @param SubjectRightsRequest $body The request body * @param SubjectRightsRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SubjectRightsRequest $body, ?SubjectRightsRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubjectRightsRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?SubjectRightsRequestsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?SubjectRightsRequestsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(SubjectRightsRequest $body, ?SubjectRig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/ArticleIndicators/ArticleIndicatorsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/ArticleIndicators/ArticleIndicatorsRequestBuilder.php index 86e0ebb3e94..4a5c960197e 100644 --- a/src/Generated/Security/ThreatIntelligence/ArticleIndicators/ArticleIndicatorsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/ArticleIndicators/ArticleIndicatorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\ArticleIndicator; use Microsoft\Graph\Generated\Models\Security\ArticleIndicatorCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of an articleIndicator object. This API is available in the following national cloud deployments. * @param ArticleIndicatorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ArticleIndicatorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ArticleIndicatorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ArticleIndicatorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to articleIndicators for security * @param ArticleIndicator $body The request body * @param ArticleIndicatorsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ArticleIndicator $body, ?ArticleIndicatorsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ArticleIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ArticleIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ArticleIndicatorsRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ArticleIndicatorsRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ArticleIndicator $body, ?ArticleIndicat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/ArticleIndicators/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/ArticleIndicators/Count/CountRequestBuilder.php index 9cec23ca883..bf3dec98e7d 100644 --- a/src/Generated/Security/ThreatIntelligence/ArticleIndicators/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/ArticleIndicators/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/ArticleIndicators/Item/ArticleIndicatorItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/ArticleIndicators/Item/ArticleIndicatorItemRequestBuilder.php index 0af8ebe0637..0ec57488b0b 100644 --- a/src/Generated/Security/ThreatIntelligence/ArticleIndicators/Item/ArticleIndicatorItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/ArticleIndicators/Item/ArticleIndicatorItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\ArticleIndicator; use Microsoft\Graph\Generated\Security\ThreatIntelligence\ArticleIndicators\Item\Artifact\ArtifactRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property articleIndicators for security * @param ArticleIndicatorItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ArticleIndicatorItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an articleIndicator object. This API is available in the following national cloud deployments. * @param ArticleIndicatorItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-articleindicator-get?view=graph-rest-1.0 Find more info here */ public function get(?ArticleIndicatorItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ArticleIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ArticleIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property articleIndicators in security * @param ArticleIndicator $body The request body * @param ArticleIndicatorItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ArticleIndicator $body, ?ArticleIndicatorItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ArticleIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ArticleIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ArticleIndicatorItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ArticleIndicatorItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ArticleIndicatorItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ArticleIndicator $body, ?ArticleIndica $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/ArticleIndicators/Item/Artifact/ArtifactRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/ArticleIndicators/Item/Artifact/ArtifactRequestBuilder.php index f390dbad645..0329345fc84 100644 --- a/src/Generated/Security/ThreatIntelligence/ArticleIndicators/Item/Artifact/ArtifactRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/ArticleIndicators/Item/Artifact/ArtifactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Artifact; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The artifact related to this indicator. * @param ArtifactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ArtifactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Artifact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Artifact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ArtifactRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ArtifactRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Articles/ArticlesRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Articles/ArticlesRequestBuilder.php index d85e9ce6315..15cd43fd5f1 100644 --- a/src/Generated/Security/ThreatIntelligence/Articles/ArticlesRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Articles/ArticlesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Article; use Microsoft\Graph\Generated\Models\Security\ArticleCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of article objects, including their properties and relationships. This API is available in the following national cloud deployments. * @param ArticlesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-threatintelligence-list-articles?view=graph-rest-1.0 Find more info here */ public function get(?ArticlesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ArticleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ArticleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to articles for security * @param Article $body The request body * @param ArticlesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Article $body, ?ArticlesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Article::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Article::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ArticlesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ArticlesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Article $body, ?ArticlesRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Articles/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Articles/Count/CountRequestBuilder.php index 874420075bc..a5e55e7fdad 100644 --- a/src/Generated/Security/ThreatIntelligence/Articles/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Articles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Articles/Item/ArticleItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Articles/Item/ArticleItemRequestBuilder.php index e8a3de98cce..c3668a74b20 100644 --- a/src/Generated/Security/ThreatIntelligence/Articles/Item/ArticleItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Articles/Item/ArticleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Article; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Articles\Item\Indicators\IndicatorsRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property articles for security * @param ArticleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ArticleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of an article object. This API is available in the following national cloud deployments. * @param ArticleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-article-get?view=graph-rest-1.0 Find more info here */ public function get(?ArticleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Article::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Article::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property articles in security * @param Article $body The request body * @param ArticleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Article $body, ?ArticleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Article::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Article::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ArticleItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ArticleItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ArticleItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(Article $body, ?ArticleItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Articles/Item/Indicators/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Articles/Item/Indicators/Count/CountRequestBuilder.php index 9153bb51072..58c0e0ba016 100644 --- a/src/Generated/Security/ThreatIntelligence/Articles/Item/Indicators/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Articles/Item/Indicators/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Articles/Item/Indicators/IndicatorsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Articles/Item/Indicators/IndicatorsRequestBuilder.php index 06ca8f95abf..01018f78bef 100644 --- a/src/Generated/Security/ThreatIntelligence/Articles/Item/Indicators/IndicatorsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Articles/Item/Indicators/IndicatorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\ArticleIndicatorCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Articles\Item\Indicators\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of articleIndicator objects that represent indicators of threat or compromise related to the contents of an article. This API is available in the following national cloud deployments. * @param IndicatorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-article-list-indicators?view=graph-rest-1.0 Find more info here */ public function get(?IndicatorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ArticleIndicatorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ArticleIndicatorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?IndicatorsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?IndicatorsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Articles/Item/Indicators/Item/ArticleIndicatorItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Articles/Item/Indicators/Item/ArticleIndicatorItemRequestBuilder.php index 922cf881af7..2fccc0ab146 100644 --- a/src/Generated/Security/ThreatIntelligence/Articles/Item/Indicators/Item/ArticleIndicatorItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Articles/Item/Indicators/Item/ArticleIndicatorItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\ArticleIndicator; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Indicators related to this article. * @param ArticleIndicatorItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ArticleIndicatorItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ArticleIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ArticleIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ArticleIndicatorItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ArticleIndicatorItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostComponents/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostComponents/Count/CountRequestBuilder.php index 3298c99dcae..97aa3ccb39e 100644 --- a/src/Generated/Security/ThreatIntelligence/HostComponents/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostComponents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostComponents/HostComponentsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostComponents/HostComponentsRequestBuilder.php index 64dfc36a455..3193c3d1dd2 100644 --- a/src/Generated/Security/ThreatIntelligence/HostComponents/HostComponentsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostComponents/HostComponentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostComponent; use Microsoft\Graph\Generated\Models\Security\HostComponentCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a hostComponent object. This API is available in the following national cloud deployments. * @param HostComponentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostComponentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostComponentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostComponentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostComponents for security * @param HostComponent $body The request body * @param HostComponentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(HostComponent $body, ?HostComponentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostComponent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostComponent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?HostComponentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?HostComponentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(HostComponent $body, ?HostComponentsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostComponents/Item/Host/HostRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostComponents/Item/Host/HostRequestBuilder.php index c3f57904f30..ec9804d954a 100644 --- a/src/Generated/Security/ThreatIntelligence/HostComponents/Item/Host/HostRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostComponents/Item/Host/HostRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Host; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The host related to this component. This is a reverse navigation property. When navigating to components from a host, this should be assumed to be a return reference. * @param HostRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostComponents/Item/HostComponentItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostComponents/Item/HostComponentItemRequestBuilder.php index 0bb273c73f9..f3a33e7098b 100644 --- a/src/Generated/Security/ThreatIntelligence/HostComponents/Item/HostComponentItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostComponents/Item/HostComponentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostComponent; use Microsoft\Graph\Generated\Security\ThreatIntelligence\HostComponents\Item\Host\HostRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostComponents for security * @param HostComponentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?HostComponentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a hostComponent object. This API is available in the following national cloud deployments. * @param HostComponentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-hostcomponent-get?view=graph-rest-1.0 Find more info here */ public function get(?HostComponentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostComponent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostComponent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostComponents in security * @param HostComponent $body The request body * @param HostComponentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(HostComponent $body, ?HostComponentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostComponent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostComponent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?HostComponentItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?HostComponentItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?HostComponentItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(HostComponent $body, ?HostComponentIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostCookies/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostCookies/Count/CountRequestBuilder.php index 2904ac535b3..171016173e0 100644 --- a/src/Generated/Security/ThreatIntelligence/HostCookies/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostCookies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostCookies/HostCookiesRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostCookies/HostCookiesRequestBuilder.php index 8e422b07458..c7ce87cc8c7 100644 --- a/src/Generated/Security/ThreatIntelligence/HostCookies/HostCookiesRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostCookies/HostCookiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostCookie; use Microsoft\Graph\Generated\Models\Security\HostCookieCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a hostCookie object. This API is available in the following national cloud deployments. * @param HostCookiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostCookiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostCookieCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostCookieCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostCookies for security * @param HostCookie $body The request body * @param HostCookiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(HostCookie $body, ?HostCookiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostCookie::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostCookie::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?HostCookiesRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?HostCookiesRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(HostCookie $body, ?HostCookiesRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostCookies/Item/Host/HostRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostCookies/Item/Host/HostRequestBuilder.php index f8861f9240b..e1ecc6a1f3e 100644 --- a/src/Generated/Security/ThreatIntelligence/HostCookies/Item/Host/HostRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostCookies/Item/Host/HostRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Host; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Indicates that a cookie of this name and domain was found related to this host. * @param HostRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostCookies/Item/HostCookieItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostCookies/Item/HostCookieItemRequestBuilder.php index 6ba28acb9f1..7283d990e24 100644 --- a/src/Generated/Security/ThreatIntelligence/HostCookies/Item/HostCookieItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostCookies/Item/HostCookieItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostCookie; use Microsoft\Graph\Generated\Security\ThreatIntelligence\HostCookies\Item\Host\HostRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostCookies for security * @param HostCookieItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?HostCookieItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a hostCookie object. This API is available in the following national cloud deployments. * @param HostCookieItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-hostcookie-get?view=graph-rest-1.0 Find more info here */ public function get(?HostCookieItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostCookie::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostCookie::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostCookies in security * @param HostCookie $body The request body * @param HostCookieItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(HostCookie $body, ?HostCookieItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostCookie::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostCookie::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?HostCookieItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?HostCookieItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?HostCookieItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(HostCookie $body, ?HostCookieItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostPairs/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostPairs/Count/CountRequestBuilder.php index 7c13d8e52c7..c0db97435b2 100644 --- a/src/Generated/Security/ThreatIntelligence/HostPairs/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostPairs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostPairs/HostPairsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostPairs/HostPairsRequestBuilder.php index 70a91097e13..721a3844edc 100644 --- a/src/Generated/Security/ThreatIntelligence/HostPairs/HostPairsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostPairs/HostPairsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostPair; use Microsoft\Graph\Generated\Models\Security\HostPairCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a hostPair object. This API is available in the following national cloud deployments. * @param HostPairsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostPairsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostPairCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPairCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostPairs for security * @param HostPair $body The request body * @param HostPairsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(HostPair $body, ?HostPairsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostPair::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPair::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?HostPairsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?HostPairsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(HostPair $body, ?HostPairsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostPairs/Item/ChildHost/ChildHostRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostPairs/Item/ChildHost/ChildHostRequestBuilder.php index 485b9e00b37..3b790638cce 100644 --- a/src/Generated/Security/ThreatIntelligence/HostPairs/Item/ChildHost/ChildHostRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostPairs/Item/ChildHost/ChildHostRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Host; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Host reached via the parentHost. * @param ChildHostRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildHostRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ChildHostRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ChildHostRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostPairs/Item/HostPairItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostPairs/Item/HostPairItemRequestBuilder.php index cbf6d524f14..f71f6ad137f 100644 --- a/src/Generated/Security/ThreatIntelligence/HostPairs/Item/HostPairItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostPairs/Item/HostPairItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostPair; use Microsoft\Graph\Generated\Security\ThreatIntelligence\HostPairs\Item\ChildHost\ChildHostRequestBuilder; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostPairs for security * @param HostPairItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?HostPairItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a hostPair object. This API is available in the following national cloud deployments. * @param HostPairItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-hostpair-get?view=graph-rest-1.0 Find more info here */ public function get(?HostPairItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostPair::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPair::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostPairs in security * @param HostPair $body The request body * @param HostPairItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(HostPair $body, ?HostPairItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostPair::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPair::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?HostPairItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?HostPairItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?HostPairItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(HostPair $body, ?HostPairItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostPairs/Item/ParentHost/ParentHostRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostPairs/Item/ParentHost/ParentHostRequestBuilder.php index 4eea132a04f..dd53214684f 100644 --- a/src/Generated/Security/ThreatIntelligence/HostPairs/Item/ParentHost/ParentHostRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostPairs/Item/ParentHost/ParentHostRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Host; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Host used to reach the childHost. * @param ParentHostRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentHostRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentHostRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentHostRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Photos/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Count/CountRequestBuilder.php similarity index 80% rename from src/Generated/Groups/Item/Photos/Count/CountRequestBuilder.php rename to src/Generated/Security/ThreatIntelligence/HostPorts/Count/CountRequestBuilder.php index 2f53a041fd6..a3fb0b24e8f 100644 --- a/src/Generated/Groups/Item/Photos/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Count/CountRequestBuilder.php @@ -1,10 +1,9 @@ pathParameters = $pathParametersOrRawUrl; } else { @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Groups/Item/Photos/Count/CountRequestBuilderGetQueryParameters.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Count/CountRequestBuilderGetQueryParameters.php similarity index 55% rename from src/Generated/Groups/Item/Photos/Count/CountRequestBuilderGetQueryParameters.php rename to src/Generated/Security/ThreatIntelligence/HostPorts/Count/CountRequestBuilderGetQueryParameters.php index a7409f72837..7770545335f 100644 --- a/src/Generated/Groups/Item/Photos/Count/CountRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Count/CountRequestBuilderGetQueryParameters.php @@ -1,6 +1,6 @@ filter = $filter; + $this->search = $search; } } diff --git a/src/Generated/Groups/Item/Photos/Count/CountRequestBuilderGetRequestConfiguration.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Count/CountRequestBuilderGetRequestConfiguration.php similarity index 86% rename from src/Generated/Groups/Item/Photos/Count/CountRequestBuilderGetRequestConfiguration.php rename to src/Generated/Security/ThreatIntelligence/HostPorts/Count/CountRequestBuilderGetRequestConfiguration.php index 8760baf08e2..f879b8f97ae 100644 --- a/src/Generated/Groups/Item/Photos/Count/CountRequestBuilderGetRequestConfiguration.php +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Count/CountRequestBuilderGetRequestConfiguration.php @@ -1,6 +1,6 @@ pathParameters, $this->requestAdapter); + } + + /** + * Provides operations to manage the hostPorts property of the microsoft.graph.security.threatIntelligence entity. + * @param string $hostPortId The unique identifier of hostPort + * @return HostPortItemRequestBuilder + */ + public function byHostPortId(string $hostPortId): HostPortItemRequestBuilder { + $urlTplParams = $this->pathParameters; + $urlTplParams['hostPort%2Did'] = $hostPortId; + return new HostPortItemRequestBuilder($urlTplParams, $this->requestAdapter); + } + + /** + * Instantiates a new HostPortsRequestBuilder and sets the default values. + * @param array|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/security/threatIntelligence/hostPorts{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * Read the properties and relationships of a hostPort object. + * @param HostPortsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function get(?HostPortsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPortCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Create new navigation property to hostPorts for security + * @param HostPort $body The request body + * @param HostPortsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function post(HostPort $body, ?HostPortsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPort::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Read the properties and relationships of a hostPort object. + * @param HostPortsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?HostPortsRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + return $requestInfo; + } + + /** + * Create new navigation property to hostPorts for security + * @param HostPort $body The request body + * @param HostPortsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toPostRequestInformation(HostPort $body, ?HostPortsRequestBuilderPostRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::POST; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return HostPortsRequestBuilder + */ + public function withUrl(string $rawUrl): HostPortsRequestBuilder { + return new HostPortsRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/HostPortsRequestBuilderGetQueryParameters.php b/src/Generated/Security/ThreatIntelligence/HostPorts/HostPortsRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..492a7b35a77 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/HostPortsRequestBuilderGetQueryParameters.php @@ -0,0 +1,82 @@ +|null $expand Expand related entities + */ + public ?array $expand = null; + + /** + * @QueryParameter("%24filter") + * @var string|null $filter Filter items by property values + */ + public ?string $filter = null; + + /** + * @QueryParameter("%24orderby") + * @var array|null $orderby Order items by property values + */ + public ?array $orderby = null; + + /** + * @QueryParameter("%24search") + * @var string|null $search Search items by search phrases + */ + public ?string $search = null; + + /** + * @QueryParameter("%24select") + * @var array|null $select Select properties to be returned + */ + public ?array $select = null; + + /** + * @QueryParameter("%24skip") + * @var int|null $skip Skip the first n items + */ + public ?int $skip = null; + + /** + * @QueryParameter("%24top") + * @var int|null $top Show only the first n items + */ + public ?int $top = null; + + /** + * Instantiates a new hostPortsRequestBuilderGetQueryParameters and sets the default values. + * @param bool|null $count Include count of items + * @param array|null $expand Expand related entities + * @param string|null $filter Filter items by property values + * @param array|null $orderby Order items by property values + * @param string|null $search Search items by search phrases + * @param array|null $select Select properties to be returned + * @param int|null $skip Skip the first n items + * @param int|null $top Show only the first n items + */ + public function __construct(?bool $count = null, ?array $expand = null, ?string $filter = null, ?array $orderby = null, ?string $search = null, ?array $select = null, ?int $skip = null, ?int $top = null) { + $this->count = $count; + $this->expand = $expand; + $this->filter = $filter; + $this->orderby = $orderby; + $this->search = $search; + $this->select = $select; + $this->skip = $skip; + $this->top = $top; + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/HostPortsRequestBuilderGetRequestConfiguration.php b/src/Generated/Security/ThreatIntelligence/HostPorts/HostPortsRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..4faba153f01 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/HostPortsRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,45 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param HostPortsRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?HostPortsRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new hostPortsRequestBuilderGetQueryParameters. + * @param bool|null $count Include count of items + * @param array|null $expand Expand related entities + * @param string|null $filter Filter items by property values + * @param array|null $orderby Order items by property values + * @param string|null $search Search items by search phrases + * @param array|null $select Select properties to be returned + * @param int|null $skip Skip the first n items + * @param int|null $top Show only the first n items + * @return HostPortsRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?bool $count = null, ?array $expand = null, ?string $filter = null, ?array $orderby = null, ?string $search = null, ?array $select = null, ?int $skip = null, ?int $top = null): HostPortsRequestBuilderGetQueryParameters { + return new HostPortsRequestBuilderGetQueryParameters($count, $expand, $filter, $orderby, $search, $select, $skip, $top); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/HostPortsRequestBuilderPostRequestConfiguration.php b/src/Generated/Security/ThreatIntelligence/HostPorts/HostPortsRequestBuilderPostRequestConfiguration.php new file mode 100644 index 00000000000..af7f5b6eabf --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/HostPortsRequestBuilderPostRequestConfiguration.php @@ -0,0 +1,22 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + */ + public function __construct(?array $headers = null, ?array $options = null) { + parent::__construct($headers ?? [], $options ?? []); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/Item/Host/HostRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/Host/HostRequestBuilder.php new file mode 100644 index 00000000000..1ddc4b38b8b --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/Host/HostRequestBuilder.php @@ -0,0 +1,78 @@ +|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/security/threatIntelligence/hostPorts/{hostPort%2Did}/host{?%24select,%24expand}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * The host related to this hostPort. This is a reverse navigation property. When you navigate to hostPorts from a host, assume that this is a return reference. + * @param HostRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function get(?HostRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * The host related to this hostPort. This is a reverse navigation property. When you navigate to hostPorts from a host, assume that this is a return reference. + * @param HostRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?HostRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return HostRequestBuilder + */ + public function withUrl(string $rawUrl): HostRequestBuilder { + return new HostRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/Item/Host/HostRequestBuilderGetQueryParameters.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/Host/HostRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..0441ebcc4e4 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/Host/HostRequestBuilderGetQueryParameters.php @@ -0,0 +1,34 @@ +|null $expand Expand related entities + */ + public ?array $expand = null; + + /** + * @QueryParameter("%24select") + * @var array|null $select Select properties to be returned + */ + public ?array $select = null; + + /** + * Instantiates a new hostRequestBuilderGetQueryParameters and sets the default values. + * @param array|null $expand Expand related entities + * @param array|null $select Select properties to be returned + */ + public function __construct(?array $expand = null, ?array $select = null) { + $this->expand = $expand; + $this->select = $select; + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/Item/Host/HostRequestBuilderGetRequestConfiguration.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/Host/HostRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..5604a16abbd --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/Host/HostRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,39 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param HostRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?HostRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new hostRequestBuilderGetQueryParameters. + * @param array|null $expand Expand related entities + * @param array|null $select Select properties to be returned + * @return HostRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?array $expand = null, ?array $select = null): HostRequestBuilderGetQueryParameters { + return new HostRequestBuilderGetQueryParameters($expand, $select); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilder.php new file mode 100644 index 00000000000..c2b74cb4ae4 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilder.php @@ -0,0 +1,164 @@ +pathParameters, $this->requestAdapter); + } + + /** + * Provides operations to manage the mostRecentSslCertificate property of the microsoft.graph.security.hostPort entity. + */ + public function mostRecentSslCertificate(): MostRecentSslCertificateRequestBuilder { + return new MostRecentSslCertificateRequestBuilder($this->pathParameters, $this->requestAdapter); + } + + /** + * Instantiates a new HostPortItemRequestBuilder and sets the default values. + * @param array|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/security/threatIntelligence/hostPorts/{hostPort%2Did}{?%24select,%24expand}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * Delete navigation property hostPorts for security + * @param HostPortItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function delete(?HostPortItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); + } + + /** + * Read the properties and relationships of a hostPort object. + * @param HostPortItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/security-hostport-get?view=graph-rest-1.0 Find more info here + */ + public function get(?HostPortItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPort::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Update the navigation property hostPorts in security + * @param HostPort $body The request body + * @param HostPortItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function patch(HostPort $body, ?HostPortItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPort::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Delete navigation property hostPorts for security + * @param HostPortItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toDeleteRequestInformation(?HostPortItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::DELETE; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + return $requestInfo; + } + + /** + * Read the properties and relationships of a hostPort object. + * @param HostPortItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?HostPortItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + return $requestInfo; + } + + /** + * Update the navigation property hostPorts in security + * @param HostPort $body The request body + * @param HostPortItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toPatchRequestInformation(HostPort $body, ?HostPortItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::PATCH; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return HostPortItemRequestBuilder + */ + public function withUrl(string $rawUrl): HostPortItemRequestBuilder { + return new HostPortItemRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderDeleteRequestConfiguration.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderDeleteRequestConfiguration.php new file mode 100644 index 00000000000..5eaf7cdefb3 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderDeleteRequestConfiguration.php @@ -0,0 +1,22 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + */ + public function __construct(?array $headers = null, ?array $options = null) { + parent::__construct($headers ?? [], $options ?? []); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderGetQueryParameters.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..72b08f41d06 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderGetQueryParameters.php @@ -0,0 +1,34 @@ +|null $expand Expand related entities + */ + public ?array $expand = null; + + /** + * @QueryParameter("%24select") + * @var array|null $select Select properties to be returned + */ + public ?array $select = null; + + /** + * Instantiates a new HostPortItemRequestBuilderGetQueryParameters and sets the default values. + * @param array|null $expand Expand related entities + * @param array|null $select Select properties to be returned + */ + public function __construct(?array $expand = null, ?array $select = null) { + $this->expand = $expand; + $this->select = $select; + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderGetRequestConfiguration.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..a671e5cecc1 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,39 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param HostPortItemRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?HostPortItemRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new HostPortItemRequestBuilderGetQueryParameters. + * @param array|null $expand Expand related entities + * @param array|null $select Select properties to be returned + * @return HostPortItemRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?array $expand = null, ?array $select = null): HostPortItemRequestBuilderGetQueryParameters { + return new HostPortItemRequestBuilderGetQueryParameters($expand, $select); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderPatchRequestConfiguration.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderPatchRequestConfiguration.php new file mode 100644 index 00000000000..e61d423d713 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/HostPortItemRequestBuilderPatchRequestConfiguration.php @@ -0,0 +1,22 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + */ + public function __construct(?array $headers = null, ?array $options = null) { + parent::__construct($headers ?? [], $options ?? []); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/Item/MostRecentSslCertificate/MostRecentSslCertificateRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/MostRecentSslCertificate/MostRecentSslCertificateRequestBuilder.php new file mode 100644 index 00000000000..043dd3de4af --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/MostRecentSslCertificate/MostRecentSslCertificateRequestBuilder.php @@ -0,0 +1,78 @@ +|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/security/threatIntelligence/hostPorts/{hostPort%2Did}/mostRecentSslCertificate{?%24select,%24expand}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * The most recent sslCertificate used to communicate on the port. + * @param MostRecentSslCertificateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function get(?MostRecentSslCertificateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * The most recent sslCertificate used to communicate on the port. + * @param MostRecentSslCertificateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?MostRecentSslCertificateRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return MostRecentSslCertificateRequestBuilder + */ + public function withUrl(string $rawUrl): MostRecentSslCertificateRequestBuilder { + return new MostRecentSslCertificateRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/Item/MostRecentSslCertificate/MostRecentSslCertificateRequestBuilderGetQueryParameters.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/MostRecentSslCertificate/MostRecentSslCertificateRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..0b6a3cf0e25 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/MostRecentSslCertificate/MostRecentSslCertificateRequestBuilderGetQueryParameters.php @@ -0,0 +1,34 @@ +|null $expand Expand related entities + */ + public ?array $expand = null; + + /** + * @QueryParameter("%24select") + * @var array|null $select Select properties to be returned + */ + public ?array $select = null; + + /** + * Instantiates a new mostRecentSslCertificateRequestBuilderGetQueryParameters and sets the default values. + * @param array|null $expand Expand related entities + * @param array|null $select Select properties to be returned + */ + public function __construct(?array $expand = null, ?array $select = null) { + $this->expand = $expand; + $this->select = $select; + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostPorts/Item/MostRecentSslCertificate/MostRecentSslCertificateRequestBuilderGetRequestConfiguration.php b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/MostRecentSslCertificate/MostRecentSslCertificateRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..4eb0b429764 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/HostPorts/Item/MostRecentSslCertificate/MostRecentSslCertificateRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,39 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param MostRecentSslCertificateRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?MostRecentSslCertificateRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new mostRecentSslCertificateRequestBuilderGetQueryParameters. + * @param array|null $expand Expand related entities + * @param array|null $select Select properties to be returned + * @return MostRecentSslCertificateRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?array $expand = null, ?array $select = null): MostRecentSslCertificateRequestBuilderGetQueryParameters { + return new MostRecentSslCertificateRequestBuilderGetQueryParameters($expand, $select); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Count/CountRequestBuilder.php index ae6d3d003cc..d743afd3658 100644 --- a/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostSslCertificates/HostSslCertificatesRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostSslCertificates/HostSslCertificatesRequestBuilder.php index d53abed75f1..16a07041012 100644 --- a/src/Generated/Security/ThreatIntelligence/HostSslCertificates/HostSslCertificatesRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostSslCertificates/HostSslCertificatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostSslCertificate; use Microsoft\Graph\Generated\Models\Security\HostSslCertificateCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the properties and relationships of a hostSslCertificate object. This API is available in the following national cloud deployments. * @param HostSslCertificatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostSslCertificatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostSslCertificateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostSslCertificateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostSslCertificates for security * @param HostSslCertificate $body The request body * @param HostSslCertificatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(HostSslCertificate $body, ?HostSslCertificatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostSslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostSslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?HostSslCertificatesRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?HostSslCertificatesRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(HostSslCertificate $body, ?HostSslCerti $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Item/Host/HostRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Item/Host/HostRequestBuilder.php index 51562ee86f3..7836fdcf4d6 100644 --- a/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Item/Host/HostRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Item/Host/HostRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Host; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The host for this hostSslCertificate. * @param HostRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Item/HostSslCertificateItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Item/HostSslCertificateItemRequestBuilder.php index 0834383f643..4490484197a 100644 --- a/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Item/HostSslCertificateItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Item/HostSslCertificateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostSslCertificate; use Microsoft\Graph\Generated\Security\ThreatIntelligence\HostSslCertificates\Item\Host\HostRequestBuilder; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostSslCertificates for security * @param HostSslCertificateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?HostSslCertificateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a hostSslCertificate object. This API is available in the following national cloud deployments. * @param HostSslCertificateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-hostsslcertificate-get?view=graph-rest-1.0 Find more info here */ public function get(?HostSslCertificateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostSslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostSslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostSslCertificates in security * @param HostSslCertificate $body The request body * @param HostSslCertificateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(HostSslCertificate $body, ?HostSslCertificateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostSslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostSslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?HostSslCertificateItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?HostSslCertificateItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?HostSslCertificateItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(HostSslCertificate $body, ?HostSslCert $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Item/SslCertificate/SslCertificateRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Item/SslCertificate/SslCertificateRequestBuilder.php index 8ed65568591..1e431589f07 100644 --- a/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Item/SslCertificate/SslCertificateRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostSslCertificates/Item/SslCertificate/SslCertificateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\SslCertificate; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The sslCertificate for this hostSslCertificate. * @param SslCertificateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SslCertificateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SslCertificateRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SslCertificateRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostTrackers/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostTrackers/Count/CountRequestBuilder.php index 9d46a0ce249..6a191e414ea 100644 --- a/src/Generated/Security/ThreatIntelligence/HostTrackers/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostTrackers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostTrackers/HostTrackersRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostTrackers/HostTrackersRequestBuilder.php index 9e2dee06a6e..ae6fb0a14b7 100644 --- a/src/Generated/Security/ThreatIntelligence/HostTrackers/HostTrackersRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostTrackers/HostTrackersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostTracker; use Microsoft\Graph\Generated\Models\Security\HostTrackerCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a hostTracker object. This API is available in the following national cloud deployments. * @param HostTrackersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostTrackersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostTrackerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostTrackerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostTrackers for security * @param HostTracker $body The request body * @param HostTrackersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(HostTracker $body, ?HostTrackersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostTracker::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostTracker::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?HostTrackersRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?HostTrackersRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(HostTracker $body, ?HostTrackersRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostTrackers/Item/Host/HostRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostTrackers/Item/Host/HostRequestBuilder.php index 134dd7ffe51..2a16f9bf5bb 100644 --- a/src/Generated/Security/ThreatIntelligence/HostTrackers/Item/Host/HostRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostTrackers/Item/Host/HostRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Host; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The host related to this hostTracker. When navigating to a hostTracker from a host, this should be assumed to be a return reference. * @param HostRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/HostTrackers/Item/HostTrackerItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/HostTrackers/Item/HostTrackerItemRequestBuilder.php index f455cf3687d..a9a3a633e4e 100644 --- a/src/Generated/Security/ThreatIntelligence/HostTrackers/Item/HostTrackerItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/HostTrackers/Item/HostTrackerItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostTracker; use Microsoft\Graph\Generated\Security\ThreatIntelligence\HostTrackers\Item\Host\HostRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostTrackers for security * @param HostTrackerItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?HostTrackerItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a hostTracker object. This API is available in the following national cloud deployments. * @param HostTrackerItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-hosttracker-get?view=graph-rest-1.0 Find more info here */ public function get(?HostTrackerItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostTracker::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostTracker::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostTrackers in security * @param HostTracker $body The request body * @param HostTrackerItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(HostTracker $body, ?HostTrackerItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostTracker::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostTracker::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?HostTrackerItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?HostTrackerItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?HostTrackerItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(HostTracker $body, ?HostTrackerItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Count/CountRequestBuilder.php index a8d63b1fe31..5e10537c914 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/HostsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/HostsRequestBuilder.php index cea98e1d83d..539a345dc64 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/HostsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/HostsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Host; use Microsoft\Graph\Generated\Models\Security\HostCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a host object. The host resource is the abstract base type that returns an implementation. A host can be of one of the following types: This API is available in the following national cloud deployments. * @param HostsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hosts for security * @param Host $body The request body * @param HostsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Host $body, ?HostsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?HostsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?HostsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Host $body, ?HostsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/ChildHostPairsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/ChildHostPairsRequestBuilder.php index 000e7d1b537..5e387f00420 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/ChildHostPairsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/ChildHostPairsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostPairCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\ChildHostPairs\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of hostPair resources associated with a host, where that host is the *parent* and has an outgoing pairing to a *child*. This API is available in the following national cloud deployments. * @param ChildHostPairsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-host-list-childhostpairs?view=graph-rest-1.0 Find more info here */ public function get(?ChildHostPairsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostPairCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPairCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?ChildHostPairsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?ChildHostPairsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/Count/CountRequestBuilder.php index 92fce89a438..9311f35a552 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/Item/HostPairItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/Item/HostPairItemRequestBuilder.php index 7b32a50303e..c0b16d9f0c8 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/Item/HostPairItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/Item/HostPairItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostPair; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,25 +31,22 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * The hostPairs that are resources associated with a host, where that host is the parentHost and has an outgoing pairing to a cihldHost. + * The hostPairs that are resources associated with a host, where that host is the parentHost and has an outgoing pairing to a childHost. * @param HostPairItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostPairItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostPair::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPair::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * The hostPairs that are resources associated with a host, where that host is the parentHost and has an outgoing pairing to a cihldHost. + * The hostPairs that are resources associated with a host, where that host is the parentHost and has an outgoing pairing to a childHost. * @param HostPairItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostPairItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostPairItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/Item/HostPairItemRequestBuilderGetQueryParameters.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/Item/HostPairItemRequestBuilderGetQueryParameters.php index 65840390440..faf3fcfa6f4 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/Item/HostPairItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ChildHostPairs/Item/HostPairItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * The hostPairs that are resources associated with a host, where that host is the parentHost and has an outgoing pairing to a cihldHost. + * The hostPairs that are resources associated with a host, where that host is the parentHost and has an outgoing pairing to a childHost. */ class HostPairItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Components/ComponentsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Components/ComponentsRequestBuilder.php index 3bc9eeb0a10..8f23309c693 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Components/ComponentsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Components/ComponentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostComponentCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\Components\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of hostComponent resources. This API is available in the following national cloud deployments. * @param ComponentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-host-list-components?view=graph-rest-1.0 Find more info here */ public function get(?ComponentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostComponentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostComponentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?ComponentsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?ComponentsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Components/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Components/Count/CountRequestBuilder.php index f6f06c7c891..a402ea3d584 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Components/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Components/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Components/Item/HostComponentItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Components/Item/HostComponentItemRequestBuilder.php index e78e3c9eb78..bd77aeeb351 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Components/Item/HostComponentItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Components/Item/HostComponentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostComponent; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The hostComponents that are associated with this host. * @param HostComponentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostComponentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostComponent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostComponent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostComponentItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostComponentItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Cookies/CookiesRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Cookies/CookiesRequestBuilder.php index ea293cd41f5..4a37c419408 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Cookies/CookiesRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Cookies/CookiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostCookieCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\Cookies\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of hostCookie resources. This API is available in the following national cloud deployments. * @param CookiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-host-list-cookies?view=graph-rest-1.0 Find more info here */ public function get(?CookiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostCookieCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostCookieCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?CookiesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?CookiesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Cookies/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Cookies/Count/CountRequestBuilder.php index 02c150168ef..31818076eca 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Cookies/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Cookies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Cookies/Item/HostCookieItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Cookies/Item/HostCookieItemRequestBuilder.php index f7b5279703f..c6699136e36 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Cookies/Item/HostCookieItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Cookies/Item/HostCookieItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostCookie; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The hostCookies that are associated with this host. * @param HostCookieItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostCookieItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostCookie::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostCookie::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostCookieItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostCookieItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostItemRequestBuilder.php index 30b21328396..bbba9fdb08f 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Host; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\ChildHostPairs\ChildHostPairsRequestBuilder; @@ -14,6 +13,7 @@ use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\ParentHostPairs\ParentHostPairsRequestBuilder; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\PassiveDns\PassiveDnsRequestBuilder; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\PassiveDnsReverse\PassiveDnsReverseRequestBuilder; +use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\Ports\PortsRequestBuilder; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\Reputation\ReputationRequestBuilder; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\SslCertificates\SslCertificatesRequestBuilder; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\Subdomains\SubdomainsRequestBuilder; @@ -78,6 +78,13 @@ public function passiveDnsReverse(): PassiveDnsReverseRequestBuilder { return new PassiveDnsReverseRequestBuilder($this->pathParameters, $this->requestAdapter); } + /** + * Provides operations to manage the ports property of the microsoft.graph.security.host entity. + */ + public function ports(): PortsRequestBuilder { + return new PortsRequestBuilder($this->pathParameters, $this->requestAdapter); + } + /** * Provides operations to manage the reputation property of the microsoft.graph.security.host entity. */ @@ -130,57 +137,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hosts for security * @param HostItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?HostItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a host object. The host resource is the abstract base type that returns an implementation. A host can be of one of the following types: This API is available in the following national cloud deployments. * @param HostItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-host-get?view=graph-rest-1.0 Find more info here */ public function get(?HostItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hosts in security * @param Host $body The request body * @param HostItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Host $body, ?HostItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -197,6 +195,7 @@ public function toDeleteRequestInformation(?HostItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -210,7 +209,6 @@ public function toGetRequestInformation(?HostItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -218,6 +216,7 @@ public function toGetRequestInformation(?HostItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -232,11 +231,11 @@ public function toPatchRequestInformation(Host $body, ?HostItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostPairs/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostPairs/Count/CountRequestBuilder.php index 9e780ff5662..c9e4237bcc6 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostPairs/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostPairs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostPairs/HostPairsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostPairs/HostPairsRequestBuilder.php index 500db46df41..c4641e32b80 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostPairs/HostPairsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostPairs/HostPairsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostPairCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\HostPairs\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of hostPair resources associated with a host, where that host is *either* the *parent* or the *child*. This API is available in the following national cloud deployments. * @param HostPairsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-host-list-hostpairs?view=graph-rest-1.0 Find more info here */ public function get(?HostPairsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostPairCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPairCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?HostPairsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?HostPairsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostPairs/Item/HostPairItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostPairs/Item/HostPairItemRequestBuilder.php index 32c8ebb6bf6..99fdd7e84d2 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostPairs/Item/HostPairItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/HostPairs/Item/HostPairItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostPair; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The hostPairs that are associated with this host, where this host is either the parentHost or childHost. * @param HostPairItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostPairItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostPair::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPair::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostPairItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostPairItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ParentHostPairs/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ParentHostPairs/Count/CountRequestBuilder.php index 47cffd1c435..6e6822fb813 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ParentHostPairs/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ParentHostPairs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ParentHostPairs/Item/HostPairItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ParentHostPairs/Item/HostPairItemRequestBuilder.php index 92c200f6708..a787bfd2fc4 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ParentHostPairs/Item/HostPairItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ParentHostPairs/Item/HostPairItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostPair; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The hostPairs that are associated with a host, where that host is the childHost and has an incoming pairing with a parentHost. * @param HostPairItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostPairItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostPair::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPair::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostPairItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostPairItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ParentHostPairs/ParentHostPairsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ParentHostPairs/ParentHostPairsRequestBuilder.php index cd1879e544a..4971c8aac81 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/ParentHostPairs/ParentHostPairsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/ParentHostPairs/ParentHostPairsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostPairCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\ParentHostPairs\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of hostPair resources associated with a host, where that host is the *child* and has an incoming pairing with a *parent*. This API is available in the following national cloud deployments. * @param ParentHostPairsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-host-list-parenthostpairs?view=graph-rest-1.0 Find more info here */ public function get(?ParentHostPairsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostPairCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPairCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?ParentHostPairsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?ParentHostPairsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDns/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDns/Count/CountRequestBuilder.php index 263c942ca4b..380a83062c8 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDns/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDns/Item/PassiveDnsRecordItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDns/Item/PassiveDnsRecordItemRequestBuilder.php index 0a9f215fbd0..e76c9f55080 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDns/Item/PassiveDnsRecordItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDns/Item/PassiveDnsRecordItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\PassiveDnsRecord; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Passive DNS retrieval about this host. * @param PassiveDnsRecordItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PassiveDnsRecordItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PassiveDnsRecordItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PassiveDnsRecordItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDns/PassiveDnsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDns/PassiveDnsRequestBuilder.php index d14f20e0d30..39c81e6d66f 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDns/PassiveDnsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDns/PassiveDnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\PassiveDnsRecordCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\PassiveDns\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of passiveDnsRecord resources associated with a host. This is a forward DNS lookup which queries the IP address of the specified host using its hostname. This API is available in the following national cloud deployments. * @param PassiveDnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-host-list-passivedns?view=graph-rest-1.0 Find more info here */ public function get(?PassiveDnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?PassiveDnsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?PassiveDnsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDnsReverse/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDnsReverse/Count/CountRequestBuilder.php index a6a29fea8c0..fbe690a6fdc 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDnsReverse/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDnsReverse/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDnsReverse/Item/PassiveDnsRecordItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDnsReverse/Item/PassiveDnsRecordItemRequestBuilder.php index 5b10a9461cc..18b341655d3 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDnsReverse/Item/PassiveDnsRecordItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDnsReverse/Item/PassiveDnsRecordItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\PassiveDnsRecord; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reverse passive DNS retrieval about this host. * @param PassiveDnsRecordItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PassiveDnsRecordItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PassiveDnsRecordItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PassiveDnsRecordItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDnsReverse/PassiveDnsReverseRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDnsReverse/PassiveDnsReverseRequestBuilder.php index 3f89a21d3ef..41a8288e632 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDnsReverse/PassiveDnsReverseRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/PassiveDnsReverse/PassiveDnsReverseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\PassiveDnsRecordCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\PassiveDnsReverse\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a collection of passiveDnsRecord resources from a reverse passive DNS retrieval. A reverse DNS lookup queries the hostname of a host using an IP address. This API is available in the following national cloud deployments. * @param PassiveDnsReverseRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-host-list-passivednsreverse?view=graph-rest-1.0 Find more info here */ public function get(?PassiveDnsReverseRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?PassiveDnsReverseRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?PassiveDnsReverseRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Count/CountRequestBuilder.php new file mode 100644 index 00000000000..496ee7d9edd --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Count/CountRequestBuilder.php @@ -0,0 +1,79 @@ +|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/security/threatIntelligence/hosts/{host%2Did}/ports/$count{?%24search,%24filter}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * Get the number of the resource + * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; + } + + /** + * Get the number of the resource + * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return CountRequestBuilder + */ + public function withUrl(string $rawUrl): CountRequestBuilder { + return new CountRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Count/CountRequestBuilderGetQueryParameters.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Count/CountRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..5cb248d5e92 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Count/CountRequestBuilderGetQueryParameters.php @@ -0,0 +1,34 @@ +filter = $filter; + $this->search = $search; + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Count/CountRequestBuilderGetRequestConfiguration.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Count/CountRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..ab780ed7866 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Count/CountRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,39 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param CountRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?CountRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new CountRequestBuilderGetQueryParameters. + * @param string|null $filter Filter items by property values + * @param string|null $search Search items by search phrases + * @return CountRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?string $filter = null, ?string $search = null): CountRequestBuilderGetQueryParameters { + return new CountRequestBuilderGetQueryParameters($filter, $search); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Item/HostPortItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Item/HostPortItemRequestBuilder.php new file mode 100644 index 00000000000..82478c0e6e3 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Item/HostPortItemRequestBuilder.php @@ -0,0 +1,78 @@ +|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/security/threatIntelligence/hosts/{host%2Did}/ports/{hostPort%2Did}{?%24select,%24expand}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * The hostPorts associated with a host. + * @param HostPortItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function get(?HostPortItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPort::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * The hostPorts associated with a host. + * @param HostPortItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?HostPortItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return HostPortItemRequestBuilder + */ + public function withUrl(string $rawUrl): HostPortItemRequestBuilder { + return new HostPortItemRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Item/HostPortItemRequestBuilderGetQueryParameters.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Item/HostPortItemRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..ecbe6b64877 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Item/HostPortItemRequestBuilderGetQueryParameters.php @@ -0,0 +1,34 @@ +|null $expand Expand related entities + */ + public ?array $expand = null; + + /** + * @QueryParameter("%24select") + * @var array|null $select Select properties to be returned + */ + public ?array $select = null; + + /** + * Instantiates a new HostPortItemRequestBuilderGetQueryParameters and sets the default values. + * @param array|null $expand Expand related entities + * @param array|null $select Select properties to be returned + */ + public function __construct(?array $expand = null, ?array $select = null) { + $this->expand = $expand; + $this->select = $select; + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Item/HostPortItemRequestBuilderGetRequestConfiguration.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Item/HostPortItemRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..45919fec1d2 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/Item/HostPortItemRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,39 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param HostPortItemRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?HostPortItemRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new HostPortItemRequestBuilderGetQueryParameters. + * @param array|null $expand Expand related entities + * @param array|null $select Select properties to be returned + * @return HostPortItemRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?array $expand = null, ?array $select = null): HostPortItemRequestBuilderGetQueryParameters { + return new HostPortItemRequestBuilderGetQueryParameters($expand, $select); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/PortsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/PortsRequestBuilder.php new file mode 100644 index 00000000000..51b48f8306f --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/PortsRequestBuilder.php @@ -0,0 +1,99 @@ +pathParameters, $this->requestAdapter); + } + + /** + * Provides operations to manage the ports property of the microsoft.graph.security.host entity. + * @param string $hostPortId The unique identifier of hostPort + * @return HostPortItemRequestBuilder + */ + public function byHostPortId(string $hostPortId): HostPortItemRequestBuilder { + $urlTplParams = $this->pathParameters; + $urlTplParams['hostPort%2Did'] = $hostPortId; + return new HostPortItemRequestBuilder($urlTplParams, $this->requestAdapter); + } + + /** + * Instantiates a new PortsRequestBuilder and sets the default values. + * @param array|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/security/threatIntelligence/hosts/{host%2Did}/ports{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * Get the list of hostPort resources associated with a host. + * @param PortsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/security-host-list-ports?view=graph-rest-1.0 Find more info here + */ + public function get(?PortsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostPortCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Get the list of hostPort resources associated with a host. + * @param PortsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?PortsRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return PortsRequestBuilder + */ + public function withUrl(string $rawUrl): PortsRequestBuilder { + return new PortsRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/PortsRequestBuilderGetQueryParameters.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/PortsRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..c54752172b6 --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/PortsRequestBuilderGetQueryParameters.php @@ -0,0 +1,82 @@ +|null $expand Expand related entities + */ + public ?array $expand = null; + + /** + * @QueryParameter("%24filter") + * @var string|null $filter Filter items by property values + */ + public ?string $filter = null; + + /** + * @QueryParameter("%24orderby") + * @var array|null $orderby Order items by property values + */ + public ?array $orderby = null; + + /** + * @QueryParameter("%24search") + * @var string|null $search Search items by search phrases + */ + public ?string $search = null; + + /** + * @QueryParameter("%24select") + * @var array|null $select Select properties to be returned + */ + public ?array $select = null; + + /** + * @QueryParameter("%24skip") + * @var int|null $skip Skip the first n items + */ + public ?int $skip = null; + + /** + * @QueryParameter("%24top") + * @var int|null $top Show only the first n items + */ + public ?int $top = null; + + /** + * Instantiates a new portsRequestBuilderGetQueryParameters and sets the default values. + * @param bool|null $count Include count of items + * @param array|null $expand Expand related entities + * @param string|null $filter Filter items by property values + * @param array|null $orderby Order items by property values + * @param string|null $search Search items by search phrases + * @param array|null $select Select properties to be returned + * @param int|null $skip Skip the first n items + * @param int|null $top Show only the first n items + */ + public function __construct(?bool $count = null, ?array $expand = null, ?string $filter = null, ?array $orderby = null, ?string $search = null, ?array $select = null, ?int $skip = null, ?int $top = null) { + $this->count = $count; + $this->expand = $expand; + $this->filter = $filter; + $this->orderby = $orderby; + $this->search = $search; + $this->select = $select; + $this->skip = $skip; + $this->top = $top; + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/PortsRequestBuilderGetRequestConfiguration.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/PortsRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..6b76656a4dc --- /dev/null +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Ports/PortsRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,45 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param PortsRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?PortsRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new portsRequestBuilderGetQueryParameters. + * @param bool|null $count Include count of items + * @param array|null $expand Expand related entities + * @param string|null $filter Filter items by property values + * @param array|null $orderby Order items by property values + * @param string|null $search Search items by search phrases + * @param array|null $select Select properties to be returned + * @param int|null $skip Skip the first n items + * @param int|null $top Show only the first n items + * @return PortsRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?bool $count = null, ?array $expand = null, ?string $filter = null, ?array $orderby = null, ?string $search = null, ?array $select = null, ?int $skip = null, ?int $top = null): PortsRequestBuilderGetQueryParameters { + return new PortsRequestBuilderGetQueryParameters($count, $expand, $filter, $orderby, $search, $select, $skip, $top); + } + +} diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Reputation/ReputationRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Reputation/ReputationRequestBuilder.php index 15880a3ae4f..738f9e06bc3 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Reputation/ReputationRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Reputation/ReputationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostReputation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property reputation for security * @param ReputationRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ReputationRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a hostReputation object. This API is available in the following national cloud deployments. * @param ReputationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-host-get-reputation?view=graph-rest-1.0 Find more info here */ public function get(?ReputationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostReputation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostReputation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property reputation in security * @param HostReputation $body The request body * @param ReputationRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(HostReputation $body, ?ReputationRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostReputation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostReputation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ReputationRequestBuilderDeleteReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ReputationRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ReputationRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(HostReputation $body, ?ReputationReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/SslCertificates/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/SslCertificates/Count/CountRequestBuilder.php index f53cb167378..9e83806a49b 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/SslCertificates/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/SslCertificates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/SslCertificates/Item/HostSslCertificateItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/SslCertificates/Item/HostSslCertificateItemRequestBuilder.php index 5f40d6a9a5c..a672e0deab4 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/SslCertificates/Item/HostSslCertificateItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/SslCertificates/Item/HostSslCertificateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostSslCertificate; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The hostSslCertificates that are associated with this host. * @param HostSslCertificateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostSslCertificateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostSslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostSslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostSslCertificateItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostSslCertificateItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/SslCertificates/SslCertificatesRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/SslCertificates/SslCertificatesRequestBuilder.php index 961f3aa9517..d588385ad8c 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/SslCertificates/SslCertificatesRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/SslCertificates/SslCertificatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostSslCertificateCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\SslCertificates\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of hostSslCertificate objects from the host navigation property. This API is available in the following national cloud deployments. * @param SslCertificatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-host-list-sslcertificates?view=graph-rest-1.0 Find more info here */ public function get(?SslCertificatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostSslCertificateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostSslCertificateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SslCertificatesRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SslCertificatesRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Subdomains/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Subdomains/Count/CountRequestBuilder.php index 4deabc39ead..2aeadbbcba6 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Subdomains/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Subdomains/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Subdomains/Item/SubdomainItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Subdomains/Item/SubdomainItemRequestBuilder.php index f75e05d17d3..05ca9e0e539 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Subdomains/Item/SubdomainItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Subdomains/Item/SubdomainItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Subdomain; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The subdomains that are associated with this host. * @param SubdomainItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubdomainItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subdomain::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subdomain::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SubdomainItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SubdomainItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Subdomains/SubdomainsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Subdomains/SubdomainsRequestBuilder.php index d7ba3996c27..8b95a836246 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Subdomains/SubdomainsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Subdomains/SubdomainsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\SubdomainCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\Subdomains\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of subdomain resources associated with a host. This API is available in the following national cloud deployments. * @param SubdomainsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-host-list-subdomains?view=graph-rest-1.0 Find more info here */ public function get(?SubdomainsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubdomainCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubdomainCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SubdomainsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SubdomainsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Trackers/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Trackers/Count/CountRequestBuilder.php index df2f8227a21..b67b4117788 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Trackers/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Trackers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Trackers/Item/HostTrackerItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Trackers/Item/HostTrackerItemRequestBuilder.php index 11543a9931a..87bfa20c1b2 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Trackers/Item/HostTrackerItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Trackers/Item/HostTrackerItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostTracker; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The hostTrackers that are associated with this host. * @param HostTrackerItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostTrackerItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostTracker::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostTracker::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostTrackerItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostTrackerItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Trackers/TrackersRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Trackers/TrackersRequestBuilder.php index 26d92842c6b..8864590290b 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Trackers/TrackersRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Trackers/TrackersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostTrackerCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\Item\Trackers\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of hostTracker resources. This API is available in the following national cloud deployments. * @param TrackersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-host-list-trackers?view=graph-rest-1.0 Find more info here */ public function get(?TrackersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostTrackerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostTrackerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?TrackersRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?TrackersRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Whois/WhoisRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Whois/WhoisRequestBuilder.php index 184d50e9d22..5cc0f449336 100644 --- a/src/Generated/Security/ThreatIntelligence/Hosts/Item/Whois/WhoisRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Hosts/Item/Whois/WhoisRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\WhoisRecord; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the specified whoisRecord resource. Specify the desired whoisRecord in one of the following two ways:- Identify a host and get its current whoisRecord. - Specify an id value to get the corresponding whoisRecord. This API is available in the following national cloud deployments. * @param WhoisRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-whoisrecord-get?view=graph-rest-1.0 Find more info here */ public function get(?WhoisRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WhoisRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WhoisRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?WhoisRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?WhoisRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/IntelProfiles/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/IntelProfiles/Count/CountRequestBuilder.php index e40ab30f8ce..f7b543a5b87 100644 --- a/src/Generated/Security/ThreatIntelligence/IntelProfiles/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/IntelProfiles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/IntelProfiles/IntelProfilesRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/IntelProfiles/IntelProfilesRequestBuilder.php index 8749f58e5ea..84ccc5f3d0b 100644 --- a/src/Generated/Security/ThreatIntelligence/IntelProfiles/IntelProfilesRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/IntelProfiles/IntelProfilesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\IntelligenceProfile; use Microsoft\Graph\Generated\Models\Security\IntelligenceProfileCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the intelligenceProfile objects and their properties. This API is available in the following national cloud deployments. * @param IntelProfilesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-threatintelligence-list-intelprofiles?view=graph-rest-1.0 Find more info here */ public function get(?IntelProfilesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to intelProfiles for security * @param IntelligenceProfile $body The request body * @param IntelProfilesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IntelligenceProfile $body, ?IntelProfilesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?IntelProfilesRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?IntelProfilesRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(IntelligenceProfile $body, ?IntelProfil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/Indicators/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/Indicators/Count/CountRequestBuilder.php index ff479f76316..d48ba6390bd 100644 --- a/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/Indicators/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/Indicators/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/Indicators/IndicatorsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/Indicators/IndicatorsRequestBuilder.php index 785c36d9768..91805de0d86 100644 --- a/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/Indicators/IndicatorsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/Indicators/IndicatorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\IntelligenceProfileIndicatorCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\IntelProfiles\Item\Indicators\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the intelligenceProfileIndicator resources from the indicators navigation property of an intelligenceProfile. This API is available in the following national cloud deployments. * @param IndicatorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-intelligenceprofile-list-indicators?view=graph-rest-1.0 Find more info here */ public function get(?IndicatorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileIndicatorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileIndicatorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?IndicatorsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?IndicatorsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/Indicators/Item/IntelligenceProfileIndicatorItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/Indicators/Item/IntelligenceProfileIndicatorItemRequestBuilder.php index 0cd8bc43512..f4799e037fe 100644 --- a/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/Indicators/Item/IntelligenceProfileIndicatorItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/Indicators/Item/IntelligenceProfileIndicatorItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\IntelligenceProfileIndicator; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Includes an assemblage of high-fidelity network indicators of compromise. * @param IntelligenceProfileIndicatorItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IntelligenceProfileIndicatorItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?IntelligenceProfileIndicatorItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?IntelligenceProfileIndicatorItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/IntelligenceProfileItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/IntelligenceProfileItemRequestBuilder.php index f8d7ec15b11..02e26ba5192 100644 --- a/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/IntelligenceProfileItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/IntelProfiles/Item/IntelligenceProfileItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\IntelligenceProfile; use Microsoft\Graph\Generated\Security\ThreatIntelligence\IntelProfiles\Item\Indicators\IndicatorsRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property intelProfiles for security * @param IntelligenceProfileItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?IntelligenceProfileItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a intelligenceProfile object. This API is available in the following national cloud deployments. * @param IntelligenceProfileItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-intelligenceprofile-get?view=graph-rest-1.0 Find more info here */ public function get(?IntelligenceProfileItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property intelProfiles in security * @param IntelligenceProfile $body The request body * @param IntelligenceProfileItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(IntelligenceProfile $body, ?IntelligenceProfileItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfile::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfile::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?IntelligenceProfileItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?IntelligenceProfileItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?IntelligenceProfileItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(IntelligenceProfile $body, ?Intelligen $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/Count/CountRequestBuilder.php index 0e892e7da68..d89fbb24802 100644 --- a/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/IntelligenceProfileIndicatorsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/IntelligenceProfileIndicatorsRequestBuilder.php index 3179790dc09..f4941ffee7e 100644 --- a/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/IntelligenceProfileIndicatorsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/IntelligenceProfileIndicatorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\IntelligenceProfileIndicator; use Microsoft\Graph\Generated\Models\Security\IntelligenceProfileIndicatorCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a intelligenceProfileIndicator object. This API is available in the following national cloud deployments. * @param IntelligenceProfileIndicatorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IntelligenceProfileIndicatorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileIndicatorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileIndicatorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to intelligenceProfileIndicators for security * @param IntelligenceProfileIndicator $body The request body * @param IntelligenceProfileIndicatorsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(IntelligenceProfileIndicator $body, ?IntelligenceProfileIndicatorsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?IntelligenceProfileIndicatorsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?IntelligenceProfileIndicatorsRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(IntelligenceProfileIndicator $body, ?In $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/Item/Artifact/ArtifactRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/Item/Artifact/ArtifactRequestBuilder.php index d421285e204..85e4a582eba 100644 --- a/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/Item/Artifact/ArtifactRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/Item/Artifact/ArtifactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Artifact; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The artifact related to this indicator. * @param ArtifactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ArtifactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Artifact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Artifact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ArtifactRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ArtifactRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/Item/IntelligenceProfileIndicatorItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/Item/IntelligenceProfileIndicatorItemRequestBuilder.php index 61e697ac453..14986375d33 100644 --- a/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/Item/IntelligenceProfileIndicatorItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/IntelligenceProfileIndicators/Item/IntelligenceProfileIndicatorItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\IntelligenceProfileIndicator; use Microsoft\Graph\Generated\Security\ThreatIntelligence\IntelligenceProfileIndicators\Item\Artifact\ArtifactRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property intelligenceProfileIndicators for security * @param IntelligenceProfileIndicatorItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?IntelligenceProfileIndicatorItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a intelligenceProfileIndicator object. This API is available in the following national cloud deployments. * @param IntelligenceProfileIndicatorItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-intelligenceprofileindicator-get?view=graph-rest-1.0 Find more info here */ public function get(?IntelligenceProfileIndicatorItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property intelligenceProfileIndicators in security * @param IntelligenceProfileIndicator $body The request body * @param IntelligenceProfileIndicatorItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(IntelligenceProfileIndicator $body, ?IntelligenceProfileIndicatorItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IntelligenceProfileIndicator::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?IntelligenceProfileIndicatorItemRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?IntelligenceProfileIndicatorItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?IntelligenceProfileIndicatorItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(IntelligenceProfileIndicator $body, ?I $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Count/CountRequestBuilder.php index ed2a73532d0..a639d646009 100644 --- a/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Item/Artifact/ArtifactRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Item/Artifact/ArtifactRequestBuilder.php index 47dd0727ee1..ebded246f57 100644 --- a/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Item/Artifact/ArtifactRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Item/Artifact/ArtifactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Artifact; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The artifact related to this passiveDnsRecord entry. * @param ArtifactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ArtifactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Artifact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Artifact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ArtifactRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ArtifactRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Item/ParentHost/ParentHostRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Item/ParentHost/ParentHostRequestBuilder.php index 6cf22e241b4..64983f2f719 100644 --- a/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Item/ParentHost/ParentHostRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Item/ParentHost/ParentHostRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Host; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The parent host related to this passiveDnsRecord entry. Generally, this is the value that you can search to discover this passiveDnsRecord value. * @param ParentHostRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentHostRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentHostRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentHostRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Item/PassiveDnsRecordItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Item/PassiveDnsRecordItemRequestBuilder.php index 8e9edcef32e..be303a0e10f 100644 --- a/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Item/PassiveDnsRecordItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/Item/PassiveDnsRecordItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\PassiveDnsRecord; use Microsoft\Graph\Generated\Security\ThreatIntelligence\PassiveDnsRecords\Item\Artifact\ArtifactRequestBuilder; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property passiveDnsRecords for security * @param PassiveDnsRecordItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PassiveDnsRecordItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a passiveDnsRecord object. This API is available in the following national cloud deployments. * @param PassiveDnsRecordItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-passivednsrecord-get?view=graph-rest-1.0 Find more info here */ public function get(?PassiveDnsRecordItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property passiveDnsRecords in security * @param PassiveDnsRecord $body The request body * @param PassiveDnsRecordItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PassiveDnsRecord $body, ?PassiveDnsRecordItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?PassiveDnsRecordItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?PassiveDnsRecordItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?PassiveDnsRecordItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(PassiveDnsRecord $body, ?PassiveDnsRec $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/PassiveDnsRecordsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/PassiveDnsRecordsRequestBuilder.php index 18f7afc8cc0..c6386902fcb 100644 --- a/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/PassiveDnsRecordsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/PassiveDnsRecords/PassiveDnsRecordsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\PassiveDnsRecord; use Microsoft\Graph\Generated\Models\Security\PassiveDnsRecordCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a passiveDnsRecord object. This API is available in the following national cloud deployments. * @param PassiveDnsRecordsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PassiveDnsRecordsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to passiveDnsRecords for security * @param PassiveDnsRecord $body The request body * @param PassiveDnsRecordsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PassiveDnsRecord $body, ?PassiveDnsRecordsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PassiveDnsRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?PassiveDnsRecordsRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?PassiveDnsRecordsRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(PassiveDnsRecord $body, ?PassiveDnsReco $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/SslCertificates/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/SslCertificates/Count/CountRequestBuilder.php index e0621e8b9f3..31e44a980d1 100644 --- a/src/Generated/Security/ThreatIntelligence/SslCertificates/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/SslCertificates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/RelatedHosts/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/RelatedHosts/Count/CountRequestBuilder.php index 09c354aa26f..8b52e0b87cd 100644 --- a/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/RelatedHosts/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/RelatedHosts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/RelatedHosts/Item/HostItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/RelatedHosts/Item/HostItemRequestBuilder.php index dd3daa207a7..e10b40611c5 100644 --- a/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/RelatedHosts/Item/HostItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/RelatedHosts/Item/HostItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Host; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The hosts related with this sslCertificate. * @param HostItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/RelatedHosts/RelatedHostsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/RelatedHosts/RelatedHostsRequestBuilder.php index 9b4471237e2..dd16ab8714d 100644 --- a/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/RelatedHosts/RelatedHostsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/RelatedHosts/RelatedHostsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\HostCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\SslCertificates\Item\RelatedHosts\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The hosts related with this sslCertificate. * @param RelatedHostsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelatedHostsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HostCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HostCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?RelatedHostsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?RelatedHostsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/SslCertificateItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/SslCertificateItemRequestBuilder.php index 6afac1a07ef..c21f1c78834 100644 --- a/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/SslCertificateItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/SslCertificates/Item/SslCertificateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\SslCertificate; use Microsoft\Graph\Generated\Security\ThreatIntelligence\SslCertificates\Item\RelatedHosts\RelatedHostsRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sslCertificates for security * @param SslCertificateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SslCertificateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of an sslCertificate object. This API is available in the following national cloud deployments. * @param SslCertificateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-sslcertificate-get?view=graph-rest-1.0 Find more info here */ public function get(?SslCertificateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sslCertificates in security * @param SslCertificate $body The request body * @param SslCertificateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SslCertificate $body, ?SslCertificateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?SslCertificateItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?SslCertificateItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?SslCertificateItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(SslCertificate $body, ?SslCertificateI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/SslCertificates/SslCertificatesRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/SslCertificates/SslCertificatesRequestBuilder.php index 2ce75d4c428..ff122993578 100644 --- a/src/Generated/Security/ThreatIntelligence/SslCertificates/SslCertificatesRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/SslCertificates/SslCertificatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\SslCertificate; use Microsoft\Graph\Generated\Models\Security\SslCertificateCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of sslCertificate objects and their properties. This API is available in the following national cloud deployments. * @param SslCertificatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-threatintelligence-list-sslcertificates?view=graph-rest-1.0 Find more info here */ public function get(?SslCertificatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SslCertificateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SslCertificateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sslCertificates for security * @param SslCertificate $body The request body * @param SslCertificatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SslCertificate $body, ?SslCertificatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SslCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SslCertificatesRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SslCertificatesRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SslCertificate $body, ?SslCertificatesR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Subdomains/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Subdomains/Count/CountRequestBuilder.php index 6df0ef339c3..cc5b49653e1 100644 --- a/src/Generated/Security/ThreatIntelligence/Subdomains/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Subdomains/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Subdomains/Item/Host/HostRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Subdomains/Item/Host/HostRequestBuilder.php index d2e43783298..daca913e956 100644 --- a/src/Generated/Security/ThreatIntelligence/Subdomains/Item/Host/HostRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Subdomains/Item/Host/HostRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Host; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The host of the subdomain. * @param HostRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Subdomains/Item/SubdomainItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Subdomains/Item/SubdomainItemRequestBuilder.php index 24a5b484dfe..49d522e708e 100644 --- a/src/Generated/Security/ThreatIntelligence/Subdomains/Item/SubdomainItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Subdomains/Item/SubdomainItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Subdomain; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Subdomains\Item\Host\HostRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property subdomains for security * @param SubdomainItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SubdomainItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a subdomain object. This API is available in the following national cloud deployments. * @param SubdomainItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-subdomain-get?view=graph-rest-1.0 Find more info here */ public function get(?SubdomainItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subdomain::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subdomain::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property subdomains in security * @param Subdomain $body The request body * @param SubdomainItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Subdomain $body, ?SubdomainItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subdomain::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subdomain::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?SubdomainItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?SubdomainItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?SubdomainItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(Subdomain $body, ?SubdomainItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Subdomains/SubdomainsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Subdomains/SubdomainsRequestBuilder.php index 7f0b4330a24..feb9a243fc1 100644 --- a/src/Generated/Security/ThreatIntelligence/Subdomains/SubdomainsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Subdomains/SubdomainsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Subdomain; use Microsoft\Graph\Generated\Models\Security\SubdomainCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a subdomain object. This API is available in the following national cloud deployments. * @param SubdomainsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubdomainsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubdomainCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubdomainCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to subdomains for security * @param Subdomain $body The request body * @param SubdomainsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Subdomain $body, ?SubdomainsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subdomain::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subdomain::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?SubdomainsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?SubdomainsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Subdomain $body, ?SubdomainsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/ThreatIntelligenceRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/ThreatIntelligenceRequestBuilder.php index 489ac50bd3d..d74b8308b9f 100644 --- a/src/Generated/Security/ThreatIntelligence/ThreatIntelligenceRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/ThreatIntelligenceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\ThreatIntelligence; use Microsoft\Graph\Generated\Security\ThreatIntelligence\ArticleIndicators\ArticleIndicatorsRequestBuilder; @@ -12,6 +11,7 @@ use Microsoft\Graph\Generated\Security\ThreatIntelligence\HostComponents\HostComponentsRequestBuilder; use Microsoft\Graph\Generated\Security\ThreatIntelligence\HostCookies\HostCookiesRequestBuilder; use Microsoft\Graph\Generated\Security\ThreatIntelligence\HostPairs\HostPairsRequestBuilder; +use Microsoft\Graph\Generated\Security\ThreatIntelligence\HostPorts\HostPortsRequestBuilder; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Hosts\HostsRequestBuilder; use Microsoft\Graph\Generated\Security\ThreatIntelligence\HostSslCertificates\HostSslCertificatesRequestBuilder; use Microsoft\Graph\Generated\Security\ThreatIntelligence\HostTrackers\HostTrackersRequestBuilder; @@ -68,6 +68,13 @@ public function hostPairs(): HostPairsRequestBuilder { return new HostPairsRequestBuilder($this->pathParameters, $this->requestAdapter); } + /** + * Provides operations to manage the hostPorts property of the microsoft.graph.security.threatIntelligence entity. + */ + public function hostPorts(): HostPortsRequestBuilder { + return new HostPortsRequestBuilder($this->pathParameters, $this->requestAdapter); + } + /** * Provides operations to manage the hosts property of the microsoft.graph.security.threatIntelligence entity. */ @@ -162,56 +169,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property threatIntelligence for security * @param ThreatIntelligenceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ThreatIntelligenceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get threatIntelligence from security * @param ThreatIntelligenceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ThreatIntelligenceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThreatIntelligence::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThreatIntelligence::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property threatIntelligence in security * @param ThreatIntelligence $body The request body * @param ThreatIntelligenceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ThreatIntelligence $body, ?ThreatIntelligenceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ThreatIntelligence::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ThreatIntelligence::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -228,6 +226,7 @@ public function toDeleteRequestInformation(?ThreatIntelligenceRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -241,7 +240,6 @@ public function toGetRequestInformation(?ThreatIntelligenceRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -249,6 +247,7 @@ public function toGetRequestInformation(?ThreatIntelligenceRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -263,11 +262,11 @@ public function toPatchRequestInformation(ThreatIntelligence $body, ?ThreatIntel $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Count/CountRequestBuilder.php index 437dd09a437..98a304b82f0 100644 --- a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Articles/ArticlesRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Articles/ArticlesRequestBuilder.php index 0dddadaac6d..96799664cc9 100644 --- a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Articles/ArticlesRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Articles/ArticlesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\ArticleCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Vulnerabilities\Item\Articles\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Articles related to this vulnerability. * @param ArticlesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ArticlesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ArticleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ArticleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ArticlesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ArticlesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Articles/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Articles/Count/CountRequestBuilder.php index ae574f6b8d5..ea1a71ce710 100644 --- a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Articles/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Articles/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Articles/Item/ArticleItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Articles/Item/ArticleItemRequestBuilder.php index 76c0ef0c309..331edc1a2d3 100644 --- a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Articles/Item/ArticleItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Articles/Item/ArticleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Article; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Articles related to this vulnerability. * @param ArticleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ArticleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Article::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Article::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ArticleItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ArticleItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Components/ComponentsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Components/ComponentsRequestBuilder.php index bcb31f70833..1b393b10421 100644 --- a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Components/ComponentsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Components/ComponentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\VulnerabilityComponent; use Microsoft\Graph\Generated\Models\Security\VulnerabilityComponentCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of vulnerabilityComponent objects related to a known vulnerability. This API is available in the following national cloud deployments. * @param ComponentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-vulnerability-list-components?view=graph-rest-1.0 Find more info here */ public function get(?ComponentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [VulnerabilityComponentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [VulnerabilityComponentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to components for security * @param VulnerabilityComponent $body The request body * @param ComponentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(VulnerabilityComponent $body, ?ComponentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [VulnerabilityComponent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [VulnerabilityComponent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ComponentsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ComponentsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(VulnerabilityComponent $body, ?Componen $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Components/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Components/Count/CountRequestBuilder.php index d6e822c5930..01396bd5eec 100644 --- a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Components/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Components/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Components/Item/VulnerabilityComponentItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Components/Item/VulnerabilityComponentItemRequestBuilder.php index e7fa1d85b0b..24ab336c2e9 100644 --- a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Components/Item/VulnerabilityComponentItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/Components/Item/VulnerabilityComponentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\VulnerabilityComponent; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property components for security * @param VulnerabilityComponentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?VulnerabilityComponentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a vulnerabilityComponent object. This API is available in the following national cloud deployments. * @param VulnerabilityComponentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-vulnerabilitycomponent-get?view=graph-rest-1.0 Find more info here */ public function get(?VulnerabilityComponentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [VulnerabilityComponent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [VulnerabilityComponent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property components in security * @param VulnerabilityComponent $body The request body * @param VulnerabilityComponentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(VulnerabilityComponent $body, ?VulnerabilityComponentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [VulnerabilityComponent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [VulnerabilityComponent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?VulnerabilityComponentItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?VulnerabilityComponentItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?VulnerabilityComponentItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(VulnerabilityComponent $body, ?Vulnera $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/VulnerabilityItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/VulnerabilityItemRequestBuilder.php index 61ccb099f97..e9eb7764a07 100644 --- a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/VulnerabilityItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/Item/VulnerabilityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Vulnerability; use Microsoft\Graph\Generated\Security\ThreatIntelligence\Vulnerabilities\Item\Articles\ArticlesRequestBuilder; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property vulnerabilities for security * @param VulnerabilityItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?VulnerabilityItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a vulnerability object. This API is available in the following national cloud deployments. * @param VulnerabilityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-vulnerability-get?view=graph-rest-1.0 Find more info here */ public function get(?VulnerabilityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Vulnerability::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Vulnerability::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property vulnerabilities in security * @param Vulnerability $body The request body * @param VulnerabilityItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Vulnerability $body, ?VulnerabilityItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Vulnerability::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Vulnerability::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?VulnerabilityItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?VulnerabilityItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?VulnerabilityItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(Vulnerability $body, ?VulnerabilityIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/VulnerabilitiesRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/VulnerabilitiesRequestBuilder.php index a5dff515cc7..79e24840004 100644 --- a/src/Generated/Security/ThreatIntelligence/Vulnerabilities/VulnerabilitiesRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/Vulnerabilities/VulnerabilitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Vulnerability; use Microsoft\Graph\Generated\Models\Security\VulnerabilityCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a vulnerability object. This API is available in the following national cloud deployments. * @param VulnerabilitiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?VulnerabilitiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [VulnerabilityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [VulnerabilityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to vulnerabilities for security * @param Vulnerability $body The request body * @param VulnerabilitiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Vulnerability $body, ?VulnerabilitiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Vulnerability::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Vulnerability::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?VulnerabilitiesRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?VulnerabilitiesRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Vulnerability $body, ?VulnerabilitiesRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/Count/CountRequestBuilder.php index 7ba43512690..6322abbf51a 100644 --- a/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/Item/Host/HostRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/Item/Host/HostRequestBuilder.php index 4534216ebbc..3f52a34e25b 100644 --- a/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/Item/Host/HostRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/Item/Host/HostRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Host; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The host associated to this WHOIS object. * @param HostRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/Item/WhoisHistoryRecordItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/Item/WhoisHistoryRecordItemRequestBuilder.php index 960f50ef6a9..9d76110c773 100644 --- a/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/Item/WhoisHistoryRecordItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/Item/WhoisHistoryRecordItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\WhoisHistoryRecord; use Microsoft\Graph\Generated\Security\ThreatIntelligence\WhoisHistoryRecords\Item\Host\HostRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property whoisHistoryRecords for security * @param WhoisHistoryRecordItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WhoisHistoryRecordItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve details about whoisHistoryRecord objects.Note: List retrieval is not yet supported. * @param WhoisHistoryRecordItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WhoisHistoryRecordItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WhoisHistoryRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WhoisHistoryRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property whoisHistoryRecords in security * @param WhoisHistoryRecord $body The request body * @param WhoisHistoryRecordItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WhoisHistoryRecord $body, ?WhoisHistoryRecordItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WhoisHistoryRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WhoisHistoryRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?WhoisHistoryRecordItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?WhoisHistoryRecordItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?WhoisHistoryRecordItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(WhoisHistoryRecord $body, ?WhoisHistor $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/WhoisHistoryRecordsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/WhoisHistoryRecordsRequestBuilder.php index 9960451268b..7451b6c5a35 100644 --- a/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/WhoisHistoryRecordsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/WhoisHistoryRecords/WhoisHistoryRecordsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\WhoisHistoryRecord; use Microsoft\Graph\Generated\Models\Security\WhoisHistoryRecordCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve details about whoisHistoryRecord objects.Note: List retrieval is not yet supported. * @param WhoisHistoryRecordsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WhoisHistoryRecordsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WhoisHistoryRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WhoisHistoryRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to whoisHistoryRecords for security * @param WhoisHistoryRecord $body The request body * @param WhoisHistoryRecordsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WhoisHistoryRecord $body, ?WhoisHistoryRecordsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WhoisHistoryRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WhoisHistoryRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?WhoisHistoryRecordsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?WhoisHistoryRecordsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(WhoisHistoryRecord $body, ?WhoisHistory $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/WhoisRecords/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/WhoisRecords/Count/CountRequestBuilder.php index abf14c02100..a083162c323 100644 --- a/src/Generated/Security/ThreatIntelligence/WhoisRecords/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/WhoisRecords/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/History/Count/CountRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/History/Count/CountRequestBuilder.php index aecdaf222d2..e89db7915ca 100644 --- a/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/History/Count/CountRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/History/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/History/HistoryRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/History/HistoryRequestBuilder.php index 06151d6f25e..256cf529a2a 100644 --- a/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/History/HistoryRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/History/HistoryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\WhoisHistoryRecordCollectionResponse; use Microsoft\Graph\Generated\Security\ThreatIntelligence\WhoisRecords\Item\History\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the history for a whoisRecord, as represented by a collection of whoisHistoryRecord resources. This API is available in the following national cloud deployments. * @param HistoryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-whoisrecord-list-history?view=graph-rest-1.0 Find more info here */ public function get(?HistoryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WhoisHistoryRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WhoisHistoryRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?HistoryRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?HistoryRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/History/Item/WhoisHistoryRecordItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/History/Item/WhoisHistoryRecordItemRequestBuilder.php index ef297297e71..62baa75a6ec 100644 --- a/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/History/Item/WhoisHistoryRecordItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/History/Item/WhoisHistoryRecordItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\WhoisHistoryRecord; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of historical records associated to this WHOIS object. * @param WhoisHistoryRecordItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?WhoisHistoryRecordItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WhoisHistoryRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WhoisHistoryRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?WhoisHistoryRecordItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?WhoisHistoryRecordItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/Host/HostRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/Host/HostRequestBuilder.php index a0696d51700..f7477098e35 100644 --- a/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/Host/HostRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/Host/HostRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\Host; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The host associated to this WHOIS object. * @param HostRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HostRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Host::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?HostRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/WhoisRecordItemRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/WhoisRecordItemRequestBuilder.php index d7887e0024e..5e49b1c5913 100644 --- a/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/WhoisRecordItemRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/WhoisRecords/Item/WhoisRecordItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\WhoisRecord; use Microsoft\Graph\Generated\Security\ThreatIntelligence\WhoisRecords\Item\History\HistoryRequestBuilder; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property whoisRecords for security * @param WhoisRecordItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WhoisRecordItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the specified whoisRecord resource. Specify the desired whoisRecord in one of the following two ways:- Identify a host and get its current whoisRecord. - Specify an id value to get the corresponding whoisRecord. This API is available in the following national cloud deployments. * @param WhoisRecordItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-whoisrecord-get?view=graph-rest-1.0 Find more info here */ public function get(?WhoisRecordItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WhoisRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WhoisRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property whoisRecords in security * @param WhoisRecord $body The request body * @param WhoisRecordItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(WhoisRecord $body, ?WhoisRecordItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WhoisRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WhoisRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?WhoisRecordItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?WhoisRecordItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?WhoisRecordItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(WhoisRecord $body, ?WhoisRecordItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/ThreatIntelligence/WhoisRecords/WhoisRecordsRequestBuilder.php b/src/Generated/Security/ThreatIntelligence/WhoisRecords/WhoisRecordsRequestBuilder.php index 65a8ff4fc35..08336506a2a 100644 --- a/src/Generated/Security/ThreatIntelligence/WhoisRecords/WhoisRecordsRequestBuilder.php +++ b/src/Generated/Security/ThreatIntelligence/WhoisRecords/WhoisRecordsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\WhoisRecord; use Microsoft\Graph\Generated\Models\Security\WhoisRecordCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of whoisRecord objects. This API is available in the following national cloud deployments. * @param WhoisRecordsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-threatintelligence-list-whoisrecords?view=graph-rest-1.0 Find more info here */ public function get(?WhoisRecordsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WhoisRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WhoisRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to whoisRecords for security * @param WhoisRecord $body The request body * @param WhoisRecordsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(WhoisRecord $body, ?WhoisRecordsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WhoisRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WhoisRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?WhoisRecordsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?WhoisRecordsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(WhoisRecord $body, ?WhoisRecordsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/TriggerTypes/RetentionEventTypes/Count/CountRequestBuilder.php b/src/Generated/Security/TriggerTypes/RetentionEventTypes/Count/CountRequestBuilder.php index 45a31b0c826..65520cc5bc8 100644 --- a/src/Generated/Security/TriggerTypes/RetentionEventTypes/Count/CountRequestBuilder.php +++ b/src/Generated/Security/TriggerTypes/RetentionEventTypes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/TriggerTypes/RetentionEventTypes/Item/RetentionEventTypeItemRequestBuilder.php b/src/Generated/Security/TriggerTypes/RetentionEventTypes/Item/RetentionEventTypeItemRequestBuilder.php index b0e7c1cedda..9f7aaebbb67 100644 --- a/src/Generated/Security/TriggerTypes/RetentionEventTypes/Item/RetentionEventTypeItemRequestBuilder.php +++ b/src/Generated/Security/TriggerTypes/RetentionEventTypes/Item/RetentionEventTypeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\RetentionEventType; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a retentionEventType object. * @param RetentionEventTypeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-retentioneventtype-delete?view=graph-rest-1.0 Find more info here */ public function delete(?RetentionEventTypeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a retentionEventType object. This API is available in the following national cloud deployments. * @param RetentionEventTypeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-retentioneventtype-get?view=graph-rest-1.0 Find more info here */ public function get(?RetentionEventTypeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RetentionEventType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RetentionEventType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property retentionEventTypes in security * @param RetentionEventType $body The request body * @param RetentionEventTypeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RetentionEventType $body, ?RetentionEventTypeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RetentionEventType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RetentionEventType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?RetentionEventTypeItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?RetentionEventTypeItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?RetentionEventTypeItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(RetentionEventType $body, ?RetentionEv $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/TriggerTypes/RetentionEventTypes/RetentionEventTypesRequestBuilder.php b/src/Generated/Security/TriggerTypes/RetentionEventTypes/RetentionEventTypesRequestBuilder.php index 3cf40ee020e..67170114ecc 100644 --- a/src/Generated/Security/TriggerTypes/RetentionEventTypes/RetentionEventTypesRequestBuilder.php +++ b/src/Generated/Security/TriggerTypes/RetentionEventTypes/RetentionEventTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\RetentionEventType; use Microsoft\Graph\Generated\Models\Security\RetentionEventTypeCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the retentionEventType objects and their properties. This API is available in the following national cloud deployments. * @param RetentionEventTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-retentioneventtype-list?view=graph-rest-1.0 Find more info here */ public function get(?RetentionEventTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RetentionEventTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RetentionEventTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new retentionEventType object. This API is available in the following national cloud deployments. * @param RetentionEventType $body The request body * @param RetentionEventTypesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-retentioneventtype-post?view=graph-rest-1.0 Find more info here */ public function post(RetentionEventType $body, ?RetentionEventTypesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RetentionEventType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RetentionEventType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?RetentionEventTypesRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?RetentionEventTypesRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(RetentionEventType $body, ?RetentionEve $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/TriggerTypes/TriggerTypesRequestBuilder.php b/src/Generated/Security/TriggerTypes/TriggerTypesRequestBuilder.php index 10d11b766a0..4fd074b6991 100644 --- a/src/Generated/Security/TriggerTypes/TriggerTypesRequestBuilder.php +++ b/src/Generated/Security/TriggerTypes/TriggerTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\TriggerTypesRoot; use Microsoft\Graph\Generated\Security\TriggerTypes\RetentionEventTypes\RetentionEventTypesRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property triggerTypes for security * @param TriggerTypesRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TriggerTypesRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get triggerTypes from security * @param TriggerTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TriggerTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TriggerTypesRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TriggerTypesRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property triggerTypes in security * @param TriggerTypesRoot $body The request body * @param TriggerTypesRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TriggerTypesRoot $body, ?TriggerTypesRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TriggerTypesRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TriggerTypesRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?TriggerTypesRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?TriggerTypesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?TriggerTypesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(TriggerTypesRoot $body, ?TriggerTypesR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Triggers/RetentionEvents/Count/CountRequestBuilder.php b/src/Generated/Security/Triggers/RetentionEvents/Count/CountRequestBuilder.php index 7f8d117085a..0e484c215ee 100644 --- a/src/Generated/Security/Triggers/RetentionEvents/Count/CountRequestBuilder.php +++ b/src/Generated/Security/Triggers/RetentionEvents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Security/Triggers/RetentionEvents/Item/RetentionEventItemRequestBuilder.php b/src/Generated/Security/Triggers/RetentionEvents/Item/RetentionEventItemRequestBuilder.php index cd702d07249..f7c9f145820 100644 --- a/src/Generated/Security/Triggers/RetentionEvents/Item/RetentionEventItemRequestBuilder.php +++ b/src/Generated/Security/Triggers/RetentionEvents/Item/RetentionEventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\RetentionEvent; use Microsoft\Graph\Generated\Security\Triggers\RetentionEvents\Item\RetentionEventType\RetentionEventTypeRequestBuilder; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a retentionEvent object. This API is available in the following national cloud deployments. * @param RetentionEventItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-retentionevent-delete?view=graph-rest-1.0 Find more info here */ public function delete(?RetentionEventItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a retentionEvent object. This API is available in the following national cloud deployments. * @param RetentionEventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-retentionevent-get?view=graph-rest-1.0 Find more info here */ public function get(?RetentionEventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RetentionEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RetentionEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property retentionEvents in security * @param RetentionEvent $body The request body * @param RetentionEventItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RetentionEvent $body, ?RetentionEventItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RetentionEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RetentionEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?RetentionEventItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?RetentionEventItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?RetentionEventItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(RetentionEvent $body, ?RetentionEventI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Triggers/RetentionEvents/Item/RetentionEventType/RetentionEventTypeRequestBuilder.php b/src/Generated/Security/Triggers/RetentionEvents/Item/RetentionEventType/RetentionEventTypeRequestBuilder.php index cc7502e3630..38afd03b1e7 100644 --- a/src/Generated/Security/Triggers/RetentionEvents/Item/RetentionEventType/RetentionEventTypeRequestBuilder.php +++ b/src/Generated/Security/Triggers/RetentionEvents/Item/RetentionEventType/RetentionEventTypeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\RetentionEventType; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Specifies the event that will start the retention period for labels that use this event type when an event is created. * @param RetentionEventTypeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RetentionEventTypeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RetentionEventType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RetentionEventType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RetentionEventTypeRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RetentionEventTypeRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Security/Triggers/RetentionEvents/RetentionEventsRequestBuilder.php b/src/Generated/Security/Triggers/RetentionEvents/RetentionEventsRequestBuilder.php index e432685bcb1..c84c206a1c7 100644 --- a/src/Generated/Security/Triggers/RetentionEvents/RetentionEventsRequestBuilder.php +++ b/src/Generated/Security/Triggers/RetentionEvents/RetentionEventsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\RetentionEvent; use Microsoft\Graph\Generated\Models\Security\RetentionEventCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the retentionEvent objects and their properties. This API is available in the following national cloud deployments. * @param RetentionEventsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-retentionevent-list?view=graph-rest-1.0 Find more info here */ public function get(?RetentionEventsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RetentionEventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RetentionEventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new retentionEvent object. This API is available in the following national cloud deployments. * @param RetentionEvent $body The request body * @param RetentionEventsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/security-retentionevent-post?view=graph-rest-1.0 Find more info here */ public function post(RetentionEvent $body, ?RetentionEventsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RetentionEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RetentionEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?RetentionEventsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?RetentionEventsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(RetentionEvent $body, ?RetentionEventsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Security/Triggers/TriggersRequestBuilder.php b/src/Generated/Security/Triggers/TriggersRequestBuilder.php index 036f13cedb0..aa6fae5acec 100644 --- a/src/Generated/Security/Triggers/TriggersRequestBuilder.php +++ b/src/Generated/Security/Triggers/TriggersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Security\TriggersRoot; use Microsoft\Graph\Generated\Security\Triggers\RetentionEvents\RetentionEventsRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property triggers for security * @param TriggersRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TriggersRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get triggers from security * @param TriggersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TriggersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TriggersRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TriggersRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property triggers in security * @param TriggersRoot $body The request body * @param TriggersRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TriggersRoot $body, ?TriggersRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TriggersRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TriggersRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?TriggersRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?TriggersRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?TriggersRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(TriggersRoot $body, ?TriggersRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Count/CountRequestBuilder.php index 03e80c00c97..8215f79b401 100644 --- a/src/Generated/ServicePrincipals/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Delta/DeltaRequestBuilder.php b/src/Generated/ServicePrincipals/Delta/DeltaRequestBuilder.php index ddbc4149eec..98f03a8325a 100644 --- a/src/Generated/ServicePrincipals/Delta/DeltaRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/ServicePrincipals/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index ea2c3576b42..76c316d242a 100644 --- a/src/Generated/ServicePrincipals/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/ServicePrincipals/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/ServicePrincipals/GetByIds/GetByIdsRequestBuilder.php index 06c4e66545d..79989bbae2e 100644 --- a/src/Generated/ServicePrincipals/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/AddKey/AddKeyRequestBuilder.php b/src/Generated/ServicePrincipals/Item/AddKey/AddKeyRequestBuilder.php index 2e9a0cf757d..9ddf2f1b14b 100644 --- a/src/Generated/ServicePrincipals/Item/AddKey/AddKeyRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/AddKey/AddKeyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\KeyCredential; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Adds a key credential to a servicePrincipal. This method along with removeKey can be used by a servicePrincipal to automate rolling its expiring keys. As part of the request validation for this method, a proof of possession of an existing key is verified before the action can be performed. ServicePrincipals that don’t have any existing valid certificates (i.e.: no certificates have been added yet, or all certificates have expired), won’t be able to use this service action. Update servicePrincipal can be used to perform an update instead. This API is available in the following national cloud deployments. * @param AddKeyPostRequestBody $body The request body * @param AddKeyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-addkey?view=graph-rest-1.0 Find more info here */ public function post(AddKeyPostRequestBody $body, ?AddKeyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [KeyCredential::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [KeyCredential::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddKeyPostRequestBody $body, ?AddKeyReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/AddPassword/AddPasswordRequestBuilder.php b/src/Generated/ServicePrincipals/Item/AddPassword/AddPasswordRequestBuilder.php index 342cd8a4ddc..4b3747180c9 100644 --- a/src/Generated/ServicePrincipals/Item/AddPassword/AddPasswordRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/AddPassword/AddPasswordRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PasswordCredential; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add a strong password or secret to a servicePrincipal object. This API is available in the following national cloud deployments. * @param AddPasswordPostRequestBody $body The request body * @param AddPasswordRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-addpassword?view=graph-rest-1.0 Find more info here */ public function post(AddPasswordPostRequestBody $body, ?AddPasswordRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PasswordCredential::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PasswordCredential::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddPasswordPostRequestBody $body, ?AddP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/AddTokenSigningCertificate/AddTokenSigningCertificateRequestBuilder.php b/src/Generated/ServicePrincipals/Item/AddTokenSigningCertificate/AddTokenSigningCertificateRequestBuilder.php index 9b60a2940e4..d0971f19c0d 100644 --- a/src/Generated/ServicePrincipals/Item/AddTokenSigningCertificate/AddTokenSigningCertificateRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/AddTokenSigningCertificate/AddTokenSigningCertificateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SelfSignedCertificate; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a self-signed signing certificate and return a selfSignedCertificate object, which is the public part of the generated certificate. The self-signed signing certificate is composed of the following objects, which are added to the servicePrincipal: + The keyCredentials object with the following objects: + A private key object with usage set to Sign. + A public key object with usage set to Verify.+ The passwordCredentials object. All the objects have the same value of customKeyIdentifier. The passwordCredential is used to open the PFX file (private key). It and the associated private key object have the same value of keyId. When set during creation through the displayName property, the subject of the certificate cannot be updated. The startDateTime is set to the same time the certificate is created using the action. The endDateTime can be up to three years after the certificate is created. This API is available in the following national cloud deployments. * @param AddTokenSigningCertificatePostRequestBody $body The request body * @param AddTokenSigningCertificateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-addtokensigningcertificate?view=graph-rest-1.0 Find more info here */ public function post(AddTokenSigningCertificatePostRequestBody $body, ?AddTokenSigningCertificateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SelfSignedCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SelfSignedCertificate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddTokenSigningCertificatePostRequestBo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/AppManagementPolicies/AppManagementPoliciesRequestBuilder.php b/src/Generated/ServicePrincipals/Item/AppManagementPolicies/AppManagementPoliciesRequestBuilder.php index 8c359573dca..41874d6d914 100644 --- a/src/Generated/ServicePrincipals/Item/AppManagementPolicies/AppManagementPoliciesRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/AppManagementPolicies/AppManagementPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppManagementPolicyCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\AppManagementPolicies\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The appManagementPolicy applied to this application. * @param AppManagementPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppManagementPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?AppManagementPoliciesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?AppManagementPoliciesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/AppManagementPolicies/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/AppManagementPolicies/Count/CountRequestBuilder.php index 7905961b7d2..de764e561b7 100644 --- a/src/Generated/ServicePrincipals/Item/AppManagementPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/AppManagementPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/AppManagementPolicies/Item/AppManagementPolicyItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/AppManagementPolicies/Item/AppManagementPolicyItemRequestBuilder.php index db0b125ad4f..679897b82ee 100644 --- a/src/Generated/ServicePrincipals/Item/AppManagementPolicies/Item/AppManagementPolicyItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/AppManagementPolicies/Item/AppManagementPolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppManagementPolicy; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an appManagementPolicy policy object from an application or service principal object. When you remove the appManagementPolicy, the application or service principal adopts the tenant-wide tenantAppManagementPolicy setting. This API is available in the following national cloud deployments. * @param AppManagementPolicyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/appmanagementpolicy-delete-appliesto?view=graph-rest-1.0 Find more info here */ public function delete(?AppManagementPolicyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The appManagementPolicy applied to this application. * @param AppManagementPolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppManagementPolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppManagementPolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AppManagementPolicyItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AppManagementPolicyItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AppManagementPolicyItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/AppRoleAssignedTo/AppRoleAssignedToRequestBuilder.php b/src/Generated/ServicePrincipals/Item/AppRoleAssignedTo/AppRoleAssignedToRequestBuilder.php index dafe1dba945..4bf6fc26dd9 100644 --- a/src/Generated/ServicePrincipals/Item/AppRoleAssignedTo/AppRoleAssignedToRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/AppRoleAssignedTo/AppRoleAssignedToRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\AppRoleAssignmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of appRoleAssignment that users, groups, or client service principals have been granted for the given resource service principal. For example, if the resource service principal is the service principal for the Microsoft Graph API, this will return all service principals that have been granted any app-only permissions to Microsoft Graph. If the resource service principal is an application that has app roles granted to users and groups, this will return all the users and groups assigned app roles for this application. This API is available in the following national cloud deployments. * @param AppRoleAssignedToRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-list-approleassignedto?view=graph-rest-1.0 Find more info here */ public function get(?AppRoleAssignedToRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Assign an app role for a resource service principal, to a user, group, or client service principal. App roles that are assigned to service principals are also known as application permissions. Application permissions can be granted directly with app role assignments, or through a consent experience. To grant an app role assignment, you need three identifiers: This API is available in the following national cloud deployments. * @param AppRoleAssignment $body The request body * @param AppRoleAssignedToRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-post-approleassignedto?view=graph-rest-1.0 Find more info here */ public function post(AppRoleAssignment $body, ?AppRoleAssignedToRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AppRoleAssignedToRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AppRoleAssignedToRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AppRoleAssignment $body, ?AppRoleAssign $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/AppRoleAssignedTo/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/AppRoleAssignedTo/Count/CountRequestBuilder.php index 113e49233a7..6490d4501a3 100644 --- a/src/Generated/ServicePrincipals/Item/AppRoleAssignedTo/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/AppRoleAssignedTo/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/AppRoleAssignedTo/Item/AppRoleAssignmentItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/AppRoleAssignedTo/Item/AppRoleAssignmentItemRequestBuilder.php index 9f16b5f35f4..00140c73cde 100644 --- a/src/Generated/ServicePrincipals/Item/AppRoleAssignedTo/Item/AppRoleAssignmentItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/AppRoleAssignedTo/Item/AppRoleAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes an appRoleAssignment that a user, group, or client service principal has been granted for a resource service principal. This API is available in the following national cloud deployments. * @param AppRoleAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-delete-approleassignedto?view=graph-rest-1.0 Find more info here */ public function delete(?AppRoleAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * App role assignments for this app or service, granted to users, groups, and other service principals. Supports $expand. * @param AppRoleAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppRoleAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property appRoleAssignedTo in servicePrincipals * @param AppRoleAssignment $body The request body * @param AppRoleAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AppRoleAssignment $body, ?AppRoleAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?AppRoleAssignmentItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?AppRoleAssignmentItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?AppRoleAssignmentItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(AppRoleAssignment $body, ?AppRoleAssig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/AppRoleAssignments/AppRoleAssignmentsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/AppRoleAssignments/AppRoleAssignmentsRequestBuilder.php index 9ea5893cb38..b42108d6609 100644 --- a/src/Generated/ServicePrincipals/Item/AppRoleAssignments/AppRoleAssignmentsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/AppRoleAssignments/AppRoleAssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\AppRoleAssignmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * App role assignment for another app or service, granted to this service principal. Supports $expand. * @param AppRoleAssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-list-approleassignments?view=graph-rest-1.0 Find more info here */ public function get(?AppRoleAssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Assign an app role to a client service principal. App roles that are assigned to service principals are also known as application permissions. Application permissions can be granted directly with app role assignments, or through a consent experience. To grant an app role assignment to a client service principal, you need three identifiers: This API is available in the following national cloud deployments. * @param AppRoleAssignment $body The request body * @param AppRoleAssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-post-approleassignments?view=graph-rest-1.0 Find more info here */ public function post(AppRoleAssignment $body, ?AppRoleAssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AppRoleAssignmentsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AppRoleAssignmentsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AppRoleAssignment $body, ?AppRoleAssign $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/AppRoleAssignments/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/AppRoleAssignments/Count/CountRequestBuilder.php index dae2f72219e..473eb0ef377 100644 --- a/src/Generated/ServicePrincipals/Item/AppRoleAssignments/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/AppRoleAssignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/AppRoleAssignments/Item/AppRoleAssignmentItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/AppRoleAssignments/Item/AppRoleAssignmentItemRequestBuilder.php index 5b28fe1e898..b5025be2b5e 100644 --- a/src/Generated/ServicePrincipals/Item/AppRoleAssignments/Item/AppRoleAssignmentItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/AppRoleAssignments/Item/AppRoleAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes an appRoleAssignment that a service principal has been granted. App roles which are assigned to service principals are also known as application permissions. Deleting an app role assignment for a service principal is equivalent to revoking the app-only permission grant. This API is available in the following national cloud deployments. * @param AppRoleAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-delete-approleassignments?view=graph-rest-1.0 Find more info here */ public function delete(?AppRoleAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * App role assignment for another app or service, granted to this service principal. Supports $expand. * @param AppRoleAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppRoleAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property appRoleAssignments in servicePrincipals * @param AppRoleAssignment $body The request body * @param AppRoleAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AppRoleAssignment $body, ?AppRoleAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?AppRoleAssignmentItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?AppRoleAssignmentItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?AppRoleAssignmentItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(AppRoleAssignment $body, ?AppRoleAssig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index 2c5bfc6b5f6..11d106b1f00 100644 --- a/src/Generated/ServicePrincipals/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index eee347c1262..4ef6070b708 100644 --- a/src/Generated/ServicePrincipals/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/ClaimsMappingPoliciesRequestBuilder.php b/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/ClaimsMappingPoliciesRequestBuilder.php index 8755978f230..600e87711ef 100644 --- a/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/ClaimsMappingPoliciesRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/ClaimsMappingPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ClaimsMappingPolicyCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\ClaimsMappingPolicies\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the claimsMappingPolicy objects that are assigned to a servicePrincipal. This API is available in the following national cloud deployments. * @param ClaimsMappingPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-list-claimsmappingpolicies?view=graph-rest-1.0 Find more info here */ public function get(?ClaimsMappingPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ClaimsMappingPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ClaimsMappingPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?ClaimsMappingPoliciesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?ClaimsMappingPoliciesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/Count/CountRequestBuilder.php index fc0222ff669..5d88f63d4dd 100644 --- a/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/Item/Ref/RefRequestBuilder.php b/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/Item/Ref/RefRequestBuilder.php index 4cff9f66d28..33baa7fd9b4 100644 --- a/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a claimsMappingPolicy from a servicePrincipal. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-delete-claimsmappingpolicies?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/Ref/RefRequestBuilder.php b/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/Ref/RefRequestBuilder.php index b91a925cd3a..7dceb6e1d8b 100644 --- a/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/Ref/RefRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/ClaimsMappingPolicies/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the claimsMappingPolicy objects that are assigned to a servicePrincipal. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-list-claimsmappingpolicies?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Assign a claimsMappingPolicy to a servicePrincipal. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-post-claimsmappingpolicies?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/CreatedObjects/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/CreatedObjects/Count/CountRequestBuilder.php index 18e3ef211a0..cd16d6d3a04 100644 --- a/src/Generated/ServicePrincipals/Item/CreatedObjects/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/CreatedObjects/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/CreatedObjects/CreatedObjectsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/CreatedObjects/CreatedObjectsRequestBuilder.php index bb1da496041..7e056d77296 100644 --- a/src/Generated/ServicePrincipals/Item/CreatedObjects/CreatedObjectsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/CreatedObjects/CreatedObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\CreatedObjects\Count\CountRequestBuilder; @@ -62,19 +61,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Directory objects created by this service principal. Read-only. Nullable. * @param CreatedObjectsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedObjectsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -87,7 +83,6 @@ public function toGetRequestInformation(?CreatedObjectsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -95,6 +90,7 @@ public function toGetRequestInformation(?CreatedObjectsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/CreatedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/CreatedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php index dc463b5c685..2bba8f46410 100644 --- a/src/Generated/ServicePrincipals/Item/CreatedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/CreatedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/CreatedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/ServicePrincipals/Item/CreatedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index d9edc7bb943..d5f47677637 100644 --- a/src/Generated/ServicePrincipals/Item/CreatedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/CreatedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; use Microsoft\Graph\Generated\ServicePrincipals\Item\CreatedObjects\GraphServicePrincipal\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/CreatedObjects/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/CreatedObjects/Item/DirectoryObjectItemRequestBuilder.php index e8684f096b5..b5ff081cb66 100644 --- a/src/Generated/ServicePrincipals/Item/CreatedObjects/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/CreatedObjects/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\CreatedObjects\Item\GraphServicePrincipal\GraphServicePrincipalRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Directory objects created by this service principal. Read-only. Nullable. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/CreatedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/ServicePrincipals/Item/CreatedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index ae1a70a0f14..ec215980488 100644 --- a/src/Generated/ServicePrincipals/Item/CreatedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/CreatedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/DelegatedPermissionClassifications/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/DelegatedPermissionClassifications/Count/CountRequestBuilder.php index 803afad3d06..9ade041c49c 100644 --- a/src/Generated/ServicePrincipals/Item/DelegatedPermissionClassifications/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/DelegatedPermissionClassifications/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/DelegatedPermissionClassifications/DelegatedPermissionClassificationsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/DelegatedPermissionClassifications/DelegatedPermissionClassificationsRequestBuilder.php index 4535942f771..02767be4b09 100644 --- a/src/Generated/ServicePrincipals/Item/DelegatedPermissionClassifications/DelegatedPermissionClassificationsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/DelegatedPermissionClassifications/DelegatedPermissionClassificationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedPermissionClassification; use Microsoft\Graph\Generated\Models\DelegatedPermissionClassificationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of delegatedPermissionClassification currently configured for the delegated permissions exposed by an API. This API is available in the following national cloud deployments. * @param DelegatedPermissionClassificationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-list-delegatedpermissionclassifications?view=graph-rest-1.0 Find more info here */ public function get(?DelegatedPermissionClassificationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedPermissionClassificationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedPermissionClassificationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Classify a delegated permission by adding a delegatedPermissionClassification to the servicePrincipal representing the API. This API is available in the following national cloud deployments. * @param DelegatedPermissionClassification $body The request body * @param DelegatedPermissionClassificationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-post-delegatedpermissionclassifications?view=graph-rest-1.0 Find more info here */ public function post(DelegatedPermissionClassification $body, ?DelegatedPermissionClassificationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedPermissionClassification::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedPermissionClassification::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DelegatedPermissionClassificationsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DelegatedPermissionClassificationsReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DelegatedPermissionClassification $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/DelegatedPermissionClassifications/Item/DelegatedPermissionClassificationItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/DelegatedPermissionClassifications/Item/DelegatedPermissionClassificationItemRequestBuilder.php index d325f9e6cce..e0fc65da2c2 100644 --- a/src/Generated/ServicePrincipals/Item/DelegatedPermissionClassifications/Item/DelegatedPermissionClassificationItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/DelegatedPermissionClassifications/Item/DelegatedPermissionClassificationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedPermissionClassification; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a delegatedPermissionClassification which had previously been set for a delegated permission. This API is available in the following national cloud deployments. * @param DelegatedPermissionClassificationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-delete-delegatedpermissionclassifications?view=graph-rest-1.0 Find more info here */ public function delete(?DelegatedPermissionClassificationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get delegatedPermissionClassifications from servicePrincipals * @param DelegatedPermissionClassificationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DelegatedPermissionClassificationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedPermissionClassification::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedPermissionClassification::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property delegatedPermissionClassifications in servicePrincipals * @param DelegatedPermissionClassification $body The request body * @param DelegatedPermissionClassificationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DelegatedPermissionClassification $body, ?DelegatedPermissionClassificationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedPermissionClassification::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedPermissionClassification::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?DelegatedPermissionClassificationIte $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?DelegatedPermissionClassificationItemRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?DelegatedPermissionClassificationItemRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(DelegatedPermissionClassification $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Endpoints/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Endpoints/Count/CountRequestBuilder.php index 46fce6d0866..12a6dfa1207 100644 --- a/src/Generated/ServicePrincipals/Item/Endpoints/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Endpoints/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Endpoints/EndpointsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Endpoints/EndpointsRequestBuilder.php index c02647d1eda..963158bcdf7 100644 --- a/src/Generated/ServicePrincipals/Item/Endpoints/EndpointsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Endpoints/EndpointsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Endpoint; use Microsoft\Graph\Generated\Models\EndpointCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get endpoints from servicePrincipals * @param EndpointsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EndpointsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to endpoints for servicePrincipals * @param Endpoint $body The request body * @param EndpointsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Endpoint $body, ?EndpointsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?EndpointsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?EndpointsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Endpoint $body, ?EndpointsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Endpoints/Item/EndpointItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Endpoints/Item/EndpointItemRequestBuilder.php index 81db12a7875..60c34102034 100644 --- a/src/Generated/ServicePrincipals/Item/Endpoints/Item/EndpointItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Endpoints/Item/EndpointItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Endpoint; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property endpoints for servicePrincipals * @param EndpointItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EndpointItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get endpoints from servicePrincipals * @param EndpointItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EndpointItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property endpoints in servicePrincipals * @param Endpoint $body The request body * @param EndpointItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Endpoint $body, ?EndpointItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?EndpointItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?EndpointItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?EndpointItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Endpoint $body, ?EndpointItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/FederatedIdentityCredentials/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/FederatedIdentityCredentials/Count/CountRequestBuilder.php index e78b2db0eb0..f5e2a8e7da6 100644 --- a/src/Generated/ServicePrincipals/Item/FederatedIdentityCredentials/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/FederatedIdentityCredentials/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/FederatedIdentityCredentials/FederatedIdentityCredentialsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/FederatedIdentityCredentials/FederatedIdentityCredentialsRequestBuilder.php index f0803d576f6..62307b7fc90 100644 --- a/src/Generated/ServicePrincipals/Item/FederatedIdentityCredentials/FederatedIdentityCredentialsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/FederatedIdentityCredentials/FederatedIdentityCredentialsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FederatedIdentityCredential; use Microsoft\Graph\Generated\Models\FederatedIdentityCredentialCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Federated identities for a specific type of service principal - managed identity. Supports $expand and $filter (/$count eq 0, /$count ne 0). * @param FederatedIdentityCredentialsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FederatedIdentityCredentialsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredentialCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredentialCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to federatedIdentityCredentials for servicePrincipals * @param FederatedIdentityCredential $body The request body * @param FederatedIdentityCredentialsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(FederatedIdentityCredential $body, ?FederatedIdentityCredentialsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredential::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredential::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?FederatedIdentityCredentialsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?FederatedIdentityCredentialsRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(FederatedIdentityCredential $body, ?Fed $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/FederatedIdentityCredentials/Item/FederatedIdentityCredentialItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/FederatedIdentityCredentials/Item/FederatedIdentityCredentialItemRequestBuilder.php index 6d5aa61f2a3..d19f4676ffb 100644 --- a/src/Generated/ServicePrincipals/Item/FederatedIdentityCredentials/Item/FederatedIdentityCredentialItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/FederatedIdentityCredentials/Item/FederatedIdentityCredentialItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FederatedIdentityCredential; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property federatedIdentityCredentials for servicePrincipals * @param FederatedIdentityCredentialItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FederatedIdentityCredentialItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Federated identities for a specific type of service principal - managed identity. Supports $expand and $filter (/$count eq 0, /$count ne 0). * @param FederatedIdentityCredentialItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FederatedIdentityCredentialItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredential::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredential::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property federatedIdentityCredentials in servicePrincipals * @param FederatedIdentityCredential $body The request body * @param FederatedIdentityCredentialItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(FederatedIdentityCredential $body, ?FederatedIdentityCredentialItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredential::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FederatedIdentityCredential::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FederatedIdentityCredentialItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FederatedIdentityCredentialItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FederatedIdentityCredentialItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(FederatedIdentityCredential $body, ?Fe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index 9f75587877d..1e7d6590ff6 100644 --- a/src/Generated/ServicePrincipals/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index 5db522e9890..c2bb12a66f0 100644 --- a/src/Generated/ServicePrincipals/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/Count/CountRequestBuilder.php index a69957e9e0c..4a4ece6b9c5 100644 --- a/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/HomeRealmDiscoveryPoliciesRequestBuilder.php b/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/HomeRealmDiscoveryPoliciesRequestBuilder.php index f2827ace223..50f321044cc 100644 --- a/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/HomeRealmDiscoveryPoliciesRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/HomeRealmDiscoveryPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\HomeRealmDiscoveryPolicyCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\HomeRealmDiscoveryPolicies\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the homeRealmDiscoveryPolicy objects that are assigned to a servicePrincipal. This API is available in the following national cloud deployments. * @param HomeRealmDiscoveryPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-list-homerealmdiscoverypolicies?view=graph-rest-1.0 Find more info here */ public function get(?HomeRealmDiscoveryPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [HomeRealmDiscoveryPolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?HomeRealmDiscoveryPoliciesRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?HomeRealmDiscoveryPoliciesRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/Item/Ref/RefRequestBuilder.php b/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/Item/Ref/RefRequestBuilder.php index 867fb4c8fae..918b7b470e8 100644 --- a/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a homeRealmDiscoveryPolicy from a servicePrincipal. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-delete-homerealmdiscoverypolicies?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/Ref/RefRequestBuilder.php b/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/Ref/RefRequestBuilder.php index 87cc2763146..9725867667a 100644 --- a/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/Ref/RefRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/HomeRealmDiscoveryPolicies/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the homeRealmDiscoveryPolicy objects that are assigned to a servicePrincipal. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-list-homerealmdiscoverypolicies?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Assign a homeRealmDiscoveryPolicy to a servicePrincipal. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-post-homerealmdiscoverypolicies?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/MemberOf/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/MemberOf/Count/CountRequestBuilder.php index 03b31582d29..dd27579d6f3 100644 --- a/src/Generated/ServicePrincipals/Item/MemberOf/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/MemberOf/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php index 6019d6929db..4914a41e82f 100644 --- a/src/Generated/ServicePrincipals/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/ServicePrincipals/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index e2fc58696eb..6485e4e6c0c 100644 --- a/src/Generated/ServicePrincipals/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnitCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\MemberOf\GraphAdministrativeUnit\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.administrativeUnit in the microsoft.graph.directoryObject collection * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/MemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/MemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php index 8842d82646a..1d67daaa4bf 100644 --- a/src/Generated/ServicePrincipals/Item/MemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/MemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/MemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php b/src/Generated/ServicePrincipals/Item/MemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php index 10d094d8a60..931a6535ef9 100644 --- a/src/Generated/ServicePrincipals/Item/MemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/MemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryRoleCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\MemberOf\GraphDirectoryRole\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.directoryRole in the microsoft.graph.directoryObject collection * @param GraphDirectoryRoleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDirectoryRoleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php index 62d24deb4d6..078a6f31391 100644 --- a/src/Generated/ServicePrincipals/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/ServicePrincipals/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php index adc84f67afd..e39960eeab2 100644 --- a/src/Generated/ServicePrincipals/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\MemberOf\GraphGroup\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php index b00eda8b092..5437fc0762d 100644 --- a/src/Generated/ServicePrincipals/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\MemberOf\Item\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Roles that this service principal is a member of. HTTP Methods: GET Read-only. Nullable. Supports $expand. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/ServicePrincipals/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index d4a91025d8e..d6176fd3ada 100644 --- a/src/Generated/ServicePrincipals/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnit; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.administrativeUnit * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/MemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php b/src/Generated/ServicePrincipals/Item/MemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php index 82188fb161f..c095d90c6b9 100644 --- a/src/Generated/ServicePrincipals/Item/MemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/MemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.directoryRole * @param GraphDirectoryRoleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDirectoryRoleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/ServicePrincipals/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php index ab92ff61fcf..a4cc4e7c636 100644 --- a/src/Generated/ServicePrincipals/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/MemberOf/MemberOfRequestBuilder.php b/src/Generated/ServicePrincipals/Item/MemberOf/MemberOfRequestBuilder.php index 04dcb43a764..acbc08a57e2 100644 --- a/src/Generated/ServicePrincipals/Item/MemberOf/MemberOfRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/MemberOf/MemberOfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\MemberOf\Count\CountRequestBuilder; @@ -78,20 +77,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Roles that this service principal is a member of. HTTP Methods: GET Read-only. Nullable. Supports $expand. * @param MemberOfRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-list-memberof?view=graph-rest-1.0 Find more info here */ public function get(?MemberOfRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -104,7 +100,6 @@ public function toGetRequestInformation(?MemberOfRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -112,6 +107,7 @@ public function toGetRequestInformation(?MemberOfRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Oauth2PermissionGrants/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Oauth2PermissionGrants/Count/CountRequestBuilder.php index cc3bb6784eb..cb6b57d651e 100644 --- a/src/Generated/ServicePrincipals/Item/Oauth2PermissionGrants/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Oauth2PermissionGrants/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Oauth2PermissionGrants/Item/OAuth2PermissionGrantItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Oauth2PermissionGrants/Item/OAuth2PermissionGrantItemRequestBuilder.php index f3521c5e53c..e4a786ae147 100644 --- a/src/Generated/ServicePrincipals/Item/Oauth2PermissionGrants/Item/OAuth2PermissionGrantItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Oauth2PermissionGrants/Item/OAuth2PermissionGrantItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\OAuth2PermissionGrant; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delegated permission grants authorizing this service principal to access an API on behalf of a signed-in user. Read-only. Nullable. * @param OAuth2PermissionGrantItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OAuth2PermissionGrantItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?OAuth2PermissionGrantItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?OAuth2PermissionGrantItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Oauth2PermissionGrants/Oauth2PermissionGrantsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Oauth2PermissionGrants/Oauth2PermissionGrantsRequestBuilder.php index d9de39d5006..748a58e42de 100644 --- a/src/Generated/ServicePrincipals/Item/Oauth2PermissionGrants/Oauth2PermissionGrantsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Oauth2PermissionGrants/Oauth2PermissionGrantsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\OAuth2PermissionGrantCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\Oauth2PermissionGrants\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of oAuth2PermissionGrant entities, representing delegated permissions granted to the service principal (representing the client application) to access an API on behalf of a user. This API is available in the following national cloud deployments. * @param Oauth2PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-list-oauth2permissiongrants?view=graph-rest-1.0 Find more info here */ public function get(?Oauth2PermissionGrantsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?Oauth2PermissionGrantsRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?Oauth2PermissionGrantsRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/Count/CountRequestBuilder.php index a5d277e978b..66e4cb8fd2c 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphAppRoleAssignment/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphAppRoleAssignment/Count/CountRequestBuilder.php index 3ea5fbd97bb..eae4dc6e47d 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphAppRoleAssignment/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphAppRoleAssignment/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index f249b519710..a0f7835e9d4 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\OwnedObjects\GraphAppRoleAssignment\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.appRoleAssignment in the microsoft.graph.directoryObject collection * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphApplication/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphApplication/Count/CountRequestBuilder.php index 87c9744501b..157f0553e5b 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphApplication/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphApplication/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphApplication/GraphApplicationRequestBuilder.php index 8cf851d2688..faf2b9cb26d 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ApplicationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\OwnedObjects\GraphApplication\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.application in the microsoft.graph.directoryObject collection * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphEndpoint/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphEndpoint/Count/CountRequestBuilder.php index f5b5a24ad9a..65391e09c5a 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphEndpoint/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphEndpoint/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphEndpoint/GraphEndpointRequestBuilder.php index 721d8532e77..66fbb74c44a 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EndpointCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\OwnedObjects\GraphEndpoint\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.endpoint in the microsoft.graph.directoryObject collection * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphGroup/Count/CountRequestBuilder.php index f8e8f0a749d..6b7a55b6402 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphGroup/GraphGroupRequestBuilder.php index 216641ac611..cf55dfd9616 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\OwnedObjects\GraphGroup\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php index 72004d1e78a..eac4130d7b3 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index a2224eadf9e..b1d0b13c80c 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; use Microsoft\Graph\Generated\ServicePrincipals\Item\OwnedObjects\GraphServicePrincipal\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/DirectoryObjectItemRequestBuilder.php index 73db364582b..940f8830842 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\OwnedObjects\Item\GraphApplication\GraphApplicationRequestBuilder; @@ -74,19 +73,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Directory objects that are owned by this service principal. Read-only. Nullable. Supports $expand, $select nested in $expand, and $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1). * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +95,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +102,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index 5f3bad12c84..9d965cf7f13 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.appRoleAssignment * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphApplication/GraphApplicationRequestBuilder.php index fdca75bca2f..587056e6bd5 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Application; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.application * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphEndpoint/GraphEndpointRequestBuilder.php index c20e759ea63..4ada34331bd 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Endpoint; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.endpoint * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphGroup/GraphGroupRequestBuilder.php index 4033af257b2..8a20fd6b905 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index c85195ad77a..22e0f6c7937 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/OwnedObjects/OwnedObjectsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/OwnedObjects/OwnedObjectsRequestBuilder.php index dfaf65fda52..a2fe6e0ca3f 100644 --- a/src/Generated/ServicePrincipals/Item/OwnedObjects/OwnedObjectsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/OwnedObjects/OwnedObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\OwnedObjects\Count\CountRequestBuilder; @@ -94,19 +93,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Directory objects that are owned by this service principal. Read-only. Nullable. Supports $expand, $select nested in $expand, and $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1). * @param OwnedObjectsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OwnedObjectsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,7 +115,6 @@ public function toGetRequestInformation(?OwnedObjectsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -127,6 +122,7 @@ public function toGetRequestInformation(?OwnedObjectsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/Count/CountRequestBuilder.php index d241d21d672..5bed54b110e 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/GraphAppRoleAssignment/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/GraphAppRoleAssignment/Count/CountRequestBuilder.php index 72ed5f24d70..b33b533aafc 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/GraphAppRoleAssignment/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/GraphAppRoleAssignment/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index 91b1a79d93f..e73da21ea7f 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\Owners\GraphAppRoleAssignment\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.appRoleAssignment in the microsoft.graph.directoryObject collection * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/GraphEndpoint/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/GraphEndpoint/Count/CountRequestBuilder.php index 1f9904685f7..c06e4147a0c 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/GraphEndpoint/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/GraphEndpoint/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/GraphEndpoint/GraphEndpointRequestBuilder.php index 3ab293d08e7..b8cb9511b43 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EndpointCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\Owners\GraphEndpoint\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.endpoint in the microsoft.graph.directoryObject collection * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/GraphServicePrincipal/Count/CountRequestBuilder.php index ed744a7d555..3f605253d87 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 8cf20ee05e5..49004ba7a37 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; use Microsoft\Graph\Generated\ServicePrincipals\Item\Owners\GraphServicePrincipal\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/GraphUser/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/GraphUser/Count/CountRequestBuilder.php index e649649df86..56d062fa448 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/GraphUser/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/GraphUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/GraphUser/GraphUserRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/GraphUser/GraphUserRequestBuilder.php index e2a0d8060d5..8704505d679 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; use Microsoft\Graph\Generated\ServicePrincipals\Item\Owners\GraphUser\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.user in the microsoft.graph.directoryObject collection * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index 77becf4c990..a0ea28586bc 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.appRoleAssignment * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/Item/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/Item/GraphEndpoint/GraphEndpointRequestBuilder.php index 282370c46c4..682c8213fd8 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/Item/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/Item/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Endpoint; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.endpoint * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 32809a4e8eb..03c507a9824 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/Item/GraphUser/GraphUserRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/Item/GraphUser/GraphUserRequestBuilder.php index 0cb374dcc2c..08c67981272 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/Item/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/Item/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.user * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/Item/Ref/RefRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/Item/Ref/RefRequestBuilder.php index 1c3b0041e2d..ad9bce4e932 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/Item/Ref/RefRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/Item/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an owner from a servicePrincipal object. As a recommended best practice, service principals should have at least two owners. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-delete-owners?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -66,6 +62,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/OwnersRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/OwnersRequestBuilder.php index f5be400302b..6d466fe5f08 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/OwnersRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/OwnersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\Owners\Count\CountRequestBuilder; @@ -94,20 +93,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Directory objects that are owners of this servicePrincipal. The owners are a set of non-admin users or servicePrincipals who are allowed to modify this object. Read-only. Nullable. Supports $expand, $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1), and $select nested in $expand. * @param OwnersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-list-owners?view=graph-rest-1.0 Find more info here */ public function get(?OwnersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -120,7 +116,6 @@ public function toGetRequestInformation(?OwnersRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -128,6 +123,7 @@ public function toGetRequestInformation(?OwnersRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Owners/Ref/RefRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Owners/Ref/RefRequestBuilder.php index 429662e4a34..d054af9ec27 100644 --- a/src/Generated/ServicePrincipals/Item/Owners/Ref/RefRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Owners/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceCreate; use Microsoft\Graph\Generated\Models\StringCollectionResponse; @@ -35,40 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Directory objects that are owners of this servicePrincipal. The owners are a set of non-admin users or servicePrincipals who are allowed to modify this object. Read-only. Nullable. Supports $expand, $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1), and $select nested in $expand. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-list-owners?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an owner for the servicePrincipal. Service principal owners can be users, the service principal itself, or other service principals. This API is available in the following national cloud deployments. * @param ReferenceCreate $body The request body * @param RefRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-post-owners?view=graph-rest-1.0 Find more info here */ public function post(ReferenceCreate $body, ?RefRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -81,7 +74,6 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -89,6 +81,7 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -107,6 +100,7 @@ public function toPostRequestInformation(ReferenceCreate $body, ?RefRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilder.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilder.php new file mode 100644 index 00000000000..c3d8566542f --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilder.php @@ -0,0 +1,158 @@ +pathParameters, $this->requestAdapter); + } + + /** + * Instantiates a new RemoteDesktopSecurityConfigurationRequestBuilder and sets the default values. + * @param array|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/servicePrincipals/{servicePrincipal%2Did}/remoteDesktopSecurityConfiguration{?%24select,%24expand}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * Delete a remoteDesktopSecurityConfiguration object on a servicePrincipal. Removing remoteDesktopSecurityConfiguration object on the servicePrincipal disables the Microsoft Entra ID Remote Desktop Services (RDS) authentication protocol to authenticate a user to Microsoft Entra joined or Microsoft Entra hybrid joined devices, and removes any target device groups that you configured for SSO. + * @param RemoteDesktopSecurityConfigurationRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/serviceprincipal-delete-remotedesktopsecurityconfiguration?view=graph-rest-1.0 Find more info here + */ + public function delete(?RemoteDesktopSecurityConfigurationRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); + } + + /** + * Read the properties and relationships of a remoteDesktopSecurityConfiguration object on a servicePrincipal. Use this configuration to view the Microsoft Entra ID Remote Desktop Services (RDS) authentication protocol to authenticate a user to Microsoft Entra joined or Microsoft Entra hybrid joined devices. Additionally you can view any targetDeviceGroups that have been configured for SSO. + * @param RemoteDesktopSecurityConfigurationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/remotedesktopsecurityconfiguration-get?view=graph-rest-1.0 Find more info here + */ + public function get(?RemoteDesktopSecurityConfigurationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RemoteDesktopSecurityConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Update the properties of a remoteDesktopSecurityConfiguration object on the servicePrincipal. Use this configuration to enable or disable the Microsoft Entra ID Remote Desktop Services (RDS) authentication protocol to authenticate a user to Microsoft Entra joined or Microsoft Entra hybrid joined devices. + * @param RemoteDesktopSecurityConfiguration $body The request body + * @param RemoteDesktopSecurityConfigurationRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/remotedesktopsecurityconfiguration-update?view=graph-rest-1.0 Find more info here + */ + public function patch(RemoteDesktopSecurityConfiguration $body, ?RemoteDesktopSecurityConfigurationRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RemoteDesktopSecurityConfiguration::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Delete a remoteDesktopSecurityConfiguration object on a servicePrincipal. Removing remoteDesktopSecurityConfiguration object on the servicePrincipal disables the Microsoft Entra ID Remote Desktop Services (RDS) authentication protocol to authenticate a user to Microsoft Entra joined or Microsoft Entra hybrid joined devices, and removes any target device groups that you configured for SSO. + * @param RemoteDesktopSecurityConfigurationRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toDeleteRequestInformation(?RemoteDesktopSecurityConfigurationRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::DELETE; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + return $requestInfo; + } + + /** + * Read the properties and relationships of a remoteDesktopSecurityConfiguration object on a servicePrincipal. Use this configuration to view the Microsoft Entra ID Remote Desktop Services (RDS) authentication protocol to authenticate a user to Microsoft Entra joined or Microsoft Entra hybrid joined devices. Additionally you can view any targetDeviceGroups that have been configured for SSO. + * @param RemoteDesktopSecurityConfigurationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?RemoteDesktopSecurityConfigurationRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + return $requestInfo; + } + + /** + * Update the properties of a remoteDesktopSecurityConfiguration object on the servicePrincipal. Use this configuration to enable or disable the Microsoft Entra ID Remote Desktop Services (RDS) authentication protocol to authenticate a user to Microsoft Entra joined or Microsoft Entra hybrid joined devices. + * @param RemoteDesktopSecurityConfiguration $body The request body + * @param RemoteDesktopSecurityConfigurationRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toPatchRequestInformation(RemoteDesktopSecurityConfiguration $body, ?RemoteDesktopSecurityConfigurationRequestBuilderPatchRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::PATCH; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return RemoteDesktopSecurityConfigurationRequestBuilder + */ + public function withUrl(string $rawUrl): RemoteDesktopSecurityConfigurationRequestBuilder { + return new RemoteDesktopSecurityConfigurationRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderDeleteRequestConfiguration.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderDeleteRequestConfiguration.php new file mode 100644 index 00000000000..7323253e552 --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderDeleteRequestConfiguration.php @@ -0,0 +1,22 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + */ + public function __construct(?array $headers = null, ?array $options = null) { + parent::__construct($headers ?? [], $options ?? []); + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderGetQueryParameters.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..c77c9ab3bb7 --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderGetQueryParameters.php @@ -0,0 +1,34 @@ +|null $expand Expand related entities + */ + public ?array $expand = null; + + /** + * @QueryParameter("%24select") + * @var array|null $select Select properties to be returned + */ + public ?array $select = null; + + /** + * Instantiates a new remoteDesktopSecurityConfigurationRequestBuilderGetQueryParameters and sets the default values. + * @param array|null $expand Expand related entities + * @param array|null $select Select properties to be returned + */ + public function __construct(?array $expand = null, ?array $select = null) { + $this->expand = $expand; + $this->select = $select; + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderGetRequestConfiguration.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..2918ed262c0 --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,39 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param RemoteDesktopSecurityConfigurationRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?RemoteDesktopSecurityConfigurationRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new remoteDesktopSecurityConfigurationRequestBuilderGetQueryParameters. + * @param array|null $expand Expand related entities + * @param array|null $select Select properties to be returned + * @return RemoteDesktopSecurityConfigurationRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?array $expand = null, ?array $select = null): RemoteDesktopSecurityConfigurationRequestBuilderGetQueryParameters { + return new RemoteDesktopSecurityConfigurationRequestBuilderGetQueryParameters($expand, $select); + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderPatchRequestConfiguration.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderPatchRequestConfiguration.php new file mode 100644 index 00000000000..0f3de8346ab --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/RemoteDesktopSecurityConfigurationRequestBuilderPatchRequestConfiguration.php @@ -0,0 +1,22 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + */ + public function __construct(?array $headers = null, ?array $options = null) { + parent::__construct($headers ?? [], $options ?? []); + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Count/CountRequestBuilder.php new file mode 100644 index 00000000000..02c4d0e4354 --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Count/CountRequestBuilder.php @@ -0,0 +1,79 @@ +|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/servicePrincipals/{servicePrincipal%2Did}/remoteDesktopSecurityConfiguration/targetDeviceGroups/$count{?%24search,%24filter}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * Get the number of the resource + * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; + } + + /** + * Get the number of the resource + * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return CountRequestBuilder + */ + public function withUrl(string $rawUrl): CountRequestBuilder { + return new CountRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Count/CountRequestBuilderGetQueryParameters.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Count/CountRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..4742073b04f --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Count/CountRequestBuilderGetQueryParameters.php @@ -0,0 +1,34 @@ +filter = $filter; + $this->search = $search; + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Count/CountRequestBuilderGetRequestConfiguration.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Count/CountRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..9bc21afaf9f --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Count/CountRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,39 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param CountRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?CountRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new CountRequestBuilderGetQueryParameters. + * @param string|null $filter Filter items by property values + * @param string|null $search Search items by search phrases + * @return CountRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?string $filter = null, ?string $search = null): CountRequestBuilderGetQueryParameters { + return new CountRequestBuilderGetQueryParameters($filter, $search); + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilder.php new file mode 100644 index 00000000000..953b37bb471 --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilder.php @@ -0,0 +1,150 @@ +|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/servicePrincipals/{servicePrincipal%2Did}/remoteDesktopSecurityConfiguration/targetDeviceGroups/{targetDeviceGroup%2Did}{?%24select,%24expand}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * Delete a targetDeviceGroup object for the remoteDesktopSecurityConfiguration object on the servicePrincipal. Any user authenticating using the Microsoft Entra ID Remote Desktop Services (RDS) authentication protocol to a Microsoft Entra joined or Microsoft Entra hybrid joined device that's in the removed targetDeviceGroup doesn't get SSO prompts. + * @param TargetDeviceGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/remotedesktopsecurityconfiguration-delete-targetdevicegroups?view=graph-rest-1.0 Find more info here + */ + public function delete(?TargetDeviceGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); + } + + /** + * Read the properties and relationships of a targetDeviceGroup object for the remoteDesktopSecurityConfiguration object on the servicePrincipal. + * @param TargetDeviceGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/targetdevicegroup-get?view=graph-rest-1.0 Find more info here + */ + public function get(?TargetDeviceGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetDeviceGroup::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Update the properties of a targetDeviceGroup object for remoteDesktopSecurityConfiguration object on the servicePrincipal. You can configure a maximum of 10 target device groups for the remoteDesktopSecurityConfiguraiton object on the servicePrincipal. + * @param TargetDeviceGroup $body The request body + * @param TargetDeviceGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/targetdevicegroup-update?view=graph-rest-1.0 Find more info here + */ + public function patch(TargetDeviceGroup $body, ?TargetDeviceGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetDeviceGroup::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Delete a targetDeviceGroup object for the remoteDesktopSecurityConfiguration object on the servicePrincipal. Any user authenticating using the Microsoft Entra ID Remote Desktop Services (RDS) authentication protocol to a Microsoft Entra joined or Microsoft Entra hybrid joined device that's in the removed targetDeviceGroup doesn't get SSO prompts. + * @param TargetDeviceGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toDeleteRequestInformation(?TargetDeviceGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::DELETE; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + return $requestInfo; + } + + /** + * Read the properties and relationships of a targetDeviceGroup object for the remoteDesktopSecurityConfiguration object on the servicePrincipal. + * @param TargetDeviceGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?TargetDeviceGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + return $requestInfo; + } + + /** + * Update the properties of a targetDeviceGroup object for remoteDesktopSecurityConfiguration object on the servicePrincipal. You can configure a maximum of 10 target device groups for the remoteDesktopSecurityConfiguraiton object on the servicePrincipal. + * @param TargetDeviceGroup $body The request body + * @param TargetDeviceGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toPatchRequestInformation(TargetDeviceGroup $body, ?TargetDeviceGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::PATCH; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return TargetDeviceGroupItemRequestBuilder + */ + public function withUrl(string $rawUrl): TargetDeviceGroupItemRequestBuilder { + return new TargetDeviceGroupItemRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderDeleteRequestConfiguration.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderDeleteRequestConfiguration.php new file mode 100644 index 00000000000..5a2a6749843 --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderDeleteRequestConfiguration.php @@ -0,0 +1,22 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + */ + public function __construct(?array $headers = null, ?array $options = null) { + parent::__construct($headers ?? [], $options ?? []); + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderGetQueryParameters.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..6419d645c82 --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderGetQueryParameters.php @@ -0,0 +1,34 @@ +|null $expand Expand related entities + */ + public ?array $expand = null; + + /** + * @QueryParameter("%24select") + * @var array|null $select Select properties to be returned + */ + public ?array $select = null; + + /** + * Instantiates a new TargetDeviceGroupItemRequestBuilderGetQueryParameters and sets the default values. + * @param array|null $expand Expand related entities + * @param array|null $select Select properties to be returned + */ + public function __construct(?array $expand = null, ?array $select = null) { + $this->expand = $expand; + $this->select = $select; + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderGetRequestConfiguration.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..2d3137d97e0 --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,39 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param TargetDeviceGroupItemRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?TargetDeviceGroupItemRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new TargetDeviceGroupItemRequestBuilderGetQueryParameters. + * @param array|null $expand Expand related entities + * @param array|null $select Select properties to be returned + * @return TargetDeviceGroupItemRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?array $expand = null, ?array $select = null): TargetDeviceGroupItemRequestBuilderGetQueryParameters { + return new TargetDeviceGroupItemRequestBuilderGetQueryParameters($expand, $select); + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderPatchRequestConfiguration.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderPatchRequestConfiguration.php new file mode 100644 index 00000000000..20c08f9fdb6 --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/Item/TargetDeviceGroupItemRequestBuilderPatchRequestConfiguration.php @@ -0,0 +1,22 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + */ + public function __construct(?array $headers = null, ?array $options = null) { + parent::__construct($headers ?? [], $options ?? []); + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilder.php new file mode 100644 index 00000000000..cce0cb69100 --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilder.php @@ -0,0 +1,137 @@ +pathParameters, $this->requestAdapter); + } + + /** + * Provides operations to manage the targetDeviceGroups property of the microsoft.graph.remoteDesktopSecurityConfiguration entity. + * @param string $targetDeviceGroupId The unique identifier of targetDeviceGroup + * @return TargetDeviceGroupItemRequestBuilder + */ + public function byTargetDeviceGroupId(string $targetDeviceGroupId): TargetDeviceGroupItemRequestBuilder { + $urlTplParams = $this->pathParameters; + $urlTplParams['targetDeviceGroup%2Did'] = $targetDeviceGroupId; + return new TargetDeviceGroupItemRequestBuilder($urlTplParams, $this->requestAdapter); + } + + /** + * Instantiates a new TargetDeviceGroupsRequestBuilder and sets the default values. + * @param array|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/servicePrincipals/{servicePrincipal%2Did}/remoteDesktopSecurityConfiguration/targetDeviceGroups{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * Get a list of the targetDeviceGroup objects and their properties on the remoteDesktopSecurityConfiguration resource on the servicePrincipal. Any user authenticating using the Microsoft Entra ID Remote Desktop Services (RDS) authentication protocol to a Microsoft Entra joined or Microsoft Entra hybrid joined device that belongs to the targetDeviceGroup will get SSO. + * @param TargetDeviceGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/remotedesktopsecurityconfiguration-list-targetdevicegroups?view=graph-rest-1.0 Find more info here + */ + public function get(?TargetDeviceGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetDeviceGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Create a new targetDeviceGroup object for the remoteDesktopSecurityConfiguration object on the servicePrincipal. You can configure a maximum of 10 target device groups for the remoteDesktopSecurityConfiguraiton object on the servicePrincipal. + * @param TargetDeviceGroup $body The request body + * @param TargetDeviceGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/remotedesktopsecurityconfiguration-post-targetdevicegroups?view=graph-rest-1.0 Find more info here + */ + public function post(TargetDeviceGroup $body, ?TargetDeviceGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TargetDeviceGroup::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Get a list of the targetDeviceGroup objects and their properties on the remoteDesktopSecurityConfiguration resource on the servicePrincipal. Any user authenticating using the Microsoft Entra ID Remote Desktop Services (RDS) authentication protocol to a Microsoft Entra joined or Microsoft Entra hybrid joined device that belongs to the targetDeviceGroup will get SSO. + * @param TargetDeviceGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?TargetDeviceGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + return $requestInfo; + } + + /** + * Create a new targetDeviceGroup object for the remoteDesktopSecurityConfiguration object on the servicePrincipal. You can configure a maximum of 10 target device groups for the remoteDesktopSecurityConfiguraiton object on the servicePrincipal. + * @param TargetDeviceGroup $body The request body + * @param TargetDeviceGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toPostRequestInformation(TargetDeviceGroup $body, ?TargetDeviceGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::POST; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return TargetDeviceGroupsRequestBuilder + */ + public function withUrl(string $rawUrl): TargetDeviceGroupsRequestBuilder { + return new TargetDeviceGroupsRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilderGetQueryParameters.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..4d4707ca175 --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilderGetQueryParameters.php @@ -0,0 +1,82 @@ +|null $expand Expand related entities + */ + public ?array $expand = null; + + /** + * @QueryParameter("%24filter") + * @var string|null $filter Filter items by property values + */ + public ?string $filter = null; + + /** + * @QueryParameter("%24orderby") + * @var array|null $orderby Order items by property values + */ + public ?array $orderby = null; + + /** + * @QueryParameter("%24search") + * @var string|null $search Search items by search phrases + */ + public ?string $search = null; + + /** + * @QueryParameter("%24select") + * @var array|null $select Select properties to be returned + */ + public ?array $select = null; + + /** + * @QueryParameter("%24skip") + * @var int|null $skip Skip the first n items + */ + public ?int $skip = null; + + /** + * @QueryParameter("%24top") + * @var int|null $top Show only the first n items + */ + public ?int $top = null; + + /** + * Instantiates a new targetDeviceGroupsRequestBuilderGetQueryParameters and sets the default values. + * @param bool|null $count Include count of items + * @param array|null $expand Expand related entities + * @param string|null $filter Filter items by property values + * @param array|null $orderby Order items by property values + * @param string|null $search Search items by search phrases + * @param array|null $select Select properties to be returned + * @param int|null $skip Skip the first n items + * @param int|null $top Show only the first n items + */ + public function __construct(?bool $count = null, ?array $expand = null, ?string $filter = null, ?array $orderby = null, ?string $search = null, ?array $select = null, ?int $skip = null, ?int $top = null) { + $this->count = $count; + $this->expand = $expand; + $this->filter = $filter; + $this->orderby = $orderby; + $this->search = $search; + $this->select = $select; + $this->skip = $skip; + $this->top = $top; + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilderGetRequestConfiguration.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..f5ab9c76ba6 --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,45 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param TargetDeviceGroupsRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?TargetDeviceGroupsRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new targetDeviceGroupsRequestBuilderGetQueryParameters. + * @param bool|null $count Include count of items + * @param array|null $expand Expand related entities + * @param string|null $filter Filter items by property values + * @param array|null $orderby Order items by property values + * @param string|null $search Search items by search phrases + * @param array|null $select Select properties to be returned + * @param int|null $skip Skip the first n items + * @param int|null $top Show only the first n items + * @return TargetDeviceGroupsRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?bool $count = null, ?array $expand = null, ?string $filter = null, ?array $orderby = null, ?string $search = null, ?array $select = null, ?int $skip = null, ?int $top = null): TargetDeviceGroupsRequestBuilderGetQueryParameters { + return new TargetDeviceGroupsRequestBuilderGetQueryParameters($count, $expand, $filter, $orderby, $search, $select, $skip, $top); + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilderPostRequestConfiguration.php b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilderPostRequestConfiguration.php new file mode 100644 index 00000000000..79d17e74e31 --- /dev/null +++ b/src/Generated/ServicePrincipals/Item/RemoteDesktopSecurityConfiguration/TargetDeviceGroups/TargetDeviceGroupsRequestBuilderPostRequestConfiguration.php @@ -0,0 +1,22 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + */ + public function __construct(?array $headers = null, ?array $options = null) { + parent::__construct($headers ?? [], $options ?? []); + } + +} diff --git a/src/Generated/ServicePrincipals/Item/RemoveKey/RemoveKeyRequestBuilder.php b/src/Generated/ServicePrincipals/Item/RemoveKey/RemoveKeyRequestBuilder.php index b9ac449085e..1085352f86f 100644 --- a/src/Generated/ServicePrincipals/Item/RemoveKey/RemoveKeyRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/RemoveKey/RemoveKeyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Remove a key credential from a servicePrincipal. This method along with addKey can be used by a servicePrincipal to automate rolling its expiring keys. As part of the request validation for this method, a proof of possession of an existing key is verified before the action can be performed. This API is available in the following national cloud deployments. * @param RemoveKeyPostRequestBody $body The request body * @param RemoveKeyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-removekey?view=graph-rest-1.0 Find more info here */ public function post(RemoveKeyPostRequestBody $body, ?RemoveKeyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(RemoveKeyPostRequestBody $body, ?Remove $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/RemovePassword/RemovePasswordRequestBuilder.php b/src/Generated/ServicePrincipals/Item/RemovePassword/RemovePasswordRequestBuilder.php index 93aec5c875e..d2a4437a976 100644 --- a/src/Generated/ServicePrincipals/Item/RemovePassword/RemovePasswordRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/RemovePassword/RemovePasswordRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Remove a password from a servicePrincipal object. This API is available in the following national cloud deployments. * @param RemovePasswordPostRequestBody $body The request body * @param RemovePasswordRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-removepassword?view=graph-rest-1.0 Find more info here */ public function post(RemovePasswordPostRequestBody $body, ?RemovePasswordRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(RemovePasswordPostRequestBody $body, ?R $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Restore/RestoreRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Restore/RestoreRequestBuilder.php index 0c0ad560a1c..26425560eb6 100644 --- a/src/Generated/ServicePrincipals/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/ServicePrincipalItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/ServicePrincipalItemRequestBuilder.php index afc4fe668ec..fda797d4b33 100644 --- a/src/Generated/ServicePrincipals/Item/ServicePrincipalItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/ServicePrincipalItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Graph\Generated\ServicePrincipals\Item\AddKey\AddKeyRequestBuilder; @@ -27,6 +26,7 @@ use Microsoft\Graph\Generated\ServicePrincipals\Item\Oauth2PermissionGrants\Oauth2PermissionGrantsRequestBuilder; use Microsoft\Graph\Generated\ServicePrincipals\Item\OwnedObjects\OwnedObjectsRequestBuilder; use Microsoft\Graph\Generated\ServicePrincipals\Item\Owners\OwnersRequestBuilder; +use Microsoft\Graph\Generated\ServicePrincipals\Item\RemoteDesktopSecurityConfiguration\RemoteDesktopSecurityConfigurationRequestBuilder; use Microsoft\Graph\Generated\ServicePrincipals\Item\RemoveKey\RemoveKeyRequestBuilder; use Microsoft\Graph\Generated\ServicePrincipals\Item\RemovePassword\RemovePasswordRequestBuilder; use Microsoft\Graph\Generated\ServicePrincipals\Item\Restore\RestoreRequestBuilder; @@ -184,6 +184,13 @@ public function owners(): OwnersRequestBuilder { return new OwnersRequestBuilder($this->pathParameters, $this->requestAdapter); } + /** + * Provides operations to manage the remoteDesktopSecurityConfiguration property of the microsoft.graph.servicePrincipal entity. + */ + public function remoteDesktopSecurityConfiguration(): RemoteDesktopSecurityConfigurationRequestBuilder { + return new RemoteDesktopSecurityConfigurationRequestBuilder($this->pathParameters, $this->requestAdapter); + } + /** * Provides operations to call the removeKey method. */ @@ -250,58 +257,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a servicePrincipal object. This API is available in the following national cloud deployments. * @param ServicePrincipalItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ServicePrincipalItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a servicePrincipal object. This API is available in the following national cloud deployments. * @param ServicePrincipalItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-get?view=graph-rest-1.0 Find more info here */ public function get(?ServicePrincipalItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in servicePrincipals * @param ServicePrincipal $body The request body * @param ServicePrincipalItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ServicePrincipal $body, ?ServicePrincipalItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -318,6 +316,7 @@ public function toDeleteRequestInformation(?ServicePrincipalItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -331,7 +330,6 @@ public function toGetRequestInformation(?ServicePrincipalItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -339,6 +337,7 @@ public function toGetRequestInformation(?ServicePrincipalItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -353,11 +352,11 @@ public function toPatchRequestInformation(ServicePrincipal $body, ?ServicePrinci $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/AcquireAccessToken/AcquireAccessTokenRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/AcquireAccessToken/AcquireAccessTokenRequestBuilder.php index a7b9f49209b..77118cbe0c6 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/AcquireAccessToken/AcquireAccessTokenRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/AcquireAccessToken/AcquireAccessTokenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Acquire an OAuth access token to authorize the Azure AD provisioning service to provision users into an application. This API is available in the following national cloud deployments. + * Acquire an OAuth access token to authorize the Microsoft Entra provisioning service to provision users into an application. This API is available in the following national cloud deployments. * @param AcquireAccessTokenPostRequestBody $body The request body * @param AcquireAccessTokenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronization-acquireaccesstoken?view=graph-rest-1.0 Find more info here */ public function post(AcquireAccessTokenPostRequestBody $body, ?AcquireAccessTokenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Acquire an OAuth access token to authorize the Azure AD provisioning service to provision users into an application. This API is available in the following national cloud deployments. + * Acquire an OAuth access token to authorize the Microsoft Entra provisioning service to provision users into an application. This API is available in the following national cloud deployments. * @param AcquireAccessTokenPostRequestBody $body The request body * @param AcquireAccessTokenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcquireAccessTokenPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Count/CountRequestBuilder.php index 8620d26f50c..1af7b881fee 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Pause/PauseRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Pause/PauseRequestBuilder.php index 03c362fd883..e3eea8fecae 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Pause/PauseRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Pause/PauseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Temporarily stop a running synchronization job. All the progress, including job state, is persisted, and the job will continue from where it left off when a start call is made. This API is available in the following national cloud deployments. * @param PauseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-pause?view=graph-rest-1.0 Find more info here */ public function post(?PauseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?PauseRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/ProvisionOnDemand/ProvisionOnDemandRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/ProvisionOnDemand/ProvisionOnDemandRequestBuilder.php index 2ce7a9182e9..730c0adbcda 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/ProvisionOnDemand/ProvisionOnDemandRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/ProvisionOnDemand/ProvisionOnDemandRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\StringKeyStringValuePair; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Select a user and provision the account on-demand. The rate limit for this API is 5 requests per 10 seconds. This API is available in the following national cloud deployments. * @param ProvisionOnDemandPostRequestBody $body The request body * @param ProvisionOnDemandRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-provisionondemand?view=graph-rest-1.0 Find more info here */ public function post(ProvisionOnDemandPostRequestBody $body, ?ProvisionOnDemandRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StringKeyStringValuePair::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StringKeyStringValuePair::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(ProvisionOnDemandPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Restart/RestartRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Restart/RestartRequestBuilder.php index 93d4cdf5b56..82d1a7df6e4 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Restart/RestartRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Restart/RestartRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Restart a stopped synchronization job, forcing it to reprocess all the objects in the directory. Optionally clears existing the synchronization state and previous errors. This API is available in the following national cloud deployments. * @param RestartPostRequestBody $body The request body * @param RestartRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-restart?view=graph-rest-1.0 Find more info here */ public function post(RestartPostRequestBody $body, ?RestartRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(RestartPostRequestBody $body, ?RestartR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/Count/CountRequestBuilder.php index a2af08e84d1..5a38fc72534 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/DirectoriesRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/DirectoriesRequestBuilder.php index b3c5ee33f10..84881774546 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/DirectoriesRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/DirectoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryDefinition; use Microsoft\Graph\Generated\Models\DirectoryDefinitionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the collection of directories and all of their objects. * @param DirectoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to directories for servicePrincipals * @param DirectoryDefinition $body The request body * @param DirectoriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DirectoryDefinition $body, ?DirectoriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DirectoriesRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DirectoriesRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DirectoryDefinition $body, ?Directories $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php index 11312108424..835d4bb4e81 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\Synchronization\Jobs\Item\Schema\Directories\Item\Discover\DiscoverRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property directories for servicePrincipals * @param DirectoryDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DirectoryDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Contains the collection of directories and all of their objects. * @param DirectoryDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property directories in servicePrincipals * @param DirectoryDefinition $body The request body * @param DirectoryDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DirectoryDefinition $body, ?DirectoryDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?DirectoryDefinitionItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?DirectoryDefinitionItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?DirectoryDefinitionItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(DirectoryDefinition $body, ?DirectoryD $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php index d8ee2036652..4e464a2f99f 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Discover the latest schema definition for provisioning to an application. This API is available in the following national cloud deployments. * @param DiscoverRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-directorydefinition-discover?view=graph-rest-1.0 Find more info here */ public function post(?DiscoverRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?DiscoverRequestBuilderPostRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php index 7c629d283ce..7fec836a377 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterOperators * @param FilterOperatorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterOperatorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?FilterOperatorsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?FilterOperatorsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Functions/FunctionsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Functions/FunctionsRequestBuilder.php index ad6093f27fd..75e4002d2c8 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Functions/FunctionsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/Functions/FunctionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function functions * @param FunctionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FunctionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FunctionsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FunctionsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?FunctionsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?FunctionsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php index bd1a88ebb60..9ad3ac4e07e 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ParseExpressionResponse; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,27 +31,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Azure Active Directory. This API is available in the following national cloud deployments. + * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Microsoft Entra ID. This API is available in the following national cloud deployments. * @param ParseExpressionPostRequestBody $body The request body * @param ParseExpressionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationschema-parseexpression?view=graph-rest-1.0 Find more info here */ public function post(ParseExpressionPostRequestBody $body, ?ParseExpressionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ParseExpressionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ParseExpressionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Azure Active Directory. This API is available in the following national cloud deployments. + * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Microsoft Entra ID. This API is available in the following national cloud deployments. * @param ParseExpressionPostRequestBody $body The request body * @param ParseExpressionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -62,11 +58,11 @@ public function toPostRequestInformation(ParseExpressionPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/SchemaRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/SchemaRequestBuilder.php index d68d39e8c03..29769b86f8f 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/SchemaRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Schema/SchemaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SynchronizationSchema; use Microsoft\Graph\Generated\ServicePrincipals\Item\Synchronization\Jobs\Item\Schema\Directories\DirectoriesRequestBuilder; @@ -66,58 +65,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property schema for servicePrincipals * @param SchemaRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SchemaRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the schema for a given synchronization job or template. This API is available in the following national cloud deployments. * @param SchemaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationschema-get?view=graph-rest-1.0 Find more info here */ public function get(?SchemaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the synchronization schema for a given job or template. This method fully replaces the current schema with the one provided in the request. To update the schema of a template, make the call on the application object. You must be the owner of the application. * @param SynchronizationSchema $body The request body * @param SchemaRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationschema-update?view=graph-rest-1.0 Find more info here */ public function patch(SynchronizationSchema $body, ?SchemaRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -134,6 +124,7 @@ public function toDeleteRequestInformation(?SchemaRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -147,7 +138,6 @@ public function toGetRequestInformation(?SchemaRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -155,6 +145,7 @@ public function toGetRequestInformation(?SchemaRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -169,11 +160,11 @@ public function toPatchRequestInformation(SynchronizationSchema $body, ?SchemaRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Start/StartRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Start/StartRequestBuilder.php index 83dd359aacb..0fcba147078 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Start/StartRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/Start/StartRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Start an existing synchronization job. If the job is in a paused state, it continues processing changes from the point where it was paused. If the job is in quarantine, the quarantine status is cleared. Don't create scripts to call the start job continuously while it's running because that can cause the service to stop running. Use the start job only when the job is currently paused or in quarantine. This API is available in the following national cloud deployments. * @param StartRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-start?view=graph-rest-1.0 Find more info here */ public function post(?StartRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?StartRequestBuilderPostRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/SynchronizationJobItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/SynchronizationJobItemRequestBuilder.php index e894ab677e5..5bf7d93b0f0 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/SynchronizationJobItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/SynchronizationJobItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SynchronizationJob; use Microsoft\Graph\Generated\ServicePrincipals\Item\Synchronization\Jobs\Item\Pause\PauseRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Stop the synchronization job, and permanently delete all the state associated with it. Synchronized accounts are left as-is. This API is available in the following national cloud deployments. * @param SynchronizationJobItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SynchronizationJobItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the existing synchronization job and its properties. This API is available in the following national cloud deployments. * @param SynchronizationJobItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-get?view=graph-rest-1.0 Find more info here */ public function get(?SynchronizationJobItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property jobs in servicePrincipals * @param SynchronizationJob $body The request body * @param SynchronizationJobItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SynchronizationJob $body, ?SynchronizationJobItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?SynchronizationJobItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?SynchronizationJobItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?SynchronizationJobItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(SynchronizationJob $body, ?Synchroniza $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/ValidateCredentials/ValidateCredentialsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/ValidateCredentials/ValidateCredentialsRequestBuilder.php index d0e9502713a..31b7607920c 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/ValidateCredentials/ValidateCredentialsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/Item/ValidateCredentials/ValidateCredentialsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that the credentials are valid in the tenant. This API is available in the following national cloud deployments. * @param ValidateCredentialsPostRequestBody $body The request body * @param ValidateCredentialsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationjob-validatecredentials?view=graph-rest-1.0 Find more info here */ public function post(ValidateCredentialsPostRequestBody $body, ?ValidateCredentialsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidateCredentialsPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/JobsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/JobsRequestBuilder.php index 5df9e60de33..208c99d2e6a 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/JobsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/JobsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SynchronizationJob; use Microsoft\Graph\Generated\Models\SynchronizationJobCollectionResponse; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List existing jobs for a given application instance (service principal). This API is available in the following national cloud deployments. * @param JobsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronization-list-jobs?view=graph-rest-1.0 Find more info here */ public function get(?JobsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJobCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJobCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new synchronization job with a default synchronization schema. The job is created in a disabled state. Call Start job to start synchronization. This API is available in the following national cloud deployments. * @param SynchronizationJob $body The request body * @param JobsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronization-post-jobs?view=graph-rest-1.0 Find more info here */ public function post(SynchronizationJob $body, ?JobsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJob::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationJob::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?JobsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?JobsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(SynchronizationJob $body, ?JobsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/ValidateCredentials/ValidateCredentialsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/ValidateCredentials/ValidateCredentialsRequestBuilder.php index 3ed60cea598..a30682dcb37 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/ValidateCredentials/ValidateCredentialsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Jobs/ValidateCredentials/ValidateCredentialsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action validateCredentials * @param ValidateCredentialsPostRequestBody $body The request body * @param ValidateCredentialsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ValidateCredentialsPostRequestBody $body, ?ValidateCredentialsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(ValidateCredentialsPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Secrets/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Secrets/Count/CountRequestBuilder.php index b1c9ebeeac0..d34f2986fb9 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Secrets/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Secrets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Secrets/SecretsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Secrets/SecretsRequestBuilder.php index 7119e691ada..6506fc6dba0 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Secrets/SecretsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Secrets/SecretsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SynchronizationSecretKeyStringValuePair; use Microsoft\Graph\Generated\ServicePrincipals\Item\Synchronization\Secrets\Count\CountRequestBuilder; @@ -43,19 +42,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Update property secrets value. * @param array $body The request body * @param SecretsRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise|null> + * @throws Exception */ public function put(array $body, ?SecretsRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendCollectionAsync($requestInfo, [SynchronizationSecretKeyStringValuePair::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendCollectionAsync($requestInfo, [SynchronizationSecretKeyStringValuePair::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -69,11 +65,11 @@ public function toPutRequestInformation(array $body, ?SecretsRequestBuilderPutRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsableCollection($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/SynchronizationRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/SynchronizationRequestBuilder.php index 45e1944c527..42a0cc1d645 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/SynchronizationRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/SynchronizationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Synchronization; use Microsoft\Graph\Generated\ServicePrincipals\Item\Synchronization\AcquireAccessToken\AcquireAccessTokenRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property synchronization for servicePrincipals * @param SynchronizationRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SynchronizationRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Represents the capability for Azure Active Directory (Azure AD) identity synchronization through the Microsoft Graph API. + * Represents the capability for Microsoft Entra identity synchronization through the Microsoft Graph API. * @param SynchronizationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SynchronizationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Synchronization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Synchronization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property synchronization in servicePrincipals * @param Synchronization $body The request body * @param SynchronizationRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(Synchronization $body, ?SynchronizationRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Synchronization::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Synchronization::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,11 +122,12 @@ public function toDeleteRequestInformation(?SynchronizationRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Represents the capability for Azure Active Directory (Azure AD) identity synchronization through the Microsoft Graph API. + * Represents the capability for Microsoft Entra identity synchronization through the Microsoft Graph API. * @param SynchronizationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -145,7 +136,6 @@ public function toGetRequestInformation(?SynchronizationRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?SynchronizationRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPutRequestInformation(Synchronization $body, ?SynchronizationR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/SynchronizationRequestBuilderGetQueryParameters.php b/src/Generated/ServicePrincipals/Item/Synchronization/SynchronizationRequestBuilderGetQueryParameters.php index d6d6492efa9..4283f4f06d8 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/SynchronizationRequestBuilderGetQueryParameters.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/SynchronizationRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Represents the capability for Azure Active Directory (Azure AD) identity synchronization through the Microsoft Graph API. + * Represents the capability for Microsoft Entra identity synchronization through the Microsoft Graph API. */ class SynchronizationRequestBuilderGetQueryParameters { diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Count/CountRequestBuilder.php index 86a4c6345c1..abe55a5fb91 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/Count/CountRequestBuilder.php index 99e79ffd1bb..eb3c43c331f 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/DirectoriesRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/DirectoriesRequestBuilder.php index 3a474ab354d..cc3d054f1b4 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/DirectoriesRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/DirectoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryDefinition; use Microsoft\Graph\Generated\Models\DirectoryDefinitionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Contains the collection of directories and all of their objects. * @param DirectoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to directories for servicePrincipals * @param DirectoryDefinition $body The request body * @param DirectoriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DirectoryDefinition $body, ?DirectoriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DirectoriesRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DirectoriesRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DirectoryDefinition $body, ?Directories $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php index 5443c948232..2a6273bc549 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/Item/DirectoryDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\Synchronization\Templates\Item\Schema\Directories\Item\Discover\DiscoverRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property directories for servicePrincipals * @param DirectoryDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DirectoryDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Contains the collection of directories and all of their objects. * @param DirectoryDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property directories in servicePrincipals * @param DirectoryDefinition $body The request body * @param DirectoryDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DirectoryDefinition $body, ?DirectoryDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?DirectoryDefinitionItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?DirectoryDefinitionItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?DirectoryDefinitionItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(DirectoryDefinition $body, ?DirectoryD $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php index 2059235a1c3..a94a79a5b6a 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Directories/Item/Discover/DiscoverRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Discover the latest schema definition for provisioning to an application. This API is available in the following national cloud deployments. * @param DiscoverRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-directorydefinition-discover?view=graph-rest-1.0 Find more info here */ public function post(?DiscoverRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?DiscoverRequestBuilderPostRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php index f0e90beb871..7ea2f94956e 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/FilterOperators/FilterOperatorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function filterOperators * @param FilterOperatorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FilterOperatorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FilterOperatorsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?FilterOperatorsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?FilterOperatorsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Functions/FunctionsRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Functions/FunctionsRequestBuilder.php index f41045d1fcb..10d922068b4 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Functions/FunctionsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/Functions/FunctionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function functions * @param FunctionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FunctionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FunctionsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FunctionsGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?FunctionsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?FunctionsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php index 4962fcdb073..c858b410634 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/ParseExpression/ParseExpressionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ParseExpressionResponse; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,27 +31,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Azure Active Directory. This API is available in the following national cloud deployments. + * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Microsoft Entra ID. This API is available in the following national cloud deployments. * @param ParseExpressionPostRequestBody $body The request body * @param ParseExpressionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationschema-parseexpression?view=graph-rest-1.0 Find more info here */ public function post(ParseExpressionPostRequestBody $body, ?ParseExpressionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ParseExpressionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ParseExpressionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Azure Active Directory. This API is available in the following national cloud deployments. + * Parse a given string expression into an attributeMappingSource object. For more information about expressions, see Writing Expressions for Attribute Mappings in Microsoft Entra ID. This API is available in the following national cloud deployments. * @param ParseExpressionPostRequestBody $body The request body * @param ParseExpressionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -62,11 +58,11 @@ public function toPostRequestInformation(ParseExpressionPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/SchemaRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/SchemaRequestBuilder.php index ac8921de7ff..e4d06a181c4 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/SchemaRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/Schema/SchemaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SynchronizationSchema; use Microsoft\Graph\Generated\ServicePrincipals\Item\Synchronization\Templates\Item\Schema\Directories\DirectoriesRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property schema for servicePrincipals * @param SchemaRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SchemaRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Default synchronization schema for the jobs based on this template. * @param SchemaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SchemaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property schema in servicePrincipals * @param SynchronizationSchema $body The request body * @param SchemaRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SynchronizationSchema $body, ?SchemaRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationSchema::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?SchemaRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?SchemaRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?SchemaRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(SynchronizationSchema $body, ?SchemaRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/SynchronizationTemplateItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/SynchronizationTemplateItemRequestBuilder.php index dd729d02850..a831cad5018 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/SynchronizationTemplateItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/Item/SynchronizationTemplateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SynchronizationTemplate; use Microsoft\Graph\Generated\ServicePrincipals\Item\Synchronization\Templates\Item\Schema\SchemaRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property templates for servicePrincipals * @param SynchronizationTemplateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SynchronizationTemplateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Preconfigured synchronization settings for a particular application. * @param SynchronizationTemplateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SynchronizationTemplateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update (override) the synchronization template associated with a given application. This API is available in the following national cloud deployments. * @param SynchronizationTemplate $body The request body * @param SynchronizationTemplateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronizationtemplate-update?view=graph-rest-1.0 Find more info here */ public function patch(SynchronizationTemplate $body, ?SynchronizationTemplateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?SynchronizationTemplateItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?SynchronizationTemplateItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?SynchronizationTemplateItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(SynchronizationTemplate $body, ?Synchr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/TemplatesRequestBuilder.php b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/TemplatesRequestBuilder.php index 1a5414d1266..c320d351917 100644 --- a/src/Generated/ServicePrincipals/Item/Synchronization/Templates/TemplatesRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/Synchronization/Templates/TemplatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SynchronizationTemplate; use Microsoft\Graph\Generated\Models\SynchronizationTemplateCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the synchronization templates associated with a given application or service principal. This API is available in the following national cloud deployments. * @param TemplatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/synchronization-synchronization-list-templates?view=graph-rest-1.0 Find more info here */ public function get(?TemplatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to templates for servicePrincipals * @param SynchronizationTemplate $body The request body * @param TemplatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SynchronizationTemplate $body, ?TemplatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SynchronizationTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TemplatesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TemplatesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SynchronizationTemplate $body, ?Templat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TokenIssuancePolicies/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TokenIssuancePolicies/Count/CountRequestBuilder.php index f0ff9028217..d8cf0d7aba8 100644 --- a/src/Generated/ServicePrincipals/Item/TokenIssuancePolicies/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TokenIssuancePolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TokenIssuancePolicies/Item/TokenIssuancePolicyItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TokenIssuancePolicies/Item/TokenIssuancePolicyItemRequestBuilder.php index 34ce6afd1ec..7fa98acb377 100644 --- a/src/Generated/ServicePrincipals/Item/TokenIssuancePolicies/Item/TokenIssuancePolicyItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TokenIssuancePolicies/Item/TokenIssuancePolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TokenIssuancePolicy; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The tokenIssuancePolicies assigned to this service principal. * @param TokenIssuancePolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TokenIssuancePolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TokenIssuancePolicyItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TokenIssuancePolicyItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TokenIssuancePolicies/TokenIssuancePoliciesRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TokenIssuancePolicies/TokenIssuancePoliciesRequestBuilder.php index 3fd9c54a5bc..a3faf386778 100644 --- a/src/Generated/ServicePrincipals/Item/TokenIssuancePolicies/TokenIssuancePoliciesRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TokenIssuancePolicies/TokenIssuancePoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TokenIssuancePolicyCollectionResponse; use Microsoft\Graph\Generated\ServicePrincipals\Item\TokenIssuancePolicies\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The tokenIssuancePolicies assigned to this service principal. * @param TokenIssuancePoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TokenIssuancePoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenIssuancePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?TokenIssuancePoliciesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?TokenIssuancePoliciesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TokenLifetimePolicies/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TokenLifetimePolicies/Count/CountRequestBuilder.php index 514163a5b33..854ea02bd1b 100644 --- a/src/Generated/ServicePrincipals/Item/TokenLifetimePolicies/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TokenLifetimePolicies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TokenLifetimePolicies/Item/TokenLifetimePolicyItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TokenLifetimePolicies/Item/TokenLifetimePolicyItemRequestBuilder.php index 2a36a0e3e1b..14ac51c01bb 100644 --- a/src/Generated/ServicePrincipals/Item/TokenLifetimePolicies/Item/TokenLifetimePolicyItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TokenLifetimePolicies/Item/TokenLifetimePolicyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TokenLifetimePolicy; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The tokenLifetimePolicies assigned to this service principal. * @param TokenLifetimePolicyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TokenLifetimePolicyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicy::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TokenLifetimePolicyItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TokenLifetimePolicyItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TokenLifetimePolicies/TokenLifetimePoliciesRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TokenLifetimePolicies/TokenLifetimePoliciesRequestBuilder.php index 4d6b169f80c..7e7b37a0bb0 100644 --- a/src/Generated/ServicePrincipals/Item/TokenLifetimePolicies/TokenLifetimePoliciesRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TokenLifetimePolicies/TokenLifetimePoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TokenLifetimePolicyCollectionResponse; use Microsoft\Graph\Generated\ServicePrincipals\Item\TokenLifetimePolicies\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The tokenLifetimePolicies assigned to this service principal. * @param TokenLifetimePoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TokenLifetimePoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TokenLifetimePolicyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?TokenLifetimePoliciesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?TokenLifetimePoliciesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Count/CountRequestBuilder.php index dc45d5c48ea..cbd24a43daa 100644 --- a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php index 273b3e2c280..f944c516dc8 100644 --- a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index 21da763c728..1dc5c7734ec 100644 --- a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnitCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\TransitiveMemberOf\GraphAdministrativeUnit\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.administrativeUnit in the microsoft.graph.directoryObject collection * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php index ab6788d4400..94a1ea71e83 100644 --- a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php index 5c5f80327ee..99299d6f54e 100644 --- a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryRoleCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\TransitiveMemberOf\GraphDirectoryRole\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.directoryRole in the microsoft.graph.directoryObject collection * @param GraphDirectoryRoleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDirectoryRoleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php index c7259a919b2..a06ac723e1f 100644 --- a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php index 0b69b4cfa11..986a91b3836 100644 --- a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\TransitiveMemberOf\GraphGroup\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php index 26039396ca1..a2c18b2e13a 100644 --- a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\TransitiveMemberOf\Item\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get transitiveMemberOf from servicePrincipals * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index 2943445bf43..22d9939f706 100644 --- a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnit; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.administrativeUnit * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php index c2af3d00a4b..a0ff732d47a 100644 --- a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.directoryRole * @param GraphDirectoryRoleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDirectoryRoleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php index 22e74c25e85..807ebd8ae3d 100644 --- a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php index dc1f673f1c3..48c8f4e9a1a 100644 --- a/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php +++ b/src/Generated/ServicePrincipals/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\ServicePrincipals\Item\TransitiveMemberOf\Count\CountRequestBuilder; @@ -78,20 +77,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get transitiveMemberOf from servicePrincipals * @param TransitiveMemberOfRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-list-transitivememberof?view=graph-rest-1.0 Find more info here */ public function get(?TransitiveMemberOfRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -104,7 +100,6 @@ public function toGetRequestInformation(?TransitiveMemberOfRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -112,6 +107,7 @@ public function toGetRequestInformation(?TransitiveMemberOfRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/ServicePrincipalsRequestBuilder.php b/src/Generated/ServicePrincipals/ServicePrincipalsRequestBuilder.php index 946907d097c..06dd0858315 100644 --- a/src/Generated/ServicePrincipals/ServicePrincipalsRequestBuilder.php +++ b/src/Generated/ServicePrincipals/ServicePrincipalsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; @@ -87,40 +86,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of servicePrincipal objects. This API is available in the following national cloud deployments. * @param ServicePrincipalsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-list?view=graph-rest-1.0 Find more info here */ public function get(?ServicePrincipalsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new servicePrincipal object. This API is available in the following national cloud deployments. * @param ServicePrincipal $body The request body * @param ServicePrincipalsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-post-serviceprincipals?view=graph-rest-1.0 Find more info here */ public function post(ServicePrincipal $body, ?ServicePrincipalsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,7 +126,6 @@ public function toGetRequestInformation(?ServicePrincipalsRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -141,6 +133,7 @@ public function toGetRequestInformation(?ServicePrincipalsRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -155,11 +148,11 @@ public function toPostRequestInformation(ServicePrincipal $body, ?ServicePrincip $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipals/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/ServicePrincipals/ValidateProperties/ValidatePropertiesRequestBuilder.php index d43b8133556..e1127f99e42 100644 --- a/src/Generated/ServicePrincipals/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/ServicePrincipals/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/ServicePrincipalsWithAppId/ServicePrincipalsWithAppIdRequestBuilder.php b/src/Generated/ServicePrincipalsWithAppId/ServicePrincipalsWithAppIdRequestBuilder.php index 630667cb059..43d346bb456 100644 --- a/src/Generated/ServicePrincipalsWithAppId/ServicePrincipalsWithAppIdRequestBuilder.php +++ b/src/Generated/ServicePrincipalsWithAppId/ServicePrincipalsWithAppIdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,58 +36,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a servicePrincipal object. This API is available in the following national cloud deployments. * @param ServicePrincipalsWithAppIdRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ServicePrincipalsWithAppIdRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a servicePrincipal object. This API is available in the following national cloud deployments. * @param ServicePrincipalsWithAppIdRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/serviceprincipal-get?view=graph-rest-1.0 Find more info here */ public function get(?ServicePrincipalsWithAppIdRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in servicePrincipals by appId * @param ServicePrincipal $body The request body * @param ServicePrincipalsWithAppIdRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ServicePrincipal $body, ?ServicePrincipalsWithAppIdRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -105,6 +95,7 @@ public function toDeleteRequestInformation(?ServicePrincipalsWithAppIdRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -118,7 +109,6 @@ public function toGetRequestInformation(?ServicePrincipalsWithAppIdRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -126,6 +116,7 @@ public function toGetRequestInformation(?ServicePrincipalsWithAppIdRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -140,11 +131,11 @@ public function toPatchRequestInformation(ServicePrincipal $body, ?ServicePrinci $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Count/CountRequestBuilder.php b/src/Generated/Shares/Count/CountRequestBuilder.php index 74100355ece..24863c5a2b6 100644 --- a/src/Generated/Shares/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/CreatedByUser/CreatedByUserRequestBuilder.php b/src/Generated/Shares/Item/CreatedByUser/CreatedByUserRequestBuilder.php index 306c887c5a8..c236a5e1a64 100644 --- a/src/Generated/Shares/Item/CreatedByUser/CreatedByUserRequestBuilder.php +++ b/src/Generated/Shares/Item/CreatedByUser/CreatedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Shares\Item\CreatedByUser\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who created the item. Read-only. * @param CreatedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Shares/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index ed24a7caff9..99f64cc0470 100644 --- a/src/Generated/Shares/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Shares/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index dc116e1f9b1..ff8e68075e4 100644 --- a/src/Generated/Shares/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Shares/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 0e140e6f28c..cb15c6e041e 100644 --- a/src/Generated/Shares/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Shares/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Shares\Item\CreatedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/DriveItem/Content/ContentRequestBuilder.php b/src/Generated/Shares/Item/DriveItem/Content/ContentRequestBuilder.php index 30b963ebf8c..4e80e144ee1 100644 --- a/src/Generated/Shares/Item/DriveItem/Content/ContentRequestBuilder.php +++ b/src/Generated/Shares/Item/DriveItem/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shares-get?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/DriveItem/DriveItemRequestBuilder.php b/src/Generated/Shares/Item/DriveItem/DriveItemRequestBuilder.php index 52cdc709c50..3053c3a114c 100644 --- a/src/Generated/Shares/Item/DriveItem/DriveItemRequestBuilder.php +++ b/src/Generated/Shares/Item/DriveItem/DriveItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\DriveItem\Content\ContentRequestBuilder; @@ -42,20 +41,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Access a shared DriveItem or a collection of shared items by using a shareId or sharing URL. To use a sharing URL with this API, your app needs to transform the URL into a sharing token. This API is available in the following national cloud deployments. * @param DriveItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shares-get?view=graph-rest-1.0 Find more info here */ public function get(?DriveItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -68,7 +64,6 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -76,6 +71,7 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Columns/ColumnsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Columns/ColumnsRequestBuilder.php index 2f6c5921394..0bf6c881f46 100644 --- a/src/Generated/Shares/Item/EscapedList/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of columns represented as columnDefinition][columnDefinition] resources in a [list][list]. This API is available in the following [national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a column for a list][list] with a request that specifies a [columnDefinition][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-post-columns?view=graph-rest-1.0 Find more info here */ public function post(ColumnDefinition $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ColumnDefinition $body, ?ColumnsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Columns/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Columns/Count/CountRequestBuilder.php index df72e98b838..319c87df3e0 100644 --- a/src/Generated/Shares/Item/EscapedList/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Columns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Columns/Item/ColumnDefinitionItemRequestBuilder.php index 92aa81da532..9b704f31e82 100644 --- a/src/Generated/Shares/Item/EscapedList/Columns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Columns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\EscapedList\Columns\Item\SourceColumn\SourceColumnRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property columns for shares * @param ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of field definitions for this list. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property columns in shares * @param ColumnDefinition $body The request body * @param ColumnDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ColumnDefinition $body, ?ColumnDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ColumnDefinitionItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ColumnDefinition $body, ?ColumnDefinit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php index 414c4708726..22a74aef260 100644 --- a/src/Generated/Shares/Item/EscapedList/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The source column for the content type column. * @param SourceColumnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SourceColumnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/AddCopy/AddCopyRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/AddCopy/AddCopyRequestBuilder.php index 9a334a14bad..5fb684d75b1 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/AddCopy/AddCopyRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/AddCopy/AddCopyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add a copy of a content type][contentType] from a [site][site] to a [list][list]. This API is available in the following [national cloud deployments. * @param AddCopyPostRequestBody $body The request body * @param AddCopyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-addcopy?view=graph-rest-1.0 Find more info here */ public function post(AddCopyPostRequestBody $body, ?AddCopyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddCopyPostRequestBody $body, ?AddCopyR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php index 653bad56d2d..2d5e8335fa0 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add or sync a copy of a published content type from the content type hub to a target site or a list. This method is part of the content type publishing changes to optimize the syncing of published content types to sites and lists, effectively switching from a 'push everywhere' to 'pull as needed' approach. The method allows users to pull content types directly from the content type hub to a site or list. For more information, see contentType: getCompatibleHubContentTypes and the blog post Syntex Product Updates – August 2021. This API is available in the following national cloud deployments. * @param AddCopyFromContentTypeHubPostRequestBody $body The request body * @param AddCopyFromContentTypeHubRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-addcopyfromcontenttypehub?view=graph-rest-1.0 Find more info here */ public function post(AddCopyFromContentTypeHubPostRequestBody $body, ?AddCopyFromContentTypeHubRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddCopyFromContentTypeHubPostRequestBod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/ContentTypesRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/ContentTypesRequestBuilder.php index 275570470cc..794d9a9d7a9 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/ContentTypesRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/ContentTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ContentTypeCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -79,39 +78,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of contentType][contentType] resources in a [list][]. This API is available in the following [national cloud deployments. * @param ContentTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-list-contenttypes?view=graph-rest-1.0 Find more info here */ public function get(?ContentTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentTypes for shares * @param ContentType $body The request body * @param ContentTypesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ContentType $body, ?ContentTypesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,7 +117,6 @@ public function toGetRequestInformation(?ContentTypesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +124,7 @@ public function toGetRequestInformation(?ContentTypesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +139,11 @@ public function toPostRequestInformation(ContentType $body, ?ContentTypesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Count/CountRequestBuilder.php index fcf450b3d5a..08988af574f 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php index dc3ddb6fe4f..e2f2ea08112 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getCompatibleHubContentTypes * @param GetCompatibleHubContentTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetCompatibleHubContentTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetCompatibleHubContentTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetCompatibleHubContentTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetCompatibleHubContentTypesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetCompatibleHubContentTypesRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php index e32405766b5..fc358de5239 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Associate a published content type][contentType] present in a content type hub with a list of hub sites. This API is available in the following [national cloud deployments. * @param AssociateWithHubSitesPostRequestBody $body The request body * @param AssociateWithHubSitesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-associatewithhubsites?view=graph-rest-1.0 Find more info here */ public function post(AssociateWithHubSitesPostRequestBody $body, ?AssociateWithHubSitesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AssociateWithHubSitesPostRequestBody $b $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php index 07866e873ce..f31cf338027 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Parent contentType from which this content type is derived. * @param BaseRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?BaseRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?BaseRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php index fec088a459a..95b2e646078 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentTypeCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\EscapedList\ContentTypes\Item\BaseTypes\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of content types that are ancestors of this content type. * @param BaseTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?BaseTypesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?BaseTypesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php index 2997935a3f2..69cc9830bec 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php index 2a19e8406b9..6f004f9c8d6 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of content types that are ancestors of this content type. * @param ContentTypeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentTypeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php index fd1612f7e6b..fec53610a25 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnLink; use Microsoft\Graph\Generated\Models\ColumnLinkCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of columns that are required by this content type. * @param ColumnLinksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnLinksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLinkCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLinkCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to columnLinks for shares * @param ColumnLink $body The request body * @param ColumnLinksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ColumnLink $body, ?ColumnLinksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ColumnLinksRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ColumnLinksRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ColumnLink $body, ?ColumnLinksRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php index 0de4ab37b21..ba67b35180a 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php index f93db167b73..884db7b327a 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnLink; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property columnLinks for shares * @param ColumnLinkItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ColumnLinkItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of columns that are required by this content type. * @param ColumnLinkItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnLinkItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property columnLinks in shares * @param ColumnLink $body The request body * @param ColumnLinkItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ColumnLink $body, ?ColumnLinkItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ColumnLinkItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ColumnLinkItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ColumnLinkItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ColumnLink $body, ?ColumnLinkItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php index 37f9afc55a0..87d7e1cbd8d 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\EscapedList\ContentTypes\Item\ColumnPositions\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Column order information in a content type. * @param ColumnPositionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnPositionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ColumnPositionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ColumnPositionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php index a6494191f1f..4cda334a207 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php index 58a0f97cbb5..61fbb55dd37 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Column order information in a content type. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/ColumnsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/ColumnsRequestBuilder.php index 7b958281f0d..566676ed421 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of columns represented as columnDefinition][columnDefinition] resources in a [content type][contentType]. This API is available in the following [national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a column to a content type][contentType] in a site, or a list with a request that specifies a [columnDefinition][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-post-columns?view=graph-rest-1.0 Find more info here */ public function post(ColumnDefinition $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ColumnDefinition $body, ?ColumnsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/Count/CountRequestBuilder.php index 0fb8ce37f44..06d401c578f 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php index f66af9a9ffa..5cd870e76e0 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\EscapedList\ContentTypes\Item\Columns\Item\SourceColumn\SourceColumnRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a column][columndefinition] from a [site][], a [list][], or a [content type][contentType]. This API is available in the following [national cloud deployments. * @param ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the metadata for a site][], a [list][], or a [contentType][] [column][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a site][], a [list][], or a [content type][contentType] [column][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-update?view=graph-rest-1.0 Find more info here */ public function patch(ColumnDefinition $body, ?ColumnDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?ColumnDefinitionItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(ColumnDefinition $body, ?ColumnDefinit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php index 6e30075a97b..f78a51943fb 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The source column for the content type column. * @param SourceColumnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SourceColumnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ContentTypeItemRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ContentTypeItemRequestBuilder.php index 03450cb2f4e..9940e15a52c 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ContentTypeItemRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/ContentTypeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\EscapedList\ContentTypes\Item\AssociateWithHubSites\AssociateWithHubSitesRequestBuilder; @@ -114,56 +113,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentTypes for shares * @param ContentTypeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ContentTypeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of content types present in this list. * @param ContentTypeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentTypeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentTypes in shares * @param ContentType $body The request body * @param ContentTypeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ContentType $body, ?ContentTypeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -180,6 +170,7 @@ public function toDeleteRequestInformation(?ContentTypeItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -193,7 +184,6 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -201,6 +191,7 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -215,11 +206,11 @@ public function toPatchRequestInformation(ContentType $body, ?ContentTypeItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php index fc3b766e119..de216f00302 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a file to a default content location in a content type][contentType]. The file can then be added as a default file or template via a POST operation. This API is available in the following [national cloud deployments. * @param CopyToDefaultContentLocationPostRequestBody $body The request body * @param CopyToDefaultContentLocationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-copytodefaultcontentlocation?view=graph-rest-1.0 Find more info here */ public function post(CopyToDefaultContentLocationPostRequestBody $body, ?CopyToDefaultContentLocationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CopyToDefaultContentLocationPostRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php index f03073bee33..9ab4a262aea 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function isPublished * @param IsPublishedRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IsPublishedRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IsPublishedGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IsPublishedGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?IsPublishedRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Publish/PublishRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Publish/PublishRequestBuilder.php index 692e107fd9e..d1fa7f10a14 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Publish/PublishRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Publish/PublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Publishes a contentType][] present in the content type hub site. This API is available in the following [national cloud deployments. * @param PublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-publish?view=graph-rest-1.0 Find more info here */ public function post(?PublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?PublishRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php index ce20b69be0b..68387a46092 100644 --- a/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unpublish a contentType][] from a content type hub site. This API is available in the following [national cloud deployments. * @param UnpublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-unpublish?view=graph-rest-1.0 Find more info here */ public function post(?UnpublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnpublishRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/CreatedByUser/CreatedByUserRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/CreatedByUser/CreatedByUserRequestBuilder.php index 3847e93204c..df70a90993b 100644 --- a/src/Generated/Shares/Item/EscapedList/CreatedByUser/CreatedByUserRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/CreatedByUser/CreatedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Shares\Item\EscapedList\CreatedByUser\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who created the item. Read-only. * @param CreatedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index a31a199acb5..4872e9555ca 100644 --- a/src/Generated/Shares/Item/EscapedList/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 10afe4dffea..b9e57c66e6f 100644 --- a/src/Generated/Shares/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 450462e2794..15adcad2b49 100644 --- a/src/Generated/Shares/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Shares\Item\EscapedList\CreatedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Drive/DriveRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Drive/DriveRequestBuilder.php index 440f4ad52d6..ac7bfaf12ad 100644 --- a/src/Generated/Shares/Item/EscapedList/Drive/DriveRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Drive/DriveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Drive; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Allows access to the list as a drive resource with driveItems. Only present on document libraries. * @param DriveRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/Analytics/AnalyticsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/Analytics/AnalyticsRequestBuilder.php index 835e28a0912..a79555dd6da 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/Analytics/AnalyticsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/Analytics/AnalyticsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemAnalytics; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Analytics about the view activities that took place on this item. * @param AnalyticsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AnalyticsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php index bc94292b3a6..86731c502b1 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Shares\Item\EscapedList\Items\Item\CreatedByUser\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who created the item. Read-only. * @param CreatedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index ddacb4f907d..ffb3058f989 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 95633dc19a7..0e01e461032 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 098f5c4c18a..c7db24f6dce 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Shares\Item\EscapedList\Items\Item\CreatedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php index c2c5dd60cfa..648b1f21122 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php index 59aef9feb19..b4e2643edb0 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DocumentSetVersion; use Microsoft\Graph\Generated\Models\DocumentSetVersionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the versions of a document set item in a list. This API is available in the following national cloud deployments. * @param DocumentSetVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-list-documentsetversions?view=graph-rest-1.0 Find more info here */ public function get(?DocumentSetVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new version of a document set item in a list. This API is available in the following national cloud deployments. * @param DocumentSetVersion $body The request body * @param DocumentSetVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-post-documentsetversions?view=graph-rest-1.0 Find more info here */ public function post(DocumentSetVersion $body, ?DocumentSetVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DocumentSetVersionsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DocumentSetVersionsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DocumentSetVersion $body, ?DocumentSetV $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php index 7bd58eb374d..66b7c30aa5b 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DocumentSetVersion; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\EscapedList\Items\Item\DocumentSetVersions\Item\Fields\FieldsRequestBuilder; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a version of a document set in a list. This API is available in the following national cloud deployments. * @param DocumentSetVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/documentsetversion-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DocumentSetVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a documentSetVersion object. This API is available in the following national cloud deployments. * @param DocumentSetVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/documentsetversion-get?view=graph-rest-1.0 Find more info here */ public function get(?DocumentSetVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property documentSetVersions in shares * @param DocumentSetVersion $body The request body * @param DocumentSetVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DocumentSetVersion $body, ?DocumentSetVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?DocumentSetVersionItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?DocumentSetVersionItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?DocumentSetVersionItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(DocumentSetVersion $body, ?DocumentSet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php index bdf5c19a84c..635da37ae99 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FieldValueSet; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fields for shares * @param FieldsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FieldsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of the fields and values for this version of the list item. * @param FieldsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FieldsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fields in shares * @param FieldValueSet $body The request body * @param FieldsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(FieldValueSet $body, ?FieldsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FieldsRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(FieldValueSet $body, ?FieldsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php index 1652c851ce0..2fb8065cb24 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a document set version. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/documentsetversion-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/DriveItem/Content/ContentRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/DriveItem/Content/ContentRequestBuilder.php index 1a35c628235..60fa1d46ada 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/DriveItem/Content/ContentRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/DriveItem/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/DriveItem/DriveItemRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/DriveItem/DriveItemRequestBuilder.php index 28b93276bcf..69d236f0566 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/DriveItem/DriveItemRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/DriveItem/DriveItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\EscapedList\Items\Item\DriveItem\Content\ContentRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * For document libraries, the driveItem relationship exposes the listItem as a [driveItem][] * @param DriveItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/Fields/FieldsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/Fields/FieldsRequestBuilder.php index 3df8852f40f..94ff64b5110 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/Fields/FieldsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/Fields/FieldsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FieldValueSet; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fields for shares * @param FieldsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FieldsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The values of the columns set on this list item. * @param FieldsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FieldsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties on a listItem][]. This API is available in the following [national cloud deployments. * @param FieldValueSet $body The request body * @param FieldsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-update?view=graph-rest-1.0 Find more info here */ public function patch(FieldValueSet $body, ?FieldsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?FieldsRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(FieldValueSet $body, ?FieldsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php index 430471c104d..03e7c0975bd 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php index cd63dfa5839..1efddd38c1a 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,7 +61,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -73,6 +68,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php index 723112612a7..045800f2f9c 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Shares\Item\EscapedList\Items\Item\LastModifiedByUser\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who last modified the item. Read-only. * @param LastModifiedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 7c35f32755c..7f952ece07c 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index c8d6a6f41c7..4aa28c7e28b 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 77d5de341a0..19c3e8de705 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Shares\Item\EscapedList\Items\Item\LastModifiedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/ListItemItemRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/ListItemItemRequestBuilder.php index 79b71f31dea..725076bd73f 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/ListItemItemRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/ListItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ListItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\EscapedList\Items\Item\Analytics\AnalyticsRequestBuilder; @@ -99,39 +98,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Removes an item from a list][]. This API is available in the following [national cloud deployments. * @param ListItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ListItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns the metadata for an item][] in a [list][]. This API is available in the following [national cloud deployments. * @param ListItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-get?view=graph-rest-1.0 Find more info here */ public function get(?ListItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -149,19 +142,16 @@ public function getActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInter * Update the navigation property items in shares * @param ListItem $body The request body * @param ListItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ListItem $body, ?ListItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -178,6 +168,7 @@ public function toDeleteRequestInformation(?ListItemItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -191,7 +182,6 @@ public function toGetRequestInformation(?ListItemItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -199,6 +189,7 @@ public function toGetRequestInformation(?ListItemItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -213,11 +204,11 @@ public function toPatchRequestInformation(ListItem $body, ?ListItemItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Count/CountRequestBuilder.php index 526d49bd4dd..b043cc8a0f7 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php index 14ff6492954..19ffc0c7950 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FieldValueSet; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fields for shares * @param FieldsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FieldsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of the fields and values for this version of the list item. * @param FieldsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FieldsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fields in shares * @param FieldValueSet $body The request body * @param FieldsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(FieldValueSet $body, ?FieldsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FieldsRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(FieldValueSet $body, ?FieldsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php index e8a2a6bb6ad..7d7ec62ffe9 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ListItemVersion; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\EscapedList\Items\Item\Versions\Item\Fields\FieldsRequestBuilder; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property versions for shares * @param ListItemVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ListItemVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the metadata for a specific version of a ListItem. This API is available in the following national cloud deployments. * @param ListItemVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitemversion-get?view=graph-rest-1.0 Find more info here */ public function get(?ListItemVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property versions in shares * @param ListItemVersion $body The request body * @param ListItemVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ListItemVersion $body, ?ListItemVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?ListItemVersionItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?ListItemVersionItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?ListItemVersionItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(ListItemVersion $body, ?ListItemVersio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php index 17a5332f2db..46ccf2c596a 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a previous version of a ListItem to be the current version. This will create a new version with the contents of the previous version, but preserves all existing versions of the item. This API is available in the following national cloud deployments. * @param RestoreVersionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitemversion-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreVersionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RestoreVersionRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/VersionsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/VersionsRequestBuilder.php index 066fbf32c37..b290be0601a 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/VersionsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/Item/Versions/VersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ListItemVersion; use Microsoft\Graph\Generated\Models\ListItemVersionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * SharePoint can be configured to retain the history for list items. Previous versions may be retained for a finite period of time depending on admin settings which may be unique per user or location. This API is available in the following national cloud deployments. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-list-versions?view=graph-rest-1.0 Find more info here */ public function get(?VersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to versions for shares * @param ListItemVersion $body The request body * @param VersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ListItemVersion $body, ?VersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ListItemVersion $body, ?VersionsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Items/ItemsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Items/ItemsRequestBuilder.php index cfc6837a03c..85a9c5c8764 100644 --- a/src/Generated/Shares/Item/EscapedList/Items/ItemsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Items/ItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ListItem; use Microsoft\Graph\Generated\Models\ListItemCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -47,40 +46,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of items][item] in a [list][]. This API is available in the following [national cloud deployments. * @param ItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-list?view=graph-rest-1.0 Find more info here */ public function get(?ItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new listItem][] in a [list][]. This API is available in the following [national cloud deployments. * @param ListItem $body The request body * @param ItemsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-create?view=graph-rest-1.0 Find more info here */ public function post(ListItem $body, ?ItemsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,7 +86,6 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -101,6 +93,7 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -115,11 +108,11 @@ public function toPostRequestInformation(ListItem $body, ?ItemsRequestBuilderPos $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/LastModifiedByUserRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/LastModifiedByUserRequestBuilder.php index 9c9a9234022..e505e0c39a6 100644 --- a/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/LastModifiedByUserRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/LastModifiedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Shares\Item\EscapedList\LastModifiedByUser\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who last modified the item. Read-only. * @param LastModifiedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 04b9e92a66b..99c4ae9ca36 100644 --- a/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 1c2c025eb6b..b6374092ef2 100644 --- a/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 9d5c5538f0f..9947fb8fd9e 100644 --- a/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Shares\Item\EscapedList\LastModifiedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/ListRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/ListRequestBuilder.php index 53b7d6ebc64..9f7189a17bd 100644 --- a/src/Generated/Shares/Item/EscapedList/ListRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/ListRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EscapedList; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\EscapedList\Columns\ColumnsRequestBuilder; @@ -98,56 +97,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property list for shares * @param ListRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ListRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Used to access the underlying list * @param ListRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ListRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property list in shares * @param EscapedList $body The request body * @param ListRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EscapedList $body, ?ListRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -164,6 +154,7 @@ public function toDeleteRequestInformation(?ListRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -177,7 +168,6 @@ public function toGetRequestInformation(?ListRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -185,6 +175,7 @@ public function toGetRequestInformation(?ListRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -199,11 +190,11 @@ public function toPatchRequestInformation(EscapedList $body, ?ListRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Operations/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Operations/Count/CountRequestBuilder.php index 5b31324a9e6..ba8dc5bac18 100644 --- a/src/Generated/Shares/Item/EscapedList/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Operations/Item/RichLongRunningOperationItemRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Operations/Item/RichLongRunningOperationItemRequestBuilder.php index ec88705f810..08040d904eb 100644 --- a/src/Generated/Shares/Item/EscapedList/Operations/Item/RichLongRunningOperationItemRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Operations/Item/RichLongRunningOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RichLongRunningOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for shares * @param RichLongRunningOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RichLongRunningOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of long-running operations on the list. * @param RichLongRunningOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RichLongRunningOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in shares * @param RichLongRunningOperation $body The request body * @param RichLongRunningOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RichLongRunningOperation $body, ?RichLongRunningOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?RichLongRunningOperationItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?RichLongRunningOperationItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?RichLongRunningOperationItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(RichLongRunningOperation $body, ?RichL $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Operations/OperationsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Operations/OperationsRequestBuilder.php index a5ec9f296eb..76baac70c98 100644 --- a/src/Generated/Shares/Item/EscapedList/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RichLongRunningOperation; use Microsoft\Graph\Generated\Models\RichLongRunningOperationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of long-running operations on the list. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for shares * @param RichLongRunningOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RichLongRunningOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(RichLongRunningOperation $body, ?Operat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Subscriptions/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Subscriptions/Count/CountRequestBuilder.php index fea820f937f..cf7f6150be4 100644 --- a/src/Generated/Shares/Item/EscapedList/Subscriptions/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Subscriptions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php index 8707cbac67a..3f803dd8db1 100644 --- a/src/Generated/Shares/Item/EscapedList/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reauthorize a subscription when you receive a reauthorizationRequired challenge. This API is available in the following national cloud deployments. * @param ReauthorizeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subscription-reauthorize?view=graph-rest-1.0 Find more info here */ public function post(?ReauthorizeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ReauthorizeRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Subscriptions/Item/SubscriptionItemRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Subscriptions/Item/SubscriptionItemRequestBuilder.php index 12b6a5d5ebc..950fb70b2b7 100644 --- a/src/Generated/Shares/Item/EscapedList/Subscriptions/Item/SubscriptionItemRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Subscriptions/Item/SubscriptionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Subscription; use Microsoft\Graph\Generated\Shares\Item\EscapedList\Subscriptions\Item\Reauthorize\ReauthorizeRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property subscriptions for shares * @param SubscriptionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SubscriptionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The set of subscriptions on the list. * @param SubscriptionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubscriptionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property subscriptions in shares * @param Subscription $body The request body * @param SubscriptionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Subscription $body, ?SubscriptionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?SubscriptionItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?SubscriptionItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?SubscriptionItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Subscription $body, ?SubscriptionItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/EscapedList/Subscriptions/SubscriptionsRequestBuilder.php b/src/Generated/Shares/Item/EscapedList/Subscriptions/SubscriptionsRequestBuilder.php index e9773454737..2eb489c6927 100644 --- a/src/Generated/Shares/Item/EscapedList/Subscriptions/SubscriptionsRequestBuilder.php +++ b/src/Generated/Shares/Item/EscapedList/Subscriptions/SubscriptionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Subscription; use Microsoft\Graph\Generated\Models\SubscriptionCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The set of subscriptions on the list. * @param SubscriptionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubscriptionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubscriptionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubscriptionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to subscriptions for shares * @param Subscription $body The request body * @param SubscriptionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Subscription $body, ?SubscriptionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?SubscriptionsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?SubscriptionsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Subscription $body, ?SubscriptionsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/Items/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/Items/Count/CountRequestBuilder.php index dda549d6a3f..3790d585cff 100644 --- a/src/Generated/Shares/Item/Items/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/Items/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/Items/Item/Content/ContentRequestBuilder.php b/src/Generated/Shares/Item/Items/Item/Content/ContentRequestBuilder.php index 275fcdd77a7..1d00b648923 100644 --- a/src/Generated/Shares/Item/Items/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Shares/Item/Items/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/Items/Item/DriveItemItemRequestBuilder.php b/src/Generated/Shares/Item/Items/Item/DriveItemItemRequestBuilder.php index 3fb5a1fea7a..5282845ed42 100644 --- a/src/Generated/Shares/Item/Items/Item/DriveItemItemRequestBuilder.php +++ b/src/Generated/Shares/Item/Items/Item/DriveItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\Items\Item\Content\ContentRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * All driveItems contained in the sharing root. This collection cannot be enumerated. * @param DriveItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?DriveItemItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?DriveItemItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/Items/ItemsRequestBuilder.php b/src/Generated/Shares/Item/Items/ItemsRequestBuilder.php index d0887319e2f..c783c6dfcb0 100644 --- a/src/Generated/Shares/Item/Items/ItemsRequestBuilder.php +++ b/src/Generated/Shares/Item/Items/ItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItemCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\Items\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * All driveItems contained in the sharing root. This collection cannot be enumerated. * @param ItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php b/src/Generated/Shares/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php index 7ffcd59529a..c7ed9b33d29 100644 --- a/src/Generated/Shares/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php +++ b/src/Generated/Shares/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Shares\Item\LastModifiedByUser\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who last modified the item. Read-only. * @param LastModifiedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Shares/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 3d4eff1cc8b..d8ea4ab2e18 100644 --- a/src/Generated/Shares/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Shares/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Shares/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index c42c5e8f2de..7f4c238171d 100644 --- a/src/Generated/Shares/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Shares/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Shares/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 42d8a506a16..cd7caa72f82 100644 --- a/src/Generated/Shares/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Shares/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Shares\Item\LastModifiedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/ListItem/ListItemRequestBuilder.php b/src/Generated/Shares/Item/ListItem/ListItemRequestBuilder.php index 44b6dfa9e2e..98f45cc7bae 100644 --- a/src/Generated/Shares/Item/ListItem/ListItemRequestBuilder.php +++ b/src/Generated/Shares/Item/ListItem/ListItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ListItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Used to access the underlying listItem * @param ListItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ListItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ListItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ListItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/Permission/Grant/GrantRequestBuilder.php b/src/Generated/Shares/Item/Permission/Grant/GrantRequestBuilder.php index 78b7233e8a1..84380a75deb 100644 --- a/src/Generated/Shares/Item/Permission/Grant/GrantRequestBuilder.php +++ b/src/Generated/Shares/Item/Permission/Grant/GrantRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Grant users access to a link represented by a permission][]. This API is available in the following [national cloud deployments. * @param GrantPostRequestBody $body The request body * @param GrantRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permission-grant?view=graph-rest-1.0 Find more info here */ public function post(GrantPostRequestBody $body, ?GrantRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GrantPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GrantPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GrantPostRequestBody $body, ?GrantReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/Permission/PermissionRequestBuilder.php b/src/Generated/Shares/Item/Permission/PermissionRequestBuilder.php index d0627447da0..559b5eb12c1 100644 --- a/src/Generated/Shares/Item/Permission/PermissionRequestBuilder.php +++ b/src/Generated/Shares/Item/Permission/PermissionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Permission; use Microsoft\Graph\Generated\Shares\Item\Permission\Grant\GrantRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property permission for shares * @param PermissionRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PermissionRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Used to access the permission representing the underlying sharing link * @param PermissionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PermissionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property permission in shares * @param Permission $body The request body * @param PermissionRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Permission $body, ?PermissionRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?PermissionRequestBuilderDeleteReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?PermissionRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?PermissionRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Permission $body, ?PermissionRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/Root/Content/ContentRequestBuilder.php b/src/Generated/Shares/Item/Root/Content/ContentRequestBuilder.php index bd59b09c1fe..445686b4e11 100644 --- a/src/Generated/Shares/Item/Root/Content/ContentRequestBuilder.php +++ b/src/Generated/Shares/Item/Root/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/Root/RootRequestBuilder.php b/src/Generated/Shares/Item/Root/RootRequestBuilder.php index 3d9b0b183b4..2974e92991f 100644 --- a/src/Generated/Shares/Item/Root/RootRequestBuilder.php +++ b/src/Generated/Shares/Item/Root/RootRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Shares\Item\Root\Content\ContentRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Used to access the underlying driveItem. Deprecated -- use driveItem instead. * @param RootRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RootRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?RootRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?RootRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/Item/SharedDriveItemItemRequestBuilder.php b/src/Generated/Shares/Item/SharedDriveItemItemRequestBuilder.php index 2edac4ea3d3..3370d4a6ac9 100644 --- a/src/Generated/Shares/Item/SharedDriveItemItemRequestBuilder.php +++ b/src/Generated/Shares/Item/SharedDriveItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedDriveItem; use Microsoft\Graph\Generated\Shares\Item\CreatedByUser\CreatedByUserRequestBuilder; @@ -106,57 +105,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from shares * @param SharedDriveItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SharedDriveItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Access a shared DriveItem or a collection of shared items by using a shareId or sharing URL. To use a sharing URL with this API, your app needs to transform the URL into a sharing token. This API is available in the following national cloud deployments. * @param SharedDriveItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shares-get?view=graph-rest-1.0 Find more info here */ public function get(?SharedDriveItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedDriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedDriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in shares * @param SharedDriveItem $body The request body * @param SharedDriveItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SharedDriveItem $body, ?SharedDriveItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedDriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedDriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -173,6 +163,7 @@ public function toDeleteRequestInformation(?SharedDriveItemItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -186,7 +177,6 @@ public function toGetRequestInformation(?SharedDriveItemItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -194,6 +184,7 @@ public function toGetRequestInformation(?SharedDriveItemItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -208,11 +199,11 @@ public function toPatchRequestInformation(SharedDriveItem $body, ?SharedDriveIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Shares/Item/Site/SiteRequestBuilder.php b/src/Generated/Shares/Item/Site/SiteRequestBuilder.php index 7817faffeeb..b1316b2ed82 100644 --- a/src/Generated/Shares/Item/Site/SiteRequestBuilder.php +++ b/src/Generated/Shares/Item/Site/SiteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Site; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Used to access the underlying site * @param SiteRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SiteRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SiteRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SiteRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Shares/SharesRequestBuilder.php b/src/Generated/Shares/SharesRequestBuilder.php index 99e322a15fd..70de4940117 100644 --- a/src/Generated/Shares/SharesRequestBuilder.php +++ b/src/Generated/Shares/SharesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedDriveItem; use Microsoft\Graph\Generated\Models\SharedDriveItemCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Access a shared DriveItem or a collection of shared items by using a shareId or sharing URL. To use a sharing URL with this API, your app needs to transform the URL into a sharing token. This API is available in the following national cloud deployments. * @param SharesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SharesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedDriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedDriveItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to shares * @param SharedDriveItem $body The request body * @param SharesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SharedDriveItem $body, ?SharesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedDriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedDriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?SharesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?SharesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(SharedDriveItem $body, ?SharesRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Add/AddRequestBuilder.php b/src/Generated/Sites/Add/AddRequestBuilder.php index d7fcbc6da8c..390a747384d 100644 --- a/src/Generated/Sites/Add/AddRequestBuilder.php +++ b/src/Generated/Sites/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Follow a user's site or multiple sites. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-follow?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Count/CountRequestBuilder.php b/src/Generated/Sites/Count/CountRequestBuilder.php index 3996c6cccc7..52d7e974ca8 100644 --- a/src/Generated/Sites/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Delta/DeltaGetResponse.php b/src/Generated/Sites/Delta/DeltaGetResponse.php new file mode 100644 index 00000000000..c666c58227f --- /dev/null +++ b/src/Generated/Sites/Delta/DeltaGetResponse.php @@ -0,0 +1,72 @@ + + */ + public function getFieldDeserializers(): array { + $o = $this; + return array_merge(parent::getFieldDeserializers(), [ + 'value' => fn(ParseNode $n) => $o->setValue($n->getCollectionOfObjectValues([Site::class, 'createFromDiscriminatorValue'])), + ]); + } + + /** + * Gets the value property value. The value property + * @return array|null + */ + public function getValue(): ?array { + $val = $this->getBackingStore()->get('value'); + if (is_array($val) || is_null($val)) { + TypeUtils::validateCollectionValues($val, Site::class); + /** @var array|null $val */ + return $val; + } + throw new \UnexpectedValueException("Invalid type found in backing store for 'value'"); + } + + /** + * Serializes information the current object + * @param SerializationWriter $writer Serialization writer to use to serialize this model + */ + public function serialize(SerializationWriter $writer): void { + parent::serialize($writer); + $writer->writeCollectionOfObjectValues('value', $this->getValue()); + } + + /** + * Sets the value property value. The value property + * @param array|null $value Value to set for the value property. + */ + public function setValue(?array $value): void { + $this->getBackingStore()->set('value', $value); + } + +} diff --git a/src/Generated/Sites/Delta/DeltaRequestBuilder.php b/src/Generated/Sites/Delta/DeltaRequestBuilder.php new file mode 100644 index 00000000000..085756b6fed --- /dev/null +++ b/src/Generated/Sites/Delta/DeltaRequestBuilder.php @@ -0,0 +1,77 @@ +|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. + */ + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { + parent::__construct($requestAdapter, [], '{+baseurl}/sites/delta(){?%24top,%24skip,%24search,%24filter,%24count,%24select,%24orderby}'); + if (is_array($pathParametersOrRawUrl)) { + $this->pathParameters = $pathParametersOrRawUrl; + } else { + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; + } + } + + /** + * Invoke function delta + * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return Promise + * @throws Exception + */ + public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { + $requestInfo = $this->toGetRequestInformation($requestConfiguration); + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); + } + + /** + * Invoke function delta + * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @return RequestInformation + */ + public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { + $requestInfo = new RequestInformation(); + $requestInfo->urlTemplate = $this->urlTemplate; + $requestInfo->pathParameters = $this->pathParameters; + $requestInfo->httpMethod = HttpMethod::GET; + if ($requestConfiguration !== null) { + $requestInfo->addHeaders($requestConfiguration->headers); + if ($requestConfiguration->queryParameters !== null) { + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); + } + $requestInfo->addRequestOptions(...$requestConfiguration->options); + } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + return $requestInfo; + } + + /** + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + * @param string $rawUrl The raw URL to use for the request builder. + * @return DeltaRequestBuilder + */ + public function withUrl(string $rawUrl): DeltaRequestBuilder { + return new DeltaRequestBuilder($rawUrl, $this->requestAdapter); + } + +} diff --git a/src/Generated/Sites/Delta/DeltaRequestBuilderGetQueryParameters.php b/src/Generated/Sites/Delta/DeltaRequestBuilderGetQueryParameters.php new file mode 100644 index 00000000000..ecc617743f6 --- /dev/null +++ b/src/Generated/Sites/Delta/DeltaRequestBuilderGetQueryParameters.php @@ -0,0 +1,74 @@ +|null $orderby Order items by property values + */ + public ?array $orderby = null; + + /** + * @QueryParameter("%24search") + * @var string|null $search Search items by search phrases + */ + public ?string $search = null; + + /** + * @QueryParameter("%24select") + * @var array|null $select Select properties to be returned + */ + public ?array $select = null; + + /** + * @QueryParameter("%24skip") + * @var int|null $skip Skip the first n items + */ + public ?int $skip = null; + + /** + * @QueryParameter("%24top") + * @var int|null $top Show only the first n items + */ + public ?int $top = null; + + /** + * Instantiates a new deltaRequestBuilderGetQueryParameters and sets the default values. + * @param bool|null $count Include count of items + * @param string|null $filter Filter items by property values + * @param array|null $orderby Order items by property values + * @param string|null $search Search items by search phrases + * @param array|null $select Select properties to be returned + * @param int|null $skip Skip the first n items + * @param int|null $top Show only the first n items + */ + public function __construct(?bool $count = null, ?string $filter = null, ?array $orderby = null, ?string $search = null, ?array $select = null, ?int $skip = null, ?int $top = null) { + $this->count = $count; + $this->filter = $filter; + $this->orderby = $orderby; + $this->search = $search; + $this->select = $select; + $this->skip = $skip; + $this->top = $top; + } + +} diff --git a/src/Generated/Sites/Delta/DeltaRequestBuilderGetRequestConfiguration.php b/src/Generated/Sites/Delta/DeltaRequestBuilderGetRequestConfiguration.php new file mode 100644 index 00000000000..47aee6cce1a --- /dev/null +++ b/src/Generated/Sites/Delta/DeltaRequestBuilderGetRequestConfiguration.php @@ -0,0 +1,44 @@ +|string>|null $headers Request headers + * @param array|null $options Request options + * @param DeltaRequestBuilderGetQueryParameters|null $queryParameters Request query parameters + */ + public function __construct(?array $headers = null, ?array $options = null, ?DeltaRequestBuilderGetQueryParameters $queryParameters = null) { + parent::__construct($headers ?? [], $options ?? []); + $this->queryParameters = $queryParameters; + } + + /** + * Instantiates a new deltaRequestBuilderGetQueryParameters. + * @param bool|null $count Include count of items + * @param string|null $filter Filter items by property values + * @param array|null $orderby Order items by property values + * @param string|null $search Search items by search phrases + * @param array|null $select Select properties to be returned + * @param int|null $skip Skip the first n items + * @param int|null $top Show only the first n items + * @return DeltaRequestBuilderGetQueryParameters + */ + public static function createQueryParameters(?bool $count = null, ?string $filter = null, ?array $orderby = null, ?string $search = null, ?array $select = null, ?int $skip = null, ?int $top = null): DeltaRequestBuilderGetQueryParameters { + return new DeltaRequestBuilderGetQueryParameters($count, $filter, $orderby, $search, $select, $skip, $top); + } + +} diff --git a/src/Generated/Sites/GetAllSites/GetAllSitesRequestBuilder.php b/src/Generated/Sites/GetAllSites/GetAllSitesRequestBuilder.php index 7d5719a07d0..e1394189fd9 100644 --- a/src/Generated/Sites/GetAllSites/GetAllSitesRequestBuilder.php +++ b/src/Generated/Sites/GetAllSites/GetAllSitesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAllSites * @param GetAllSitesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAllSitesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAllSitesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAllSitesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAllSitesRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAllSitesRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Analytics/AllTime/AllTimeRequestBuilder.php b/src/Generated/Sites/Item/Analytics/AllTime/AllTimeRequestBuilder.php index b0c45249897..a6c9d43075e 100644 --- a/src/Generated/Sites/Item/Analytics/AllTime/AllTimeRequestBuilder.php +++ b/src/Generated/Sites/Item/Analytics/AllTime/AllTimeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemActivityStat; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get [itemAnalytics][] about the views that took place under this resource.The itemAnalytics resource is a convenient way to get activity stats for allTime and the lastSevenDays.For a custom time range or interval, use the getActivitiesByInterval][] API. This API is available in the following [national cloud deployments. * @param AllTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/itemanalytics-get?view=graph-rest-1.0 Find more info here */ public function get(?AllTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?AllTimeRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?AllTimeRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Analytics/AnalyticsRequestBuilder.php b/src/Generated/Sites/Item/Analytics/AnalyticsRequestBuilder.php index 7b78e33384f..8fc3ff4974e 100644 --- a/src/Generated/Sites/Item/Analytics/AnalyticsRequestBuilder.php +++ b/src/Generated/Sites/Item/Analytics/AnalyticsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemAnalytics; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Analytics\AllTime\AllTimeRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property analytics for sites * @param AnalyticsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AnalyticsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Analytics about the view activities that took place in this site. * @param AnalyticsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AnalyticsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property analytics in sites * @param ItemAnalytics $body The request body * @param AnalyticsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ItemAnalytics $body, ?AnalyticsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?AnalyticsRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(ItemAnalytics $body, ?AnalyticsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Count/CountRequestBuilder.php index 436d768ea02..a48fe47a9af 100644 --- a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/ActivitiesRequestBuilder.php b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/ActivitiesRequestBuilder.php index ad08a83cdb8..96efc20e559 100644 --- a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/ActivitiesRequestBuilder.php +++ b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/ActivitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemActivity; use Microsoft\Graph\Generated\Models\ItemActivityCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Exposes the itemActivities represented in this itemActivityStat resource. * @param ActivitiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivitiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to activities for sites * @param ItemActivity $body The request body * @param ActivitiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ItemActivity $body, ?ActivitiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ActivitiesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ActivitiesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ItemActivity $body, ?ActivitiesRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Count/CountRequestBuilder.php index 89e919ab9a2..6945310a8ff 100644 --- a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/Content/ContentRequestBuilder.php b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/Content/ContentRequestBuilder.php index ac163373b81..1864b7ac6fc 100644 --- a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/Content/ContentRequestBuilder.php +++ b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/DriveItemRequestBuilder.php b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/DriveItemRequestBuilder.php index 486dcca4e17..ae32b04846d 100644 --- a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/DriveItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/DriveItem/DriveItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Analytics\ItemActivityStats\Item\Activities\Item\DriveItem\Content\ContentRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Exposes the driveItem that was the target of this activity. * @param DriveItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/ItemActivityItemRequestBuilder.php b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/ItemActivityItemRequestBuilder.php index defa5321ab9..5ab8d14ffd2 100644 --- a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/ItemActivityItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/Activities/Item/ItemActivityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemActivity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Analytics\ItemActivityStats\Item\Activities\Item\DriveItem\DriveItemRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property activities for sites * @param ItemActivityItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ItemActivityItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Exposes the itemActivities represented in this itemActivityStat resource. * @param ItemActivityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemActivityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property activities in sites * @param ItemActivity $body The request body * @param ItemActivityItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ItemActivity $body, ?ItemActivityItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ItemActivityItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ItemActivityItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ItemActivityItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ItemActivity $body, ?ItemActivityItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/ItemActivityStatItemRequestBuilder.php b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/ItemActivityStatItemRequestBuilder.php index 0eb25f2a49a..958c495f60a 100644 --- a/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/ItemActivityStatItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Analytics/ItemActivityStats/Item/ItemActivityStatItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemActivityStat; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Analytics\ItemActivityStats\Item\Activities\ActivitiesRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property itemActivityStats for sites * @param ItemActivityStatItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ItemActivityStatItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get itemActivityStats from sites * @param ItemActivityStatItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemActivityStatItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property itemActivityStats in sites * @param ItemActivityStat $body The request body * @param ItemActivityStatItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ItemActivityStat $body, ?ItemActivityStatItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ItemActivityStatItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ItemActivityStatItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ItemActivityStatItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ItemActivityStat $body, ?ItemActivityS $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Analytics/ItemActivityStats/ItemActivityStatsRequestBuilder.php b/src/Generated/Sites/Item/Analytics/ItemActivityStats/ItemActivityStatsRequestBuilder.php index 1770491ad97..2ed170c5cbc 100644 --- a/src/Generated/Sites/Item/Analytics/ItemActivityStats/ItemActivityStatsRequestBuilder.php +++ b/src/Generated/Sites/Item/Analytics/ItemActivityStats/ItemActivityStatsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemActivityStat; use Microsoft\Graph\Generated\Models\ItemActivityStatCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get itemActivityStats from sites * @param ItemActivityStatsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemActivityStatsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStatCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStatCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to itemActivityStats for sites * @param ItemActivityStat $body The request body * @param ItemActivityStatsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ItemActivityStat $body, ?ItemActivityStatsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ItemActivityStatsRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ItemActivityStatsRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ItemActivityStat $body, ?ItemActivitySt $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Analytics/LastSevenDays/LastSevenDaysRequestBuilder.php b/src/Generated/Sites/Item/Analytics/LastSevenDays/LastSevenDaysRequestBuilder.php index 318b5516e73..8814c1eb77b 100644 --- a/src/Generated/Sites/Item/Analytics/LastSevenDays/LastSevenDaysRequestBuilder.php +++ b/src/Generated/Sites/Item/Analytics/LastSevenDays/LastSevenDaysRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemActivityStat; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get lastSevenDays from sites * @param LastSevenDaysRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastSevenDaysRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemActivityStat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?LastSevenDaysRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?LastSevenDaysRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Columns/ColumnsRequestBuilder.php b/src/Generated/Sites/Item/Columns/ColumnsRequestBuilder.php index f4c04a326f9..f8c1e941a06 100644 --- a/src/Generated/Sites/Item/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Sites/Item/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of columns represented as columnDefinition][columnDefinition] resources in a [site][site]. This API is available in the following [national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a column for a site][site] with a request that specifies a [columnDefinition][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-post-columns?view=graph-rest-1.0 Find more info here */ public function post(ColumnDefinition $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ColumnDefinition $body, ?ColumnsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Columns/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Columns/Count/CountRequestBuilder.php index e411e13a3d4..4d292ed23e5 100644 --- a/src/Generated/Sites/Item/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Sites/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php index 3b0a76bd7e8..0457c167df1 100644 --- a/src/Generated/Sites/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Columns\Item\SourceColumn\SourceColumnRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property columns for sites * @param ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of column definitions reusable across lists under this site. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property columns in sites * @param ColumnDefinition $body The request body * @param ColumnDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ColumnDefinition $body, ?ColumnDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ColumnDefinitionItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ColumnDefinition $body, ?ColumnDefinit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php b/src/Generated/Sites/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php index 4eb6f305b2a..0b22f51534a 100644 --- a/src/Generated/Sites/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php +++ b/src/Generated/Sites/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The source column for the content type column. * @param SourceColumnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SourceColumnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php index 0641a78e84c..a747da53536 100644 --- a/src/Generated/Sites/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add a copy of a content type][contentType] from a [site][site] to a [list][list]. This API is available in the following [national cloud deployments. * @param AddCopyPostRequestBody $body The request body * @param AddCopyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-addcopy?view=graph-rest-1.0 Find more info here */ public function post(AddCopyPostRequestBody $body, ?AddCopyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddCopyPostRequestBody $body, ?AddCopyR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php index 16d42719bfd..bb0c6b3b8fc 100644 --- a/src/Generated/Sites/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add or sync a copy of a published content type from the content type hub to a target site or a list. This method is part of the content type publishing changes to optimize the syncing of published content types to sites and lists, effectively switching from a 'push everywhere' to 'pull as needed' approach. The method allows users to pull content types directly from the content type hub to a site or list. For more information, see contentType: getCompatibleHubContentTypes and the blog post Syntex Product Updates – August 2021. This API is available in the following national cloud deployments. * @param AddCopyFromContentTypeHubPostRequestBody $body The request body * @param AddCopyFromContentTypeHubRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-addcopyfromcontenttypehub?view=graph-rest-1.0 Find more info here */ public function post(AddCopyFromContentTypeHubPostRequestBody $body, ?AddCopyFromContentTypeHubRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddCopyFromContentTypeHubPostRequestBod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/ContentTypesRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/ContentTypesRequestBuilder.php index eb4d361f249..e1c9df8572e 100644 --- a/src/Generated/Sites/Item/ContentTypes/ContentTypesRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/ContentTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ContentTypeCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -79,40 +78,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of contentType][contentType] resources in a [site][]. This API is available in the following [national cloud deployments. * @param ContentTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-list-contenttypes?view=graph-rest-1.0 Find more info here */ public function get(?ContentTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new contentType][] in a [site][]. This API is available in the following [national cloud deployments. * @param ContentType $body The request body * @param ContentTypesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-post-contenttypes?view=graph-rest-1.0 Find more info here */ public function post(ContentType $body, ?ContentTypesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -125,7 +118,6 @@ public function toGetRequestInformation(?ContentTypesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -133,6 +125,7 @@ public function toGetRequestInformation(?ContentTypesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -147,11 +140,11 @@ public function toPostRequestInformation(ContentType $body, ?ContentTypesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Count/CountRequestBuilder.php index 6fc94b794ca..27b140b5273 100644 --- a/src/Generated/Sites/Item/ContentTypes/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php index cddee050766..a72770d3587 100644 --- a/src/Generated/Sites/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getCompatibleHubContentTypes * @param GetCompatibleHubContentTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetCompatibleHubContentTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetCompatibleHubContentTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetCompatibleHubContentTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetCompatibleHubContentTypesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetCompatibleHubContentTypesRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php index adac329a983..7be6af25d49 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Associate a published content type][contentType] present in a content type hub with a list of hub sites. This API is available in the following [national cloud deployments. * @param AssociateWithHubSitesPostRequestBody $body The request body * @param AssociateWithHubSitesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-associatewithhubsites?view=graph-rest-1.0 Find more info here */ public function post(AssociateWithHubSitesPostRequestBody $body, ?AssociateWithHubSitesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AssociateWithHubSitesPostRequestBody $b $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php index 03b3f6dd69e..f9e53c7453f 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Parent contentType from which this content type is derived. * @param BaseRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?BaseRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?BaseRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php index 24430f03add..b7ce2f7e9a5 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentTypeCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\ContentTypes\Item\BaseTypes\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of content types that are ancestors of this content type. * @param BaseTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?BaseTypesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?BaseTypesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php index 6e24eac80ac..d7f96793da2 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php index 3403df17e97..47b575dbc8a 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of content types that are ancestors of this content type. * @param ContentTypeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentTypeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php index 2eb199ce836..4bf6ee4fe6f 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnLink; use Microsoft\Graph\Generated\Models\ColumnLinkCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of columns that are required by this content type. * @param ColumnLinksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnLinksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLinkCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLinkCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to columnLinks for sites * @param ColumnLink $body The request body * @param ColumnLinksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ColumnLink $body, ?ColumnLinksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ColumnLinksRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ColumnLinksRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ColumnLink $body, ?ColumnLinksRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php index cb8049f2f95..4d9826953f7 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php index 85395189e90..332bd5167e3 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnLink; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property columnLinks for sites * @param ColumnLinkItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ColumnLinkItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of columns that are required by this content type. * @param ColumnLinkItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnLinkItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property columnLinks in sites * @param ColumnLink $body The request body * @param ColumnLinkItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ColumnLink $body, ?ColumnLinkItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ColumnLinkItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ColumnLinkItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ColumnLinkItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ColumnLink $body, ?ColumnLinkItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php index 26bb021b1f5..4b2ba020d08 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\ContentTypes\Item\ColumnPositions\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Column order information in a content type. * @param ColumnPositionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnPositionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ColumnPositionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ColumnPositionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php index 424d9f02ac3..8afb982bc82 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php index 7a40e9439d7..1b438030588 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Column order information in a content type. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php index 13f7d379c07..1dc829e7fed 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of columns represented as columnDefinition][columnDefinition] resources in a [content type][contentType]. This API is available in the following [national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a column to a content type][contentType] in a site, or a list with a request that specifies a [columnDefinition][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-post-columns?view=graph-rest-1.0 Find more info here */ public function post(ColumnDefinition $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ColumnDefinition $body, ?ColumnsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php index c67175a673a..05aa7c96e65 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php index 75e9b11b87e..0d40c3a8882 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\ContentTypes\Item\Columns\Item\SourceColumn\SourceColumnRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a column][columndefinition] from a [site][], a [list][], or a [content type][contentType]. This API is available in the following [national cloud deployments. * @param ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the metadata for a site][], a [list][], or a [contentType][] [column][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a site][], a [list][], or a [content type][contentType] [column][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-update?view=graph-rest-1.0 Find more info here */ public function patch(ColumnDefinition $body, ?ColumnDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?ColumnDefinitionItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(ColumnDefinition $body, ?ColumnDefinit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php index c7af0f3b660..d2e383ffca1 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The source column for the content type column. * @param SourceColumnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SourceColumnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php index 86dcd822d1d..8f9fc39c9b6 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\ContentTypes\Item\AssociateWithHubSites\AssociateWithHubSitesRequestBuilder; @@ -114,59 +113,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a content type][contentType] from a [list][] or a [site][]. This API is available in the following [national cloud deployments. * @param ContentTypeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ContentTypeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the metadata for a content type][contentType] in a [site][] or a [list][]. This API is available in the following [national cloud deployments. * @param ContentTypeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-get?view=graph-rest-1.0 Find more info here */ public function get(?ContentTypeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a content type][contentType]. This API is available in the following [national cloud deployments. * @param ContentType $body The request body * @param ContentTypeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-update?view=graph-rest-1.0 Find more info here */ public function patch(ContentType $body, ?ContentTypeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -183,6 +173,7 @@ public function toDeleteRequestInformation(?ContentTypeItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -196,7 +187,6 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -204,6 +194,7 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -218,11 +209,11 @@ public function toPatchRequestInformation(ContentType $body, ?ContentTypeItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php index 961a594e8bf..47360030f7b 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a file to a default content location in a content type][contentType]. The file can then be added as a default file or template via a POST operation. This API is available in the following [national cloud deployments. * @param CopyToDefaultContentLocationPostRequestBody $body The request body * @param CopyToDefaultContentLocationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-copytodefaultcontentlocation?view=graph-rest-1.0 Find more info here */ public function post(CopyToDefaultContentLocationPostRequestBody $body, ?CopyToDefaultContentLocationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CopyToDefaultContentLocationPostRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php index 27137ff11a0..e5663bf0b91 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function isPublished * @param IsPublishedRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IsPublishedRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IsPublishedGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IsPublishedGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?IsPublishedRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php index 6156ba05d15..baf561d51d4 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Publishes a contentType][] present in the content type hub site. This API is available in the following [national cloud deployments. * @param PublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-publish?view=graph-rest-1.0 Find more info here */ public function post(?PublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?PublishRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php b/src/Generated/Sites/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php index 0acfa1711ed..e521e0aba04 100644 --- a/src/Generated/Sites/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php +++ b/src/Generated/Sites/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unpublish a contentType][] from a content type hub site. This API is available in the following [national cloud deployments. * @param UnpublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-unpublish?view=graph-rest-1.0 Find more info here */ public function post(?UnpublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnpublishRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/CreatedByUser/CreatedByUserRequestBuilder.php b/src/Generated/Sites/Item/CreatedByUser/CreatedByUserRequestBuilder.php index 46f517e965b..81b1641415c 100644 --- a/src/Generated/Sites/Item/CreatedByUser/CreatedByUserRequestBuilder.php +++ b/src/Generated/Sites/Item/CreatedByUser/CreatedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Sites\Item\CreatedByUser\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who created the item. Read-only. * @param CreatedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Sites/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index ac882f68ddd..d44292e0cca 100644 --- a/src/Generated/Sites/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Sites/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 279089acc47..b991559b6fb 100644 --- a/src/Generated/Sites/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Sites/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 09d6e6d88c9..319c000e80b 100644 --- a/src/Generated/Sites/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Sites/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Sites\Item\CreatedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Drive/DriveRequestBuilder.php b/src/Generated/Sites/Item/Drive/DriveRequestBuilder.php index 5deccd6bdb5..90f75182fa1 100644 --- a/src/Generated/Sites/Item/Drive/DriveRequestBuilder.php +++ b/src/Generated/Sites/Item/Drive/DriveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Drive; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The default drive (document library) for this site. * @param DriveRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Drives/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Drives/Count/CountRequestBuilder.php index 69914453517..ba38ebb7f60 100644 --- a/src/Generated/Sites/Item/Drives/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Drives/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Drives/DrivesRequestBuilder.php b/src/Generated/Sites/Item/Drives/DrivesRequestBuilder.php index 439fa580f9e..7c99517149e 100644 --- a/src/Generated/Sites/Item/Drives/DrivesRequestBuilder.php +++ b/src/Generated/Sites/Item/Drives/DrivesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Drives\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of drives (document libraries) under this site. * @param DrivesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DrivesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?DrivesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?DrivesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Drives/Item/DriveItemRequestBuilder.php b/src/Generated/Sites/Item/Drives/Item/DriveItemRequestBuilder.php index 08133c09a34..6f6075f4b5d 100644 --- a/src/Generated/Sites/Item/Drives/Item/DriveItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Drives/Item/DriveItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Drive; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of drives (document libraries) under this site. * @param DriveItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ExternalColumns/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/ExternalColumns/Count/CountRequestBuilder.php index 9a615a893c7..2dc26a01558 100644 --- a/src/Generated/Sites/Item/ExternalColumns/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/ExternalColumns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ExternalColumns/ExternalColumnsRequestBuilder.php b/src/Generated/Sites/Item/ExternalColumns/ExternalColumnsRequestBuilder.php index f17a828c8f8..0b0fabe0fea 100644 --- a/src/Generated/Sites/Item/ExternalColumns/ExternalColumnsRequestBuilder.php +++ b/src/Generated/Sites/Item/ExternalColumns/ExternalColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\ExternalColumns\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get externalColumns from sites * @param ExternalColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExternalColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ExternalColumnsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ExternalColumnsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/ExternalColumns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Sites/Item/ExternalColumns/Item/ColumnDefinitionItemRequestBuilder.php index 1238fd4b780..51d5e9cdfe5 100644 --- a/src/Generated/Sites/Item/ExternalColumns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/ExternalColumns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get externalColumns from sites * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php b/src/Generated/Sites/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php index d2f0a49d7a5..e43c5bf734f 100644 --- a/src/Generated/Sites/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php +++ b/src/Generated/Sites/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php b/src/Generated/Sites/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php index b49c78bf529..78816f2b3ad 100644 --- a/src/Generated/Sites/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php +++ b/src/Generated/Sites/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,7 +61,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -73,6 +68,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/GetApplicableContentTypesForListWithListId/GetApplicableContentTypesForListWithListIdRequestBuilder.php b/src/Generated/Sites/Item/GetApplicableContentTypesForListWithListId/GetApplicableContentTypesForListWithListIdRequestBuilder.php index e437372b277..16728d743a7 100644 --- a/src/Generated/Sites/Item/GetApplicableContentTypesForListWithListId/GetApplicableContentTypesForListWithListIdRequestBuilder.php +++ b/src/Generated/Sites/Item/GetApplicableContentTypesForListWithListId/GetApplicableContentTypesForListWithListIdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getApplicableContentTypesForList * @param GetApplicableContentTypesForListWithListIdRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetApplicableContentTypesForListWithListIdRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetApplicableContentTypesForListWithListIdGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetApplicableContentTypesForListWithListIdGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?GetApplicableContentTypesForListWithLis $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?GetApplicableContentTypesForListWithLis } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/GetByPathWithPath/GetByPathWithPathRequestBuilder.php b/src/Generated/Sites/Item/GetByPathWithPath/GetByPathWithPathRequestBuilder.php index 03102304228..1ae61759ee0 100644 --- a/src/Generated/Sites/Item/GetByPathWithPath/GetByPathWithPathRequestBuilder.php +++ b/src/Generated/Sites/Item/GetByPathWithPath/GetByPathWithPathRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Site; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getByPath * @param GetByPathWithPathRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetByPathWithPathRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?GetByPathWithPathRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Items/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Items/Count/CountRequestBuilder.php index 6f8a089b707..5c25bd1c8c6 100644 --- a/src/Generated/Sites/Item/Items/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Items/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Items/Item/BaseItemItemRequestBuilder.php b/src/Generated/Sites/Item/Items/Item/BaseItemItemRequestBuilder.php index 0c56b32b819..17505a1e98f 100644 --- a/src/Generated/Sites/Item/Items/Item/BaseItemItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Items/Item/BaseItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BaseItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Used to address any item contained in this site. This collection can't be enumerated. * @param BaseItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BaseItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BaseItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?BaseItemItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?BaseItemItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Items/ItemsRequestBuilder.php b/src/Generated/Sites/Item/Items/ItemsRequestBuilder.php index 3de97a6282c..3d0b253f044 100644 --- a/src/Generated/Sites/Item/Items/ItemsRequestBuilder.php +++ b/src/Generated/Sites/Item/Items/ItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BaseItemCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Items\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Used to address any item contained in this site. This collection can't be enumerated. * @param ItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BaseItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BaseItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php b/src/Generated/Sites/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php index db182d6dbdc..1aa2466e186 100644 --- a/src/Generated/Sites/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php +++ b/src/Generated/Sites/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Sites\Item\LastModifiedByUser\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who last modified the item. Read-only. * @param LastModifiedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Sites/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index fa7e275081e..c2ce6ea3442 100644 --- a/src/Generated/Sites/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Sites/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 8171f1d43e9..c44d31e01d3 100644 --- a/src/Generated/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 4b55adabe1b..b890c436bc2 100644 --- a/src/Generated/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Sites/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Sites\Item\LastModifiedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Count/CountRequestBuilder.php index 1ec6a1dbcba..6059a5a5231 100644 --- a/src/Generated/Sites/Item/Lists/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Columns/ColumnsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Columns/ColumnsRequestBuilder.php index 0536c2585d6..b00963da554 100644 --- a/src/Generated/Sites/Item/Lists/Item/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of columns represented as columnDefinition][columnDefinition] resources in a [list][list]. This API is available in the following [national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a column for a list][list] with a request that specifies a [columnDefinition][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-post-columns?view=graph-rest-1.0 Find more info here */ public function post(ColumnDefinition $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ColumnDefinition $body, ?ColumnsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Columns/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Columns/Count/CountRequestBuilder.php index aefb56407ab..141207f31cc 100644 --- a/src/Generated/Sites/Item/Lists/Item/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php index de5dbecc405..b6e3240572f 100644 --- a/src/Generated/Sites/Item/Lists/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\Columns\Item\SourceColumn\SourceColumnRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property columns for sites * @param ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of field definitions for this list. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property columns in sites * @param ColumnDefinition $body The request body * @param ColumnDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ColumnDefinition $body, ?ColumnDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ColumnDefinitionItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ColumnDefinition $body, ?ColumnDefinit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php index e2f09890058..810d00db875 100644 --- a/src/Generated/Sites/Item/Lists/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The source column for the content type column. * @param SourceColumnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SourceColumnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php index 900b2ede183..468e3c723b8 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/AddCopy/AddCopyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add a copy of a content type][contentType] from a [site][site] to a [list][list]. This API is available in the following [national cloud deployments. * @param AddCopyPostRequestBody $body The request body * @param AddCopyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-addcopy?view=graph-rest-1.0 Find more info here */ public function post(AddCopyPostRequestBody $body, ?AddCopyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddCopyPostRequestBody $body, ?AddCopyR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php index 6e08b289972..c18cc66a77a 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/AddCopyFromContentTypeHub/AddCopyFromContentTypeHubRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add or sync a copy of a published content type from the content type hub to a target site or a list. This method is part of the content type publishing changes to optimize the syncing of published content types to sites and lists, effectively switching from a 'push everywhere' to 'pull as needed' approach. The method allows users to pull content types directly from the content type hub to a site or list. For more information, see contentType: getCompatibleHubContentTypes and the blog post Syntex Product Updates – August 2021. This API is available in the following national cloud deployments. * @param AddCopyFromContentTypeHubPostRequestBody $body The request body * @param AddCopyFromContentTypeHubRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-addcopyfromcontenttypehub?view=graph-rest-1.0 Find more info here */ public function post(AddCopyFromContentTypeHubPostRequestBody $body, ?AddCopyFromContentTypeHubRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AddCopyFromContentTypeHubPostRequestBod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/ContentTypesRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/ContentTypesRequestBuilder.php index f9ab462ba74..c54b172bf04 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/ContentTypesRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/ContentTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ContentTypeCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -79,39 +78,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of contentType][contentType] resources in a [list][]. This API is available in the following [national cloud deployments. * @param ContentTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-list-contenttypes?view=graph-rest-1.0 Find more info here */ public function get(?ContentTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to contentTypes for sites * @param ContentType $body The request body * @param ContentTypesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ContentType $body, ?ContentTypesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,7 +117,6 @@ public function toGetRequestInformation(?ContentTypesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +124,7 @@ public function toGetRequestInformation(?ContentTypesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +139,11 @@ public function toPostRequestInformation(ContentType $body, ?ContentTypesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Count/CountRequestBuilder.php index ab87bf95f75..1286b1fd54f 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php index bde9d82da99..d4bacf216ef 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/GetCompatibleHubContentTypes/GetCompatibleHubContentTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getCompatibleHubContentTypes * @param GetCompatibleHubContentTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetCompatibleHubContentTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetCompatibleHubContentTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetCompatibleHubContentTypesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetCompatibleHubContentTypesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetCompatibleHubContentTypesRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php index b6aed6fc282..03d81278c5e 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/AssociateWithHubSites/AssociateWithHubSitesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Associate a published content type][contentType] present in a content type hub with a list of hub sites. This API is available in the following [national cloud deployments. * @param AssociateWithHubSitesPostRequestBody $body The request body * @param AssociateWithHubSitesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-associatewithhubsites?view=graph-rest-1.0 Find more info here */ public function post(AssociateWithHubSitesPostRequestBody $body, ?AssociateWithHubSitesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AssociateWithHubSitesPostRequestBody $b $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php index 1a72024eb25..85b628fe580 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Base/EscapedBaseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Parent contentType from which this content type is derived. * @param BaseRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?BaseRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?BaseRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php index 76de52c8d13..d07d6c02892 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/BaseTypesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentTypeCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\ContentTypes\Item\BaseTypes\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of content types that are ancestors of this content type. * @param BaseTypesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BaseTypesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentTypeCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?BaseTypesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?BaseTypesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php index da5341e5fb2..046cbc89c0b 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php index f2b928cb4ea..cc403eee1c7 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/BaseTypes/Item/ContentTypeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of content types that are ancestors of this content type. * @param ContentTypeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentTypeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php index 35aef4dfa13..21ee7e5aa6c 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/ColumnLinksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnLink; use Microsoft\Graph\Generated\Models\ColumnLinkCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of columns that are required by this content type. * @param ColumnLinksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnLinksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLinkCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLinkCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to columnLinks for sites * @param ColumnLink $body The request body * @param ColumnLinksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ColumnLink $body, ?ColumnLinksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ColumnLinksRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ColumnLinksRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ColumnLink $body, ?ColumnLinksRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php index 11a31d5cf3e..04bae2b36a9 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php index 4cd7a40ad3e..ef530e914e9 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnLinks/Item/ColumnLinkItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnLink; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property columnLinks for sites * @param ColumnLinkItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ColumnLinkItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of columns that are required by this content type. * @param ColumnLinkItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnLinkItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property columnLinks in sites * @param ColumnLink $body The request body * @param ColumnLinkItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ColumnLink $body, ?ColumnLinkItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnLink::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ColumnLinkItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ColumnLinkItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ColumnLinkItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ColumnLink $body, ?ColumnLinkItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php index 40fe297edbf..b7e01ea9f94 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/ColumnPositionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\ContentTypes\Item\ColumnPositions\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Column order information in a content type. * @param ColumnPositionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnPositionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ColumnPositionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ColumnPositionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php index ae9ea8a1251..48114558a76 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php index fb495a4719d..915758b5841 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ColumnPositions/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Column order information in a content type. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php index 839f9ea2f13..6eb35be3729 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/ColumnsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ColumnDefinitionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of columns represented as columnDefinition][columnDefinition] resources in a [content type][contentType]. This API is available in the following [national cloud deployments. * @param ColumnsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-list-columns?view=graph-rest-1.0 Find more info here */ public function get(?ColumnsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinitionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a column to a content type][contentType] in a site, or a list with a request that specifies a [columnDefinition][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-post-columns?view=graph-rest-1.0 Find more info here */ public function post(ColumnDefinition $body, ?ColumnsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ColumnsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ColumnDefinition $body, ?ColumnsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php index bb0fa5ec9af..d53cd3762ad 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php index bda3dcd0f11..779fe28cff6 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/ColumnDefinitionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\ContentTypes\Item\Columns\Item\SourceColumn\SourceColumnRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a column][columndefinition] from a [site][], a [list][], or a [content type][contentType]. This API is available in the following [national cloud deployments. * @param ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ColumnDefinitionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the metadata for a site][], a [list][], or a [contentType][] [column][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinitionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-get?view=graph-rest-1.0 Find more info here */ public function get(?ColumnDefinitionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a site][], a [list][], or a [content type][contentType] [column][columnDefinition]. This API is available in the following [national cloud deployments. * @param ColumnDefinition $body The request body * @param ColumnDefinitionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/columndefinition-update?view=graph-rest-1.0 Find more info here */ public function patch(ColumnDefinition $body, ?ColumnDefinitionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?ColumnDefinitionItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?ColumnDefinitionItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(ColumnDefinition $body, ?ColumnDefinit $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php index b3c87e90889..5c37f87fbfc 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Columns/Item/SourceColumn/SourceColumnRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ColumnDefinition; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The source column for the content type column. * @param SourceColumnRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SourceColumnRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ColumnDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SourceColumnRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php index 4df7cc8a98d..7b7e1f0a3a1 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/ContentTypeItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContentType; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\ContentTypes\Item\AssociateWithHubSites\AssociateWithHubSitesRequestBuilder; @@ -114,56 +113,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contentTypes for sites * @param ContentTypeItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ContentTypeItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of content types present in this list. * @param ContentTypeItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentTypeItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contentTypes in sites * @param ContentType $body The request body * @param ContentTypeItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ContentType $body, ?ContentTypeItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContentType::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -180,6 +170,7 @@ public function toDeleteRequestInformation(?ContentTypeItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -193,7 +184,6 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -201,6 +191,7 @@ public function toGetRequestInformation(?ContentTypeItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -215,11 +206,11 @@ public function toPatchRequestInformation(ContentType $body, ?ContentTypeItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php index c31923b6fbb..1784e633926 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/CopyToDefaultContentLocation/CopyToDefaultContentLocationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a file to a default content location in a content type][contentType]. The file can then be added as a default file or template via a POST operation. This API is available in the following [national cloud deployments. * @param CopyToDefaultContentLocationPostRequestBody $body The request body * @param CopyToDefaultContentLocationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-copytodefaultcontentlocation?view=graph-rest-1.0 Find more info here */ public function post(CopyToDefaultContentLocationPostRequestBody $body, ?CopyToDefaultContentLocationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CopyToDefaultContentLocationPostRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php index eb822ffe4e8..7052b7a7275 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/IsPublished/IsPublishedRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function isPublished * @param IsPublishedRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?IsPublishedRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [IsPublishedGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [IsPublishedGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?IsPublishedRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php index d52dbdf644a..7c7f18543d6 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Publish/PublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Publishes a contentType][] present in the content type hub site. This API is available in the following [national cloud deployments. * @param PublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-publish?view=graph-rest-1.0 Find more info here */ public function post(?PublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?PublishRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php index fc83b70fd9f..d45548e6cce 100644 --- a/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ContentTypes/Item/Unpublish/UnpublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unpublish a contentType][] from a content type hub site. This API is available in the following [national cloud deployments. * @param UnpublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contenttype-unpublish?view=graph-rest-1.0 Find more info here */ public function post(?UnpublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnpublishRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/CreatedByUser/CreatedByUserRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/CreatedByUser/CreatedByUserRequestBuilder.php index 0e75c77729a..473237c4ecb 100644 --- a/src/Generated/Sites/Item/Lists/Item/CreatedByUser/CreatedByUserRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/CreatedByUser/CreatedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\CreatedByUser\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who created the item. Read-only. * @param CreatedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 008ada58917..17df1967817 100644 --- a/src/Generated/Sites/Item/Lists/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 2587a5c8217..48c1f4e5b4d 100644 --- a/src/Generated/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 73d1234d58a..0796da096aa 100644 --- a/src/Generated/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\CreatedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Drive/DriveRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Drive/DriveRequestBuilder.php index 922965f455d..5cf0e0ccdee 100644 --- a/src/Generated/Sites/Item/Lists/Item/Drive/DriveRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Drive/DriveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Drive; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Allows access to the list as a drive resource with driveItems. Only present on document libraries. * @param DriveRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/Analytics/AnalyticsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/Analytics/AnalyticsRequestBuilder.php index aad83db9844..162e8f714c0 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/Analytics/AnalyticsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/Analytics/AnalyticsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ItemAnalytics; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Analytics about the view activities that took place on this item. * @param AnalyticsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AnalyticsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ItemAnalytics::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AnalyticsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php index ba1186e4be4..47fc3bbccdd 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/CreatedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\Items\Item\CreatedByUser\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who created the item. Read-only. * @param CreatedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CreatedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?CreatedByUserRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 6d58f4bc7d3..d23bfc03301 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 95316e3a8d6..4e378355635 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 773902c2810..7152650e8a2 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/CreatedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\Items\Item\CreatedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php index 59bb7b19168..75ca3ecfb01 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php index 63a2a0a2745..0f1b3f1a5e9 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/DocumentSetVersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DocumentSetVersion; use Microsoft\Graph\Generated\Models\DocumentSetVersionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the versions of a document set item in a list. This API is available in the following national cloud deployments. * @param DocumentSetVersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-list-documentsetversions?view=graph-rest-1.0 Find more info here */ public function get(?DocumentSetVersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new version of a document set item in a list. This API is available in the following national cloud deployments. * @param DocumentSetVersion $body The request body * @param DocumentSetVersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-post-documentsetversions?view=graph-rest-1.0 Find more info here */ public function post(DocumentSetVersion $body, ?DocumentSetVersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DocumentSetVersionsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DocumentSetVersionsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DocumentSetVersion $body, ?DocumentSetV $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php index e30814e4fd5..8fe8ba35a61 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/DocumentSetVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DocumentSetVersion; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\Items\Item\DocumentSetVersions\Item\Fields\FieldsRequestBuilder; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a version of a document set in a list. This API is available in the following national cloud deployments. * @param DocumentSetVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/documentsetversion-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DocumentSetVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a documentSetVersion object. This API is available in the following national cloud deployments. * @param DocumentSetVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/documentsetversion-get?view=graph-rest-1.0 Find more info here */ public function get(?DocumentSetVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property documentSetVersions in sites * @param DocumentSetVersion $body The request body * @param DocumentSetVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DocumentSetVersion $body, ?DocumentSetVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DocumentSetVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?DocumentSetVersionItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?DocumentSetVersionItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?DocumentSetVersionItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(DocumentSetVersion $body, ?DocumentSet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php index 56b00270a0f..a5067ee0b58 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Fields/FieldsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FieldValueSet; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fields for sites * @param FieldsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FieldsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of the fields and values for this version of the list item. * @param FieldsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FieldsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fields in sites * @param FieldValueSet $body The request body * @param FieldsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(FieldValueSet $body, ?FieldsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FieldsRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(FieldValueSet $body, ?FieldsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php index 164a914a90f..b6785f84a20 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/DocumentSetVersions/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a document set version. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/documentsetversion-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/DriveItem/Content/ContentRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/DriveItem/Content/ContentRequestBuilder.php index 37075a2ecef..35db5128105 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/DriveItem/Content/ContentRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/DriveItem/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/DriveItem/DriveItemRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/DriveItem/DriveItemRequestBuilder.php index 1e72818ae7b..75acd6b0f28 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/DriveItem/DriveItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/DriveItem/DriveItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\Items\Item\DriveItem\Content\ContentRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * For document libraries, the driveItem relationship exposes the listItem as a [driveItem][] * @param DriveItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/Fields/FieldsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/Fields/FieldsRequestBuilder.php index 80f8ad4abae..a43c1462f67 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/Fields/FieldsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/Fields/FieldsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FieldValueSet; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fields for sites * @param FieldsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FieldsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The values of the columns set on this list item. * @param FieldsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FieldsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties on a listItem][]. This API is available in the following [national cloud deployments. * @param FieldValueSet $body The request body * @param FieldsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-update?view=graph-rest-1.0 Find more info here */ public function patch(FieldValueSet $body, ?FieldsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?FieldsRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(FieldValueSet $body, ?FieldsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php index a98a833eedc..5748746d0f6 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/GetActivitiesByInterval/GetActivitiesByIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php index 22b21baa930..2607576b062 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval/GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -40,19 +39,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getActivitiesByInterval * @param GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -65,7 +61,6 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -73,6 +68,7 @@ public function toGetRequestInformation(?GetActivitiesByIntervalWithStartDateTim } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php index 6bac0a079e1..a49fa93fd88 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\Items\Item\LastModifiedByUser\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who last modified the item. Read-only. * @param LastModifiedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index ba1e836bd45..0f86fc1fff2 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index b55ac9b2a18..31259fe150f 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 732335973d3..5802117aed9 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\Items\Item\LastModifiedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/ListItemItemRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/ListItemItemRequestBuilder.php index fbe3d93928a..8a3c888abfd 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/ListItemItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/ListItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ListItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\Items\Item\Analytics\AnalyticsRequestBuilder; @@ -99,39 +98,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Removes an item from a list][]. This API is available in the following [national cloud deployments. * @param ListItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ListItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns the metadata for an item][] in a [list][]. This API is available in the following [national cloud deployments. * @param ListItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-get?view=graph-rest-1.0 Find more info here */ public function get(?ListItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -149,19 +142,16 @@ public function getActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInter * Update the navigation property items in sites * @param ListItem $body The request body * @param ListItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ListItem $body, ?ListItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -178,6 +168,7 @@ public function toDeleteRequestInformation(?ListItemItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -191,7 +182,6 @@ public function toGetRequestInformation(?ListItemItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -199,6 +189,7 @@ public function toGetRequestInformation(?ListItemItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -213,11 +204,11 @@ public function toPatchRequestInformation(ListItem $body, ?ListItemItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Count/CountRequestBuilder.php index b6dd0fe4557..5ea529351ad 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php index 8e4c942cbd2..6b20706436b 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Item/Fields/FieldsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\FieldValueSet; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property fields for sites * @param FieldsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?FieldsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of the fields and values for this version of the list item. * @param FieldsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FieldsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property fields in sites * @param FieldValueSet $body The request body * @param FieldsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(FieldValueSet $body, ?FieldsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [FieldValueSet::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?FieldsRequestBuilderDeleteRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?FieldsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(FieldValueSet $body, ?FieldsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php index ba497b24407..3dab9950a29 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Item/ListItemVersionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ListItemVersion; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\Items\Item\Versions\Item\Fields\FieldsRequestBuilder; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property versions for sites * @param ListItemVersionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ListItemVersionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the metadata for a specific version of a ListItem. This API is available in the following national cloud deployments. * @param ListItemVersionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitemversion-get?view=graph-rest-1.0 Find more info here */ public function get(?ListItemVersionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property versions in sites * @param ListItemVersion $body The request body * @param ListItemVersionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ListItemVersion $body, ?ListItemVersionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?ListItemVersionItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?ListItemVersionItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?ListItemVersionItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(ListItemVersion $body, ?ListItemVersio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php index c47b3f44bd0..3a0fd72f71d 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/Item/RestoreVersion/RestoreVersionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a previous version of a ListItem to be the current version. This will create a new version with the contents of the previous version, but preserves all existing versions of the item. This API is available in the following national cloud deployments. * @param RestoreVersionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitemversion-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreVersionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RestoreVersionRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/VersionsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/VersionsRequestBuilder.php index 4a3243891c4..aa9657cb51a 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/VersionsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/Item/Versions/VersionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ListItemVersion; use Microsoft\Graph\Generated\Models\ListItemVersionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * SharePoint can be configured to retain the history for list items. Previous versions may be retained for a finite period of time depending on admin settings which may be unique per user or location. This API is available in the following national cloud deployments. * @param VersionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-list-versions?view=graph-rest-1.0 Find more info here */ public function get(?VersionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to versions for sites * @param ListItemVersion $body The request body * @param VersionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ListItemVersion $body, ?VersionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemVersion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?VersionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ListItemVersion $body, ?VersionsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Items/ItemsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Items/ItemsRequestBuilder.php index d83df5f0861..284e601ea97 100644 --- a/src/Generated/Sites/Item/Lists/Item/Items/ItemsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Items/ItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ListItem; use Microsoft\Graph\Generated\Models\ListItemCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -47,40 +46,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of items][item] in a [list][]. This API is available in the following [national cloud deployments. * @param ItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-list?view=graph-rest-1.0 Find more info here */ public function get(?ItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new listItem][] in a [list][]. This API is available in the following [national cloud deployments. * @param ListItem $body The request body * @param ItemsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/listitem-create?view=graph-rest-1.0 Find more info here */ public function post(ListItem $body, ?ItemsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,7 +86,6 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -101,6 +93,7 @@ public function toGetRequestInformation(?ItemsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -115,11 +108,11 @@ public function toPostRequestInformation(ListItem $body, ?ItemsRequestBuilderPos $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php index 057a7a694a1..1f875062378 100644 --- a/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/LastModifiedByUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\LastModifiedByUser\MailboxSettings\MailboxSettingsRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Identity of the user who last modified the item. Read-only. * @param LastModifiedByUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastModifiedByUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?LastModifiedByUserRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php index 88936ca1c12..ce8c5419867 100644 --- a/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 07eeb15602d..9d52263ba7e 100644 --- a/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index e15eb5a5189..d6d23b7727c 100644 --- a/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/LastModifiedByUser/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\LastModifiedByUser\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ListItemRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/ListItemRequestBuilder.php index e8750959d3d..e52c409be7e 100644 --- a/src/Generated/Sites/Item/Lists/Item/ListItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/ListItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EscapedList; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\Columns\ColumnsRequestBuilder; @@ -98,57 +97,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property lists for sites * @param ListItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ListItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Returns the metadata for a list][]. This API is available in the following [national cloud deployments. + * Get a list of rich long-running operations associated with a list. This API is available in the following national cloud deployments. * @param ListItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/list-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/list-list-operations?view=graph-rest-1.0 Find more info here */ public function get(?ListItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property lists in sites * @param EscapedList $body The request body * @param ListItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EscapedList $body, ?ListItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -165,11 +155,12 @@ public function toDeleteRequestInformation(?ListItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Returns the metadata for a list][]. This API is available in the following [national cloud deployments. + * Get a list of rich long-running operations associated with a list. This API is available in the following national cloud deployments. * @param ListItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -178,7 +169,6 @@ public function toGetRequestInformation(?ListItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -186,6 +176,7 @@ public function toGetRequestInformation(?ListItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -200,11 +191,11 @@ public function toPatchRequestInformation(EscapedList $body, ?ListItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/ListItemRequestBuilderGetQueryParameters.php b/src/Generated/Sites/Item/Lists/Item/ListItemRequestBuilderGetQueryParameters.php index 54ba634e1b9..f48d97cbae1 100644 --- a/src/Generated/Sites/Item/Lists/Item/ListItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Sites/Item/Lists/Item/ListItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Returns the metadata for a list][]. This API is available in the following [national cloud deployments. + * Get a list of rich long-running operations associated with a list. This API is available in the following national cloud deployments. */ class ListItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Sites/Item/Lists/Item/Operations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Operations/Count/CountRequestBuilder.php index 6c9d6e90065..f68e4d04f23 100644 --- a/src/Generated/Sites/Item/Lists/Item/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php index af81904d3ae..31185b8ea05 100644 --- a/src/Generated/Sites/Item/Lists/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RichLongRunningOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for sites * @param RichLongRunningOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RichLongRunningOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of long-running operations on the list. * @param RichLongRunningOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RichLongRunningOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in sites * @param RichLongRunningOperation $body The request body * @param RichLongRunningOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RichLongRunningOperation $body, ?RichLongRunningOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?RichLongRunningOperationItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?RichLongRunningOperationItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?RichLongRunningOperationItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(RichLongRunningOperation $body, ?RichL $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Operations/OperationsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Operations/OperationsRequestBuilder.php index 1d91041cda9..621e4c77b9e 100644 --- a/src/Generated/Sites/Item/Lists/Item/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RichLongRunningOperation; use Microsoft\Graph\Generated\Models\RichLongRunningOperationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of long-running operations on the list. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for sites * @param RichLongRunningOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RichLongRunningOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(RichLongRunningOperation $body, ?Operat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Subscriptions/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Subscriptions/Count/CountRequestBuilder.php index c581e62d2e3..958feaac554 100644 --- a/src/Generated/Sites/Item/Lists/Item/Subscriptions/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Subscriptions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php index 4a684b6f819..f35e21415ca 100644 --- a/src/Generated/Sites/Item/Lists/Item/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reauthorize a subscription when you receive a reauthorizationRequired challenge. This API is available in the following national cloud deployments. * @param ReauthorizeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subscription-reauthorize?view=graph-rest-1.0 Find more info here */ public function post(?ReauthorizeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ReauthorizeRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Subscriptions/Item/SubscriptionItemRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Subscriptions/Item/SubscriptionItemRequestBuilder.php index 8932b8969a7..a22a94f8d85 100644 --- a/src/Generated/Sites/Item/Lists/Item/Subscriptions/Item/SubscriptionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Subscriptions/Item/SubscriptionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Subscription; use Microsoft\Graph\Generated\Sites\Item\Lists\Item\Subscriptions\Item\Reauthorize\ReauthorizeRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property subscriptions for sites * @param SubscriptionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SubscriptionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The set of subscriptions on the list. * @param SubscriptionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubscriptionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property subscriptions in sites * @param Subscription $body The request body * @param SubscriptionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Subscription $body, ?SubscriptionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?SubscriptionItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?SubscriptionItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?SubscriptionItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Subscription $body, ?SubscriptionItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/Item/Subscriptions/SubscriptionsRequestBuilder.php b/src/Generated/Sites/Item/Lists/Item/Subscriptions/SubscriptionsRequestBuilder.php index 7bba800c87c..d695a24e78c 100644 --- a/src/Generated/Sites/Item/Lists/Item/Subscriptions/SubscriptionsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/Item/Subscriptions/SubscriptionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Subscription; use Microsoft\Graph\Generated\Models\SubscriptionCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The set of subscriptions on the list. * @param SubscriptionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SubscriptionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubscriptionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubscriptionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to subscriptions for sites * @param Subscription $body The request body * @param SubscriptionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Subscription $body, ?SubscriptionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?SubscriptionsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?SubscriptionsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Subscription $body, ?SubscriptionsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Lists/ListsRequestBuilder.php b/src/Generated/Sites/Item/Lists/ListsRequestBuilder.php index ef813ea2608..d70a2df89ac 100644 --- a/src/Generated/Sites/Item/Lists/ListsRequestBuilder.php +++ b/src/Generated/Sites/Item/Lists/ListsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EscapedList; use Microsoft\Graph\Generated\Models\ListCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the collection of [lists][] for a [site][]. Lists with the [system][] facet are hidden by default.To list them, include system in your $select statement. This API is available in the following national cloud deployments. * @param ListsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-list?view=graph-rest-1.0 Find more info here */ public function get(?ListsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ListCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ListCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new list][] in a [site][]. This API is available in the following [national cloud deployments. * @param EscapedList $body The request body * @param ListsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/list-create?view=graph-rest-1.0 Find more info here */ public function post(EscapedList $body, ?ListsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EscapedList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ListsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ListsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EscapedList $body, ?ListsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Count/CountRequestBuilder.php index 464c33e7c81..1ea5797fbbf 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php index 3678b63aed4..3388c6f5c78 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CopyNotebookModel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Retrieve the properties and relationships of a notebook object by using its URL path. The location can be user notebooks on Microsoft 365, group notebooks, or SharePoint site-hosted team notebooks on Microsoft 365. This API is available in the following national cloud deployments. * @param GetNotebookFromWebUrlPostRequestBody $body The request body * @param GetNotebookFromWebUrlRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-getnotebookfromweburl?view=graph-rest-1.0 Find more info here */ public function post(GetNotebookFromWebUrlPostRequestBody $body, ?GetNotebookFromWebUrlRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CopyNotebookModel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CopyNotebookModel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(GetNotebookFromWebUrlPostRequestBody $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php index 0b3ab534038..823f0f750de 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getRecentNotebooks * @param GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetRecentNotebooksWithIncludePersonalNotebooksGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetRecentNotebooksWithIncludePersonalNotebooksGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?GetRecentNotebooksWithIncludePersonalNo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?GetRecentNotebooksWithIncludePersonalNo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php index 5bb77beecb1..37399cabb2f 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyNotebookPostRequestBody $body The request body * @param CopyNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-copynotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyNotebookPostRequestBody $body, ?CopyNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyNotebookPostRequestBody $body, ?Cop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php index dba14d0fba9..f5bbc1e44e1 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Sites\Item\Onenote\Notebooks\Item\CopyNotebook\CopyNotebookRequestBuilder; @@ -58,57 +57,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property notebooks for sites * @param NotebookItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?NotebookItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a notebook object. This API is available in the following national cloud deployments. * @param NotebookItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-get?view=graph-rest-1.0 Find more info here */ public function get(?NotebookItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property notebooks in sites * @param Notebook $body The request body * @param NotebookItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Notebook $body, ?NotebookItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -125,6 +115,7 @@ public function toDeleteRequestInformation(?NotebookItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -138,7 +129,6 @@ public function toGetRequestInformation(?NotebookItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -146,6 +136,7 @@ public function toGetRequestInformation(?NotebookItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -160,11 +151,11 @@ public function toPatchRequestInformation(Notebook $body, ?NotebookItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php index 45e9a4e5c30..158c1dde733 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php index e44097d7b9c..d09323ace79 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section group. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index d34d2bacdca..8fb6b329797 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section group. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php index f9a2c4059a2..665742f54ca 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Graph\Generated\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\ParentNotebook\ParentNotebookRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sectionGroups for sites * @param SectionGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SectionGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The section groups in the notebook. Read-only. Nullable. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sectionGroups in sites * @param SectionGroup $body The request body * @param SectionGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SectionGroup $body, ?SectionGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?SectionGroupItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(SectionGroup $body, ?SectionGroupItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php index 79587adde10..0a74fda4e2e 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php index 353d3e2ef6f..7130de33fd5 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section groups in the section. Read-only. Nullable. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php index c7344d4b3a4..c28c537141a 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroupCollectionResponse; use Microsoft\Graph\Generated\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\SectionGroups\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of section groups from the specified section group. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php index 257729df504..4e4564e002a 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index 254f42949f3..1a0a3c089fe 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index 32fa1c0bd46..aa4ef1ea50f 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php index ba9e6e797d8..28ac3878f03 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for sites * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The sections in the section group. Read-only. Nullable. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in sites * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php index 2e2bf2062ff..df0c647abba 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index a3f975f3b7e..460c3efa99e 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index ad05f864230..6bad5b851f5 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index 56baaa77935..fbd3266e504 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Sites\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\Item\Content\ContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for sites * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in sites * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 2b23684b181..06546da2d1c 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 95f52e4db34..de9cc82c3a3 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index 9fc0cfc0eea..b8097297653 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index deb7252ede9..3e7664ddece 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php index d5f4cd6ce70..2f416bbeea3 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Models\OnenotePageCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index df43d5786ae..5df7d215780 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index ea44ee0df85..ad7a7769545 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php index 5754b44469e..e9163bfc80f 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Models\OnenoteSectionCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects from the specified section group. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new onenoteSection in the specified section group. This API is available in the following national cloud deployments. * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-post-sections?view=graph-rest-1.0 Find more info here */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php index 5461dc035dd..d9af290a6b7 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Graph\Generated\Models\SectionGroupCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of section groups from the specified notebook. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new section group in the specified notebook. This API is available in the following national cloud deployments. * @param SectionGroup $body The request body * @param SectionGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-post-sectiongroups?view=graph-rest-1.0 Find more info here */ public function post(SectionGroup $body, ?SectionGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SectionGroup $body, ?SectionGroupsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php index 2eed865304c..41deaf397f0 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index 1d8568f5f10..afe4dfb8495 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index 47d9df0a7c4..362658fafda 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php index 545f3b4a3ee..d28ca78455b 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Sites\Item\Onenote\Notebooks\Item\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for sites * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The sections in the notebook. Read-only. Nullable. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in sites * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php index 596e30fb2f1..c83179dff41 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index 9d2fbee94a4..3d6985fd39a 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index 055adbdff62..d80d15c1698 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index 8fcdf99fb22..4eea54bfe45 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Sites\Item\Onenote\Notebooks\Item\Sections\Item\Pages\Item\Content\ContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for sites * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in sites * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 6daffbc187e..269339d9a16 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 49d2299d636..0e5e24fe833 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index 68de5d91717..a9f80d3e146 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index c795480349f..17f848a279a 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php index 1ff9a9af744..eacecb81d21 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Models\OnenotePageCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 8c870af1d40..e93fd9d00dc 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index a9202a81d7a..b4365d38eaa 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php index 771e57b69fb..eee47a87cda 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Models\OnenoteSectionCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects from the specified notebook. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new onenoteSection in the specified notebook. This API is available in the following national cloud deployments. * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-post-sections?view=graph-rest-1.0 Find more info here */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Notebooks/NotebooksRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Notebooks/NotebooksRequestBuilder.php index 75abb7ba5f0..e27e9df3a2a 100644 --- a/src/Generated/Sites/Item/Onenote/Notebooks/NotebooksRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Notebooks/NotebooksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\NotebookCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -64,20 +63,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of notebook objects. This API is available in the following national cloud deployments. * @param NotebooksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-notebooks?view=graph-rest-1.0 Find more info here */ public function get(?NotebooksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [NotebookCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [NotebookCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,20 +89,17 @@ public function getRecentNotebooksWithIncludePersonalNotebooks(bool $includePers * Create a new OneNote notebook. This API is available in the following national cloud deployments. * @param Notebook $body The request body * @param NotebooksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-post-notebooks?view=graph-rest-1.0 Find more info here */ public function post(Notebook $body, ?NotebooksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,7 +112,6 @@ public function toGetRequestInformation(?NotebooksRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -127,6 +119,7 @@ public function toGetRequestInformation(?NotebooksRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -141,11 +134,11 @@ public function toPostRequestInformation(Notebook $body, ?NotebooksRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/OnenoteRequestBuilder.php b/src/Generated/Sites/Item/Onenote/OnenoteRequestBuilder.php index b304fbdad13..5d03a6ae58c 100644 --- a/src/Generated/Sites/Item/Onenote/OnenoteRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/OnenoteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Onenote; use Microsoft\Graph\Generated\Sites\Item\Onenote\Notebooks\NotebooksRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property onenote for sites * @param OnenoteRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Calls the OneNote service for notebook related operations. * @param OnenoteRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property onenote in sites * @param Onenote $body The request body * @param OnenoteRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Onenote $body, ?OnenoteRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenoteRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenoteRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenoteRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(Onenote $body, ?OnenoteRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Operations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Operations/Count/CountRequestBuilder.php index 8118e3cb7f6..579ac842062 100644 --- a/src/Generated/Sites/Item/Onenote/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php index 89f086c40cc..96db90e2ed7 100644 --- a/src/Generated/Sites/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for sites * @param OnenoteOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the status of a long-running OneNote operation. This applies to operations that return the Operation-Location header in the response, such as CopyNotebook, CopyToNotebook, CopyToSectionGroup, and CopyToSection. You can poll the Operation-Location endpoint until the status property returns completed or failed. If the status is completed, the resourceLocation property contains the resource endpoint URI. If the status is failed, the error and @api.diagnostics properties provide error information. This API is available in the following national cloud deployments. * @param OnenoteOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenoteoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?OnenoteOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in sites * @param OnenoteOperation $body The request body * @param OnenoteOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteOperation $body, ?OnenoteOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?OnenoteOperationItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?OnenoteOperationItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?OnenoteOperationItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(OnenoteOperation $body, ?OnenoteOperat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Operations/OperationsRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Operations/OperationsRequestBuilder.php index db65be0dbd9..8c6b0470eb8 100644 --- a/src/Generated/Sites/Item/Onenote/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Graph\Generated\Models\OnenoteOperationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the status of a long-running OneNote operation. This applies to operations that return the Operation-Location header in the response, such as CopyNotebook, CopyToNotebook, CopyToSectionGroup, and CopyToSection. You can poll the Operation-Location endpoint until the status property returns completed or failed. If the status is completed, the resourceLocation property contains the resource endpoint URI. If the status is failed, the error and @api.diagnostics properties provide error information. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for sites * @param OnenoteOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenoteOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(OnenoteOperation $body, ?OperationsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Pages/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Pages/Count/CountRequestBuilder.php index f4b82ef027f..3a082b061be 100644 --- a/src/Generated/Sites/Item/Onenote/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php index a2b526631e8..1e91cca370f 100644 --- a/src/Generated/Sites/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index 5323513c610..c74ebb0336e 100644 --- a/src/Generated/Sites/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php index 22a64638a3b..3b91d4d1b86 100644 --- a/src/Generated/Sites/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Sites\Item\Onenote\Pages\Item\Content\ContentRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a OneNote page. This API is available in the following national cloud deployments. * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-delete?view=graph-rest-1.0 Find more info here */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a page object. Getting page information Access a page's metadata by page identifier: Getting page content You can use the page's content endpoint to get the HTML content of a page: The includeIDs=true query option is used to update pages. This API is available in the following national cloud deployments. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-get?view=graph-rest-1.0 Find more info here */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in sites * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 53f6ba02ca3..f4bdcc190ff 100644 --- a/src/Generated/Sites/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 0cb94fd0616..84422a31ed5 100644 --- a/src/Generated/Sites/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index 537097fb5ce..888bb05259f 100644 --- a/src/Generated/Sites/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php index 36dffcbb12e..4a65c327ed7 100644 --- a/src/Generated/Sites/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Pages/PagesRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Pages/PagesRequestBuilder.php index 1b5210b7952..ae1eda96500 100644 --- a/src/Generated/Sites/Item/Onenote/Pages/PagesRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Models\OnenotePageCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new OneNote page in the default section of the default notebook. To create a page in a different section in the default notebook, you can use the sectionName query parameter. Example: ../onenote/pages?sectionName=My%20section The POST /onenote/pages operation is used only to create pages in the current user's default notebook. If you're targeting other notebooks, you can create pages in a specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Resources/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Resources/Count/CountRequestBuilder.php index d31b4998164..b572e6cbc0d 100644 --- a/src/Generated/Sites/Item/Onenote/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php index b02ff0ec29e..384452737dc 100644 --- a/src/Generated/Sites/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteResource; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php index 8b04c346adf..5263f9e6713 100644 --- a/src/Generated/Sites/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteResource; use Microsoft\Graph\Generated\Sites\Item\Onenote\Resources\Item\Content\ContentRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resources for sites * @param OnenoteResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The image and other file resources in OneNote pages. Getting a resources collection isn't supported, but you can get the binary content of a specific resource. Read-only. Nullable. * @param OnenoteResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in sites * @param OnenoteResource $body The request body * @param OnenoteResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteResource $body, ?OnenoteResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?OnenoteResourceItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?OnenoteResourceItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?OnenoteResourceItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(OnenoteResource $body, ?OnenoteResourc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Resources/ResourcesRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Resources/ResourcesRequestBuilder.php index 30cdd1efdd6..f5db510e630 100644 --- a/src/Generated/Sites/Item/Onenote/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteResource; use Microsoft\Graph\Generated\Models\OnenoteResourceCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The image and other file resources in OneNote pages. Getting a resources collection isn't supported, but you can get the binary content of a specific resource. Read-only. Nullable. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resources for sites * @param OnenoteResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenoteResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(OnenoteResource $body, ?ResourcesReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php index d4242319384..491aa898c17 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 9008437862e..91aaca95a95 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section group. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index a0f1b9b0b07..4f659b94d67 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section group. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php index 5e294d344a2..ac3da67e3c8 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Graph\Generated\Sites\Item\Onenote\SectionGroups\Item\ParentNotebook\ParentNotebookRequestBuilder; @@ -66,57 +65,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sectionGroups for sites * @param SectionGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SectionGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a sectionGroup object. This API is available in the following national cloud deployments. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-get?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sectionGroups in sites * @param SectionGroup $body The request body * @param SectionGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SectionGroup $body, ?SectionGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,6 +123,7 @@ public function toDeleteRequestInformation(?SectionGroupItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -146,7 +137,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -154,6 +144,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -168,11 +159,11 @@ public function toPatchRequestInformation(SectionGroup $body, ?SectionGroupItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php index 529e717c907..fc7cc188335 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php index 325089d8aba..d909aeb3261 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section groups in the section. Read-only. Nullable. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php index 859db7955d8..d20e3aae991 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroupCollectionResponse; use Microsoft\Graph\Generated\Sites\Item\Onenote\SectionGroups\Item\SectionGroups\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of section groups from the specified section group. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php index 0ff2e2f2337..aa08b9f245f 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index 40ec68cf6bb..caa8b05dac1 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index 331e52db516..31bcd84f640 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php index 0fdda02a7f5..615b5483ffb 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Sites\Item\Onenote\SectionGroups\Item\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for sites * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The sections in the section group. Read-only. Nullable. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in sites * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php index 132ae8434fc..7a25d359f0e 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index e00004a09f2..46f95c09d86 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index ced7e7adb60..f6a928f6920 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index 467a06628d7..6d307dae51f 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Sites\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\Item\Content\ContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for sites * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in sites * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 6663ba5bcaa..624ed167e8f 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 69a08e898fe..b660b4680d6 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index 9d4c9ec6afc..b37f518a1bb 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index 27f5ff7882c..79d793726d1 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php index 0c08e761cab..1f8d80d5024 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Models\OnenotePageCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 497926ac9d1..e84dc3b5ab9 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index 3638c55c621..bedb60f5aca 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php index 1a1fd41e4a0..78e95bc48f9 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Models\OnenoteSectionCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects from the specified section group. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new onenoteSection in the specified section group. This API is available in the following national cloud deployments. * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-post-sections?view=graph-rest-1.0 Find more info here */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Sites/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php index d434b1155f6..b39cc02652a 100644 --- a/src/Generated/Sites/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Graph\Generated\Models\SectionGroupCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of sectionGroup objects. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sectionGroups for sites * @param SectionGroup $body The request body * @param SectionGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SectionGroup $body, ?SectionGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SectionGroup $body, ?SectionGroupsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Count/CountRequestBuilder.php index 590ce970565..0fb7504f725 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index 32a8bd9ec73..d85fa8a82c4 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index 764186f004f..4d0fba1af34 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php index 2d479057a49..738652ab2a2 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Sites\Item\Onenote\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for sites * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a onenoteSection object. This API is available in the following national cloud deployments. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-get?view=graph-rest-1.0 Find more info here */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in sites * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php index 224d7e94abb..c8e4ac429bc 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index 33df0362702..d82ed5a0b97 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index ad007becd99..95abae82e98 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index 846c027f677..8aa9834169e 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Sites\Item\Onenote\Sections\Item\Pages\Item\Content\ContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for sites * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in sites * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 0493f18f954..2196899eaa0 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 3751bc5f8d2..cd162de7a56 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index 62fd508e0bf..b339cd88e1a 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index 83f8de1cc1e..5f2eedfa1f4 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php index 7bebdbc58b7..96f595d01d9 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Models\OnenotePageCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index b00dc4330d6..ab80ee0294a 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index cc98857bdef..425e835c7c8 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Onenote/Sections/SectionsRequestBuilder.php b/src/Generated/Sites/Item/Onenote/Sections/SectionsRequestBuilder.php index ce0ef7f8eef..92d1404124f 100644 --- a/src/Generated/Sites/Item/Onenote/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Sites/Item/Onenote/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Models\OnenoteSectionCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sections for sites * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Operations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Operations/Count/CountRequestBuilder.php index 2808c91012e..7ace76b1239 100644 --- a/src/Generated/Sites/Item/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php b/src/Generated/Sites/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php index d2b1e31c4af..188bcbedc76 100644 --- a/src/Generated/Sites/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Operations/Item/RichLongRunningOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RichLongRunningOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for sites * @param RichLongRunningOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RichLongRunningOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the status of a rich long-running operation on a site or a list. This API is available in the following national cloud deployments. * @param RichLongRunningOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/richlongrunningoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?RichLongRunningOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in sites * @param RichLongRunningOperation $body The request body * @param RichLongRunningOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(RichLongRunningOperation $body, ?RichLongRunningOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?RichLongRunningOperationItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?RichLongRunningOperationItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?RichLongRunningOperationItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(RichLongRunningOperation $body, ?RichL $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Operations/OperationsRequestBuilder.php b/src/Generated/Sites/Item/Operations/OperationsRequestBuilder.php index df6ec9a6ca9..79270343745 100644 --- a/src/Generated/Sites/Item/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Sites/Item/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\RichLongRunningOperation; use Microsoft\Graph\Generated\Models\RichLongRunningOperationCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of rich long-running operations associated with a site. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-list-operations?view=graph-rest-1.0 Find more info here */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for sites * @param RichLongRunningOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(RichLongRunningOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RichLongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(RichLongRunningOperation $body, ?Operat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Permissions/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Permissions/Count/CountRequestBuilder.php index a06ef03cbc0..5e3e4879d88 100644 --- a/src/Generated/Sites/Item/Permissions/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Permissions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Permissions/Item/Grant/GrantRequestBuilder.php b/src/Generated/Sites/Item/Permissions/Item/Grant/GrantRequestBuilder.php index dec3e273825..f9fd7141fd2 100644 --- a/src/Generated/Sites/Item/Permissions/Item/Grant/GrantRequestBuilder.php +++ b/src/Generated/Sites/Item/Permissions/Item/Grant/GrantRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Grant users access to a link represented by a permission][]. This API is available in the following [national cloud deployments. * @param GrantPostRequestBody $body The request body * @param GrantRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/permission-grant?view=graph-rest-1.0 Find more info here */ public function post(GrantPostRequestBody $body, ?GrantRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GrantPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GrantPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GrantPostRequestBody $body, ?GrantReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Permissions/Item/PermissionItemRequestBuilder.php b/src/Generated/Sites/Item/Permissions/Item/PermissionItemRequestBuilder.php index 465df746bf7..968e943363b 100644 --- a/src/Generated/Sites/Item/Permissions/Item/PermissionItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Permissions/Item/PermissionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Permission; use Microsoft\Graph\Generated\Sites\Item\Permissions\Item\Grant\GrantRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a permission object on a site. This API is available in the following national cloud deployments. * @param PermissionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-delete-permission?view=graph-rest-1.0 Find more info here */ public function delete(?PermissionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a permission object on a site. This API is available in the following national cloud deployments. * @param PermissionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-get-permission?view=graph-rest-1.0 Find more info here */ public function get(?PermissionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an application permission object on a site. This API is available in the following national cloud deployments. * @param Permission $body The request body * @param PermissionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-update-permission?view=graph-rest-1.0 Find more info here */ public function patch(Permission $body, ?PermissionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?PermissionItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?PermissionItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?PermissionItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(Permission $body, ?PermissionItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Permissions/PermissionsRequestBuilder.php b/src/Generated/Sites/Item/Permissions/PermissionsRequestBuilder.php index ac2b5b12073..68b18a23a90 100644 --- a/src/Generated/Sites/Item/Permissions/PermissionsRequestBuilder.php +++ b/src/Generated/Sites/Item/Permissions/PermissionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Permission; use Microsoft\Graph\Generated\Models\PermissionCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the permission resources from the permissions navigation property on a site. This API is available in the following national cloud deployments. * @param PermissionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-list-permissions?view=graph-rest-1.0 Find more info here */ public function get(?PermissionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new permission object on a site. This API is available in the following national cloud deployments. * @param Permission $body The request body * @param PermissionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-post-permissions?view=graph-rest-1.0 Find more info here */ public function post(Permission $body, ?PermissionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Permission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PermissionsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PermissionsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Permission $body, ?PermissionsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/SiteItemRequestBuilder.php b/src/Generated/Sites/Item/SiteItemRequestBuilder.php index 9b2e7fab645..f23e89f1964 100644 --- a/src/Generated/Sites/Item/SiteItemRequestBuilder.php +++ b/src/Generated/Sites/Item/SiteItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Site; use Microsoft\Graph\Generated\Sites\Item\Analytics\AnalyticsRequestBuilder; @@ -173,20 +172,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve properties and relationships for a [site][] resource.A site resource represents a team site in SharePoint. * @param SiteItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-get?view=graph-rest-1.0 Find more info here */ public function get(?SiteItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -222,19 +218,16 @@ public function getByPathWithPath(string $path): GetByPathWithPathRequestBuilder * Update entity in sites * @param Site $body The request body * @param SiteItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Site $body, ?SiteItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -247,7 +240,6 @@ public function toGetRequestInformation(?SiteItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -255,6 +247,7 @@ public function toGetRequestInformation(?SiteItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -269,11 +262,11 @@ public function toPatchRequestInformation(Site $body, ?SiteItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Sites/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/Sites/Count/CountRequestBuilder.php index 8eabf7d2d11..3db799884a4 100644 --- a/src/Generated/Sites/Item/Sites/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/Sites/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Sites/Item/SiteItemRequestBuilder.php b/src/Generated/Sites/Item/Sites/Item/SiteItemRequestBuilder.php index e96fd959659..8ff5282010b 100644 --- a/src/Generated/Sites/Item/Sites/Item/SiteItemRequestBuilder.php +++ b/src/Generated/Sites/Item/Sites/Item/SiteItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Site; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of the sub-sites under this site. * @param SiteItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SiteItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SiteItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SiteItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/Sites/SitesRequestBuilder.php b/src/Generated/Sites/Item/Sites/SitesRequestBuilder.php index 99a31a68c75..65e103ec9ef 100644 --- a/src/Generated/Sites/Item/Sites/SitesRequestBuilder.php +++ b/src/Generated/Sites/Item/Sites/SitesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SiteCollectionResponse; use Microsoft\Graph\Generated\Sites\Item\Sites\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a collection of subsites defined for a site][]. This API is available in the following [national cloud deployments. * @param SitesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-list-subsites?view=graph-rest-1.0 Find more info here */ public function get(?SitesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SiteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SiteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SitesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SitesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Count/CountRequestBuilder.php index 40a1b14f7e2..fd85cece9a2 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/GroupsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/GroupsRequestBuilder.php index fdb6c07c674..214cf759046 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/GroupsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/GroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; use Microsoft\Graph\Generated\Models\TermStore\GroupCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of group objects in a term store. This API is available in the following national cloud deployments. * @param GroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-list-groups?view=graph-rest-1.0 Find more info here */ public function get(?GroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new group object in a term store. This API is available in the following national cloud deployments. * @param Group $body The request body * @param GroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-post?view=graph-rest-1.0 Find more info here */ public function post(Group $body, ?GroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Group $body, ?GroupsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/GroupItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/GroupItemRequestBuilder.php index 571afe88fc6..6950dfea33d 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/GroupItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/GroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; use Microsoft\Graph\Generated\Sites\Item\TermStore\Groups\Item\Sets\SetsRequestBuilder; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a group object in a term store]. This API is available in the following [national cloud deployments. * @param GroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-delete?view=graph-rest-1.0 Find more info here */ public function delete(?GroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term store group object. This API is available in the following national cloud deployments. * @param GroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-get?view=graph-rest-1.0 Find more info here */ public function get(?GroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property groups in sites * @param Group $body The request body * @param GroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Group $body, ?GroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?GroupItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?GroupItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?GroupItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(Group $body, ?GroupItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Count/CountRequestBuilder.php index d8c3568b8cb..8c5e7942c33 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php index 5f88fa82ea3..46eb56e4353 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the first level children of a set] or [term] resource using the children navigation property. This API is available in the following [national cloud deployments. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-post?view=graph-rest-1.0 Find more info here */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php index ee2382f8e8c..dd6fc8fbf08 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php index d608b6616cf..736f292266d 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for sites * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php index afd152040d9..af5613d29ae 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php index b99230ab3fa..ff3e8c6fa1e 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index e77172dca0a..b18bce42185 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 6e1bb5dc9e4..dd777106e9a 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 499de0cfc56..0d9ea169149 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 4ff402a17a1..d6da194502e 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php index 795e1341c9e..59aa35a7d32 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php index 61be01076f7..e12a55fb181 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php index 14bda9ff93e..19409c91132 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\RelationsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php index c0b55369a6a..e1a46dc5f42 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index e7b89afd1a2..86b319ec9df 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index df0f6fe4e61..30baa7cf675 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index b86279ff706..268b13dac71 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 443a3d8ff92..e3eb6c57137 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php index 8936290b2b3..6e4844dc9af 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php index b905e8d8684..d50e7992a50 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php index 80250323ad0..ad92d2548eb 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\Item\Children\ChildrenRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children terms of set in term [store]. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php index 920312abd09..da9484b37fb 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property parentGroup for sites * @param ParentGroupRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ParentGroupRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The parent [group] that contains the set. * @param ParentGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property parentGroup in sites * @param Group $body The request body * @param ParentGroupRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Group $body, ?ParentGroupRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ParentGroupRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Group $body, ?ParentGroupRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php index ae0d1632f57..75cebbcb8b6 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 8c56d78c48d..c253d8cb610 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php index debfbe88e66..4f7b4fc9d82 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Groups\Item\Sets\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Indicates which terms have been pinned or reused directly under the set. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php index 3b3fe9c8894..54e435dce27 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 0ada2e339ce..a603530590b 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php index bb4e4444f08..5a9bcc488e1 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the different relation of a term] or [set] from the relations navigation property. This API is available in the following [national cloud deployments. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-relations?view=graph-rest-1.0 Find more info here */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/SetItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/SetItemRequestBuilder.php index 1ea1a0eea51..f23ce93ea4c 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/SetItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/SetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Graph\Generated\Sites\Item\TermStore\Groups\Item\Sets\Item\Children\ChildrenRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sets for sites * @param SetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * All sets under the group in a term [store]. * @param SetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sets in sites * @param Set $body The request body * @param SetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Set $body, ?SetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?SetItemRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(Set $body, ?SetItemRequestBuilderPatch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php index 24c259551cb..f2f5213ddef 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php index b13746d799d..6b420df2e05 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for sites * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php index ea64b700985..10204119c8e 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 8c9d943d0b3..4a193cade49 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 5bf0c05a21f..0ceaaeab81f 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index b3679b8fbff..99d4eaf3439 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 3bdb8e701bc..3e1915788d8 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 1c0a00f20dd..2614e799856 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php index 5b90a836930..a3793c59c54 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php index 46e5b5fb345..8ec4a518277 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php index 977b4e19a87..eb1bbc431b4 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\RelationsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php index 318fa0f57b2..c4d68bddf5e 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index ebd40fc70bb..c6bf952dd0a 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php index 8234fe3d6e5..4c091b60371 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php index 784075c184a..3fd844568d3 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 7e9d0a1977c..4d45e8dacb8 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php index 1f7ce81c0cd..e6fb2393417 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php index 0f3a839253d..975f722644f 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php index daa9393e400..eb0530f3a2b 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStore\Groups\Item\Sets\Item\Terms\Item\Children\ChildrenRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-get?view=graph-rest-1.0 Find more info here */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-update?view=graph-rest-1.0 Find more info here */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php index 8977fb8b9db..5a6757e4424 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to terms for sites * @param Term $body The request body * @param TermsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?TermsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?TermsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/SetsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/SetsRequestBuilder.php index 997b5e95c8c..289ff2fe94c 100644 --- a/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/SetsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Groups/Item/Sets/SetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Graph\Generated\Models\TermStore\SetCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the set objects and their properties. This API is available in the following national cloud deployments. * @param SetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-list-sets?view=graph-rest-1.0 Find more info here */ public function get(?SetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sets for sites * @param Set $body The request body * @param SetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Set $body, ?SetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Set $body, ?SetsRequestBuilderPostReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Count/CountRequestBuilder.php index b7c1f9dca20..36b14b58f85 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/ChildrenRequestBuilder.php index 848311634d0..984614d7203 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the first level children of a set] or [term] resource using the children navigation property. This API is available in the following [national cloud deployments. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-post?view=graph-rest-1.0 Find more info here */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Count/CountRequestBuilder.php index 41921f58d56..8a79add8a13 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php index b7734a86a69..54159dc226b 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for sites * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php index 65f8688ee07..d154f520bbe 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 03dd4e0f3e9..a6d792aa95e 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 79f62e64c19..38aa00f5f9a 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index e37d62218e3..9a437c37d04 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\Children\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 0afa1465add..87dd32f5173 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index d81ec603eea..2da651c9b44 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php index 0d6d007d0d5..df911a2c878 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php index 74a8ad899fa..0ca2d18dc6e 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php index c32641c3b0a..c7815171450 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\Children\Item\Children\Item\Relations\RelationsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 8a451141b55..02463774d29 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 84ec7305c20..832bc773799 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 1962bb83fae..83300bd2e85 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 81a6ebdd499..25b7a403bf7 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index d2b1aca1a0a..107d31e8650 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php index 90ab9cdef62..936f46412eb 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Set/SetRequestBuilder.php index ced1a0a664e..31f809966d7 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/TermItemRequestBuilder.php index 1a25368eede..44cf3209f77 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\Children\Item\Children\ChildrenRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children terms of set in term [store]. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php index 87347bd9856..cda794b9f02 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\SetsRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property parentGroup for sites * @param ParentGroupRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ParentGroupRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The parent [group] that contains the set. * @param ParentGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property parentGroup in sites * @param Group $body The request body * @param ParentGroupRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Group $body, ?ParentGroupRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ParentGroupRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Group $body, ?ParentGroupRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php index 6d779623bce..e666a1d95f9 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php index bdf2f30a183..db0e28de752 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the first level children of a set] or [term] resource using the children navigation property. This API is available in the following [national cloud deployments. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-post?view=graph-rest-1.0 Find more info here */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php index a18083e519e..d0a8474295d 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php index 0381bf0a62a..2893612462e 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for sites * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php index 792104d3a47..a1d553941ba 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php index d9f2c57cc26..cd9c266ccc5 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index b6eefddd23e..b76c75a4ffd 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index d6e9e22183e..4d4bba7f48f 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index b2be2ada870..8f8dc2bcb70 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 6374f09c5b6..4626cfcb92b 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php index a12e3db8f58..2d7ade0291f 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php index 3d23b011313..2e70062ca16 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php index acbe19a6fa2..1ab89e87ce8 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\RelationsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 7b378bd4748..8c54147b258 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index c75649bd555..a6198ff10ec 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 7dcaa700d4a..7c68a52f393 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index b5920d54c29..8db835b7f80 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index fc7f6591b68..ab8ce8dbaeb 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php index b99de59c4a2..4044724d2ff 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php index e97db14cd99..e3b2cadfadc 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php index 969b560ccda..37b0444ae9f 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\ChildrenRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children terms of set in term [store]. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php index 9727268ca3c..71c7f900d27 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index c60f3488306..68267ed9f22 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php index 079dbdec898..8f565bcda08 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Indicates which terms have been pinned or reused directly under the set. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php index a75233d7296..fe9f0b8be8b 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index d082edfb9d8..a73dc30ae60 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php index 055034ea9d1..730ca42faba 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the different relation of a term] or [set] from the relations navigation property. This API is available in the following [national cloud deployments. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-relations?view=graph-rest-1.0 Find more info here */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php index 34f68223384..657376ac9bd 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Children\ChildrenRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sets for sites * @param SetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * All sets under the group in a term [store]. * @param SetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sets in sites * @param Set $body The request body * @param SetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Set $body, ?SetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?SetItemRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Set $body, ?SetItemRequestBuilderPatch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php index 01b91955bb9..8a4258e4c9e 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php index 4010981f5a2..0ed071277a6 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for sites * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php index 72e4c593505..ed678bf572f 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php index cfdad7f3c33..fe49e98e44b 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index ef397cd85df..2a092bf176c 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index e9dcbf82c36..eac8d33c969 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 2d7c0859c72..608e96e40e8 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 04e0ff06c7e..14f9ee8651a 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php index 1c384b44a98..caf2432c081 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php index 81a39e727b3..7f39a260a49 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php index 26bd82b28df..9f0024b026e 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\RelationsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php index 81a2fe836f2..5c02e0ca659 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 334d01dd43b..e5928d1d865 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php index 5a7a92d1d0a..e3b594234db 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php index b902391fecd..cbb8cee686a 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index e89040dad85..534213b4bd8 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php index ed1f816acf4..8407a9496bf 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php index f8588a9d5b7..98ca4a74df1 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php index e756d6656d9..5cd5135da69 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\ChildrenRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-get?view=graph-rest-1.0 Find more info here */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-update?view=graph-rest-1.0 Find more info here */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php index 1a12bd391c2..79a70cf7ccf 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to terms for sites * @param Term $body The request body * @param TermsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?TermsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?TermsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php index 14fb6d38ac5..89789439fc1 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Graph\Generated\Models\TermStore\SetCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the set objects and their properties. This API is available in the following national cloud deployments. * @param SetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-list-sets?view=graph-rest-1.0 Find more info here */ public function get(?SetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sets for sites * @param Set $body The request body * @param SetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Set $body, ?SetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Set $body, ?SetsRequestBuilderPostReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Count/CountRequestBuilder.php index cf7c975c044..7a3ba91cfe0 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 3050c726434..ea93c99e6b6 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/RelationItemRequestBuilder.php index 642f95d4856..26124fb98c4 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Indicates which terms have been pinned or reused directly under the set. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/Set/SetRequestBuilder.php index 0b0e5e388f2..8d8f3d8ef28 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 7fd93b745b5..0bb8fcbaad5 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/RelationsRequestBuilder.php index dcf92f635ba..7689155b17f 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the different relation of a term] or [set] from the relations navigation property. This API is available in the following [national cloud deployments. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-relations?view=graph-rest-1.0 Find more info here */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/SetItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/SetItemRequestBuilder.php index d08f9ad036d..30ae6bc08a9 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/SetItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/SetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\Children\ChildrenRequestBuilder; @@ -66,59 +65,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a set object. This API is available in the following national cloud deployments. * @param SetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a set object. This API is available in the following national cloud deployments. * @param SetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-get?view=graph-rest-1.0 Find more info here */ public function get(?SetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a set object. This API is available in the following national cloud deployments. * @param Set $body The request body * @param SetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-update?view=graph-rest-1.0 Find more info here */ public function patch(Set $body, ?SetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -135,6 +125,7 @@ public function toDeleteRequestInformation(?SetItemRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -148,7 +139,6 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -156,6 +146,7 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -170,11 +161,11 @@ public function toPatchRequestInformation(Set $body, ?SetItemRequestBuilderPatch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Count/CountRequestBuilder.php index 79087905238..f83273d91e0 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php index 6e76d10ce54..5f3f2e10586 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for sites * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php index 27a4b8fd08c..38489da88f1 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 71adaf8361a..2b61074b823 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 41c273d1bb4..bcb578a4371 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 4793f6bb734..7e1b9eaba4c 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\Terms\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 46f3e0b1e32..713b6d48a23 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 6bf0b88b06c..27df13c4649 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php index 5f702f3e817..04d889cf53a 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php index f9751f26b92..dcfdd3868e1 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php index 35ed7d02abb..1e23b8edbc3 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\Terms\Item\Children\Item\Relations\RelationsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php index 2817ac2aeab..7a18eb0c0f5 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 92b60b5faf1..5951398d19b 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php index fc17b7a1fd8..425d80e4cd2 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\Terms\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php index 09302357885..19e90f334a7 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index afb09244089..3ab2df8b786 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php index e1c9cca8bc8..53310f379de 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Set/SetRequestBuilder.php index 839d2008aec..b7ef7316bd8 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/TermItemRequestBuilder.php index 72c4fea9e6c..a215e873bac 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStore\Sets\Item\Terms\Item\Children\ChildrenRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-get?view=graph-rest-1.0 Find more info here */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-update?view=graph-rest-1.0 Find more info here */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/TermsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/TermsRequestBuilder.php index da01d18e47f..e0f7a4d7108 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/TermsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/Item/Terms/TermsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to terms for sites * @param Term $body The request body * @param TermsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?TermsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?TermsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/Sets/SetsRequestBuilder.php b/src/Generated/Sites/Item/TermStore/Sets/SetsRequestBuilder.php index 5bfaaebcd5d..6eb7922ae3c 100644 --- a/src/Generated/Sites/Item/TermStore/Sets/SetsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/Sets/SetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Graph\Generated\Models\TermStore\SetCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a set object. This API is available in the following national cloud deployments. * @param SetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new set object. This API is available in the following national cloud deployments. * @param Set $body The request body * @param SetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-post?view=graph-rest-1.0 Find more info here */ public function post(Set $body, ?SetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Set $body, ?SetsRequestBuilderPostReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStore/TermStoreRequestBuilder.php b/src/Generated/Sites/Item/TermStore/TermStoreRequestBuilder.php index fe9c2939875..672753dfc64 100644 --- a/src/Generated/Sites/Item/TermStore/TermStoreRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStore/TermStoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Store; use Microsoft\Graph\Generated\Sites\Item\TermStore\Groups\GroupsRequestBuilder; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property termStore for sites * @param TermStoreRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermStoreRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a store object. This API is available in the following national cloud deployments. * @param TermStoreRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-store-get?view=graph-rest-1.0 Find more info here */ public function get(?TermStoreRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a store object. This API is available in the following national cloud deployments. * @param Store $body The request body * @param TermStoreRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-store-update?view=graph-rest-1.0 Find more info here */ public function patch(Store $body, ?TermStoreRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?TermStoreRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?TermStoreRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?TermStoreRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(Store $body, ?TermStoreRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Count/CountRequestBuilder.php index d669a246822..9ec96875578 100644 --- a/src/Generated/Sites/Item/TermStores/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Count/CountRequestBuilder.php index ad79731ae7d..09184de8c3c 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/GroupsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/GroupsRequestBuilder.php index 9282cf0acc0..6d4d45580ab 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/GroupsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/GroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; use Microsoft\Graph\Generated\Models\TermStore\GroupCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of group objects in a term store. This API is available in the following national cloud deployments. * @param GroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-list-groups?view=graph-rest-1.0 Find more info here */ public function get(?GroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new group object in a term store. This API is available in the following national cloud deployments. * @param Group $body The request body * @param GroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-post?view=graph-rest-1.0 Find more info here */ public function post(Group $body, ?GroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?GroupsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Group $body, ?GroupsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/GroupItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/GroupItemRequestBuilder.php index 9040aa59db3..a95b8a9f754 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/GroupItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/GroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Groups\Item\Sets\SetsRequestBuilder; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a group object in a term store]. This API is available in the following [national cloud deployments. * @param GroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-delete?view=graph-rest-1.0 Find more info here */ public function delete(?GroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term store group object. This API is available in the following national cloud deployments. * @param GroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-get?view=graph-rest-1.0 Find more info here */ public function get(?GroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property groups in sites * @param Group $body The request body * @param GroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Group $body, ?GroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?GroupItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?GroupItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?GroupItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(Group $body, ?GroupItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Count/CountRequestBuilder.php index fdbc8e2f6c6..477d0d44620 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php index cdeabd46502..6bf68df9936 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the first level children of a set] or [term] resource using the children navigation property. This API is available in the following [national cloud deployments. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-post?view=graph-rest-1.0 Find more info here */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php index 2526f03da7d..c09e4318be8 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php index 38a001ea938..4333101d14f 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for sites * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php index 62e38dff56c..83592a37cf8 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 4ad668e4612..345ddce03cd 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index dea7d40904b..8d8637c18a2 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index cedf9a55ad8..a43c0f24695 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index c5b929736f2..072edc0e3d6 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 174a60d5ed2..e3a49078489 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php index 0902fdc14fa..e54819c04da 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php index 7fb8fa25196..5779417f577 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php index a0a2548f851..f7a572349a0 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Children\Item\Relations\RelationsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 22dbd5125ee..de2a126e9e4 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index ad8b8b4297f..73b143a9584 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index f8de2de4448..104d2f59d49 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 90e7f44092b..783ad667df0 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index c9d8e0715b0..7dcebbe0d98 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php index 13a9e71d4a6..1d8e9a5f349 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php index 91816327314..79bf3eb5837 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php index 658cb52c8bb..df09f28837f 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\Item\Children\ChildrenRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children terms of set in term [store]. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php index 39389a35a01..118fbba8318 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property parentGroup for sites * @param ParentGroupRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ParentGroupRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The parent [group] that contains the set. * @param ParentGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property parentGroup in sites * @param Group $body The request body * @param ParentGroupRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Group $body, ?ParentGroupRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ParentGroupRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Group $body, ?ParentGroupRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php index 66016084e4a..76b3984345a 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index db5aaa8a78a..70dfc194a87 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php index 2d3acce711b..f9e40a5e112 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Indicates which terms have been pinned or reused directly under the set. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php index 994fdef0f16..f194ff783c9 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 757889aad87..c41bde3f264 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php index bde73641e4b..94507e2549b 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the different relation of a term] or [set] from the relations navigation property. This API is available in the following [national cloud deployments. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-relations?view=graph-rest-1.0 Find more info here */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/SetItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/SetItemRequestBuilder.php index 8de4745107d..5a380bdf94c 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/SetItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/SetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Children\ChildrenRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sets for sites * @param SetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * All sets under the group in a term [store]. * @param SetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sets in sites * @param Set $body The request body * @param SetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Set $body, ?SetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?SetItemRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(Set $body, ?SetItemRequestBuilderPatch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php index 2a3dbbf8408..1a2a73e8d3b 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php index 04edaff4b74..118f512a8eb 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for sites * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php index 5ae03a9043f..77bc0e79d3d 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 82a9d5cf8a0..6baa3585ad5 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index f083d0c018a..68c001d28c0 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 8c2f6e92433..5eb17d78213 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index e7fb09d41fb..d84eae7dc0f 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 9b02ed7ce3c..705a067defd 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php index a7a8fb4e8a1..a9f73078959 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php index 6e05815e613..d7e6108958f 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php index 85241f8a2e0..c5db60a8a29 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Children\Item\Relations\RelationsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php index ef0253af506..baddee30517 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 0544bd6f8b3..9013eb9131b 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php index 425e652b0d2..cf937506f5c 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php index c0fe84fd9b0..fb4cd884ee2 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index dc3caf386d6..d5ae265ab0f 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php index f51fd5f6b21..e84703a6877 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php index 4e2c220419d..2075ad4d615 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php index e1268ed6f7b..cb76f7236ed 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Groups\Item\Sets\Item\Terms\Item\Children\ChildrenRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-get?view=graph-rest-1.0 Find more info here */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-update?view=graph-rest-1.0 Find more info here */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php index debe309014a..48aedf43eb9 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/Item/Terms/TermsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to terms for sites * @param Term $body The request body * @param TermsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?TermsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?TermsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/SetsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/SetsRequestBuilder.php index 57c92d57ea4..879c30316b9 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/SetsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Groups/Item/Sets/SetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Graph\Generated\Models\TermStore\SetCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the set objects and their properties. This API is available in the following national cloud deployments. * @param SetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-list-sets?view=graph-rest-1.0 Find more info here */ public function get(?SetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sets for sites * @param Set $body The request body * @param SetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Set $body, ?SetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Set $body, ?SetsRequestBuilderPostReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Count/CountRequestBuilder.php index 9419d235736..ca2a9a5a778 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/ChildrenRequestBuilder.php index 2bae2dbbf36..5f2b0323865 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the first level children of a set] or [term] resource using the children navigation property. This API is available in the following [national cloud deployments. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-post?view=graph-rest-1.0 Find more info here */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Count/CountRequestBuilder.php index 719065beee7..d0d55749d3f 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php index 4e2733ae75f..816ed0bb113 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for sites * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php index 8400b58e442..545ef318898 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php index f2e6b8ae3ea..547a9692188 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index bc073436de6..f48057e1139 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 2dda007a876..269197d551b 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index a825f37f0af..0c563930f48 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 16bdb73d533..0d47b58bcca 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php index bec2ce142a4..77a79704491 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php index 14e3a7f6bc6..f8d6a97bc26 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php index 51937b2e99c..c8515d88145 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Children\Item\Relations\RelationsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php index cb6f80da3b2..f9ac60a44a6 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index b7134b0f0d9..dca18fced55 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index e43d0c474da..9e86f45af37 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 061cd2f67f8..46a4b8a2ee7 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 9f35b29a01f..7048a045e1f 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php index 5d0003f67d9..4af63779747 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php index a3cb9a00d07..fb480ee78e4 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php index 9a578ab293f..d8b106f7837 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\Children\Item\Children\ChildrenRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children terms of set in term [store]. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php index 01057084bd3..8ac207e97dd 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/ParentGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Group; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\SetsRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property parentGroup for sites * @param ParentGroupRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ParentGroupRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The parent [group] that contains the set. * @param ParentGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property parentGroup in sites * @param Group $body The request body * @param ParentGroupRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Group $body, ?ParentGroupRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ParentGroupRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ParentGroupRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Group $body, ?ParentGroupRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php index c36c1ea60ae..11e4104db58 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php index d9c95863620..e8ee7df8eea 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the first level children of a set] or [term] resource using the children navigation property. This API is available in the following [national cloud deployments. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-children?view=graph-rest-1.0 Find more info here */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-post?view=graph-rest-1.0 Find more info here */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php index 80b16eb825d..c6cd26f4955 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php index c38b6a1319e..2e6f7f241ee 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for sites * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php index b1702c9b994..fe94e14fc66 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 0fa66b614bf..bdb61d9472f 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index ff56d3e9df1..a755a7054df 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 13692871b4e..88cb36b488e 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index f1ee69cf0ee..76fdebb8ab3 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 087ea289d62..090d1368479 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php index 0f091fb7c13..2189634709f 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php index c76bfeb09e1..a983c2855bf 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php index fb10d018a31..2d516844b64 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\Item\Relations\RelationsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php index 5d0aefa3b46..0cdd95e9d17 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 5b2ff81f33b..77b3a6a33c6 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 7848eff6ac0..75d26bdf19d 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index c61347e5419..fbd04760d74 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index ba1abc4171f..cd7a09cb1a1 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php index bd4dce5f3c8..476e1e78296 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php index f6919999064..f5d6f317fdb 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php index a066b1e196c..d35889b2cf3 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\Item\Children\ChildrenRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children terms of set in term [store]. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php index 132e151356c..0930521f31c 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 3a558e35e8d..6b67d6868da 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php index b23435969db..6e9a53abd66 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Indicates which terms have been pinned or reused directly under the set. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php index 4835936d3e5..4726cc79e40 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index ca89da29554..26423829ca1 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php index e413a29a52d..9a4379ac5f9 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the different relation of a term] or [set] from the relations navigation property. This API is available in the following [national cloud deployments. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-relations?view=graph-rest-1.0 Find more info here */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php index 7ac9d6594e2..ecfb96701d9 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/SetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Children\ChildrenRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sets for sites * @param SetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * All sets under the group in a term [store]. * @param SetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sets in sites * @param Set $body The request body * @param SetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Set $body, ?SetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?SetItemRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Set $body, ?SetItemRequestBuilderPatch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php index a6e7d074818..9520482369b 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php index 1bada44342d..10941466994 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for sites * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php index 174e61212d8..9870f7b7d7d 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php index c2c9da93e64..e5795a1ffa4 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 6e63f379595..f2ab2eb0d97 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index e1a390e7025..d019ce9197a 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index 8dc069f1dbe..e1fc6282a07 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 7a104ce92e2..1dec468a2f5 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php index b9689b322ca..77a81868c5e 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php index c8393c8b0e1..60c2b7382b5 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php index 3ffd525fa67..f3a9106614f 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\Item\Relations\RelationsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php index 76bcba8ef7f..5432c03ffbc 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 1a78bd610b6..a5e1b6752f7 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php index ecf619d28ef..b468a72d516 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php index afd2a056cf7..4f29e5d7344 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 788fe5dfcde..32a4ac6e07d 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php index d55a808500e..8523bf8c132 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php index d4b1eb86d53..e9abad836bf 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php index d7fedad6155..d647ddf2a76 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\ParentGroup\Sets\Item\Terms\Item\Children\ChildrenRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-get?view=graph-rest-1.0 Find more info here */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-update?view=graph-rest-1.0 Find more info here */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php index 7c87c55ef82..53260636fe1 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/Item/Terms/TermsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to terms for sites * @param Term $body The request body * @param TermsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?TermsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?TermsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php index 1c65d0c1378..f55a63a955e 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/ParentGroup/Sets/SetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Graph\Generated\Models\TermStore\SetCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the set objects and their properties. This API is available in the following national cloud deployments. * @param SetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-group-list-sets?view=graph-rest-1.0 Find more info here */ public function get(?SetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sets for sites * @param Set $body The request body * @param SetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Set $body, ?SetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Set $body, ?SetsRequestBuilderPostReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Count/CountRequestBuilder.php index 5b6a6e9c65d..23f41355470 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 90d17cc17d6..35c4d624646 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php index 6fb8f36c6d7..b4f59c8358b 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Indicates which terms have been pinned or reused directly under the set. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php index d1742af0d28..05234663c1c 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index ba9358466be..2b30f143bde 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/RelationsRequestBuilder.php index 2f0831b642e..053881436f6 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the different relation of a term] or [set] from the relations navigation property. This API is available in the following [national cloud deployments. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-list-relations?view=graph-rest-1.0 Find more info here */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/SetItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/SetItemRequestBuilder.php index 58f6cc794c9..96998f904bf 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/SetItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/SetItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\Children\ChildrenRequestBuilder; @@ -66,59 +65,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a set object. This API is available in the following national cloud deployments. * @param SetItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SetItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a set object. This API is available in the following national cloud deployments. * @param SetItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-get?view=graph-rest-1.0 Find more info here */ public function get(?SetItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a set object. This API is available in the following national cloud deployments. * @param Set $body The request body * @param SetItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-update?view=graph-rest-1.0 Find more info here */ public function patch(Set $body, ?SetItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -135,6 +125,7 @@ public function toDeleteRequestInformation(?SetItemRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -148,7 +139,6 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -156,6 +146,7 @@ public function toGetRequestInformation(?SetItemRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -170,11 +161,11 @@ public function toPatchRequestInformation(Set $body, ?SetItemRequestBuilderPatch $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Count/CountRequestBuilder.php index 6c71f59f4ac..556549a8f36 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php index 64674fe4653..1d3b479586d 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/ChildrenRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Children of current term. * @param ChildrenRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChildrenRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to children for sites * @param Term $body The request body * @param ChildrenRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?ChildrenRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ChildrenRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?ChildrenRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php index f923d4523ba..055f07f3499 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php index e8c1b055417..00a8d812d80 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index a8526490e45..cdbfe727e10 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php index 3d3c04c661d..86b55a84fbd 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Children\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php index ae0fdc3cb9f..f4da91e10c6 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 70ea1a936f6..f0a95374ec3 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php index c5d25baea66..9b2f1ef4f0d 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php index cb144190a05..4bd4c7fef5b 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php index 325bcb5b3d1..1e20b4e19aa 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Children/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Children\Item\Relations\RelationsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property children for sites * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Children of current term. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property children in sites * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php index ed2bb317a55..af5a071367a 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php index 35c5531464b..5e9de9951fc 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/FromTerm/FromTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. * @param FromTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FromTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?FromTermRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php index 988681c357c..add4a947f41 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/RelationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Relations\Item\FromTerm\FromTermRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property relations for sites * @param RelationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?RelationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property relations in sites * @param Relation $body The request body * @param RelationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Relation $body, ?RelationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?RelationItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?RelationItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(Relation $body, ?RelationItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php index 7ca022928f4..cf1e85795cf 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the relation is relevant. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php index 53f18a09359..b7d98583ae0 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/Item/ToTerm/ToTermRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The to [term] of the relation. The term to which the relationship is defined. * @param ToTermRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ToTermRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ToTermRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php index d0d3658818c..755af5bb5f0 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Relations/RelationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Relation; use Microsoft\Graph\Generated\Models\TermStore\RelationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * To indicate which terms are related to the current term as either pinned or reused. * @param RelationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?RelationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RelationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to relations for sites * @param Relation $body The request body * @param RelationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Relation $body, ?RelationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Relation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?RelationsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Relation $body, ?RelationsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php index a726302029d..9fc8c9ae263 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/Set/SetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The [set] in which the term is created. * @param SetRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SetRequestBuilderGetRequestConfiguratio } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php index 36ead9a701d..e2e7cb5a119 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/Item/TermItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Sets\Item\Terms\Item\Children\ChildrenRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TermItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-get?view=graph-rest-1.0 Find more info here */ public function get(?TermItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a term object. This API is available in the following national cloud deployments. * @param Term $body The request body * @param TermItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-term-update?view=graph-rest-1.0 Find more info here */ public function patch(Term $body, ?TermItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?TermItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,6 +138,7 @@ public function toGetRequestInformation(?TermItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -162,11 +153,11 @@ public function toPatchRequestInformation(Term $body, ?TermItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/TermsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/TermsRequestBuilder.php index 60a366a657d..060c832444c 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/TermsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/Item/Terms/TermsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Term; use Microsoft\Graph\Generated\Models\TermStore\TermCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a term object. This API is available in the following national cloud deployments. * @param TermsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TermCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to terms for sites * @param Term $body The request body * @param TermsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Term $body, ?TermsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Term::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Term $body, ?TermsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/Sets/SetsRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/Sets/SetsRequestBuilder.php index 2cdb882960a..d184611d4c2 100644 --- a/src/Generated/Sites/Item/TermStores/Item/Sets/SetsRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/Sets/SetsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Set; use Microsoft\Graph\Generated\Models\TermStore\SetCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Read the properties and relationships of a set object. This API is available in the following national cloud deployments. * @param SetsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SetsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SetCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new set object. This API is available in the following national cloud deployments. * @param Set $body The request body * @param SetsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/termstore-set-post?view=graph-rest-1.0 Find more info here */ public function post(Set $body, ?SetsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Set::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SetsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Set $body, ?SetsRequestBuilderPostReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/Item/StoreItemRequestBuilder.php b/src/Generated/Sites/Item/TermStores/Item/StoreItemRequestBuilder.php index 0c64e7934e1..352838dfee1 100644 --- a/src/Generated/Sites/Item/TermStores/Item/StoreItemRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/Item/StoreItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Store; use Microsoft\Graph\Generated\Sites\Item\TermStores\Item\Groups\GroupsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property termStores for sites * @param StoreItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?StoreItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of termStores under this site. * @param StoreItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?StoreItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property termStores in sites * @param Store $body The request body * @param StoreItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Store $body, ?StoreItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?StoreItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?StoreItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?StoreItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Store $body, ?StoreItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Item/TermStores/TermStoresRequestBuilder.php b/src/Generated/Sites/Item/TermStores/TermStoresRequestBuilder.php index 6ad177e711e..f5fa3ee13c4 100644 --- a/src/Generated/Sites/Item/TermStores/TermStoresRequestBuilder.php +++ b/src/Generated/Sites/Item/TermStores/TermStoresRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TermStore\Store; use Microsoft\Graph\Generated\Models\TermStore\StoreCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of termStores under this site. * @param TermStoresRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TermStoresRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [StoreCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [StoreCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to termStores for sites * @param Store $body The request body * @param TermStoresRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Store $body, ?TermStoresRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Store::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TermStoresRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TermStoresRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Store $body, ?TermStoresRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/Remove/RemoveRequestBuilder.php b/src/Generated/Sites/Remove/RemoveRequestBuilder.php index 1cffe182b8e..f4769f1dbd8 100644 --- a/src/Generated/Sites/Remove/RemoveRequestBuilder.php +++ b/src/Generated/Sites/Remove/RemoveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Unfollow a user's site or multiple sites. * @param RemovePostRequestBody $body The request body * @param RemoveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/site-unfollow?view=graph-rest-1.0 Find more info here */ public function post(RemovePostRequestBody $body, ?RemoveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RemovePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RemovePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(RemovePostRequestBody $body, ?RemoveReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Sites/SitesRequestBuilder.php b/src/Generated/Sites/SitesRequestBuilder.php index c449f3e2a0f..9262634e3e4 100644 --- a/src/Generated/Sites/SitesRequestBuilder.php +++ b/src/Generated/Sites/SitesRequestBuilder.php @@ -4,11 +4,11 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SiteCollectionResponse; use Microsoft\Graph\Generated\Sites\Add\AddRequestBuilder; use Microsoft\Graph\Generated\Sites\Count\CountRequestBuilder; +use Microsoft\Graph\Generated\Sites\Delta\DeltaRequestBuilder; use Microsoft\Graph\Generated\Sites\GetAllSites\GetAllSitesRequestBuilder; use Microsoft\Graph\Generated\Sites\Item\SiteItemRequestBuilder; use Microsoft\Graph\Generated\Sites\Remove\RemoveRequestBuilder; @@ -36,6 +36,13 @@ public function count(): CountRequestBuilder { return new CountRequestBuilder($this->pathParameters, $this->requestAdapter); } + /** + * Provides operations to call the delta method. + */ + public function delta(): DeltaRequestBuilder { + return new DeltaRequestBuilder($this->pathParameters, $this->requestAdapter); + } + /** * Provides operations to call the getAllSites method. */ @@ -76,26 +83,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List all available [sites][] in an organization. Specific filter criteria and query options are also supported and described below: In addition, you can use a [$search][] query against the /sites collection to find sites matching given keywords.If you want to list all sites across all geographies, refer to getAllSites][]. For more guidance about building applications that use site discovery for scanning purposes, see [Best practices for discovering files and detecting changes at scale. This API is available in the following national cloud deployments. + * Search across a SharePoint tenant for sites][] that match keywords provided. The only property that works for sorting is createdDateTime. The search filter is a free text search that uses multiple properties when retrieving the search results. This API is available in the following [national cloud deployments. * @param SitesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/site-list?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/site-search?view=graph-rest-1.0 Find more info here */ public function get(?SitesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SiteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SiteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List all available [sites][] in an organization. Specific filter criteria and query options are also supported and described below: In addition, you can use a [$search][] query against the /sites collection to find sites matching given keywords.If you want to list all sites across all geographies, refer to getAllSites][]. For more guidance about building applications that use site discovery for scanning purposes, see [Best practices for discovering files and detecting changes at scale. This API is available in the following national cloud deployments. + * Search across a SharePoint tenant for sites][] that match keywords provided. The only property that works for sorting is createdDateTime. The search filter is a free text search that uses multiple properties when retrieving the search results. This API is available in the following [national cloud deployments. * @param SitesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -104,7 +108,6 @@ public function toGetRequestInformation(?SitesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -112,6 +115,7 @@ public function toGetRequestInformation(?SitesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Sites/SitesRequestBuilderGetQueryParameters.php b/src/Generated/Sites/SitesRequestBuilderGetQueryParameters.php index 33f0dd6fe33..6d6a847664d 100644 --- a/src/Generated/Sites/SitesRequestBuilderGetQueryParameters.php +++ b/src/Generated/Sites/SitesRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List all available [sites][] in an organization. Specific filter criteria and query options are also supported and described below: In addition, you can use a [$search][] query against the /sites collection to find sites matching given keywords.If you want to list all sites across all geographies, refer to getAllSites][]. For more guidance about building applications that use site discovery for scanning purposes, see [Best practices for discovering files and detecting changes at scale. This API is available in the following national cloud deployments. + * Search across a SharePoint tenant for sites][] that match keywords provided. The only property that works for sorting is createdDateTime. The search filter is a free text search that uses multiple properties when retrieving the search results. This API is available in the following [national cloud deployments. */ class SitesRequestBuilderGetQueryParameters { diff --git a/src/Generated/Solutions/BookingBusinesses/BookingBusinessesRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/BookingBusinessesRequestBuilder.php index 9b0c385528b..3d14f9f890f 100644 --- a/src/Generated/Solutions/BookingBusinesses/BookingBusinessesRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/BookingBusinessesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingBusiness; use Microsoft\Graph\Generated\Models\BookingBusinessCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a collection of bookingBusiness objects that has been created for the tenant. This operation returns only the id and displayName of each Microsoft Bookings business in the collection. For performance considerations, it does not return other properties. You can get the other properties of a Bookings business by specifying its id in a GET operation. This API is available in the following national cloud deployments. * @param BookingBusinessesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-list?view=graph-rest-1.0 Find more info here */ public function get(?BookingBusinessesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingBusinessCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingBusinessCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new Microsoft Bookings business in a tenant. This is the first step in setting up a Bookings business where you must specify the business display name. You can include other information such as business address, web site address, and scheduling policy, or set that information later by updating the bookingBusiness. This API is available in the following national cloud deployments. * @param BookingBusiness $body The request body * @param BookingBusinessesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-post-bookingbusinesses?view=graph-rest-1.0 Find more info here */ public function post(BookingBusiness $body, ?BookingBusinessesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingBusiness::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingBusiness::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?BookingBusinessesRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?BookingBusinessesRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(BookingBusiness $body, ?BookingBusiness $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Count/CountRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Count/CountRequestBuilder.php index 00966087907..5abd8d945d8 100644 --- a/src/Generated/Solutions/BookingBusinesses/Count/CountRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/Appointments/AppointmentsRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/Appointments/AppointmentsRequestBuilder.php index 33894e52559..86a2fa77867 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/Appointments/AppointmentsRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/Appointments/AppointmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingAppointment; use Microsoft\Graph\Generated\Models\BookingAppointmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of bookingAppointment objects for the specified bookingBusiness. This API is available in the following national cloud deployments. * @param AppointmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-list-appointments?view=graph-rest-1.0 Find more info here */ public function get(?AppointmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new bookingAppointment for the specified bookingBusiness. This API is available in the following national cloud deployments. * @param BookingAppointment $body The request body * @param AppointmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-post-appointments?view=graph-rest-1.0 Find more info here */ public function post(BookingAppointment $body, ?AppointmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AppointmentsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AppointmentsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(BookingAppointment $body, ?Appointments $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/Appointments/Count/CountRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/Appointments/Count/CountRequestBuilder.php index 2430d03eab0..2c784e0448b 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/Appointments/Count/CountRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/Appointments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/Appointments/Item/BookingAppointmentItemRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/Appointments/Item/BookingAppointmentItemRequestBuilder.php index 34e5e7798a5..fa3e19fb60e 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/Appointments/Item/BookingAppointmentItemRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/Appointments/Item/BookingAppointmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingAppointment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Solutions\BookingBusinesses\Item\Appointments\Item\Cancel\CancelRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a bookingAppointment in the specified bookingBusiness. This API is available in the following national cloud deployments. * @param BookingAppointmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingappointment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?BookingAppointmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a bookingAppointment object in the specified bookingBusiness. The startDateTime and endDateTime properties are always returned in UTC. This API is available in the following national cloud deployments. * @param BookingAppointmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingappointment-get?view=graph-rest-1.0 Find more info here */ public function get(?BookingAppointmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a bookingAppointment object in the specified bookingBusiness. This API is available in the following national cloud deployments. * @param BookingAppointment $body The request body * @param BookingAppointmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingappointment-update?view=graph-rest-1.0 Find more info here */ public function patch(BookingAppointment $body, ?BookingAppointmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?BookingAppointmentItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?BookingAppointmentItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?BookingAppointmentItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(BookingAppointment $body, ?BookingAppo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/Appointments/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/Appointments/Item/Cancel/CancelRequestBuilder.php index a1b5e06eff8..762bc5a2156 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/Appointments/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/Appointments/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Cancel the specified bookingAppointment in the specified bookingBusiness and send a message to the involved customer and staff members. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingappointment-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/BookingBusinessItemRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/BookingBusinessItemRequestBuilder.php index 91b7076994a..fab7a2c751b 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/BookingBusinessItemRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/BookingBusinessItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingBusiness; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Solutions\BookingBusinesses\Item\Appointments\AppointmentsRequestBuilder; @@ -106,59 +105,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a bookingBusiness object. This API is available in the following national cloud deployments. * @param BookingBusinessItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-delete?view=graph-rest-1.0 Find more info here */ public function delete(?BookingBusinessItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a bookingBusiness object. This API is available in the following national cloud deployments. * @param BookingBusinessItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-get?view=graph-rest-1.0 Find more info here */ public function get(?BookingBusinessItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingBusiness::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingBusiness::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a bookingBusiness object. This API is available in the following national cloud deployments. * @param BookingBusiness $body The request body * @param BookingBusinessItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-update?view=graph-rest-1.0 Find more info here */ public function patch(BookingBusiness $body, ?BookingBusinessItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingBusiness::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingBusiness::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -175,6 +165,7 @@ public function toDeleteRequestInformation(?BookingBusinessItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -188,7 +179,6 @@ public function toGetRequestInformation(?BookingBusinessItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -196,6 +186,7 @@ public function toGetRequestInformation(?BookingBusinessItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -210,11 +201,11 @@ public function toPatchRequestInformation(BookingBusiness $body, ?BookingBusines $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/CalendarViewRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/CalendarViewRequestBuilder.php index 66fc8617890..844f69c008f 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/CalendarViewRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/CalendarViewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingAppointment; use Microsoft\Graph\Generated\Models\BookingAppointmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The set of appointments of this business in a specified date range. Read-only. Nullable. * @param CalendarViewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-list-calendarview?view=graph-rest-1.0 Find more info here */ public function get(?CalendarViewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to calendarView for solutions * @param BookingAppointment $body The request body * @param CalendarViewRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(BookingAppointment $body, ?CalendarViewRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(BookingAppointment $body, ?CalendarView $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/Count/CountRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/Count/CountRequestBuilder.php index 024dde1b491..772cd67007f 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/Count/CountRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/Item/BookingAppointmentItemRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/Item/BookingAppointmentItemRequestBuilder.php index 5bca6e32fbd..40a5259cb4d 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/Item/BookingAppointmentItemRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/Item/BookingAppointmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingAppointment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Solutions\BookingBusinesses\Item\CalendarView\Item\Cancel\CancelRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property calendarView for solutions * @param BookingAppointmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?BookingAppointmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The set of appointments of this business in a specified date range. Read-only. Nullable. * @param BookingAppointmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?BookingAppointmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property calendarView in solutions * @param BookingAppointment $body The request body * @param BookingAppointmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(BookingAppointment $body, ?BookingAppointmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingAppointment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?BookingAppointmentItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?BookingAppointmentItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?BookingAppointmentItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(BookingAppointment $body, ?BookingAppo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php index 8a10ffc29bb..8b76ca758bd 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Cancel the specified bookingAppointment in the specified bookingBusiness and send a message to the involved customer and staff members. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingappointment-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/CustomQuestions/Count/CountRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/CustomQuestions/Count/CountRequestBuilder.php index 19fc95d1884..b76a370f07e 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/CustomQuestions/Count/CountRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/CustomQuestions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/CustomQuestions/CustomQuestionsRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/CustomQuestions/CustomQuestionsRequestBuilder.php index 0b838a6a46a..6a5e40f6f90 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/CustomQuestions/CustomQuestionsRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/CustomQuestions/CustomQuestionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingCustomQuestion; use Microsoft\Graph\Generated\Models\BookingCustomQuestionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the bookingCustomQuestion resources associated with a bookingBusiness. This API is available in the following national cloud deployments. * @param CustomQuestionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-list-customquestions?view=graph-rest-1.0 Find more info here */ public function get(?CustomQuestionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomQuestionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomQuestionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new bookingCustomQuestion object. This API is available in the following national cloud deployments. * @param BookingCustomQuestion $body The request body * @param CustomQuestionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-post-customquestions?view=graph-rest-1.0 Find more info here */ public function post(BookingCustomQuestion $body, ?CustomQuestionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CustomQuestionsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CustomQuestionsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(BookingCustomQuestion $body, ?CustomQue $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/CustomQuestions/Item/BookingCustomQuestionItemRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/CustomQuestions/Item/BookingCustomQuestionItemRequestBuilder.php index 53d08144e31..c49019a6a38 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/CustomQuestions/Item/BookingCustomQuestionItemRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/CustomQuestions/Item/BookingCustomQuestionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingCustomQuestion; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a bookingCustomQuestion object. This API is available in the following national cloud deployments. * @param BookingCustomQuestionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingcustomquestion-delete?view=graph-rest-1.0 Find more info here */ public function delete(?BookingCustomQuestionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a bookingCustomQuestion object. This API is available in the following national cloud deployments. * @param BookingCustomQuestionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingcustomquestion-get?view=graph-rest-1.0 Find more info here */ public function get(?BookingCustomQuestionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a bookingCustomQuestion object. This API is available in the following national cloud deployments. * @param BookingCustomQuestion $body The request body * @param BookingCustomQuestionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingcustomquestion-update?view=graph-rest-1.0 Find more info here */ public function patch(BookingCustomQuestion $body, ?BookingCustomQuestionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomQuestion::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?BookingCustomQuestionItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?BookingCustomQuestionItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?BookingCustomQuestionItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(BookingCustomQuestion $body, ?BookingC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/Customers/Count/CountRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/Customers/Count/CountRequestBuilder.php index d0c8bd49b35..c77b7135744 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/Customers/Count/CountRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/Customers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/Customers/CustomersRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/Customers/CustomersRequestBuilder.php index d98edfdf800..ca6754c70b8 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/Customers/CustomersRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/Customers/CustomersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingCustomerBase; use Microsoft\Graph\Generated\Models\BookingCustomerBaseCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of bookingCustomer objects of a business. This API is available in the following national cloud deployments. * @param CustomersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-list-customers?view=graph-rest-1.0 Find more info here */ public function get(?CustomersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomerBaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomerBaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new bookingCustomer object. This API is available in the following national cloud deployments. * @param BookingCustomerBase $body The request body * @param CustomersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-post-customers?view=graph-rest-1.0 Find more info here */ public function post(BookingCustomerBase $body, ?CustomersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomerBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomerBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CustomersRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CustomersRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(BookingCustomerBase $body, ?CustomersRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/Customers/Item/BookingCustomerBaseItemRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/Customers/Item/BookingCustomerBaseItemRequestBuilder.php index cbdc166e0cd..c44707a6478 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/Customers/Item/BookingCustomerBaseItemRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/Customers/Item/BookingCustomerBaseItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingCustomerBase; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the specified bookingCustomer object. This API is available in the following national cloud deployments. * @param BookingCustomerBaseItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingcustomer-delete?view=graph-rest-1.0 Find more info here */ public function delete(?BookingCustomerBaseItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a bookingCustomer object. This API is available in the following national cloud deployments. * @param BookingCustomerBaseItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingcustomer-get?view=graph-rest-1.0 Find more info here */ public function get(?BookingCustomerBaseItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomerBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomerBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a bookingCustomer object. This API is available in the following national cloud deployments. * @param BookingCustomerBase $body The request body * @param BookingCustomerBaseItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingcustomer-update?view=graph-rest-1.0 Find more info here */ public function patch(BookingCustomerBase $body, ?BookingCustomerBaseItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomerBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingCustomerBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?BookingCustomerBaseItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?BookingCustomerBaseItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?BookingCustomerBaseItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(BookingCustomerBase $body, ?BookingCus $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/GetStaffAvailability/GetStaffAvailabilityRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/GetStaffAvailability/GetStaffAvailabilityRequestBuilder.php index d1b75b33abd..ac57830bf0f 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/GetStaffAvailability/GetStaffAvailabilityRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/GetStaffAvailability/GetStaffAvailabilityRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Get the availability information of staff members of a Microsoft Bookings calendar. This API is available in the following national cloud deployments. * @param GetStaffAvailabilityPostRequestBody $body The request body * @param GetStaffAvailabilityRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-getstaffavailability?view=graph-rest-1.0 Find more info here */ public function post(GetStaffAvailabilityPostRequestBody $body, ?GetStaffAvailabilityRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetStaffAvailabilityPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetStaffAvailabilityPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetStaffAvailabilityPostRequestBody $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/Publish/PublishRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/Publish/PublishRequestBuilder.php index 2a8e1e9f973..899af64518b 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/Publish/PublishRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/Publish/PublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Make the scheduling page of a business available to external customers. Set the isPublished property to true, and the publicUrl property to the URL of the scheduling page. This API is available in the following national cloud deployments. * @param PublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-publish?view=graph-rest-1.0 Find more info here */ public function post(?PublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?PublishRequestBuilderPostRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/Services/Count/CountRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/Services/Count/CountRequestBuilder.php index de8d2b2debb..4b3a3d0879a 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/Services/Count/CountRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/Services/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/Services/Item/BookingServiceItemRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/Services/Item/BookingServiceItemRequestBuilder.php index c57f221b2ff..aa0147a734d 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/Services/Item/BookingServiceItemRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/Services/Item/BookingServiceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingService; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a bookingService object in the specified bookingBusiness. This API is available in the following national cloud deployments. * @param BookingServiceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingservice-delete?view=graph-rest-1.0 Find more info here */ public function delete(?BookingServiceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a bookingService object in the specified bookingBusiness. This API is available in the following national cloud deployments. * @param BookingServiceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingservice-get?view=graph-rest-1.0 Find more info here */ public function get(?BookingServiceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingService::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingService::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a bookingService object in the specified bookingBusiness. The following are some examples you can customize for a service:- Price- Typical length of an appointment- Reminders- Any time buffer to set up before or finish up after the service- Scheduling policy parameters, such as minimum notice to book or cancel, and whether customers can select specific staff members for an appointment. This API is available in the following national cloud deployments. * @param BookingService $body The request body * @param BookingServiceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingservice-update?view=graph-rest-1.0 Find more info here */ public function patch(BookingService $body, ?BookingServiceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingService::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingService::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?BookingServiceItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?BookingServiceItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?BookingServiceItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(BookingService $body, ?BookingServiceI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/Services/ServicesRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/Services/ServicesRequestBuilder.php index 425ae068555..7da66f800c9 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/Services/ServicesRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/Services/ServicesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingService; use Microsoft\Graph\Generated\Models\BookingServiceCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of bookingService objects in the specified bookingBusiness. This API is available in the following national cloud deployments. * @param ServicesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-list-services?view=graph-rest-1.0 Find more info here */ public function get(?ServicesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingServiceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingServiceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new bookingService for the specified bookingBusiness. This API is available in the following national cloud deployments. * @param BookingService $body The request body * @param ServicesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-post-services?view=graph-rest-1.0 Find more info here */ public function post(BookingService $body, ?ServicesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingService::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingService::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ServicesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ServicesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(BookingService $body, ?ServicesRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/StaffMembers/Count/CountRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/StaffMembers/Count/CountRequestBuilder.php index 8d70d78c896..46bcdbf4ac4 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/StaffMembers/Count/CountRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/StaffMembers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/StaffMembers/Item/BookingStaffMemberBaseItemRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/StaffMembers/Item/BookingStaffMemberBaseItemRequestBuilder.php index 1fbc2d597c6..9dffce1fe63 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/StaffMembers/Item/BookingStaffMemberBaseItemRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/StaffMembers/Item/BookingStaffMemberBaseItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingStaffMemberBase; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a bookingStaffMember in the specified bookingBusiness. This API is available in the following national cloud deployments. * @param BookingStaffMemberBaseItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingstaffmember-delete?view=graph-rest-1.0 Find more info here */ public function delete(?BookingStaffMemberBaseItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a bookingStaffMember in the specified bookingBusiness. This API is available in the following national cloud deployments. * @param BookingStaffMemberBaseItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingstaffmember-get?view=graph-rest-1.0 Find more info here */ public function get(?BookingStaffMemberBaseItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingStaffMemberBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingStaffMemberBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a bookingStaffMember in the specified bookingBusiness. This API is available in the following national cloud deployments. * @param BookingStaffMemberBase $body The request body * @param BookingStaffMemberBaseItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingstaffmember-update?view=graph-rest-1.0 Find more info here */ public function patch(BookingStaffMemberBase $body, ?BookingStaffMemberBaseItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingStaffMemberBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingStaffMemberBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?BookingStaffMemberBaseItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?BookingStaffMemberBaseItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?BookingStaffMemberBaseItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(BookingStaffMemberBase $body, ?Booking $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/StaffMembers/StaffMembersRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/StaffMembers/StaffMembersRequestBuilder.php index 5c42eef7e0b..7e0d2e8097b 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/StaffMembers/StaffMembersRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/StaffMembers/StaffMembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingStaffMemberBase; use Microsoft\Graph\Generated\Models\BookingStaffMemberBaseCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of bookingStaffMember objects in the specified bookingBusiness. This API is available in the following national cloud deployments. * @param StaffMembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-list-staffmembers?view=graph-rest-1.0 Find more info here */ public function get(?StaffMembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingStaffMemberBaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingStaffMemberBaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new bookingStaffMember in the specified bookingBusiness. This API is available in the following national cloud deployments. * @param BookingStaffMemberBase $body The request body * @param StaffMembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-post-staffmembers?view=graph-rest-1.0 Find more info here */ public function post(BookingStaffMemberBase $body, ?StaffMembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingStaffMemberBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingStaffMemberBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?StaffMembersRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?StaffMembersRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(BookingStaffMemberBase $body, ?StaffMem $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingBusinesses/Item/Unpublish/UnpublishRequestBuilder.php b/src/Generated/Solutions/BookingBusinesses/Item/Unpublish/UnpublishRequestBuilder.php index e2858459b2f..d41e8d4861a 100644 --- a/src/Generated/Solutions/BookingBusinesses/Item/Unpublish/UnpublishRequestBuilder.php +++ b/src/Generated/Solutions/BookingBusinesses/Item/Unpublish/UnpublishRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Make the scheduling page of this business not available to external customers. Set the isPublished property to false, and the publicUrl property to null. This API is available in the following national cloud deployments. * @param UnpublishRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingbusiness-unpublish?view=graph-rest-1.0 Find more info here */ public function post(?UnpublishRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnpublishRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingCurrencies/BookingCurrenciesRequestBuilder.php b/src/Generated/Solutions/BookingCurrencies/BookingCurrenciesRequestBuilder.php index 76c0b873fdb..eae18f46ce8 100644 --- a/src/Generated/Solutions/BookingCurrencies/BookingCurrenciesRequestBuilder.php +++ b/src/Generated/Solutions/BookingCurrencies/BookingCurrenciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingCurrency; use Microsoft\Graph\Generated\Models\BookingCurrencyCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of bookingCurrency objects available to a Microsoft Bookings business. This API is available in the following national cloud deployments. * @param BookingCurrenciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingcurrency-list?view=graph-rest-1.0 Find more info here */ public function get(?BookingCurrenciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingCurrencyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingCurrencyCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to bookingCurrencies for solutions * @param BookingCurrency $body The request body * @param BookingCurrenciesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(BookingCurrency $body, ?BookingCurrenciesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingCurrency::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingCurrency::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?BookingCurrenciesRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?BookingCurrenciesRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(BookingCurrency $body, ?BookingCurrenci $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingCurrencies/Count/CountRequestBuilder.php b/src/Generated/Solutions/BookingCurrencies/Count/CountRequestBuilder.php index 99692f4a714..e20dfae4104 100644 --- a/src/Generated/Solutions/BookingCurrencies/Count/CountRequestBuilder.php +++ b/src/Generated/Solutions/BookingCurrencies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Solutions/BookingCurrencies/Item/BookingCurrencyItemRequestBuilder.php b/src/Generated/Solutions/BookingCurrencies/Item/BookingCurrencyItemRequestBuilder.php index 4541e7c8fd7..7f6c0fcc36e 100644 --- a/src/Generated/Solutions/BookingCurrencies/Item/BookingCurrencyItemRequestBuilder.php +++ b/src/Generated/Solutions/BookingCurrencies/Item/BookingCurrencyItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\BookingCurrency; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property bookingCurrencies for solutions * @param BookingCurrencyItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?BookingCurrencyItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties of a bookingCurrency object that is available to a Microsoft Bookings business. Use the id property, which is the currency code, to specify the currency. This API is available in the following national cloud deployments. * @param BookingCurrencyItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/bookingcurrency-get?view=graph-rest-1.0 Find more info here */ public function get(?BookingCurrencyItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingCurrency::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingCurrency::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property bookingCurrencies in solutions * @param BookingCurrency $body The request body * @param BookingCurrencyItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(BookingCurrency $body, ?BookingCurrencyItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [BookingCurrency::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [BookingCurrency::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?BookingCurrencyItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?BookingCurrencyItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?BookingCurrencyItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(BookingCurrency $body, ?BookingCurrenc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Solutions/SolutionsRequestBuilder.php b/src/Generated/Solutions/SolutionsRequestBuilder.php index f944c342115..2f9d3f100a1 100644 --- a/src/Generated/Solutions/SolutionsRequestBuilder.php +++ b/src/Generated/Solutions/SolutionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SolutionsRoot; use Microsoft\Graph\Generated\Solutions\BookingBusinesses\BookingBusinessesRequestBuilder; @@ -50,38 +49,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get solutions * @param SolutionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SolutionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SolutionsRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SolutionsRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update solutions * @param SolutionsRoot $body The request body * @param SolutionsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SolutionsRoot $body, ?SolutionsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SolutionsRoot::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SolutionsRoot::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -94,7 +87,6 @@ public function toGetRequestInformation(?SolutionsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -102,6 +94,7 @@ public function toGetRequestInformation(?SolutionsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -116,11 +109,11 @@ public function toPatchRequestInformation(SolutionsRoot $body, ?SolutionsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/SubscribedSkus/Item/SubscribedSkuItemRequestBuilder.php b/src/Generated/SubscribedSkus/Item/SubscribedSkuItemRequestBuilder.php index 83db258c454..77bea97bfec 100644 --- a/src/Generated/SubscribedSkus/Item/SubscribedSkuItemRequestBuilder.php +++ b/src/Generated/SubscribedSkus/Item/SubscribedSkuItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SubscribedSku; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from subscribedSkus * @param SubscribedSkuItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SubscribedSkuItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a specific commercial subscription that an organization has acquired. This API is available in the following national cloud deployments. * @param SubscribedSkuItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subscribedsku-get?view=graph-rest-1.0 Find more info here */ public function get(?SubscribedSkuItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubscribedSku::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubscribedSku::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in subscribedSkus * @param SubscribedSku $body The request body * @param SubscribedSkuItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SubscribedSku $body, ?SubscribedSkuItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubscribedSku::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubscribedSku::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?SubscribedSkuItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?SubscribedSkuItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?SubscribedSkuItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(SubscribedSku $body, ?SubscribedSkuIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/SubscribedSkus/SubscribedSkusRequestBuilder.php b/src/Generated/SubscribedSkus/SubscribedSkusRequestBuilder.php index 7e45773971d..13d3d436288 100644 --- a/src/Generated/SubscribedSkus/SubscribedSkusRequestBuilder.php +++ b/src/Generated/SubscribedSkus/SubscribedSkusRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SubscribedSku; use Microsoft\Graph\Generated\Models\SubscribedSkuCollectionResponse; @@ -47,39 +46,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of commercial subscriptions that an organization has acquired. For the mapping of license names as displayed on the Microsoft Entra admin center or the Microsoft 365 admin center against their Microsoft Graph skuId and skuPartNumber properties, see Product names and service plan identifiers for licensing. This API is available in the following national cloud deployments. * @param SubscribedSkusRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subscribedsku-list?view=graph-rest-1.0 Find more info here */ public function get(?SubscribedSkusRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubscribedSkuCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubscribedSkuCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to subscribedSkus * @param SubscribedSku $body The request body * @param SubscribedSkusRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SubscribedSku $body, ?SubscribedSkusRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubscribedSku::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubscribedSku::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -92,7 +85,6 @@ public function toGetRequestInformation(?SubscribedSkusRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -100,6 +92,7 @@ public function toGetRequestInformation(?SubscribedSkusRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -114,11 +107,11 @@ public function toPostRequestInformation(SubscribedSku $body, ?SubscribedSkusReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php b/src/Generated/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php index f42f88f1a9e..46c2b59ba05 100644 --- a/src/Generated/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php +++ b/src/Generated/Subscriptions/Item/Reauthorize/ReauthorizeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reauthorize a subscription when you receive a reauthorizationRequired challenge. This API is available in the following national cloud deployments. * @param ReauthorizeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subscription-reauthorize?view=graph-rest-1.0 Find more info here */ public function post(?ReauthorizeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ReauthorizeRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Subscriptions/Item/SubscriptionItemRequestBuilder.php b/src/Generated/Subscriptions/Item/SubscriptionItemRequestBuilder.php index 55deb2ceee3..2a0747bca8c 100644 --- a/src/Generated/Subscriptions/Item/SubscriptionItemRequestBuilder.php +++ b/src/Generated/Subscriptions/Item/SubscriptionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Subscription; use Microsoft\Graph\Generated\Subscriptions\Item\Reauthorize\ReauthorizeRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a subscription. For the list of resources that support subscribing to change notifications, see the table in the Permissions section. This API is available in the following national cloud deployments. * @param SubscriptionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subscription-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SubscriptionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a subscription. See the table in the Permissions section for the list of resources that support subscribing to change notifications. This API is available in the following national cloud deployments. * @param SubscriptionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subscription-get?view=graph-rest-1.0 Find more info here */ public function get(?SubscriptionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Renew a subscription by extending its expiry time. The table in the Permissions section lists the resources that support subscribing to change notifications. Subscriptions expire after a length of time that varies by resource type. In order to avoid missing change notifications, an app should renew its subscriptions well in advance of their expiry date. See subscription for maximum length of a subscription for each resource type. This API is available in the following national cloud deployments. * @param Subscription $body The request body * @param SubscriptionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subscription-update?view=graph-rest-1.0 Find more info here */ public function patch(Subscription $body, ?SubscriptionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?SubscriptionItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?SubscriptionItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?SubscriptionItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(Subscription $body, ?SubscriptionItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Subscriptions/SubscriptionsRequestBuilder.php b/src/Generated/Subscriptions/SubscriptionsRequestBuilder.php index 07cb1f0e967..400c8ae87ac 100644 --- a/src/Generated/Subscriptions/SubscriptionsRequestBuilder.php +++ b/src/Generated/Subscriptions/SubscriptionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Subscription; use Microsoft\Graph\Generated\Models\SubscriptionCollectionResponse; @@ -47,40 +46,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of webhook subscriptions, based on the app ID, the user, and the user's role with a tenant. The content of the response depends on the context in which the app is calling; for details, see the scenarios in the Permissions section. This API is available in the following national cloud deployments. * @param SubscriptionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subscription-list?view=graph-rest-1.0 Find more info here */ public function get(?SubscriptionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SubscriptionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SubscriptionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Subscribes a listener application to receive change notifications when the requested type of changes occur to the specified resource in Microsoft Graph. To identify the resources for which you can create subscriptions and the limitations on subscriptions, see Set up notifications for changes in resource data: Supported resources. Some resources support rich notifications, that is, notifications that include resource data. For more information about these resources, see Set up change notifications that include resource data: Supported resources. This API is available in the following national cloud deployments. * @param Subscription $body The request body * @param SubscriptionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/subscription-post-subscriptions?view=graph-rest-1.0 Find more info here */ public function post(Subscription $body, ?SubscriptionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Subscription::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,7 +86,6 @@ public function toGetRequestInformation(?SubscriptionsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -101,6 +93,7 @@ public function toGetRequestInformation(?SubscriptionsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -115,11 +108,11 @@ public function toPostRequestInformation(Subscription $body, ?SubscriptionsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Count/CountRequestBuilder.php b/src/Generated/Teams/Count/CountRequestBuilder.php index 040a6dccc81..603536243e7 100644 --- a/src/Generated/Teams/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/GetAllMessages/GetAllMessagesRequestBuilder.php b/src/Generated/Teams/GetAllMessages/GetAllMessagesRequestBuilder.php index ad9ec1afb61..bb700654774 100644 --- a/src/Generated/Teams/GetAllMessages/GetAllMessagesRequestBuilder.php +++ b/src/Generated/Teams/GetAllMessages/GetAllMessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAllMessages * @param GetAllMessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAllMessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/AllChannels/AllChannelsRequestBuilder.php b/src/Generated/Teams/Item/AllChannels/AllChannelsRequestBuilder.php index 39da1b38f98..6ce97f443db 100644 --- a/src/Generated/Teams/Item/AllChannels/AllChannelsRequestBuilder.php +++ b/src/Generated/Teams/Item/AllChannels/AllChannelsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChannelCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\AllChannels\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of channels either in this team or shared with this team (incoming channels). This API is available in the following national cloud deployments. * @param AllChannelsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-allchannels?view=graph-rest-1.0 Find more info here */ public function get(?AllChannelsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?AllChannelsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?AllChannelsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/AllChannels/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/AllChannels/Count/CountRequestBuilder.php index 6b3462d6289..b6e77d793ee 100644 --- a/src/Generated/Teams/Item/AllChannels/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/AllChannels/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/AllChannels/Item/ChannelItemRequestBuilder.php b/src/Generated/Teams/Item/AllChannels/Item/ChannelItemRequestBuilder.php index 8610a78a915..8f0f1568e98 100644 --- a/src/Generated/Teams/Item/AllChannels/Item/ChannelItemRequestBuilder.php +++ b/src/Generated/Teams/Item/AllChannels/Item/ChannelItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List of channels either hosted in or shared with the team (incoming channels). * @param ChannelItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChannelItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Archive/ArchiveRequestBuilder.php b/src/Generated/Teams/Item/Archive/ArchiveRequestBuilder.php index d6ab205971a..a5fe9faec6a 100644 --- a/src/Generated/Teams/Item/Archive/ArchiveRequestBuilder.php +++ b/src/Generated/Teams/Item/Archive/ArchiveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Archive the specified team. When a team is archived, users can no longer send or like messages on any channel in the team, edit the team's name, description, or other settings, or in general make most changes to the team.Membership changes to the team continue to be allowed. Archiving is an async operation. A team is archived once the async operation completes successfully, which may occur subsequent to a response from this API. To archive a team, the team and group must have an owner. To restore a team from its archived state, use the API to unarchive. This API is available in the following national cloud deployments. * @param ArchivePostRequestBody $body The request body * @param ArchiveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-archive?view=graph-rest-1.0 Find more info here */ public function post(ArchivePostRequestBody $body, ?ArchiveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ArchivePostRequestBody $body, ?ArchiveR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/ChannelsRequestBuilder.php b/src/Generated/Teams/Item/Channels/ChannelsRequestBuilder.php index ccebc0a6757..83d0f0b9532 100644 --- a/src/Generated/Teams/Item/Channels/ChannelsRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/ChannelsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ChannelCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of channels in this team. This API is available in the following national cloud deployments. * @param ChannelsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list?view=graph-rest-1.0 Find more info here */ public function get(?ChannelsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new channel in a team, as specified in the request body. When you create a channel, the maximum length of the channel's displayName is 50 characters. This is the name that appears to the user in Microsoft Teams. If you're creating a private channel, you can add a maximum of 200 members. This API is available in the following national cloud deployments. * @param Channel $body The request body * @param ChannelsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post?view=graph-rest-1.0 Find more info here */ public function post(Channel $body, ?ChannelsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ChannelsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ChannelsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Channel $body, ?ChannelsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Channels/Count/CountRequestBuilder.php index c831e5a51f3..088bdd33e61 100644 --- a/src/Generated/Teams/Item/Channels/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php b/src/Generated/Teams/Item/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php index 41374fe9c57..136b9663d96 100644 --- a/src/Generated/Teams/Item/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAllMessages * @param GetAllMessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAllMessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/ChannelItemRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/ChannelItemRequestBuilder.php index d6ff760a782..0416dbc68b3 100644 --- a/src/Generated/Teams/Item/Channels/Item/ChannelItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/ChannelItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\Channels\Item\CompleteMigration\CompleteMigrationRequestBuilder; @@ -106,59 +105,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the channel. This API is available in the following national cloud deployments. * @param ChannelItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ChannelItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a channel. This method supports federation. Only a user who is a member of the shared channel can retrieve channel information. This API is available in the following national cloud deployments. * @param ChannelItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get?view=graph-rest-1.0 Find more info here */ public function get(?ChannelItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified channel. This API is available in the following national cloud deployments. * @param Channel $body The request body * @param ChannelItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-patch?view=graph-rest-1.0 Find more info here */ public function patch(Channel $body, ?ChannelItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -175,6 +165,7 @@ public function toDeleteRequestInformation(?ChannelItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -188,7 +179,6 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -196,6 +186,7 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -210,11 +201,11 @@ public function toPatchRequestInformation(Channel $body, ?ChannelItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php index 45887ae869a..25ca1ec0395 100644 --- a/src/Generated/Teams/Item/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Complete the message migration process by removing migration mode from a channel in a team. Migration mode is a special state that prevents certain operations, like sending messages and adding members, during the data migration process. After a completeMigration request is made, you can't import additional messages into the team. You can add members to the team after the request returns a successful response. This API is available in the following national cloud deployments. * @param CompleteMigrationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-completemigration?view=graph-rest-1.0 Find more info here */ public function post(?CompleteMigrationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CompleteMigrationRequestBuilderPostReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php index 467bd3e1ed9..dda34cfcdeb 100644 --- a/src/Generated/Teams/Item/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function doesUserHaveAccess * @param DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php index 7b9e77d4ab8..d30a4eff78c 100644 --- a/src/Generated/Teams/Item/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php index bcc68a66de3..2f701d1cf56 100644 --- a/src/Generated/Teams/Item/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\Channels\Item\FilesFolder\Content\ContentRequestBuilder; @@ -42,20 +41,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the metadata for the location where the files of a channel are stored. This API is available in the following national cloud deployments. * @param FilesFolderRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?FilesFolderRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -68,7 +64,6 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -76,6 +71,7 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Members/Add/AddRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Members/Add/AddRequestBuilder.php index dcca7f3f420..ee216d20c0c 100644 --- a/src/Generated/Teams/Item/Channels/Item/Members/Add/AddRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Members/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add multiple members in a single request to a team. The response provides details about which memberships could and couldn't be created. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmembers-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Members/Count/CountRequestBuilder.php index 4e8e445357d..24a3e4c8f91 100644 --- a/src/Generated/Teams/Item/Channels/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php index 7ac1936a976..0c44bdf31d2 100644 --- a/src/Generated/Teams/Item/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,65 +31,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-delete-members?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/conversationmember-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-members?view=graph-rest-1.0 Find more info here */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the role of a conversationMember in a team or channel. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param ConversationMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmember-update?view=graph-rest-1.0 Find more info here */ public function patch(ConversationMember $body, ?ConversationMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ConversationMemberItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ConversationMember $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Members/MembersRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Members/MembersRequestBuilder.php index ee8e40f1741..53ad8d23c27 100644 --- a/src/Generated/Teams/Item/Channels/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of conversationMembers from a channel. This method supports federation. Only a user who is a member of the shared channel can retrieve the channel member list. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a conversationMember to a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-members?view=graph-rest-1.0 Find more info here */ public function post(ConversationMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ConversationMember $body, ?MembersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Count/CountRequestBuilder.php index ea51b0d4f5f..1f38e10a675 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Delta/DeltaRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Delta/DeltaRequestBuilder.php index 8b1f583c4df..37c786c93dc 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php index f82545ebca7..62bb936be24 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\Channels\Item\Messages\Item\HostedContents\HostedContentsRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property messages for teams * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a chatMessage object. With the exception of the policyViolation property, all properties of a chatMessage can be updated in delegated permissions scenarios.Only the policyViolation property of a chatMessage can be updated in application permissions scenarios. The update only works for chats where members are Microsoft Teams users. If one of the participants is using Skype, the operation will fail. This method does not support federation. Only the user in the tenant who sent the message can perform data loss prevention (DLP) updates on the specified chat message. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-update?view=graph-rest-1.0 Find more info here */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php index 102807f87c2..3618d23ce54 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php index 1eb1fed1482..fe0392745f5 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ChatMessageHostedContentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for teams * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index f5eafc77f32..2b443c20e1f 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index 26fcaeafe84..3d34eadff19 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\Channels\Item\Messages\Item\HostedContents\Item\Value\ContentRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for teams * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in teams * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php index 7e2f6748a2c..4e6ed7e48d9 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from teams * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in teams * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php index dff3460e101..eb5f2ec4df5 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php index 2b7e5ff4f33..46b804a559c 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php index eb477cbbc29..07f5b4d4d85 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\Channels\Item\Messages\Item\Replies\Item\HostedContents\HostedContentsRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property replies for teams * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property replies in teams * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php index cdb96ec1fb5..96b81e2b997 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php index 98cceb73ca8..54e5da8a0d4 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ChatMessageHostedContentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for teams * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 5fc83f7df0b..11e149f840b 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index 05ef6d9304c..e0d1d9d69be 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\Channels\Item\Messages\Item\Replies\Item\HostedContents\Item\Value\ContentRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for teams * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in teams * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php index d90d39c97a3..c3df9b494a5 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from teams * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in teams * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php index 22b8ae07ae5..87e0819babb 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php index 7e04c653064..1f6ff445ad3 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index dedf9f438fa..03b61eb17c1 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php index 178aece33ef..8f0ceb58808 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php index 669882fecd4..17453c6089b 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ChatMessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the replies to a message in a channel of a team. This method lists only the replies of the specified message, if any. To get the message itself, simply call get channel message. This API is available in the following national cloud deployments. * @param RepliesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-replies?view=graph-rest-1.0 Find more info here */ public function get(?RepliesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new reply to a chatMessage in a specified channel. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param RepliesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-messagereply?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?RepliesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?RepliesRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php index 0426850f0e5..42543fe99b1 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php index 4de27ff08a5..4b11fa96239 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index efd4ae233bc..85555366d57 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php index 82c8f1fdaec..6924c1ff93d 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Messages/MessagesRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Messages/MessagesRequestBuilder.php index 5e5165915a6..722384d9be8 100644 --- a/src/Generated/Teams/Item/Channels/Item/Messages/MessagesRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Messages/MessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ChatMessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of messages (without the replies) in a channel of a team. To get the replies for a message, call the list message replies or the get message reply API. This method supports federation. To list channel messages in application context, the request must be made from the tenant that the channel owner belongs to (represented by the tenantId property on the channel). This API is available in the following national cloud deployments. * @param MessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?MessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-post-messages?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/chatmessage-post?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?MessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,11 +109,12 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?MessagesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php index 7910745d4b1..36b6f619fc1 100644 --- a/src/Generated/Teams/Item/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProvisionChannelEmailResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Provision an email address for a channel. Microsoft Teams doesn't automatically provision an email address for a channel by default. To have Teams provision an email address, you can call provisionEmail, or through the Teams user interface, select Get email address, which triggers Teams to generate an email address if it has not already provisioned one. To remove the email address of a channel, use the removeEmail method. This API is available in the following national cloud deployments. * @param ProvisionEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-provisionemail?view=graph-rest-1.0 Find more info here */ public function post(?ProvisionEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ProvisionEmailRequestBuilderPostReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php index 0909d0da98e..39c2a55d544 100644 --- a/src/Generated/Teams/Item/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove the email address of a channel. You can remove an email address only if it was provisioned using the provisionEmail method or through the Microsoft Teams client. This API is available in the following national cloud deployments. * @param RemoveEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-removeemail?view=graph-rest-1.0 Find more info here */ public function post(?RemoveEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RemoveEmailRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php index 513b00ad508..464780373d4 100644 --- a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php index fa89a0a0a15..ca2b3fe634e 100644 --- a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\Channels\Item\SharedWithTeams\Item\AllowedMembers\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of conversationMembers who can access a shared channel. This method does not return the following conversationMembers from the team:- Users with Guest role- Users who are externally authenticated in the tenant This API is available in the following national cloud deployments. * @param AllowedMembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list-allowedmembers?view=graph-rest-1.0 Find more info here */ public function get(?AllowedMembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php index 071adefe7fe..7c46e971cf9 100644 --- a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php index 912dc5907b6..1f89f343de2 100644 --- a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A collection of team members who have access to the shared channel. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php index 2c65b0c9740..91b8652b808 100644 --- a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfo; use Microsoft\Graph\Generated\Teams\Item\Channels\Item\SharedWithTeams\Item\AllowedMembers\AllowedMembersRequestBuilder; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unshare a channel with a team by deleting the corresponding sharedWithChannelTeamInfo resource. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a team that has been shared with a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-get?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sharedWithTeams in teams * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SharedWithChannelTeamInfo $body, ?SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?SharedWithChannelTeamInfoItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(SharedWithChannelTeamInfo $body, ?Shar $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php index 5ec05109175..0cee339f554 100644 --- a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get team from teams * @param TeamRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php index dd82b14b1fc..67967400216 100644 --- a/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfo; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfoCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of teams that has been shared a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithTeamsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithTeamsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sharedWithTeams for teams * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithTeamsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SharedWithChannelTeamInfo $body, ?SharedWithTeamsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SharedWithChannelTeamInfo $body, ?Share $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Tabs/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Tabs/Count/CountRequestBuilder.php index 13d0955e1f0..79b813bbd8c 100644 --- a/src/Generated/Teams/Item/Channels/Item/Tabs/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Tabs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php index 6580f309472..25e04885f9e 100644 --- a/src/Generated/Teams/Item/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The application that is linked to the tab. This can't be changed after tab creation. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php index e354f683c5a..ff667ab381e 100644 --- a/src/Generated/Teams/Item/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; use Microsoft\Graph\Generated\Teams\Item\Channels\Item\Tabs\Item\TeamsApp\TeamsAppRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Removes (unpins) a tab from the specified channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-delete-tabs?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsTabItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of the specified tab in a channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TeamsTabItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified tab.This can be used to configure the content of the tab. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TeamsTabItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-patch-tabs?view=graph-rest-1.0 Find more info here */ public function patch(TeamsTab $body, ?TeamsTabItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TeamsTabItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TeamsTab $body, ?TeamsTabItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Channels/Item/Tabs/TabsRequestBuilder.php b/src/Generated/Teams/Item/Channels/Item/Tabs/TabsRequestBuilder.php index eef3ebd60c8..3a56a2ebf45 100644 --- a/src/Generated/Teams/Item/Channels/Item/Tabs/TabsRequestBuilder.php +++ b/src/Generated/Teams/Item/Channels/Item/Tabs/TabsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; use Microsoft\Graph\Generated\Models\TeamsTabCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of tabs in the specified channel within a team. This API is available in the following national cloud deployments. * @param TabsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TabsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Adds (pins) a tab to the specified channel within a team. The corresponding app must already be installed in the team. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TabsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-tabs?view=graph-rest-1.0 Find more info here */ public function post(TeamsTab $body, ?TabsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsTab $body, ?TabsRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/CompleteMigration/CompleteMigrationRequestBuilder.php b/src/Generated/Teams/Item/CompleteMigration/CompleteMigrationRequestBuilder.php index 88f3a86a4b7..e698f9f9aec 100644 --- a/src/Generated/Teams/Item/CompleteMigration/CompleteMigrationRequestBuilder.php +++ b/src/Generated/Teams/Item/CompleteMigration/CompleteMigrationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Complete the message migration process by removing migration mode from a team. Migration mode is a special state where certain operations are barred, like message POST and membership operations during the data migration process. After a completeMigration request is made, you can't import additional messages into the team. You can add members to the team after the request returns a successful response. This API is available in the following national cloud deployments. * @param CompleteMigrationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-completemigration?view=graph-rest-1.0 Find more info here */ public function post(?CompleteMigrationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CompleteMigrationRequestBuilderPostReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/EscapedClone/CloneRequestBuilder.php b/src/Generated/Teams/Item/EscapedClone/CloneRequestBuilder.php index cd6f17ba5b8..1730b24f373 100644 --- a/src/Generated/Teams/Item/EscapedClone/CloneRequestBuilder.php +++ b/src/Generated/Teams/Item/EscapedClone/CloneRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a copy of a team. This operation also creates a copy of the corresponding group.You can specify which parts of the team to clone: When tabs are cloned, they aren't configured. The tabs are displayed on the tab bar in Microsoft Teams, and the first time a user opens them, they must go through the configuration screen. If the user who opens the tab doesn't have permission to configure apps, they'll see a message that says that the tab isn't configured. Cloning is a long-running operation. After the POST clone returns, you need to GET the operation returned by the Location: header to see if it's running, succeeded, or failed. You should continue to GET until the status isn't running. The recommended delay between GETs is 5 seconds. This API is available in the following national cloud deployments. * @param ClonePostRequestBody $body The request body * @param CloneRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-clone?view=graph-rest-1.0 Find more info here */ public function post(ClonePostRequestBody $body, ?CloneRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ClonePostRequestBody $body, ?CloneReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Group/GroupRequestBuilder.php b/src/Generated/Teams/Item/Group/GroupRequestBuilder.php index 4566094578b..d39632c9a50 100644 --- a/src/Generated/Teams/Item/Group/GroupRequestBuilder.php +++ b/src/Generated/Teams/Item/Group/GroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\Group\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get group from teams * @param GroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 5fe829a4aa0..442aee28bc4 100644 --- a/src/Generated/Teams/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Teams/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index bd8fd106437..f9c5ed250e7 100644 --- a/src/Generated/Teams/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Teams/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Teams\Item\Group\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/IncomingChannels/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/IncomingChannels/Count/CountRequestBuilder.php index 290ade02282..5b41078a1a5 100644 --- a/src/Generated/Teams/Item/IncomingChannels/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/IncomingChannels/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/IncomingChannels/IncomingChannelsRequestBuilder.php b/src/Generated/Teams/Item/IncomingChannels/IncomingChannelsRequestBuilder.php index a75594def08..ebff6a787e3 100644 --- a/src/Generated/Teams/Item/IncomingChannels/IncomingChannelsRequestBuilder.php +++ b/src/Generated/Teams/Item/IncomingChannels/IncomingChannelsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChannelCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\IncomingChannels\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of incoming channels (channels shared with a team). This API is available in the following national cloud deployments. * @param IncomingChannelsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-incomingchannels?view=graph-rest-1.0 Find more info here */ public function get(?IncomingChannelsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?IncomingChannelsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?IncomingChannelsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/IncomingChannels/Item/ChannelItemRequestBuilder.php b/src/Generated/Teams/Item/IncomingChannels/Item/ChannelItemRequestBuilder.php index c0bbe8b3763..ed1a2eadcad 100644 --- a/src/Generated/Teams/Item/IncomingChannels/Item/ChannelItemRequestBuilder.php +++ b/src/Generated/Teams/Item/IncomingChannels/Item/ChannelItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an incoming channel (a channel shared with a team) from a team. * @param ChannelItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-delete-incomingchannels?view=graph-rest-1.0 Find more info here */ public function delete(?ChannelItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * List of channels shared with the team. * @param ChannelItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChannelItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?ChannelItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/InstalledApps/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/InstalledApps/Count/CountRequestBuilder.php index 1ebecbfcc59..859d2f4ddd0 100644 --- a/src/Generated/Teams/Item/InstalledApps/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/InstalledApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/InstalledApps/InstalledAppsRequestBuilder.php b/src/Generated/Teams/Item/InstalledApps/InstalledAppsRequestBuilder.php index 4b61caab77b..77a7a8184a9 100644 --- a/src/Generated/Teams/Item/InstalledApps/InstalledAppsRequestBuilder.php +++ b/src/Generated/Teams/Item/InstalledApps/InstalledAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppInstallation; use Microsoft\Graph\Generated\Models\TeamsAppInstallationCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of apps installed in the specified team. This API is available in the following national cloud deployments. * @param InstalledAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-installedapps?view=graph-rest-1.0 Find more info here */ public function get(?InstalledAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Install an app to the specified team. This API is available in the following national cloud deployments. * @param TeamsAppInstallation $body The request body * @param InstalledAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-post-installedapps?view=graph-rest-1.0 Find more info here */ public function post(TeamsAppInstallation $body, ?InstalledAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?InstalledAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?InstalledAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsAppInstallation $body, ?InstalledA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Teams/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php index 2aabf811fa0..4a50103a921 100644 --- a/src/Generated/Teams/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Teams/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The app that is installed. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php b/src/Generated/Teams/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php index c49cd280984..1674baf850b 100644 --- a/src/Generated/Teams/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php +++ b/src/Generated/Teams/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The details of this version of the app. * @param TeamsAppDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppDefinitionRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppDefinitionRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php b/src/Generated/Teams/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php index 8813eb15b7c..4c9fe808c8a 100644 --- a/src/Generated/Teams/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php +++ b/src/Generated/Teams/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppInstallation; use Microsoft\Graph\Generated\Teams\Item\InstalledApps\Item\TeamsApp\TeamsAppRequestBuilder; @@ -58,58 +57,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Uninstalls an app from the specified team. This API is available in the following national cloud deployments. * @param TeamsAppInstallationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-delete-installedapps?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsAppInstallationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the app installed in the specified team. This API is available in the following national cloud deployments. * @param TeamsAppInstallationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-get-installedapps?view=graph-rest-1.0 Find more info here */ public function get(?TeamsAppInstallationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property installedApps in teams * @param TeamsAppInstallation $body The request body * @param TeamsAppInstallationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamsAppInstallation $body, ?TeamsAppInstallationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -126,6 +116,7 @@ public function toDeleteRequestInformation(?TeamsAppInstallationItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -139,7 +130,6 @@ public function toGetRequestInformation(?TeamsAppInstallationItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +137,7 @@ public function toGetRequestInformation(?TeamsAppInstallationItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -161,11 +152,11 @@ public function toPatchRequestInformation(TeamsAppInstallation $body, ?TeamsAppI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php b/src/Generated/Teams/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php index a901c0ad3ef..b1191845734 100644 --- a/src/Generated/Teams/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php +++ b/src/Generated/Teams/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Upgrade an app installation within a chat. This API is available in the following national cloud deployments. * @param UpgradePostRequestBody $body The request body * @param UpgradeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-teamsappinstallation-upgrade?view=graph-rest-1.0 Find more info here */ public function post(UpgradePostRequestBody $body, ?UpgradeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(UpgradePostRequestBody $body, ?UpgradeR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Members/Add/AddRequestBuilder.php b/src/Generated/Teams/Item/Members/Add/AddRequestBuilder.php index 457e7d9007c..e8002262137 100644 --- a/src/Generated/Teams/Item/Members/Add/AddRequestBuilder.php +++ b/src/Generated/Teams/Item/Members/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add multiple members in a single request to a team. The response provides details about which memberships could and couldn't be created. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmembers-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Members/Count/CountRequestBuilder.php index df16424d82c..988fe079ab2 100644 --- a/src/Generated/Teams/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Members/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Teams/Item/Members/Item/ConversationMemberItemRequestBuilder.php index a6137c05260..f71a30bb61f 100644 --- a/src/Generated/Teams/Item/Members/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Members/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a conversationMember from a team. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-delete-members?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a conversationMember from a team. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-get-members?view=graph-rest-1.0 Find more info here */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the role of a conversationMember in a team. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param ConversationMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-update-members?view=graph-rest-1.0 Find more info here */ public function patch(ConversationMember $body, ?ConversationMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ConversationMemberItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ConversationMember $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Members/MembersRequestBuilder.php b/src/Generated/Teams/Item/Members/MembersRequestBuilder.php index 1798de89f74..c8698051393 100644 --- a/src/Generated/Teams/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Teams/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the conversationMember collection of a team. The membership IDs returned by the server must be treated as opaque strings. The client should not try to parse or make assumptions about these resource IDs. In the future, membership results may include users from various tenants, as indicated in the response. Clients should avoid assuming that all members exclusively belong to the current tenant. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a new conversationMember to a team. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-post-members?view=graph-rest-1.0 Find more info here */ public function post(ConversationMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ConversationMember $body, ?MembersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Operations/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Operations/Count/CountRequestBuilder.php index 3ffcda45d05..304c400670f 100644 --- a/src/Generated/Teams/Item/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Operations/Item/TeamsAsyncOperationItemRequestBuilder.php b/src/Generated/Teams/Item/Operations/Item/TeamsAsyncOperationItemRequestBuilder.php index a4d9c42f880..3c0af3f9b0a 100644 --- a/src/Generated/Teams/Item/Operations/Item/TeamsAsyncOperationItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Operations/Item/TeamsAsyncOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAsyncOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for teams * @param TeamsAsyncOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TeamsAsyncOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The async operations that ran or are running on this team. * @param TeamsAsyncOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAsyncOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in teams * @param TeamsAsyncOperation $body The request body * @param TeamsAsyncOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamsAsyncOperation $body, ?TeamsAsyncOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?TeamsAsyncOperationItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?TeamsAsyncOperationItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?TeamsAsyncOperationItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(TeamsAsyncOperation $body, ?TeamsAsync $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Operations/OperationsRequestBuilder.php b/src/Generated/Teams/Item/Operations/OperationsRequestBuilder.php index 25b6f9ec26e..f5e38cb6c39 100644 --- a/src/Generated/Teams/Item/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Teams/Item/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAsyncOperation; use Microsoft\Graph\Generated\Models\TeamsAsyncOperationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The async operations that ran or are running on this team. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for teams * @param TeamsAsyncOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TeamsAsyncOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(TeamsAsyncOperation $body, ?OperationsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PermissionGrants/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/PermissionGrants/Count/CountRequestBuilder.php index 662d5a44834..6f86d14a527 100644 --- a/src/Generated/Teams/Item/PermissionGrants/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/PermissionGrants/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php b/src/Generated/Teams/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php index de57a903b2e..55edb36669b 100644 --- a/src/Generated/Teams/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php +++ b/src/Generated/Teams/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrant; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property permissionGrants for teams * @param ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of permissions granted to apps to access the team. * @param ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property permissionGrants in teams * @param ResourceSpecificPermissionGrant $body The request body * @param ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ResourceSpecificPermissionGrant $body, ?ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ResourceSpecificPermissionGrantItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PermissionGrants/PermissionGrantsRequestBuilder.php b/src/Generated/Teams/Item/PermissionGrants/PermissionGrantsRequestBuilder.php index d70b944ae7c..b4f15899b17 100644 --- a/src/Generated/Teams/Item/PermissionGrants/PermissionGrantsRequestBuilder.php +++ b/src/Generated/Teams/Item/PermissionGrants/PermissionGrantsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrant; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrantCollectionResponse; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List all resource-specific permission grants on the team. This list specifies the Azure AD apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the team. This list specifies the Microsoft Entra apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. * @param PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-permissiongrants?view=graph-rest-1.0 Find more info here */ public function get(?PermissionGrantsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to permissionGrants for teams * @param ResourceSpecificPermissionGrant $body The request body * @param PermissionGrantsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ResourceSpecificPermissionGrant $body, ?PermissionGrantsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List all resource-specific permission grants on the team. This list specifies the Azure AD apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the team. This list specifies the Microsoft Entra apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. * @param PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php b/src/Generated/Teams/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php index 0492eebde3b..0e9709496ea 100644 --- a/src/Generated/Teams/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Teams/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List all resource-specific permission grants on the team. This list specifies the Azure AD apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the team. This list specifies the Microsoft Entra apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. */ class PermissionGrantsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Teams/Item/Photo/PhotoRequestBuilder.php b/src/Generated/Teams/Item/Photo/PhotoRequestBuilder.php index bc6257ffb90..5be69ac31b9 100644 --- a/src/Generated/Teams/Item/Photo/PhotoRequestBuilder.php +++ b/src/Generated/Teams/Item/Photo/PhotoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProfilePhoto; use Microsoft\Graph\Generated\Teams\Item\Photo\Value\ContentRequestBuilder; @@ -40,45 +39,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Azure Active Directory. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. + * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Microsoft Entra ID. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. * @param PhotoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/profilephoto-get?view=graph-rest-1.0 Find more info here */ public function get(?PhotoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property photo in teams * @param ProfilePhoto $body The request body * @param PhotoRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ProfilePhoto $body, ?PhotoRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Azure Active Directory. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. + * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Microsoft Entra ID. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. * @param PhotoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -87,7 +80,6 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -95,6 +87,7 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -109,11 +102,11 @@ public function toPatchRequestInformation(ProfilePhoto $body, ?PhotoRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Photo/PhotoRequestBuilderGetQueryParameters.php b/src/Generated/Teams/Item/Photo/PhotoRequestBuilderGetQueryParameters.php index 5b2a76dbe16..208aea28e1a 100644 --- a/src/Generated/Teams/Item/Photo/PhotoRequestBuilderGetQueryParameters.php +++ b/src/Generated/Teams/Item/Photo/PhotoRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Azure Active Directory. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. + * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Microsoft Entra ID. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. */ class PhotoRequestBuilderGetQueryParameters { diff --git a/src/Generated/Teams/Item/Photo/Value/ContentRequestBuilder.php b/src/Generated/Teams/Item/Photo/Value/ContentRequestBuilder.php index a16a453068e..3c9479a7fed 100644 --- a/src/Generated/Teams/Item/Photo/Value/ContentRequestBuilder.php +++ b/src/Generated/Teams/Item/Photo/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property photo from teams * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/profilephoto-get?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property photo in teams * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/CompleteMigration/CompleteMigrationRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/CompleteMigration/CompleteMigrationRequestBuilder.php index 4ffbcd4327e..4b07e10bd45 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/CompleteMigration/CompleteMigrationRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/CompleteMigration/CompleteMigrationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Complete the message migration process by removing migration mode from a channel in a team. Migration mode is a special state that prevents certain operations, like sending messages and adding members, during the data migration process. After a completeMigration request is made, you can't import additional messages into the team. You can add members to the team after the request returns a successful response. This API is available in the following national cloud deployments. * @param CompleteMigrationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-completemigration?view=graph-rest-1.0 Find more info here */ public function post(?CompleteMigrationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CompleteMigrationRequestBuilderPostReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php index 314cae3cbf0..229cfd9e744 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function doesUserHaveAccess * @param DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/FilesFolder/Content/ContentRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/FilesFolder/Content/ContentRequestBuilder.php index 4fd1a00b858..e5e71aa7572 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/FilesFolder/Content/ContentRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/FilesFolder/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/FilesFolder/FilesFolderRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/FilesFolder/FilesFolderRequestBuilder.php index 64f8b47d87a..2f760733d2c 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/FilesFolder/FilesFolderRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/FilesFolder/FilesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\PrimaryChannel\FilesFolder\Content\ContentRequestBuilder; @@ -42,20 +41,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the metadata for the location where the files of a channel are stored. This API is available in the following national cloud deployments. * @param FilesFolderRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?FilesFolderRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -68,7 +64,6 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -76,6 +71,7 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Members/Add/AddRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Members/Add/AddRequestBuilder.php index 18e5a40f0f6..56aa9d005d1 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Members/Add/AddRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Members/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add multiple members in a single request to a team. The response provides details about which memberships could and couldn't be created. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmembers-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Members/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Members/Count/CountRequestBuilder.php index 59edc8bbb22..c3f07a7ddff 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Members/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Members/Item/ConversationMemberItemRequestBuilder.php index e4b3061b663..aed5af317fd 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Members/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Members/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,65 +31,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-delete-members?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/conversationmember-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-members?view=graph-rest-1.0 Find more info here */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the role of a conversationMember in a team or channel. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param ConversationMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmember-update?view=graph-rest-1.0 Find more info here */ public function patch(ConversationMember $body, ?ConversationMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ConversationMemberItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ConversationMember $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Members/MembersRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Members/MembersRequestBuilder.php index 93d9d40b0f9..0c5df69f8ea 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Members/MembersRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of conversationMembers from a channel. This method supports federation. Only a user who is a member of the shared channel can retrieve the channel member list. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a conversationMember to a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-members?view=graph-rest-1.0 Find more info here */ public function post(ConversationMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ConversationMember $body, ?MembersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Count/CountRequestBuilder.php index f1d2db13a6e..16642fc3f6f 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Delta/DeltaRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Delta/DeltaRequestBuilder.php index df3f3929082..a7a7ac8ea1c 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/ChatMessageItemRequestBuilder.php index 4c0fe8173f1..7a5ab0e53cb 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\PrimaryChannel\Messages\Item\HostedContents\HostedContentsRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property messages for teams * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a chatMessage object. With the exception of the policyViolation property, all properties of a chatMessage can be updated in delegated permissions scenarios.Only the policyViolation property of a chatMessage can be updated in application permissions scenarios. The update only works for chats where members are Microsoft Teams users. If one of the participants is using Skype, the operation will fail. This method does not support federation. Only the user in the tenant who sent the message can perform data loss prevention (DLP) updates on the specified chat message. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-update?view=graph-rest-1.0 Find more info here */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/Count/CountRequestBuilder.php index baed449cc78..f4b9b2128c1 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilder.php index dddad7d6aae..068f4aa2fe2 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ChatMessageHostedContentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for teams * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 77590d4bff2..d7d01772ddc 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index 84cab3490fc..ac5af4ab6fc 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\PrimaryChannel\Messages\Item\HostedContents\Item\Value\ContentRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for teams * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in teams * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php index 03560a1b4dd..5594dc345dc 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from teams * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in teams * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Count/CountRequestBuilder.php index cd6476c7d06..b6dda6be4e5 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Delta/DeltaRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Delta/DeltaRequestBuilder.php index 47ef7fed827..eaeee4cd2bd 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php index f9e80f72144..792727bdf8f 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\PrimaryChannel\Messages\Item\Replies\Item\HostedContents\HostedContentsRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property replies for teams * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property replies in teams * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php index c0efb5566bc..20b58b391f0 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php index 549ee53560b..c6300185c69 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ChatMessageHostedContentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for teams * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 35f0e2ac7f3..3de537ffeb2 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index 282679d5d36..d3015bf2045 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\PrimaryChannel\Messages\Item\Replies\Item\HostedContents\Item\Value\ContentRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for teams * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in teams * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php index a1f975d95ef..65ff65077de 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from teams * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in teams * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php index a4f02d331c1..a7364833247 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php index 5a61e715f9e..62c457c8e9f 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index 19ca4297178..cc83c505f38 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php index 222bbba3131..2ab31634a5a 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/RepliesRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/RepliesRequestBuilder.php index 942fb3d1e35..5422481e6e0 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/RepliesRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/Replies/RepliesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ChatMessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the replies to a message in a channel of a team. This method lists only the replies of the specified message, if any. To get the message itself, simply call get channel message. This API is available in the following national cloud deployments. * @param RepliesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-replies?view=graph-rest-1.0 Find more info here */ public function get(?RepliesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new reply to a chatMessage in a specified channel. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param RepliesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-messagereply?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?RepliesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?RepliesRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/SetReaction/SetReactionRequestBuilder.php index 2daacb4f727..29ffa9c683f 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php index 79b19a2eb96..7f0f724921b 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index c147f758c95..026e858190c 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php index c444fcd423b..786d806e755 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Messages/MessagesRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Messages/MessagesRequestBuilder.php index 045a9619a68..b5b6db27dd3 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Messages/MessagesRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Messages/MessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ChatMessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of messages (without the replies) in a channel of a team. To get the replies for a message, call the list message replies or the get message reply API. This method supports federation. To list channel messages in application context, the request must be made from the tenant that the channel owner belongs to (represented by the tenantId property on the channel). This API is available in the following national cloud deployments. * @param MessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?MessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-post-messages?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/chatmessage-post?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?MessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,11 +109,12 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?MessagesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/PrimaryChannelRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/PrimaryChannelRequestBuilder.php index 1034ecc5861..b86b767eeff 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/PrimaryChannelRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/PrimaryChannelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\PrimaryChannel\CompleteMigration\CompleteMigrationRequestBuilder; @@ -106,57 +105,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property primaryChannel for teams * @param PrimaryChannelRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrimaryChannelRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the default channel, General, of a team. This API is available in the following national cloud deployments. * @param PrimaryChannelRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-get-primarychannel?view=graph-rest-1.0 Find more info here */ public function get(?PrimaryChannelRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property primaryChannel in teams * @param Channel $body The request body * @param PrimaryChannelRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Channel $body, ?PrimaryChannelRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -173,6 +163,7 @@ public function toDeleteRequestInformation(?PrimaryChannelRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -186,7 +177,6 @@ public function toGetRequestInformation(?PrimaryChannelRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -194,6 +184,7 @@ public function toGetRequestInformation(?PrimaryChannelRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -208,11 +199,11 @@ public function toPatchRequestInformation(Channel $body, ?PrimaryChannelRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/ProvisionEmail/ProvisionEmailRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/ProvisionEmail/ProvisionEmailRequestBuilder.php index 95d50fdf2e5..6d0881a9d96 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/ProvisionEmail/ProvisionEmailRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/ProvisionEmail/ProvisionEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProvisionChannelEmailResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Provision an email address for a channel. Microsoft Teams doesn't automatically provision an email address for a channel by default. To have Teams provision an email address, you can call provisionEmail, or through the Teams user interface, select Get email address, which triggers Teams to generate an email address if it has not already provisioned one. To remove the email address of a channel, use the removeEmail method. This API is available in the following national cloud deployments. * @param ProvisionEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-provisionemail?view=graph-rest-1.0 Find more info here */ public function post(?ProvisionEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ProvisionEmailRequestBuilderPostReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/RemoveEmail/RemoveEmailRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/RemoveEmail/RemoveEmailRequestBuilder.php index b8e1abbd3b0..3b61ea2fea9 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/RemoveEmail/RemoveEmailRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/RemoveEmail/RemoveEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove the email address of a channel. You can remove an email address only if it was provisioned using the provisionEmail method or through the Microsoft Teams client. This API is available in the following national cloud deployments. * @param RemoveEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-removeemail?view=graph-rest-1.0 Find more info here */ public function post(?RemoveEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RemoveEmailRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Count/CountRequestBuilder.php index 6ee68775aea..62bf66df8a1 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php index fefc98413c0..d85a77bf88a 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teams\Item\PrimaryChannel\SharedWithTeams\Item\AllowedMembers\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of conversationMembers who can access a shared channel. This method does not return the following conversationMembers from the team:- Users with Guest role- Users who are externally authenticated in the tenant This API is available in the following national cloud deployments. * @param AllowedMembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list-allowedmembers?view=graph-rest-1.0 Find more info here */ public function get(?AllowedMembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php index 955e9a9d838..80032c331e3 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php index 0558af48f0f..1768dd57261 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A collection of team members who have access to the shared channel. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php index 26b37d1d347..8448f8e0f17 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfo; use Microsoft\Graph\Generated\Teams\Item\PrimaryChannel\SharedWithTeams\Item\AllowedMembers\AllowedMembersRequestBuilder; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unshare a channel with a team by deleting the corresponding sharedWithChannelTeamInfo resource. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a team that has been shared with a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-get?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sharedWithTeams in teams * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SharedWithChannelTeamInfo $body, ?SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?SharedWithChannelTeamInfoItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(SharedWithChannelTeamInfo $body, ?Shar $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/Team/TeamRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/Team/TeamRequestBuilder.php index a9137f94015..42be27517e3 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/Team/TeamRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/Item/Team/TeamRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get team from teams * @param TeamRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/SharedWithTeamsRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/SharedWithTeamsRequestBuilder.php index 3409e2b5754..f0c159b7e35 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/SharedWithTeamsRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/SharedWithTeams/SharedWithTeamsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfo; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfoCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of teams that has been shared a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithTeamsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithTeamsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sharedWithTeams for teams * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithTeamsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SharedWithChannelTeamInfo $body, ?SharedWithTeamsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SharedWithChannelTeamInfo $body, ?Share $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Tabs/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Tabs/Count/CountRequestBuilder.php index e14d694cf31..30e597226cc 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Tabs/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Tabs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php index d4b28707818..dbf7b251a2f 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The application that is linked to the tab. This can't be changed after tab creation. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Tabs/Item/TeamsTabItemRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Tabs/Item/TeamsTabItemRequestBuilder.php index 2ab153b0e5a..a9b10ed046f 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Tabs/Item/TeamsTabItemRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Tabs/Item/TeamsTabItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; use Microsoft\Graph\Generated\Teams\Item\PrimaryChannel\Tabs\Item\TeamsApp\TeamsAppRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Removes (unpins) a tab from the specified channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-delete-tabs?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsTabItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of the specified tab in a channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TeamsTabItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified tab.This can be used to configure the content of the tab. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TeamsTabItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-patch-tabs?view=graph-rest-1.0 Find more info here */ public function patch(TeamsTab $body, ?TeamsTabItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TeamsTabItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TeamsTab $body, ?TeamsTabItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/PrimaryChannel/Tabs/TabsRequestBuilder.php b/src/Generated/Teams/Item/PrimaryChannel/Tabs/TabsRequestBuilder.php index fa520d915ed..22547635a39 100644 --- a/src/Generated/Teams/Item/PrimaryChannel/Tabs/TabsRequestBuilder.php +++ b/src/Generated/Teams/Item/PrimaryChannel/Tabs/TabsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; use Microsoft\Graph\Generated\Models\TeamsTabCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of tabs in the specified channel within a team. This API is available in the following national cloud deployments. * @param TabsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TabsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Adds (pins) a tab to the specified channel within a team. The corresponding app must already be installed in the team. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TabsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-tabs?view=graph-rest-1.0 Find more info here */ public function post(TeamsTab $body, ?TabsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsTab $body, ?TabsRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/OfferShiftRequests/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Schedule/OfferShiftRequests/Count/CountRequestBuilder.php index febe242ff52..98662012718 100644 --- a/src/Generated/Teams/Item/Schedule/OfferShiftRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/OfferShiftRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/OfferShiftRequests/Item/OfferShiftRequestItemRequestBuilder.php b/src/Generated/Teams/Item/Schedule/OfferShiftRequests/Item/OfferShiftRequestItemRequestBuilder.php index eed1c948c40..10b2c81d8bd 100644 --- a/src/Generated/Teams/Item/Schedule/OfferShiftRequests/Item/OfferShiftRequestItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/OfferShiftRequests/Item/OfferShiftRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OfferShiftRequest; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property offerShiftRequests for teams * @param OfferShiftRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OfferShiftRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an offerShiftRequest object. This API is available in the following national cloud deployments. * @param OfferShiftRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/offershiftrequest-get?view=graph-rest-1.0 Find more info here */ public function get(?OfferShiftRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property offerShiftRequests in teams * @param OfferShiftRequest $body The request body * @param OfferShiftRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OfferShiftRequest $body, ?OfferShiftRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?OfferShiftRequestItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?OfferShiftRequestItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?OfferShiftRequestItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(OfferShiftRequest $body, ?OfferShiftRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/OfferShiftRequests/OfferShiftRequestsRequestBuilder.php b/src/Generated/Teams/Item/Schedule/OfferShiftRequests/OfferShiftRequestsRequestBuilder.php index 2565c096ded..6e91628a397 100644 --- a/src/Generated/Teams/Item/Schedule/OfferShiftRequests/OfferShiftRequestsRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/OfferShiftRequests/OfferShiftRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OfferShiftRequest; use Microsoft\Graph\Generated\Models\OfferShiftRequestCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of all offerShiftRequest objects in a team. This API is available in the following national cloud deployments. * @param OfferShiftRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/offershiftrequest-list?view=graph-rest-1.0 Find more info here */ public function get(?OfferShiftRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an instance of an offerShiftRequest. This API is available in the following national cloud deployments. * @param OfferShiftRequest $body The request body * @param OfferShiftRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/offershiftrequest-post?view=graph-rest-1.0 Find more info here */ public function post(OfferShiftRequest $body, ?OfferShiftRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OfferShiftRequestsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OfferShiftRequestsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OfferShiftRequest $body, ?OfferShiftReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/OpenShiftChangeRequests/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Schedule/OpenShiftChangeRequests/Count/CountRequestBuilder.php index fba32f15f5f..f70f89c366b 100644 --- a/src/Generated/Teams/Item/Schedule/OpenShiftChangeRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/OpenShiftChangeRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/OpenShiftChangeRequests/Item/OpenShiftChangeRequestItemRequestBuilder.php b/src/Generated/Teams/Item/Schedule/OpenShiftChangeRequests/Item/OpenShiftChangeRequestItemRequestBuilder.php index 75dabe21529..4a015e26cee 100644 --- a/src/Generated/Teams/Item/Schedule/OpenShiftChangeRequests/Item/OpenShiftChangeRequestItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/OpenShiftChangeRequests/Item/OpenShiftChangeRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OpenShiftChangeRequest; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property openShiftChangeRequests for teams * @param OpenShiftChangeRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OpenShiftChangeRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an openShiftChangeRequest object. This API is available in the following national cloud deployments. * @param OpenShiftChangeRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshiftchangerequest-get?view=graph-rest-1.0 Find more info here */ public function get(?OpenShiftChangeRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property openShiftChangeRequests in teams * @param OpenShiftChangeRequest $body The request body * @param OpenShiftChangeRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OpenShiftChangeRequest $body, ?OpenShiftChangeRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?OpenShiftChangeRequestItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?OpenShiftChangeRequestItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?OpenShiftChangeRequestItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(OpenShiftChangeRequest $body, ?OpenShi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/OpenShiftChangeRequests/OpenShiftChangeRequestsRequestBuilder.php b/src/Generated/Teams/Item/Schedule/OpenShiftChangeRequests/OpenShiftChangeRequestsRequestBuilder.php index 808e75cd3f7..d70ffcfd9a5 100644 --- a/src/Generated/Teams/Item/Schedule/OpenShiftChangeRequests/OpenShiftChangeRequestsRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/OpenShiftChangeRequests/OpenShiftChangeRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OpenShiftChangeRequest; use Microsoft\Graph\Generated\Models\OpenShiftChangeRequestCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of openShiftChangeRequest objects in a team. This API is available in the following national cloud deployments. * @param OpenShiftChangeRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshiftchangerequest-list?view=graph-rest-1.0 Find more info here */ public function get(?OpenShiftChangeRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create instance of an openShiftChangeRequest object. This API is available in the following national cloud deployments. * @param OpenShiftChangeRequest $body The request body * @param OpenShiftChangeRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshiftchangerequest-post?view=graph-rest-1.0 Find more info here */ public function post(OpenShiftChangeRequest $body, ?OpenShiftChangeRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OpenShiftChangeRequestsRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OpenShiftChangeRequestsRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OpenShiftChangeRequest $body, ?OpenShif $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/OpenShifts/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Schedule/OpenShifts/Count/CountRequestBuilder.php index 9904ec22092..80320aa7800 100644 --- a/src/Generated/Teams/Item/Schedule/OpenShifts/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/OpenShifts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/OpenShifts/Item/OpenShiftItemRequestBuilder.php b/src/Generated/Teams/Item/Schedule/OpenShifts/Item/OpenShiftItemRequestBuilder.php index 49d423daf7f..932508e76e5 100644 --- a/src/Generated/Teams/Item/Schedule/OpenShifts/Item/OpenShiftItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/OpenShifts/Item/OpenShiftItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OpenShift; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an openShift object. This API is available in the following national cloud deployments. * @param OpenShiftItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-delete?view=graph-rest-1.0 Find more info here */ public function delete(?OpenShiftItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an openshift object. This API is available in the following national cloud deployments. * @param OpenShiftItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-get?view=graph-rest-1.0 Find more info here */ public function get(?OpenShiftItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an openShift object. * @param OpenShift $body The request body * @param OpenShiftItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-update?view=graph-rest-1.0 Find more info here */ public function patch(OpenShift $body, ?OpenShiftItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?OpenShiftItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?OpenShiftItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?OpenShiftItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(OpenShift $body, ?OpenShiftItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/OpenShifts/OpenShiftsRequestBuilder.php b/src/Generated/Teams/Item/Schedule/OpenShifts/OpenShiftsRequestBuilder.php index fdc4a60445f..a13df65ca39 100644 --- a/src/Generated/Teams/Item/Schedule/OpenShifts/OpenShiftsRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/OpenShifts/OpenShiftsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OpenShift; use Microsoft\Graph\Generated\Models\OpenShiftCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List openShift objects in a team. This API is available in the following national cloud deployments. * @param OpenShiftsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-list?view=graph-rest-1.0 Find more info here */ public function get(?OpenShiftsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an instance of an openShift object. This API is available in the following national cloud deployments. * @param OpenShift $body The request body * @param OpenShiftsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-post?view=graph-rest-1.0 Find more info here */ public function post(OpenShift $body, ?OpenShiftsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OpenShiftsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OpenShiftsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OpenShift $body, ?OpenShiftsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/ScheduleRequestBuilder.php b/src/Generated/Teams/Item/Schedule/ScheduleRequestBuilder.php index c5999668594..634d7272d7b 100644 --- a/src/Generated/Teams/Item/Schedule/ScheduleRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/ScheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Schedule; use Microsoft\Graph\Generated\Teams\Item\Schedule\OfferShiftRequests\OfferShiftRequestsRequestBuilder; @@ -114,57 +113,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property schedule for teams * @param ScheduleRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ScheduleRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a schedule object. The schedule creation process conforms to the One API guideline for resource based long running operations (RELO).When clients use the PUT method, if the schedule is provisioned, the operation updates the schedule; otherwise, the operation starts the schedule provisioning process in the background. During schedule provisioning, clients can use the GET method to get the schedule and look at the provisionStatus property for the current state of the provisioning. If the provisioning failed, clients can get additional information from the provisionStatusCode property. Clients can also inspect the configuration of the schedule. This API is available in the following national cloud deployments. * @param ScheduleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-get?view=graph-rest-1.0 Find more info here */ public function get(?ScheduleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Schedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Schedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property schedule in teams * @param Schedule $body The request body * @param ScheduleRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(Schedule $body, ?ScheduleRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Schedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Schedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -181,6 +171,7 @@ public function toDeleteRequestInformation(?ScheduleRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -194,7 +185,6 @@ public function toGetRequestInformation(?ScheduleRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -202,6 +192,7 @@ public function toGetRequestInformation(?ScheduleRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -216,11 +207,11 @@ public function toPutRequestInformation(Schedule $body, ?ScheduleRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/SchedulingGroups/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Schedule/SchedulingGroups/Count/CountRequestBuilder.php index eec2f35b247..63c32d10239 100644 --- a/src/Generated/Teams/Item/Schedule/SchedulingGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/SchedulingGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/SchedulingGroups/Item/SchedulingGroupItemRequestBuilder.php b/src/Generated/Teams/Item/Schedule/SchedulingGroups/Item/SchedulingGroupItemRequestBuilder.php index b9c6cd2060c..cff8bf1e080 100644 --- a/src/Generated/Teams/Item/Schedule/SchedulingGroups/Item/SchedulingGroupItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/SchedulingGroups/Item/SchedulingGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SchedulingGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Mark a schedulingGroup as inactive by setting its isActive property.This method does not remove the schedulingGroup from the schedule. Existing shift instances assigned to the scheduling group remain part of the group. This API is available in the following national cloud deployments. * @param SchedulingGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedulinggroup-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SchedulingGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a schedulingGroup by ID. This API is available in the following national cloud deployments. * @param SchedulingGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedulinggroup-get?view=graph-rest-1.0 Find more info here */ public function get(?SchedulingGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Replace an existing schedulingGroup. If the specified schedulingGroup doesn't exist, this method returns 404 Not found. * @param SchedulingGroup $body The request body * @param SchedulingGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedulinggroup-put?view=graph-rest-1.0 Find more info here */ public function patch(SchedulingGroup $body, ?SchedulingGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?SchedulingGroupItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?SchedulingGroupItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?SchedulingGroupItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(SchedulingGroup $body, ?SchedulingGrou $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/SchedulingGroups/SchedulingGroupsRequestBuilder.php b/src/Generated/Teams/Item/Schedule/SchedulingGroups/SchedulingGroupsRequestBuilder.php index 7a6e72524a5..f6b44f2b006 100644 --- a/src/Generated/Teams/Item/Schedule/SchedulingGroups/SchedulingGroupsRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/SchedulingGroups/SchedulingGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SchedulingGroup; use Microsoft\Graph\Generated\Models\SchedulingGroupCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of schedulingGroups in this schedule. This API is available in the following national cloud deployments. * @param SchedulingGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-list-schedulinggroups?view=graph-rest-1.0 Find more info here */ public function get(?SchedulingGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new schedulingGroup. This API is available in the following national cloud deployments. * @param SchedulingGroup $body The request body * @param SchedulingGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-post-schedulinggroups?view=graph-rest-1.0 Find more info here */ public function post(SchedulingGroup $body, ?SchedulingGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SchedulingGroupsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SchedulingGroupsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SchedulingGroup $body, ?SchedulingGroup $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/Share/ShareRequestBuilder.php b/src/Generated/Teams/Item/Schedule/Share/ShareRequestBuilder.php index 0d8f27d6f96..d1ac3c75779 100644 --- a/src/Generated/Teams/Item/Schedule/Share/ShareRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/Share/ShareRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Share a schedule time range with schedule members.Make the collections of shift, openshift and timeOff items in the specified time range of the schedule viewable by the specified team members, including employees and managers.Each shift, openshift and timeOff instance in a schedule supports a draft version and a shared version of the item. The draft version is viewable by only managers, and the shared version is viewable by employees and managers. For each shift, openshift and timeOff instance in the specified time range, the share action updates the shared version from the draft version, so that in addition to managers, employees can also view the most current information about the item. The notifyTeam parameter further specifies which employees can view the item. This API is available in the following national cloud deployments. * @param SharePostRequestBody $body The request body * @param ShareRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-share?view=graph-rest-1.0 Find more info here */ public function post(SharePostRequestBody $body, ?ShareRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SharePostRequestBody $body, ?ShareReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/Shifts/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Schedule/Shifts/Count/CountRequestBuilder.php index b1ae666075d..8c736041156 100644 --- a/src/Generated/Teams/Item/Schedule/Shifts/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/Shifts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/Shifts/Item/ShiftItemRequestBuilder.php b/src/Generated/Teams/Item/Schedule/Shifts/Item/ShiftItemRequestBuilder.php index 9f73a6f8cc8..68840039803 100644 --- a/src/Generated/Teams/Item/Schedule/Shifts/Item/ShiftItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/Shifts/Item/ShiftItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Shift; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a shift from the schedule. This API is available in the following national cloud deployments. * @param ShiftItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shift-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ShiftItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a shift object by ID. This API is available in the following national cloud deployments. * @param ShiftItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shift-get?view=graph-rest-1.0 Find more info here */ public function get(?ShiftItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Replace an existing shift. If the specified shift doesn't exist, this method returns 404 Not found. The duration of a shift can't be less than 1 minute or longer than 24 hours. * @param Shift $body The request body * @param ShiftItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shift-put?view=graph-rest-1.0 Find more info here */ public function patch(Shift $body, ?ShiftItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ShiftItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ShiftItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ShiftItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(Shift $body, ?ShiftItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/Shifts/ShiftsRequestBuilder.php b/src/Generated/Teams/Item/Schedule/Shifts/ShiftsRequestBuilder.php index d4dfa39bd48..1366f887199 100644 --- a/src/Generated/Teams/Item/Schedule/Shifts/ShiftsRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/Shifts/ShiftsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Shift; use Microsoft\Graph\Generated\Models\ShiftCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of shift instances in a schedule. This API is available in the following national cloud deployments. * @param ShiftsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-list-shifts?view=graph-rest-1.0 Find more info here */ public function get(?ShiftsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ShiftCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ShiftCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new shift instance in a schedule. The duration of a shift cannot be less than 1 minute or longer than 24 hours. This API is available in the following national cloud deployments. * @param Shift $body The request body * @param ShiftsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-post-shifts?view=graph-rest-1.0 Find more info here */ public function post(Shift $body, ?ShiftsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ShiftsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ShiftsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Shift $body, ?ShiftsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/SwapShiftsChangeRequests/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Schedule/SwapShiftsChangeRequests/Count/CountRequestBuilder.php index 2f16fc42730..573fdd6f693 100644 --- a/src/Generated/Teams/Item/Schedule/SwapShiftsChangeRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/SwapShiftsChangeRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/SwapShiftsChangeRequests/Item/SwapShiftsChangeRequestItemRequestBuilder.php b/src/Generated/Teams/Item/Schedule/SwapShiftsChangeRequests/Item/SwapShiftsChangeRequestItemRequestBuilder.php index 1a04cd0e102..a094f521fc4 100644 --- a/src/Generated/Teams/Item/Schedule/SwapShiftsChangeRequests/Item/SwapShiftsChangeRequestItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/SwapShiftsChangeRequests/Item/SwapShiftsChangeRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SwapShiftsChangeRequest; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property swapShiftsChangeRequests for teams * @param SwapShiftsChangeRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SwapShiftsChangeRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a swapShiftsChangeRequest object. This API is available in the following national cloud deployments. * @param SwapShiftsChangeRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/swapshiftschangerequest-get?view=graph-rest-1.0 Find more info here */ public function get(?SwapShiftsChangeRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property swapShiftsChangeRequests in teams * @param SwapShiftsChangeRequest $body The request body * @param SwapShiftsChangeRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SwapShiftsChangeRequest $body, ?SwapShiftsChangeRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?SwapShiftsChangeRequestItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?SwapShiftsChangeRequestItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?SwapShiftsChangeRequestItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(SwapShiftsChangeRequest $body, ?SwapSh $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/SwapShiftsChangeRequests/SwapShiftsChangeRequestsRequestBuilder.php b/src/Generated/Teams/Item/Schedule/SwapShiftsChangeRequests/SwapShiftsChangeRequestsRequestBuilder.php index 865c072f531..96d357c118f 100644 --- a/src/Generated/Teams/Item/Schedule/SwapShiftsChangeRequests/SwapShiftsChangeRequestsRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/SwapShiftsChangeRequests/SwapShiftsChangeRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SwapShiftsChangeRequest; use Microsoft\Graph\Generated\Models\SwapShiftsChangeRequestCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of swapShiftsChangeRequest objects in the team. This API is available in the following national cloud deployments. * @param SwapShiftsChangeRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/swapshiftschangerequest-list?view=graph-rest-1.0 Find more info here */ public function get(?SwapShiftsChangeRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an instance of a swapShiftsChangeRequest object. This API is available in the following national cloud deployments. * @param SwapShiftsChangeRequest $body The request body * @param SwapShiftsChangeRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/swapshiftschangerequest-post?view=graph-rest-1.0 Find more info here */ public function post(SwapShiftsChangeRequest $body, ?SwapShiftsChangeRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SwapShiftsChangeRequestsRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SwapShiftsChangeRequestsRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SwapShiftsChangeRequest $body, ?SwapShi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/TimeOffReasons/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Schedule/TimeOffReasons/Count/CountRequestBuilder.php index 821738db627..992beed74e2 100644 --- a/src/Generated/Teams/Item/Schedule/TimeOffReasons/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/TimeOffReasons/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/TimeOffReasons/Item/TimeOffReasonItemRequestBuilder.php b/src/Generated/Teams/Item/Schedule/TimeOffReasons/Item/TimeOffReasonItemRequestBuilder.php index 95b427b0e33..b4bf8a3b08e 100644 --- a/src/Generated/Teams/Item/Schedule/TimeOffReasons/Item/TimeOffReasonItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/TimeOffReasons/Item/TimeOffReasonItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOffReason; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Mark a timeOffReason as inactive by setting the isActive property. Every team must include at least one timeoff reason. This method doesn't remove the specified timeOffReason instance. timeOffItem instances that have been assigned this reason remain assigned to this reason. This API is available in the following national cloud deployments. * @param TimeOffReasonItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffreason-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TimeOffReasonItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a timeOffReason object by ID. This API is available in the following national cloud deployments. * @param TimeOffReasonItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffreason-get?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffReasonItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Replace an existing timeOffReason. If the specified timeOffReason doesn't exist, this method returns 404 Not found. * @param TimeOffReason $body The request body * @param TimeOffReasonItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffreason-put?view=graph-rest-1.0 Find more info here */ public function patch(TimeOffReason $body, ?TimeOffReasonItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?TimeOffReasonItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?TimeOffReasonItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?TimeOffReasonItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(TimeOffReason $body, ?TimeOffReasonIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/TimeOffReasons/TimeOffReasonsRequestBuilder.php b/src/Generated/Teams/Item/Schedule/TimeOffReasons/TimeOffReasonsRequestBuilder.php index e086892c3bf..1b92063a051 100644 --- a/src/Generated/Teams/Item/Schedule/TimeOffReasons/TimeOffReasonsRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/TimeOffReasons/TimeOffReasonsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOffReason; use Microsoft\Graph\Generated\Models\TimeOffReasonCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of timeOffReasons in a schedule. This API is available in the following national cloud deployments. * @param TimeOffReasonsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-list-timeoffreasons?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffReasonsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReasonCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReasonCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new timeOffReason. This API is available in the following national cloud deployments. * @param TimeOffReason $body The request body * @param TimeOffReasonsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-post-timeoffreasons?view=graph-rest-1.0 Find more info here */ public function post(TimeOffReason $body, ?TimeOffReasonsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TimeOffReasonsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TimeOffReasonsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TimeOffReason $body, ?TimeOffReasonsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/TimeOffRequests/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Schedule/TimeOffRequests/Count/CountRequestBuilder.php index ed9b9ccb5f6..26f3b77f99b 100644 --- a/src/Generated/Teams/Item/Schedule/TimeOffRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/TimeOffRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/TimeOffRequests/Item/TimeOffRequestItemRequestBuilder.php b/src/Generated/Teams/Item/Schedule/TimeOffRequests/Item/TimeOffRequestItemRequestBuilder.php index 20c3650a6d8..18548020e63 100644 --- a/src/Generated/Teams/Item/Schedule/TimeOffRequests/Item/TimeOffRequestItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/TimeOffRequests/Item/TimeOffRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOffRequest; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a timeOffRequest object. This API is available in the following national cloud deployments. * @param TimeOffRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffrequest-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TimeOffRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a timeoffrequest object. This API is available in the following national cloud deployments. * @param TimeOffRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffrequest-get?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property timeOffRequests in teams * @param TimeOffRequest $body The request body * @param TimeOffRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TimeOffRequest $body, ?TimeOffRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?TimeOffRequestItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?TimeOffRequestItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?TimeOffRequestItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(TimeOffRequest $body, ?TimeOffRequestI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/TimeOffRequests/TimeOffRequestsRequestBuilder.php b/src/Generated/Teams/Item/Schedule/TimeOffRequests/TimeOffRequestsRequestBuilder.php index ea11ea47def..8835af32661 100644 --- a/src/Generated/Teams/Item/Schedule/TimeOffRequests/TimeOffRequestsRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/TimeOffRequests/TimeOffRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOffRequest; use Microsoft\Graph\Generated\Models\TimeOffRequestCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of timeOffRequest objects in the team. This API is available in the following national cloud deployments. * @param TimeOffRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffrequest-list?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to timeOffRequests for teams * @param TimeOffRequest $body The request body * @param TimeOffRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TimeOffRequest $body, ?TimeOffRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TimeOffRequestsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TimeOffRequestsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(TimeOffRequest $body, ?TimeOffRequestsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/TimesOff/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Schedule/TimesOff/Count/CountRequestBuilder.php index c0b35aa180a..8c27159c554 100644 --- a/src/Generated/Teams/Item/Schedule/TimesOff/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/TimesOff/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/TimesOff/Item/TimeOffItemRequestBuilder.php b/src/Generated/Teams/Item/Schedule/TimesOff/Item/TimeOffItemRequestBuilder.php index 35f94d646a8..1e1dbd1eb88 100644 --- a/src/Generated/Teams/Item/Schedule/TimesOff/Item/TimeOffItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/TimesOff/Item/TimeOffItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOff; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a timeOff instance from a schedule. This API is available in the following national cloud deployments. * @param TimeOffItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoff-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TimeOffItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a timeOff object by ID. This API is available in the following national cloud deployments. * @param TimeOffItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoff-get?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Replace an existing timeOff object. If the specified timeOff object doesn't exist, this method returns 404 Not found. * @param TimeOff $body The request body * @param TimeOffItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoff-put?view=graph-rest-1.0 Find more info here */ public function patch(TimeOff $body, ?TimeOffItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?TimeOffItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?TimeOffItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?TimeOffItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(TimeOff $body, ?TimeOffItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Schedule/TimesOff/TimesOffRequestBuilder.php b/src/Generated/Teams/Item/Schedule/TimesOff/TimesOffRequestBuilder.php index 83ef56b97b0..0b19f3103ea 100644 --- a/src/Generated/Teams/Item/Schedule/TimesOff/TimesOffRequestBuilder.php +++ b/src/Generated/Teams/Item/Schedule/TimesOff/TimesOffRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOff; use Microsoft\Graph\Generated\Models\TimeOffCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of timeOff instances in a schedule. This API is available in the following national cloud deployments. * @param TimesOffRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-list-timesoff?view=graph-rest-1.0 Find more info here */ public function get(?TimesOffRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new timeOff instance in a schedule. This API is available in the following national cloud deployments. * @param TimeOff $body The request body * @param TimesOffRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-post-timesoff?view=graph-rest-1.0 Find more info here */ public function post(TimeOff $body, ?TimesOffRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TimesOffRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TimesOffRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TimeOff $body, ?TimesOffRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php b/src/Generated/Teams/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php index 0e9a62e9c5f..e37c4d87996 100644 --- a/src/Generated/Teams/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php +++ b/src/Generated/Teams/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Send an activity feed notification in the scope of a team. For more details about sending notifications and the requirements for doing so, seesending Teams activity notifications. This API is available in the following national cloud deployments. * @param SendActivityNotificationPostRequestBody $body The request body * @param SendActivityNotificationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-sendactivitynotification?view=graph-rest-1.0 Find more info here */ public function post(SendActivityNotificationPostRequestBody $body, ?SendActivityNotificationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SendActivityNotificationPostRequestBody $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Tags/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Tags/Count/CountRequestBuilder.php index bb922f890ee..8ce4bf9189d 100644 --- a/src/Generated/Teams/Item/Tags/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Tags/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Tags/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Teams/Item/Tags/Item/Members/Count/CountRequestBuilder.php index bdaec321bd0..338562b54da 100644 --- a/src/Generated/Teams/Item/Tags/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Teams/Item/Tags/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Tags/Item/Members/Item/TeamworkTagMemberItemRequestBuilder.php b/src/Generated/Teams/Item/Tags/Item/Members/Item/TeamworkTagMemberItemRequestBuilder.php index fa12ca39879..197ffbfd665 100644 --- a/src/Generated/Teams/Item/Tags/Item/Members/Item/TeamworkTagMemberItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Tags/Item/Members/Item/TeamworkTagMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamworkTagMember; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a member from a standard tag in a team. This API is available in the following national cloud deployments. * @param TeamworkTagMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktagmember-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TeamworkTagMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a member of a standard tag in a team. This API is available in the following national cloud deployments. * @param TeamworkTagMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktagmember-get?view=graph-rest-1.0 Find more info here */ public function get(?TeamworkTagMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property members in teams * @param TeamworkTagMember $body The request body * @param TeamworkTagMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamworkTagMember $body, ?TeamworkTagMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?TeamworkTagMemberItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?TeamworkTagMemberItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?TeamworkTagMemberItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(TeamworkTagMember $body, ?TeamworkTagM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Tags/Item/Members/MembersRequestBuilder.php b/src/Generated/Teams/Item/Tags/Item/Members/MembersRequestBuilder.php index be5c84235c6..f58c954497a 100644 --- a/src/Generated/Teams/Item/Tags/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Teams/Item/Tags/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamworkTagMember; use Microsoft\Graph\Generated\Models\TeamworkTagMemberCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the members of a standard tag in a team and their properties. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktagmember-list?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new teamworkTagMember object in a team. This API is available in the following national cloud deployments. * @param TeamworkTagMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktagmember-post?view=graph-rest-1.0 Find more info here */ public function post(TeamworkTagMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamworkTagMember $body, ?MembersReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Tags/Item/TeamworkTagItemRequestBuilder.php b/src/Generated/Teams/Item/Tags/Item/TeamworkTagItemRequestBuilder.php index d634983297a..d359c391720 100644 --- a/src/Generated/Teams/Item/Tags/Item/TeamworkTagItemRequestBuilder.php +++ b/src/Generated/Teams/Item/Tags/Item/TeamworkTagItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamworkTag; use Microsoft\Graph\Generated\Teams\Item\Tags\Item\Members\MembersRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a tag object permanently. This API is available in the following national cloud deployments. * @param TeamworkTagItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TeamworkTagItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a tag object. This API is available in the following national cloud deployments. * @param TeamworkTagItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-get?view=graph-rest-1.0 Find more info here */ public function get(?TeamworkTagItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a tag object. This API is available in the following national cloud deployments. * @param TeamworkTag $body The request body * @param TeamworkTagItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-update?view=graph-rest-1.0 Find more info here */ public function patch(TeamworkTag $body, ?TeamworkTagItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TeamworkTagItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TeamworkTagItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TeamworkTagItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TeamworkTag $body, ?TeamworkTagItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Tags/TagsRequestBuilder.php b/src/Generated/Teams/Item/Tags/TagsRequestBuilder.php index 4bedcff77c2..8d7d87cadab 100644 --- a/src/Generated/Teams/Item/Tags/TagsRequestBuilder.php +++ b/src/Generated/Teams/Item/Tags/TagsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamworkTag; use Microsoft\Graph\Generated\Models\TeamworkTagCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the tag objects and their properties. This API is available in the following national cloud deployments. * @param TagsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-list?view=graph-rest-1.0 Find more info here */ public function get(?TagsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a standard tag for members in a team. This API is available in the following national cloud deployments. * @param TeamworkTag $body The request body * @param TagsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-post?view=graph-rest-1.0 Find more info here */ public function post(TeamworkTag $body, ?TagsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TagsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TagsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamworkTag $body, ?TagsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/TeamItemRequestBuilder.php b/src/Generated/Teams/Item/TeamItemRequestBuilder.php index 21919652634..d8a23357961 100644 --- a/src/Generated/Teams/Item/TeamItemRequestBuilder.php +++ b/src/Generated/Teams/Item/TeamItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Graph\Generated\Teams\Item\AllChannels\AllChannelsRequestBuilder; @@ -178,58 +177,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from teams * @param TeamItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TeamItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of the specified team. This API is available in the following national cloud deployments. * @param TeamItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-get?view=graph-rest-1.0 Find more info here */ public function get(?TeamItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified team. This API is available in the following national cloud deployments. * @param Team $body The request body * @param TeamItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-update?view=graph-rest-1.0 Find more info here */ public function patch(Team $body, ?TeamItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -246,6 +236,7 @@ public function toDeleteRequestInformation(?TeamItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -259,7 +250,6 @@ public function toGetRequestInformation(?TeamItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -267,6 +257,7 @@ public function toGetRequestInformation(?TeamItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -281,11 +272,11 @@ public function toPatchRequestInformation(Team $body, ?TeamItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Template/TemplateRequestBuilder.php b/src/Generated/Teams/Item/Template/TemplateRequestBuilder.php index a5a60120101..fa578ba709b 100644 --- a/src/Generated/Teams/Item/Template/TemplateRequestBuilder.php +++ b/src/Generated/Teams/Item/Template/TemplateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTemplate; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The template this team was created from. See available templates. * @param TemplateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TemplateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TemplateRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TemplateRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teams/Item/Unarchive/UnarchiveRequestBuilder.php b/src/Generated/Teams/Item/Unarchive/UnarchiveRequestBuilder.php index ab2b911f4ac..3824bb26dd7 100644 --- a/src/Generated/Teams/Item/Unarchive/UnarchiveRequestBuilder.php +++ b/src/Generated/Teams/Item/Unarchive/UnarchiveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore an archived team. This restores users' ability to send messages and edit the team, abiding by tenant and team settings. A Team is archived using the archive API. Unarchiving is an async operation. A team is unarchived once the async operation completes successfully, which may occur subsequent to a response from this API. This API is available in the following national cloud deployments. * @param UnarchiveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-unarchive?view=graph-rest-1.0 Find more info here */ public function post(?UnarchiveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnarchiveRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teams/TeamsRequestBuilder.php b/src/Generated/Teams/TeamsRequestBuilder.php index 99bc38c1283..f49cc1cc02a 100644 --- a/src/Generated/Teams/TeamsRequestBuilder.php +++ b/src/Generated/Teams/TeamsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Graph\Generated\Models\TeamCollectionResponse; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all teams in an organization. This API is available in the following national cloud deployments. * @param TeamsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teams-list?view=graph-rest-1.0 Find more info here */ public function get(?TeamsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new team. This API is available in the following national cloud deployments. * @param Team $body The request body * @param TeamsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-post?view=graph-rest-1.0 Find more info here */ public function post(Team $body, ?TeamsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?TeamsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?TeamsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Team $body, ?TeamsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TeamsTemplates/Count/CountRequestBuilder.php b/src/Generated/TeamsTemplates/Count/CountRequestBuilder.php index f38e1bac122..2df52faba76 100644 --- a/src/Generated/TeamsTemplates/Count/CountRequestBuilder.php +++ b/src/Generated/TeamsTemplates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/TeamsTemplates/Item/TeamsTemplateItemRequestBuilder.php b/src/Generated/TeamsTemplates/Item/TeamsTemplateItemRequestBuilder.php index ca2ac467ea2..535446b06d9 100644 --- a/src/Generated/TeamsTemplates/Item/TeamsTemplateItemRequestBuilder.php +++ b/src/Generated/TeamsTemplates/Item/TeamsTemplateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTemplate; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete entity from teamsTemplates * @param TeamsTemplateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TeamsTemplateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get entity from teamsTemplates by key * @param TeamsTemplateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsTemplateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update entity in teamsTemplates * @param TeamsTemplate $body The request body * @param TeamsTemplateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamsTemplate $body, ?TeamsTemplateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?TeamsTemplateItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?TeamsTemplateItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?TeamsTemplateItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(TeamsTemplate $body, ?TeamsTemplateIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TeamsTemplates/TeamsTemplatesRequestBuilder.php b/src/Generated/TeamsTemplates/TeamsTemplatesRequestBuilder.php index 1c5eff7d84c..52f13cca741 100644 --- a/src/Generated/TeamsTemplates/TeamsTemplatesRequestBuilder.php +++ b/src/Generated/TeamsTemplates/TeamsTemplatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTemplate; use Microsoft\Graph\Generated\Models\TeamsTemplateCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get entities from teamsTemplates * @param TeamsTemplatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsTemplatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add new entity to teamsTemplates * @param TeamsTemplate $body The request body * @param TeamsTemplatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TeamsTemplate $body, ?TeamsTemplatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?TeamsTemplatesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?TeamsTemplatesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(TeamsTemplate $body, ?TeamsTemplatesReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Count/CountRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Count/CountRequestBuilder.php index d7c009c04c2..11191a912cc 100644 --- a/src/Generated/Teamwork/DeletedTeams/Count/CountRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/DeletedTeamsRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/DeletedTeamsRequestBuilder.php index 5057c701901..602ee674b9a 100644 --- a/src/Generated/Teamwork/DeletedTeams/DeletedTeamsRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/DeletedTeamsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeletedTeam; use Microsoft\Graph\Generated\Models\DeletedTeamCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the deletedTeam objects and their properties. This API is available in the following national cloud deployments. * @param DeletedTeamsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamwork-list-deletedteams?view=graph-rest-1.0 Find more info here */ public function get(?DeletedTeamsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeletedTeamCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeletedTeamCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to deletedTeams for teamwork * @param DeletedTeam $body The request body * @param DeletedTeamsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DeletedTeam $body, ?DeletedTeamsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeletedTeam::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeletedTeam::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?DeletedTeamsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?DeletedTeamsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(DeletedTeam $body, ?DeletedTeamsRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/GetAllMessages/GetAllMessagesRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/GetAllMessages/GetAllMessagesRequestBuilder.php index f2c2ee11890..1639638e602 100644 --- a/src/Generated/Teamwork/DeletedTeams/GetAllMessages/GetAllMessagesRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/GetAllMessages/GetAllMessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAllMessages * @param GetAllMessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAllMessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/ChannelsRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/ChannelsRequestBuilder.php index 700dab9e46c..8429a8568eb 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/ChannelsRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/ChannelsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ChannelCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,38 +62,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The channels that are either shared with this deleted team or created in this deleted team. * @param ChannelsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChannelsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to channels for teamwork * @param Channel $body The request body * @param ChannelsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Channel $body, ?ChannelsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -107,7 +100,6 @@ public function toGetRequestInformation(?ChannelsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -115,6 +107,7 @@ public function toGetRequestInformation(?ChannelsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -129,11 +122,11 @@ public function toPostRequestInformation(Channel $body, ?ChannelsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Count/CountRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Count/CountRequestBuilder.php index 2dabbf75516..c912eeb4daa 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Count/CountRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php index ced2abe36dd..94ccaabcc8d 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAllMessages * @param GetAllMessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAllMessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/ChannelItemRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/ChannelItemRequestBuilder.php index b42da95c120..01ea6aa9b80 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/ChannelItemRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/ChannelItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teamwork\DeletedTeams\Item\Channels\Item\CompleteMigration\CompleteMigrationRequestBuilder; @@ -106,56 +105,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property channels for teamwork * @param ChannelItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChannelItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The channels that are either shared with this deleted team or created in this deleted team. * @param ChannelItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChannelItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property channels in teamwork * @param Channel $body The request body * @param ChannelItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Channel $body, ?ChannelItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -172,6 +162,7 @@ public function toDeleteRequestInformation(?ChannelItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -185,7 +176,6 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -193,6 +183,7 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -207,11 +198,11 @@ public function toPatchRequestInformation(Channel $body, ?ChannelItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php index d418e131430..761993579dc 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Complete the message migration process by removing migration mode from a channel in a team. Migration mode is a special state that prevents certain operations, like sending messages and adding members, during the data migration process. After a completeMigration request is made, you can't import additional messages into the team. You can add members to the team after the request returns a successful response. This API is available in the following national cloud deployments. * @param CompleteMigrationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-completemigration?view=graph-rest-1.0 Find more info here */ public function post(?CompleteMigrationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CompleteMigrationRequestBuilderPostReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php index c888c213c63..f00b532d054 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function doesUserHaveAccess * @param DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php index 69af649b521..a5d49f3e6aa 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php index 0fd2d703b9b..7d8d39dca08 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teamwork\DeletedTeams\Item\Channels\Item\FilesFolder\Content\ContentRequestBuilder; @@ -42,20 +41,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the metadata for the location where the files of a channel are stored. This API is available in the following national cloud deployments. * @param FilesFolderRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?FilesFolderRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -68,7 +64,6 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -76,6 +71,7 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/Add/AddRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/Add/AddRequestBuilder.php index 32825e9fb9b..7099182b18e 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/Add/AddRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add multiple members in a single request to a team. The response provides details about which memberships could and couldn't be created. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmembers-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/Count/CountRequestBuilder.php index 821eca4b88c..47e8f9f9560 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php index 559c9cf9000..e218ee04f56 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,65 +31,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-delete-members?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/conversationmember-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-members?view=graph-rest-1.0 Find more info here */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the role of a conversationMember in a team or channel. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param ConversationMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmember-update?view=graph-rest-1.0 Find more info here */ public function patch(ConversationMember $body, ?ConversationMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ConversationMemberItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ConversationMember $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/MembersRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/MembersRequestBuilder.php index a89898c3f0d..95ce699563b 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of conversationMembers from a channel. This method supports federation. Only a user who is a member of the shared channel can retrieve the channel member list. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a conversationMember to a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-members?view=graph-rest-1.0 Find more info here */ public function post(ConversationMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ConversationMember $body, ?MembersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Count/CountRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Count/CountRequestBuilder.php index 139bcee312f..21c653cd035 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Count/CountRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Delta/DeltaRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Delta/DeltaRequestBuilder.php index b1292bf356c..88b5ba7bb35 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php index c603f055154..1a64b90b714 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teamwork\DeletedTeams\Item\Channels\Item\Messages\Item\HostedContents\HostedContentsRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property messages for teamwork * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a chatMessage object. With the exception of the policyViolation property, all properties of a chatMessage can be updated in delegated permissions scenarios.Only the policyViolation property of a chatMessage can be updated in application permissions scenarios. The update only works for chats where members are Microsoft Teams users. If one of the participants is using Skype, the operation will fail. This method does not support federation. Only the user in the tenant who sent the message can perform data loss prevention (DLP) updates on the specified chat message. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-update?view=graph-rest-1.0 Find more info here */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php index 4aa03751cc5..bc3d1c304ed 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php index 5874006fb55..ff620b60347 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ChatMessageHostedContentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for teamwork * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 735f1280084..c42bd5a8f17 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index 19f886378d1..5f505640657 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teamwork\DeletedTeams\Item\Channels\Item\Messages\Item\HostedContents\Item\Value\ContentRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for teamwork * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in teamwork * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php index 60ce8c0794a..9874aadeb35 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from teamwork * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in teamwork * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php index 4a24df22704..93c0f41e500 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php index 1e0f19d4e69..d7d6823694d 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php index b25614af114..75031c6926b 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teamwork\DeletedTeams\Item\Channels\Item\Messages\Item\Replies\Item\HostedContents\HostedContentsRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property replies for teamwork * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property replies in teamwork * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php index a304a87243f..fa393de7ab7 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php index 0b0cf991445..3a7a7a26dae 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ChatMessageHostedContentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for teamwork * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 345f821dfa3..b9888974c48 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index 5dfd5c58b39..8a2b58dbe91 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teamwork\DeletedTeams\Item\Channels\Item\Messages\Item\Replies\Item\HostedContents\Item\Value\ContentRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for teamwork * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in teamwork * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php index dd789615de3..fbbcdfe8cf0 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from teamwork * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in teamwork * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php index e9c727fd40b..1a11dd8cd0b 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php index 01f530144b2..1b4b56cdf69 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index f98e7c3e080..5fe2c44e64f 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php index a90f14410c3..41b48aec14e 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php index 80b11baded7..6d3998b82b0 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ChatMessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the replies to a message in a channel of a team. This method lists only the replies of the specified message, if any. To get the message itself, simply call get channel message. This API is available in the following national cloud deployments. * @param RepliesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-replies?view=graph-rest-1.0 Find more info here */ public function get(?RepliesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new reply to a chatMessage in a specified channel. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param RepliesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-messagereply?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?RepliesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?RepliesRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php index f1319f999c7..fbe53546a39 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php index 4667b9285f5..de671e4a43c 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index c8d8daccc66..1b4eb449f08 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php index 47561b9ce2c..41856026522 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/MessagesRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/MessagesRequestBuilder.php index 1dc963f0729..00a1abbbd90 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/MessagesRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Messages/MessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ChatMessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of messages (without the replies) in a channel of a team. To get the replies for a message, call the list message replies or the get message reply API. This method supports federation. To list channel messages in application context, the request must be made from the tenant that the channel owner belongs to (represented by the tenantId property on the channel). This API is available in the following national cloud deployments. * @param MessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?MessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-post-messages?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/chatmessage-post?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?MessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,11 +109,12 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?MessagesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php index acc5f3db2f5..906c74496d0 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProvisionChannelEmailResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Provision an email address for a channel. Microsoft Teams doesn't automatically provision an email address for a channel by default. To have Teams provision an email address, you can call provisionEmail, or through the Teams user interface, select Get email address, which triggers Teams to generate an email address if it has not already provisioned one. To remove the email address of a channel, use the removeEmail method. This API is available in the following national cloud deployments. * @param ProvisionEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-provisionemail?view=graph-rest-1.0 Find more info here */ public function post(?ProvisionEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ProvisionEmailRequestBuilderPostReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php index 08f5b422521..955c4e887ba 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove the email address of a channel. You can remove an email address only if it was provisioned using the provisionEmail method or through the Microsoft Teams client. This API is available in the following national cloud deployments. * @param RemoveEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-removeemail?view=graph-rest-1.0 Find more info here */ public function post(?RemoveEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RemoveEmailRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php index 2f82c9d9ea1..ab84c47cb24 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php index 9a51f9ae881..587b21c0129 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teamwork\DeletedTeams\Item\Channels\Item\SharedWithTeams\Item\AllowedMembers\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of conversationMembers who can access a shared channel. This method does not return the following conversationMembers from the team:- Users with Guest role- Users who are externally authenticated in the tenant This API is available in the following national cloud deployments. * @param AllowedMembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list-allowedmembers?view=graph-rest-1.0 Find more info here */ public function get(?AllowedMembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php index 99e6fe26e2e..9cb382051dd 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php index 4d5a5675428..4949b81c581 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A collection of team members who have access to the shared channel. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php index ed2feffccb4..c119e03101d 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfo; use Microsoft\Graph\Generated\Teamwork\DeletedTeams\Item\Channels\Item\SharedWithTeams\Item\AllowedMembers\AllowedMembersRequestBuilder; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unshare a channel with a team by deleting the corresponding sharedWithChannelTeamInfo resource. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a team that has been shared with a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-get?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sharedWithTeams in teamwork * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SharedWithChannelTeamInfo $body, ?SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?SharedWithChannelTeamInfoItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(SharedWithChannelTeamInfo $body, ?Shar $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php index 72ff7338049..f10c420ac05 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get team from teamwork * @param TeamRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php index 77f86bddb2a..4d35371f947 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfo; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfoCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of teams that has been shared a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithTeamsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithTeamsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sharedWithTeams for teamwork * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithTeamsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SharedWithChannelTeamInfo $body, ?SharedWithTeamsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SharedWithChannelTeamInfo $body, ?Share $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/Count/CountRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/Count/CountRequestBuilder.php index 50fa1c1d35d..e6829142808 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/Count/CountRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php index dd63d001830..eb048b4e2f2 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The application that is linked to the tab. This can't be changed after tab creation. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php index 8e348461ca3..585a232a47f 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; use Microsoft\Graph\Generated\Teamwork\DeletedTeams\Item\Channels\Item\Tabs\Item\TeamsApp\TeamsAppRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Removes (unpins) a tab from the specified channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-delete-tabs?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsTabItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of the specified tab in a channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TeamsTabItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified tab.This can be used to configure the content of the tab. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TeamsTabItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-patch-tabs?view=graph-rest-1.0 Find more info here */ public function patch(TeamsTab $body, ?TeamsTabItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TeamsTabItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TeamsTab $body, ?TeamsTabItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/TabsRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/TabsRequestBuilder.php index a7ff39f7bfd..76066c9e887 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/TabsRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/Channels/Item/Tabs/TabsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; use Microsoft\Graph\Generated\Models\TeamsTabCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of tabs in the specified channel within a team. This API is available in the following national cloud deployments. * @param TabsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TabsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Adds (pins) a tab to the specified channel within a team. The corresponding app must already be installed in the team. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TabsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-tabs?view=graph-rest-1.0 Find more info here */ public function post(TeamsTab $body, ?TabsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsTab $body, ?TabsRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/DeletedTeams/Item/DeletedTeamItemRequestBuilder.php b/src/Generated/Teamwork/DeletedTeams/Item/DeletedTeamItemRequestBuilder.php index 8a9550a97f4..b7ee4a759a2 100644 --- a/src/Generated/Teamwork/DeletedTeams/Item/DeletedTeamItemRequestBuilder.php +++ b/src/Generated/Teamwork/DeletedTeams/Item/DeletedTeamItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeletedTeam; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Teamwork\DeletedTeams\Item\Channels\ChannelsRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deletedTeams for teamwork * @param DeletedTeamItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeletedTeamItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The deleted team. * @param DeletedTeamItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeletedTeamItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeletedTeam::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeletedTeam::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property deletedTeams in teamwork * @param DeletedTeam $body The request body * @param DeletedTeamItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DeletedTeam $body, ?DeletedTeamItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeletedTeam::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeletedTeam::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?DeletedTeamItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?DeletedTeamItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?DeletedTeamItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(DeletedTeam $body, ?DeletedTeamItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/SendActivityNotificationToRecipients/SendActivityNotificationToRecipientsRequestBuilder.php b/src/Generated/Teamwork/SendActivityNotificationToRecipients/SendActivityNotificationToRecipientsRequestBuilder.php index 5f1abb67eca..854d5959140 100644 --- a/src/Generated/Teamwork/SendActivityNotificationToRecipients/SendActivityNotificationToRecipientsRequestBuilder.php +++ b/src/Generated/Teamwork/SendActivityNotificationToRecipients/SendActivityNotificationToRecipientsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Send activity feed notifications to multiple users, in bulk. For more details about sending notifications and the requirements for doing so, seesending Teams activity notifications. This API is available in the following national cloud deployments. * @param SendActivityNotificationToRecipientsPostRequestBody $body The request body * @param SendActivityNotificationToRecipientsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamwork-sendactivitynotificationtorecipients?view=graph-rest-1.0 Find more info here */ public function post(SendActivityNotificationToRecipientsPostRequestBody $body, ?SendActivityNotificationToRecipientsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SendActivityNotificationToRecipientsPos $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/TeamsAppSettings/TeamsAppSettingsRequestBuilder.php b/src/Generated/Teamwork/TeamsAppSettings/TeamsAppSettingsRequestBuilder.php index d610dd626a1..51c1541fc74 100644 --- a/src/Generated/Teamwork/TeamsAppSettings/TeamsAppSettingsRequestBuilder.php +++ b/src/Generated/Teamwork/TeamsAppSettings/TeamsAppSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppSettings; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property teamsAppSettings for teamwork * @param TeamsAppSettingsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TeamsAppSettingsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the tenant-wide teamsAppSettings for all Teams apps in the tenant. This API is available in the following national cloud deployments. * @param TeamsAppSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamsappsettings-get?view=graph-rest-1.0 Find more info here */ public function get(?TeamsAppSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the tenant-wide teamsAppSettings for all Teams apps in the tenant. This API is available in the following national cloud deployments. * @param TeamsAppSettings $body The request body * @param TeamsAppSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamsappsettings-update?view=graph-rest-1.0 Find more info here */ public function patch(TeamsAppSettings $body, ?TeamsAppSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?TeamsAppSettingsRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?TeamsAppSettingsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?TeamsAppSettingsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(TeamsAppSettings $body, ?TeamsAppSetti $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/TeamworkRequestBuilder.php b/src/Generated/Teamwork/TeamworkRequestBuilder.php index 2febf290f04..8ca6b7d3b48 100644 --- a/src/Generated/Teamwork/TeamworkRequestBuilder.php +++ b/src/Generated/Teamwork/TeamworkRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Teamwork; use Microsoft\Graph\Generated\Teamwork\DeletedTeams\DeletedTeamsRequestBuilder; @@ -66,38 +65,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get teamwork * @param TeamworkRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamworkRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Teamwork::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Teamwork::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update teamwork * @param Teamwork $body The request body * @param TeamworkRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Teamwork $body, ?TeamworkRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Teamwork::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Teamwork::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,7 +103,6 @@ public function toGetRequestInformation(?TeamworkRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -118,6 +110,7 @@ public function toGetRequestInformation(?TeamworkRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -132,11 +125,11 @@ public function toPatchRequestInformation(Teamwork $body, ?TeamworkRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/WorkforceIntegrations/Count/CountRequestBuilder.php b/src/Generated/Teamwork/WorkforceIntegrations/Count/CountRequestBuilder.php index 9d1ddc67f9a..09d90b90e3e 100644 --- a/src/Generated/Teamwork/WorkforceIntegrations/Count/CountRequestBuilder.php +++ b/src/Generated/Teamwork/WorkforceIntegrations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Teamwork/WorkforceIntegrations/Item/WorkforceIntegrationItemRequestBuilder.php b/src/Generated/Teamwork/WorkforceIntegrations/Item/WorkforceIntegrationItemRequestBuilder.php index 31969aa1cc0..562b59f1640 100644 --- a/src/Generated/Teamwork/WorkforceIntegrations/Item/WorkforceIntegrationItemRequestBuilder.php +++ b/src/Generated/Teamwork/WorkforceIntegrations/Item/WorkforceIntegrationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkforceIntegration; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an instance of a workforceIntegration. This API is available in the following national cloud deployments. * @param WorkforceIntegrationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workforceintegration-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WorkforceIntegrationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a workforceIntegration object. This API is available in the following national cloud deployments. * @param WorkforceIntegrationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workforceintegration-get?view=graph-rest-1.0 Find more info here */ public function get(?WorkforceIntegrationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkforceIntegration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkforceIntegration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a workforceIntegration object. This API is available in the following national cloud deployments. * @param WorkforceIntegration $body The request body * @param WorkforceIntegrationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workforceintegration-update?view=graph-rest-1.0 Find more info here */ public function patch(WorkforceIntegration $body, ?WorkforceIntegrationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkforceIntegration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkforceIntegration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?WorkforceIntegrationItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?WorkforceIntegrationItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?WorkforceIntegrationItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(WorkforceIntegration $body, ?Workforce $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Teamwork/WorkforceIntegrations/WorkforceIntegrationsRequestBuilder.php b/src/Generated/Teamwork/WorkforceIntegrations/WorkforceIntegrationsRequestBuilder.php index a0a42255269..16ac23c0513 100644 --- a/src/Generated/Teamwork/WorkforceIntegrations/WorkforceIntegrationsRequestBuilder.php +++ b/src/Generated/Teamwork/WorkforceIntegrations/WorkforceIntegrationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WorkforceIntegration; use Microsoft\Graph\Generated\Models\WorkforceIntegrationCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of workforceIntegration objects. This API is available in the following national cloud deployments. * @param WorkforceIntegrationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workforceintegration-list?view=graph-rest-1.0 Find more info here */ public function get(?WorkforceIntegrationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkforceIntegrationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkforceIntegrationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new workforceIntegration object.You can set up which entities you want to receive Shifts synchronous change notifications on and set entities to configure filtering by WFM rules eligibility for, including swap requests. This API is available in the following national cloud deployments. * @param WorkforceIntegration $body The request body * @param WorkforceIntegrationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/workforceintegration-post?view=graph-rest-1.0 Find more info here */ public function post(WorkforceIntegration $body, ?WorkforceIntegrationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WorkforceIntegration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WorkforceIntegration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?WorkforceIntegrationsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?WorkforceIntegrationsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(WorkforceIntegration $body, ?WorkforceI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminCustomers/Count/CountRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminCustomers/Count/CountRequestBuilder.php index f9d3bdece6e..ecfe301b57f 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminCustomers/Count/CountRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminCustomers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminCustomers/DelegatedAdminCustomersRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminCustomers/DelegatedAdminCustomersRequestBuilder.php index 2212a0ed2c7..7e6dc7b00d6 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminCustomers/DelegatedAdminCustomersRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminCustomers/DelegatedAdminCustomersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedAdminCustomer; use Microsoft\Graph\Generated\Models\DelegatedAdminCustomerCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the delegatedAdminCustomer objects and their properties. This API is available in the following national cloud deployments. * @param DelegatedAdminCustomersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tenantrelationship-list-delegatedadmincustomers?view=graph-rest-1.0 Find more info here */ public function get(?DelegatedAdminCustomersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminCustomerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminCustomerCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to delegatedAdminCustomers for tenantRelationships * @param DelegatedAdminCustomer $body The request body * @param DelegatedAdminCustomersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DelegatedAdminCustomer $body, ?DelegatedAdminCustomersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminCustomer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminCustomer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?DelegatedAdminCustomersRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?DelegatedAdminCustomersRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(DelegatedAdminCustomer $body, ?Delegate $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/DelegatedAdminCustomerItemRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/DelegatedAdminCustomerItemRequestBuilder.php index c80ffd40471..991cc0f2041 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/DelegatedAdminCustomerItemRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/DelegatedAdminCustomerItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedAdminCustomer; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\TenantRelationships\DelegatedAdminCustomers\Item\ServiceManagementDetails\ServiceManagementDetailsRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property delegatedAdminCustomers for tenantRelationships * @param DelegatedAdminCustomerItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DelegatedAdminCustomerItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties of a delegatedAdminCustomer object. This API is available in the following national cloud deployments. * @param DelegatedAdminCustomerItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadmincustomer-get?view=graph-rest-1.0 Find more info here */ public function get(?DelegatedAdminCustomerItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminCustomer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminCustomer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property delegatedAdminCustomers in tenantRelationships * @param DelegatedAdminCustomer $body The request body * @param DelegatedAdminCustomerItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DelegatedAdminCustomer $body, ?DelegatedAdminCustomerItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminCustomer::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminCustomer::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?DelegatedAdminCustomerItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?DelegatedAdminCustomerItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?DelegatedAdminCustomerItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(DelegatedAdminCustomer $body, ?Delegat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/ServiceManagementDetails/Count/CountRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/ServiceManagementDetails/Count/CountRequestBuilder.php index 736dba0e360..b2811b8db2f 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/ServiceManagementDetails/Count/CountRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/ServiceManagementDetails/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/ServiceManagementDetails/Item/DelegatedAdminServiceManagementDetailItemRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/ServiceManagementDetails/Item/DelegatedAdminServiceManagementDetailItemRequestBuilder.php index 205c2538cd4..0631a73497f 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/ServiceManagementDetails/Item/DelegatedAdminServiceManagementDetailItemRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/ServiceManagementDetails/Item/DelegatedAdminServiceManagementDetailItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedAdminServiceManagementDetail; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property serviceManagementDetails for tenantRelationships * @param DelegatedAdminServiceManagementDetailItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DelegatedAdminServiceManagementDetailItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Contains the management details of a service in the customer tenant that's managed by delegated administration. * @param DelegatedAdminServiceManagementDetailItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DelegatedAdminServiceManagementDetailItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminServiceManagementDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminServiceManagementDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property serviceManagementDetails in tenantRelationships * @param DelegatedAdminServiceManagementDetail $body The request body * @param DelegatedAdminServiceManagementDetailItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DelegatedAdminServiceManagementDetail $body, ?DelegatedAdminServiceManagementDetailItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminServiceManagementDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminServiceManagementDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DelegatedAdminServiceManagementDetai $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DelegatedAdminServiceManagementDetailIt $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DelegatedAdminServiceManagementDetailIt } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(DelegatedAdminServiceManagementDetail $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/ServiceManagementDetails/ServiceManagementDetailsRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/ServiceManagementDetails/ServiceManagementDetailsRequestBuilder.php index 4d50b2038c6..19b849f81b3 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/ServiceManagementDetails/ServiceManagementDetailsRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminCustomers/Item/ServiceManagementDetails/ServiceManagementDetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedAdminServiceManagementDetail; use Microsoft\Graph\Generated\Models\DelegatedAdminServiceManagementDetailCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the delegatedAdminServiceManagementDetail objects and their properties. This API is available in the following national cloud deployments. * @param ServiceManagementDetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadmincustomer-list-servicemanagementdetails?view=graph-rest-1.0 Find more info here */ public function get(?ServiceManagementDetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminServiceManagementDetailCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminServiceManagementDetailCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to serviceManagementDetails for tenantRelationships * @param DelegatedAdminServiceManagementDetail $body The request body * @param ServiceManagementDetailsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DelegatedAdminServiceManagementDetail $body, ?ServiceManagementDetailsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminServiceManagementDetail::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminServiceManagementDetail::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ServiceManagementDetailsRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ServiceManagementDetailsRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(DelegatedAdminServiceManagementDetail $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Count/CountRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Count/CountRequestBuilder.php index 22992d4ef15..92608bf1a21 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Count/CountRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminRelationships/DelegatedAdminRelationshipsRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminRelationships/DelegatedAdminRelationshipsRequestBuilder.php index ae9ce9dfa9f..23e66f11ce5 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminRelationships/DelegatedAdminRelationshipsRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminRelationships/DelegatedAdminRelationshipsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedAdminRelationship; use Microsoft\Graph\Generated\Models\DelegatedAdminRelationshipCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the delegatedAdminRelationship objects and their properties. This API is available in the following national cloud deployments. * @param DelegatedAdminRelationshipsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tenantrelationship-list-delegatedadminrelationships?view=graph-rest-1.0 Find more info here */ public function get(?DelegatedAdminRelationshipsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new delegatedAdminRelationship object. This API is available in the following national cloud deployments. * @param DelegatedAdminRelationship $body The request body * @param DelegatedAdminRelationshipsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/tenantrelationship-post-delegatedadminrelationships?view=graph-rest-1.0 Find more info here */ public function post(DelegatedAdminRelationship $body, ?DelegatedAdminRelationshipsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationship::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationship::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DelegatedAdminRelationshipsRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DelegatedAdminRelationshipsRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DelegatedAdminRelationship $body, ?Dele $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/AccessAssignments/AccessAssignmentsRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/AccessAssignments/AccessAssignmentsRequestBuilder.php index 8654c6e58ad..7096ef7593f 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/AccessAssignments/AccessAssignmentsRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/AccessAssignments/AccessAssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedAdminAccessAssignment; use Microsoft\Graph\Generated\Models\DelegatedAdminAccessAssignmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the delegatedAdminAccessAssignment objects and their properties. This API is available in the following national cloud deployments. * @param AccessAssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadminrelationship-list-accessassignments?view=graph-rest-1.0 Find more info here */ public function get(?AccessAssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminAccessAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminAccessAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new delegatedAdminAccessAssignment object. This API is available in the following national cloud deployments. * @param DelegatedAdminAccessAssignment $body The request body * @param AccessAssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadminrelationship-post-accessassignments?view=graph-rest-1.0 Find more info here */ public function post(DelegatedAdminAccessAssignment $body, ?AccessAssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminAccessAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminAccessAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AccessAssignmentsRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AccessAssignmentsRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DelegatedAdminAccessAssignment $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/AccessAssignments/Count/CountRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/AccessAssignments/Count/CountRequestBuilder.php index 3424100422a..6c48e1e44d0 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/AccessAssignments/Count/CountRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/AccessAssignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/AccessAssignments/Item/DelegatedAdminAccessAssignmentItemRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/AccessAssignments/Item/DelegatedAdminAccessAssignmentItemRequestBuilder.php index 77d033387af..d1347006651 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/AccessAssignments/Item/DelegatedAdminAccessAssignmentItemRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/AccessAssignments/Item/DelegatedAdminAccessAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedAdminAccessAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a delegatedAdminAccessAssignment object. This API is available in the following national cloud deployments. * @param DelegatedAdminAccessAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadminaccessassignment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DelegatedAdminAccessAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties of a delegatedAdminAccessAssignment object. This API is available in the following national cloud deployments. * @param DelegatedAdminAccessAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadminaccessassignment-get?view=graph-rest-1.0 Find more info here */ public function get(?DelegatedAdminAccessAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminAccessAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminAccessAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a delegatedAdminAccessAssignment object. This API is available in the following national cloud deployments. * @param DelegatedAdminAccessAssignment $body The request body * @param DelegatedAdminAccessAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadminaccessassignment-update?view=graph-rest-1.0 Find more info here */ public function patch(DelegatedAdminAccessAssignment $body, ?DelegatedAdminAccessAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminAccessAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminAccessAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?DelegatedAdminAccessAssignmentItemRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?DelegatedAdminAccessAssignmentItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?DelegatedAdminAccessAssignmentItemReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(DelegatedAdminAccessAssignment $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/DelegatedAdminRelationshipItemRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/DelegatedAdminRelationshipItemRequestBuilder.php index 46cac243c4d..3d009677dd9 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/DelegatedAdminRelationshipItemRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/DelegatedAdminRelationshipItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedAdminRelationship; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\TenantRelationships\DelegatedAdminRelationships\Item\AccessAssignments\AccessAssignmentsRequestBuilder; @@ -58,59 +57,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a delegatedAdminRelationship object. A relationship can only be deleted if it's in the 'created' status. This API is available in the following national cloud deployments. * @param DelegatedAdminRelationshipItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadminrelationship-delete?view=graph-rest-1.0 Find more info here */ public function delete(?DelegatedAdminRelationshipItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties of a delegatedAdminRelationship object. This API is available in the following national cloud deployments. * @param DelegatedAdminRelationshipItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadminrelationship-get?view=graph-rest-1.0 Find more info here */ public function get(?DelegatedAdminRelationshipItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationship::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationship::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update the properties of a delegatedAdminRelationship object. A relationship can only be updated if it's in the created status. This API is available in the following national cloud deployments. + * Update the properties of a delegatedAdminRelationship object. You can only update a relationship when it's in the created status. However, you can update the autoExtendDuration property when the relationship is in either the created or active status. This API is available in the following national cloud deployments. * @param DelegatedAdminRelationship $body The request body * @param DelegatedAdminRelationshipItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadminrelationship-update?view=graph-rest-1.0 Find more info here */ public function patch(DelegatedAdminRelationship $body, ?DelegatedAdminRelationshipItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationship::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationship::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -127,6 +117,7 @@ public function toDeleteRequestInformation(?DelegatedAdminRelationshipItemReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -140,7 +131,6 @@ public function toGetRequestInformation(?DelegatedAdminRelationshipItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -148,11 +138,12 @@ public function toGetRequestInformation(?DelegatedAdminRelationshipItemRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the properties of a delegatedAdminRelationship object. A relationship can only be updated if it's in the created status. This API is available in the following national cloud deployments. + * Update the properties of a delegatedAdminRelationship object. You can only update a relationship when it's in the created status. However, you can update the autoExtendDuration property when the relationship is in either the created or active status. This API is available in the following national cloud deployments. * @param DelegatedAdminRelationship $body The request body * @param DelegatedAdminRelationshipItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -162,11 +153,11 @@ public function toPatchRequestInformation(DelegatedAdminRelationship $body, ?Del $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Operations/Count/CountRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Operations/Count/CountRequestBuilder.php index bb281dd144f..f5c87a66433 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Operations/Item/DelegatedAdminRelationshipOperationItemRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Operations/Item/DelegatedAdminRelationshipOperationItemRequestBuilder.php index a1061afdd14..3b3bf83f265 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Operations/Item/DelegatedAdminRelationshipOperationItemRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Operations/Item/DelegatedAdminRelationshipOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedAdminRelationshipOperation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for tenantRelationships * @param DelegatedAdminRelationshipOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DelegatedAdminRelationshipOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties of a delegatedAdminRelationshipOperation object. This API is available in the following national cloud deployments. * @param DelegatedAdminRelationshipOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadminrelationshipoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?DelegatedAdminRelationshipOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in tenantRelationships * @param DelegatedAdminRelationshipOperation $body The request body * @param DelegatedAdminRelationshipOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DelegatedAdminRelationshipOperation $body, ?DelegatedAdminRelationshipOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?DelegatedAdminRelationshipOperationI $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?DelegatedAdminRelationshipOperationItem $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?DelegatedAdminRelationshipOperationItem } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(DelegatedAdminRelationshipOperation $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Operations/OperationsRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Operations/OperationsRequestBuilder.php index 48c6524298b..70021cd6103 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Operations/OperationsRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedAdminRelationshipOperation; use Microsoft\Graph\Generated\Models\DelegatedAdminRelationshipOperationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the delegatedAdminRelationshipOperation objects and their properties. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadminrelationship-list-operations?view=graph-rest-1.0 Find more info here */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for tenantRelationships * @param DelegatedAdminRelationshipOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DelegatedAdminRelationshipOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(DelegatedAdminRelationshipOperation $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Requests/Count/CountRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Requests/Count/CountRequestBuilder.php index 9a6b02ebca7..557b5272fdc 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Requests/Count/CountRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Requests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Requests/Item/DelegatedAdminRelationshipRequestItemRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Requests/Item/DelegatedAdminRelationshipRequestItemRequestBuilder.php index 89eac4f9cf3..f96ec9292a0 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Requests/Item/DelegatedAdminRelationshipRequestItemRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Requests/Item/DelegatedAdminRelationshipRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedAdminRelationshipRequest; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property requests for tenantRelationships * @param DelegatedAdminRelationshipRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DelegatedAdminRelationshipRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a delegatedAdminRelationshipRequest object. This API is available in the following national cloud deployments. * @param DelegatedAdminRelationshipRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadminrelationshiprequest-get?view=graph-rest-1.0 Find more info here */ public function get(?DelegatedAdminRelationshipRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property requests in tenantRelationships * @param DelegatedAdminRelationshipRequest $body The request body * @param DelegatedAdminRelationshipRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DelegatedAdminRelationshipRequest $body, ?DelegatedAdminRelationshipRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?DelegatedAdminRelationshipRequestIte $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?DelegatedAdminRelationshipRequestItemRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?DelegatedAdminRelationshipRequestItemRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(DelegatedAdminRelationshipRequest $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Requests/RequestsRequestBuilder.php b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Requests/RequestsRequestBuilder.php index 07e7b06f276..fce41d32023 100644 --- a/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Requests/RequestsRequestBuilder.php +++ b/src/Generated/TenantRelationships/DelegatedAdminRelationships/Item/Requests/RequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DelegatedAdminRelationshipRequest; use Microsoft\Graph\Generated\Models\DelegatedAdminRelationshipRequestCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the delegatedAdminRelationshipRequest objects and their properties. This API is available in the following national cloud deployments. * @param RequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadminrelationship-list-requests?view=graph-rest-1.0 Find more info here */ public function get(?RequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new delegatedAdminRelationshipRequest object. This API is available in the following national cloud deployments. * @param DelegatedAdminRelationshipRequest $body The request body * @param RequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/delegatedadminrelationship-post-requests?view=graph-rest-1.0 Find more info here */ public function post(DelegatedAdminRelationshipRequest $body, ?RequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DelegatedAdminRelationshipRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?RequestsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?RequestsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(DelegatedAdminRelationshipRequest $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/FindTenantInformationByDomainNameWithDomainName/FindTenantInformationByDomainNameWithDomainNameRequestBuilder.php b/src/Generated/TenantRelationships/FindTenantInformationByDomainNameWithDomainName/FindTenantInformationByDomainNameWithDomainNameRequestBuilder.php index 2f94cf530c3..ef62d8e37ec 100644 --- a/src/Generated/TenantRelationships/FindTenantInformationByDomainNameWithDomainName/FindTenantInformationByDomainNameWithDomainNameRequestBuilder.php +++ b/src/Generated/TenantRelationships/FindTenantInformationByDomainNameWithDomainName/FindTenantInformationByDomainNameWithDomainNameRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TenantInformation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function findTenantInformationByDomainName * @param FindTenantInformationByDomainNameWithDomainNameRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FindTenantInformationByDomainNameWithDomainNameRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TenantInformation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TenantInformation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?FindTenantInformationByDomainNameWithDo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/FindTenantInformationByTenantIdWithTenantId/FindTenantInformationByTenantIdWithTenantIdRequestBuilder.php b/src/Generated/TenantRelationships/FindTenantInformationByTenantIdWithTenantId/FindTenantInformationByTenantIdWithTenantIdRequestBuilder.php index f52d0171171..6afa1b8d4c7 100644 --- a/src/Generated/TenantRelationships/FindTenantInformationByTenantIdWithTenantId/FindTenantInformationByTenantIdWithTenantIdRequestBuilder.php +++ b/src/Generated/TenantRelationships/FindTenantInformationByTenantIdWithTenantId/FindTenantInformationByTenantIdWithTenantIdRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TenantInformation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -37,19 +36,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function findTenantInformationByTenantId * @param FindTenantInformationByTenantIdWithTenantIdRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?FindTenantInformationByTenantIdWithTenantIdRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TenantInformation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TenantInformation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toGetRequestInformation(?FindTenantInformationByTenantIdWithTena $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/TenantRelationships/TenantRelationshipsRequestBuilder.php b/src/Generated/TenantRelationships/TenantRelationshipsRequestBuilder.php index 217338aa6e6..a8b13d2159a 100644 --- a/src/Generated/TenantRelationships/TenantRelationshipsRequestBuilder.php +++ b/src/Generated/TenantRelationships/TenantRelationshipsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TenantRelationship; use Microsoft\Graph\Generated\TenantRelationships\DelegatedAdminCustomers\DelegatedAdminCustomersRequestBuilder; @@ -70,38 +69,32 @@ public function findTenantInformationByTenantIdWithTenantId(string $tenantId): F /** * Get tenantRelationships * @param TenantRelationshipsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TenantRelationshipsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TenantRelationship::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TenantRelationship::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update tenantRelationships * @param TenantRelationship $body The request body * @param TenantRelationshipsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TenantRelationship $body, ?TenantRelationshipsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TenantRelationship::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TenantRelationship::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -114,7 +107,6 @@ public function toGetRequestInformation(?TenantRelationshipsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +114,7 @@ public function toGetRequestInformation(?TenantRelationshipsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +129,11 @@ public function toPatchRequestInformation(TenantRelationship $body, ?TenantRelat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Count/CountRequestBuilder.php b/src/Generated/Users/Count/CountRequestBuilder.php index 60521c372b3..81c84a96ad6 100644 --- a/src/Generated/Users/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Delta/DeltaRequestBuilder.php index e47f8a1a29f..8b015ee1062 100644 --- a/src/Generated/Users/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php b/src/Generated/Users/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php index ce613d5ea4c..860131a2348 100644 --- a/src/Generated/Users/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php +++ b/src/Generated/Users/GetAvailableExtensionProperties/GetAvailableExtensionPropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all directory extension definitions that have been registered in a directory, including through multi-tenant apps. The following entities support extension properties: This API is available in the following national cloud deployments. * @param GetAvailableExtensionPropertiesPostRequestBody $body The request body * @param GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0 Find more info here */ public function post(GetAvailableExtensionPropertiesPostRequestBody $body, ?GetAvailableExtensionPropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAvailableExtensionPropertiesPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetAvailableExtensionPropertiesPostRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/GetByIds/GetByIdsRequestBuilder.php b/src/Generated/Users/GetByIds/GetByIdsRequestBuilder.php index d7465418569..f2cb50a30c3 100644 --- a/src/Generated/Users/GetByIds/GetByIdsRequestBuilder.php +++ b/src/Generated/Users/GetByIds/GetByIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return the directory objects specified in a list of IDs. Only a subset of user properties are returned by default in v1.0. Some common uses for this function are to: This API is available in the following national cloud deployments. * @param GetByIdsPostRequestBody $body The request body * @param GetByIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getbyids?view=graph-rest-1.0 Find more info here */ public function post(GetByIdsPostRequestBody $body, ?GetByIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetByIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetByIdsPostRequestBody $body, ?GetById $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Activities/ActivitiesRequestBuilder.php b/src/Generated/Users/Item/Activities/ActivitiesRequestBuilder.php index 5ed8c522e0d..a5c356f207f 100644 --- a/src/Generated/Users/Item/Activities/ActivitiesRequestBuilder.php +++ b/src/Generated/Users/Item/Activities/ActivitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserActivity; use Microsoft\Graph\Generated\Models\UserActivityCollectionResponse; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get activities for a given user. Unlike the recent OData function, activities without histories will be returned. The permission UserActivity.ReadWrite.CreatedByApp will apply extra filtering to the response, so that only activities created by your application are returned. This server-side filtering might result in empty pages if the user is particularly active and other applications have created more recent activities. To get your application's activities, use the nextLink property to paginate. This API is available in the following national cloud deployments. * @param ActivitiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/projectrome-get-activities?view=graph-rest-1.0 Find more info here */ public function get(?ActivitiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to activities for users * @param UserActivity $body The request body * @param ActivitiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UserActivity $body, ?ActivitiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?ActivitiesRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?ActivitiesRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(UserActivity $body, ?ActivitiesRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Activities/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Activities/Count/CountRequestBuilder.php index 2da8f0f8268..610bacb0539 100644 --- a/src/Generated/Users/Item/Activities/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Activities/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Activities/Item/HistoryItems/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Activities/Item/HistoryItems/Count/CountRequestBuilder.php index 9a9b0d5c8d6..66c17cd6fd6 100644 --- a/src/Generated/Users/Item/Activities/Item/HistoryItems/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Activities/Item/HistoryItems/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Activities/Item/HistoryItems/HistoryItemsRequestBuilder.php b/src/Generated/Users/Item/Activities/Item/HistoryItems/HistoryItemsRequestBuilder.php index cbb01888932..847df7aeaef 100644 --- a/src/Generated/Users/Item/Activities/Item/HistoryItems/HistoryItemsRequestBuilder.php +++ b/src/Generated/Users/Item/Activities/Item/HistoryItems/HistoryItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ActivityHistoryItem; use Microsoft\Graph\Generated\Models\ActivityHistoryItemCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Optional. NavigationProperty/Containment; navigation property to the activity's historyItems. * @param HistoryItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?HistoryItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ActivityHistoryItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ActivityHistoryItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to historyItems for users * @param ActivityHistoryItem $body The request body * @param HistoryItemsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ActivityHistoryItem $body, ?HistoryItemsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ActivityHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ActivityHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?HistoryItemsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?HistoryItemsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ActivityHistoryItem $body, ?HistoryItem $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Activities/Item/HistoryItems/Item/Activity/ActivityRequestBuilder.php b/src/Generated/Users/Item/Activities/Item/HistoryItems/Item/Activity/ActivityRequestBuilder.php index efce90d18d9..ab6ecf1efb9 100644 --- a/src/Generated/Users/Item/Activities/Item/HistoryItems/Item/Activity/ActivityRequestBuilder.php +++ b/src/Generated/Users/Item/Activities/Item/HistoryItems/Item/Activity/ActivityRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserActivity; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Optional. NavigationProperty/Containment; navigation property to the associated activity. * @param ActivityRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivityRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ActivityRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ActivityRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Activities/Item/HistoryItems/Item/ActivityHistoryItemItemRequestBuilder.php b/src/Generated/Users/Item/Activities/Item/HistoryItems/Item/ActivityHistoryItemItemRequestBuilder.php index 596f4704bda..975939df9da 100644 --- a/src/Generated/Users/Item/Activities/Item/HistoryItems/Item/ActivityHistoryItemItemRequestBuilder.php +++ b/src/Generated/Users/Item/Activities/Item/HistoryItems/Item/ActivityHistoryItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ActivityHistoryItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Activities\Item\HistoryItems\Item\Activity\ActivityRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property historyItems for users * @param ActivityHistoryItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ActivityHistoryItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Optional. NavigationProperty/Containment; navigation property to the activity's historyItems. * @param ActivityHistoryItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ActivityHistoryItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ActivityHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ActivityHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Delete an existing history item for an existing user activity. This API is available in the following national cloud deployments. * @param ActivityHistoryItem $body The request body * @param ActivityHistoryItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/projectrome-delete-historyitem?view=graph-rest-1.0 Find more info here */ public function patch(ActivityHistoryItem $body, ?ActivityHistoryItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ActivityHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ActivityHistoryItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ActivityHistoryItemItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ActivityHistoryItemItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ActivityHistoryItemItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ActivityHistoryItem $body, ?ActivityHi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Activities/Item/UserActivityItemRequestBuilder.php b/src/Generated/Users/Item/Activities/Item/UserActivityItemRequestBuilder.php index d6fd885c9a3..a69fe154d52 100644 --- a/src/Generated/Users/Item/Activities/Item/UserActivityItemRequestBuilder.php +++ b/src/Generated/Users/Item/Activities/Item/UserActivityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserActivity; use Microsoft\Graph\Generated\Users\Item\Activities\Item\HistoryItems\HistoryItemsRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an existing user activity for your app. This API is available in the following national cloud deployments. * @param UserActivityItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/projectrome-delete-activity?view=graph-rest-1.0 Find more info here */ public function delete(?UserActivityItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The user's activities across devices. Read-only. Nullable. * @param UserActivityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UserActivityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property activities in users * @param UserActivity $body The request body * @param UserActivityItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserActivity $body, ?UserActivityItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?UserActivityItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?UserActivityItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?UserActivityItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(UserActivity $body, ?UserActivityItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Activities/Recent/RecentRequestBuilder.php b/src/Generated/Users/Item/Activities/Recent/RecentRequestBuilder.php index 1f6f1a0236e..ef601c5d1e8 100644 --- a/src/Generated/Users/Item/Activities/Recent/RecentRequestBuilder.php +++ b/src/Generated/Users/Item/Activities/Recent/RecentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get recent activities for a given user. This OData function has some default behaviors included to make it operate like a 'most recently used' API. The service queries for the most recent historyItems, and then pull those related activities. Activities are sorted according to the most recent lastModified on the historyItem. This means that activities without historyItems won't be included in the response. The UserActivity.ReadWrite.CreatedByApp permission will also apply extra filtering to the response, so that only activities created by your application are returned. This server-side filtering might result in empty pages if the user is active and other applications have created more recent activities. To get your application's activities, use the nextLink property to paginate. This API is available in the following national cloud deployments. * @param RecentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/projectrome-get-recent-activities?view=graph-rest-1.0 Find more info here */ public function get(?RecentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RecentGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RecentGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?RecentRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?RecentRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/AgreementAcceptances/AgreementAcceptancesRequestBuilder.php b/src/Generated/Users/Item/AgreementAcceptances/AgreementAcceptancesRequestBuilder.php index af5e017e18d..c34953f6935 100644 --- a/src/Generated/Users/Item/AgreementAcceptances/AgreementAcceptancesRequestBuilder.php +++ b/src/Generated/Users/Item/AgreementAcceptances/AgreementAcceptancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AgreementAcceptanceCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\AgreementAcceptances\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the signed-in user's agreementAcceptance objects. This API is available in the following national cloud deployments. * @param AgreementAcceptancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-agreementacceptances?view=graph-rest-1.0 Find more info here */ public function get(?AgreementAcceptancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptanceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?AgreementAcceptancesRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?AgreementAcceptancesRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/AgreementAcceptances/Count/CountRequestBuilder.php b/src/Generated/Users/Item/AgreementAcceptances/Count/CountRequestBuilder.php index ba11530ca4b..7f0e0c26c64 100644 --- a/src/Generated/Users/Item/AgreementAcceptances/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/AgreementAcceptances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/AgreementAcceptances/Item/AgreementAcceptanceItemRequestBuilder.php b/src/Generated/Users/Item/AgreementAcceptances/Item/AgreementAcceptanceItemRequestBuilder.php index efb3a90bf17..45ef045c0c4 100644 --- a/src/Generated/Users/Item/AgreementAcceptances/Item/AgreementAcceptanceItemRequestBuilder.php +++ b/src/Generated/Users/Item/AgreementAcceptances/Item/AgreementAcceptanceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AgreementAcceptance; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The user's terms of use acceptance statuses. Read-only. Nullable. * @param AgreementAcceptanceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AgreementAcceptanceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AgreementAcceptance::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?AgreementAcceptanceItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?AgreementAcceptanceItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/AppRoleAssignments/AppRoleAssignmentsRequestBuilder.php b/src/Generated/Users/Item/AppRoleAssignments/AppRoleAssignmentsRequestBuilder.php index dcdf5a218de..13ab9a88205 100644 --- a/src/Generated/Users/Item/AppRoleAssignments/AppRoleAssignmentsRequestBuilder.php +++ b/src/Generated/Users/Item/AppRoleAssignments/AppRoleAssignmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\AppRoleAssignmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents the app roles a user has been granted for an application. Supports $expand. * @param AppRoleAssignmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-approleassignments?view=graph-rest-1.0 Find more info here */ public function get(?AppRoleAssignmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to assign an app role to a user. To grant an app role assignment to a user, you need three identifiers: This API is available in the following national cloud deployments. * @param AppRoleAssignment $body The request body * @param AppRoleAssignmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-post-approleassignments?view=graph-rest-1.0 Find more info here */ public function post(AppRoleAssignment $body, ?AppRoleAssignmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?AppRoleAssignmentsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?AppRoleAssignmentsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(AppRoleAssignment $body, ?AppRoleAssign $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/AppRoleAssignments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/AppRoleAssignments/Count/CountRequestBuilder.php index f868f9f0186..421899abbab 100644 --- a/src/Generated/Users/Item/AppRoleAssignments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/AppRoleAssignments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/AppRoleAssignments/Item/AppRoleAssignmentItemRequestBuilder.php b/src/Generated/Users/Item/AppRoleAssignments/Item/AppRoleAssignmentItemRequestBuilder.php index b6386408f8a..f79f3759622 100644 --- a/src/Generated/Users/Item/AppRoleAssignments/Item/AppRoleAssignmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/AppRoleAssignments/Item/AppRoleAssignmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an appRoleAssignment that has been granted to a user. This API is available in the following national cloud deployments. * @param AppRoleAssignmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-delete-approleassignments?view=graph-rest-1.0 Find more info here */ public function delete(?AppRoleAssignmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the app roles a user has been granted for an application. Supports $expand. * @param AppRoleAssignmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AppRoleAssignmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property appRoleAssignments in users * @param AppRoleAssignment $body The request body * @param AppRoleAssignmentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AppRoleAssignment $body, ?AppRoleAssignmentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?AppRoleAssignmentItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?AppRoleAssignmentItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?AppRoleAssignmentItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(AppRoleAssignment $body, ?AppRoleAssig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/AssignLicense/AssignLicenseRequestBuilder.php b/src/Generated/Users/Item/AssignLicense/AssignLicenseRequestBuilder.php index 7da9438eafb..f60be882ba9 100644 --- a/src/Generated/Users/Item/AssignLicense/AssignLicenseRequestBuilder.php +++ b/src/Generated/Users/Item/AssignLicense/AssignLicenseRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add or remove subscriptions for the user. You can also enable and disable specific plans associated with a subscription. This API is available in the following national cloud deployments. * @param AssignLicensePostRequestBody $body The request body * @param AssignLicenseRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-assignlicense?view=graph-rest-1.0 Find more info here */ public function post(AssignLicensePostRequestBody $body, ?AssignLicenseRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(AssignLicensePostRequestBody $body, ?As $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/AuthenticationRequestBuilder.php b/src/Generated/Users/Item/Authentication/AuthenticationRequestBuilder.php index 0d1d1d51431..4016191bbe1 100644 --- a/src/Generated/Users/Item/Authentication/AuthenticationRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/AuthenticationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Authentication; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Authentication\EmailMethods\EmailMethodsRequestBuilder; @@ -114,56 +113,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property authentication for users * @param AuthenticationRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AuthenticationRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The authentication methods that are supported for the user. * @param AuthenticationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AuthenticationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Authentication::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Authentication::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property authentication in users * @param Authentication $body The request body * @param AuthenticationRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Authentication $body, ?AuthenticationRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Authentication::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Authentication::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -180,6 +170,7 @@ public function toDeleteRequestInformation(?AuthenticationRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -193,7 +184,6 @@ public function toGetRequestInformation(?AuthenticationRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -201,6 +191,7 @@ public function toGetRequestInformation(?AuthenticationRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -215,11 +206,11 @@ public function toPatchRequestInformation(Authentication $body, ?AuthenticationR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/EmailMethods/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Authentication/EmailMethods/Count/CountRequestBuilder.php index ba6dec4b7b3..a5b4666f9a2 100644 --- a/src/Generated/Users/Item/Authentication/EmailMethods/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/EmailMethods/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/EmailMethods/EmailMethodsRequestBuilder.php b/src/Generated/Users/Item/Authentication/EmailMethods/EmailMethodsRequestBuilder.php index 5da8a889e9a..41515b25efb 100644 --- a/src/Generated/Users/Item/Authentication/EmailMethods/EmailMethodsRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/EmailMethods/EmailMethodsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EmailAuthenticationMethod; use Microsoft\Graph\Generated\Models\EmailAuthenticationMethodCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of a user's emailAuthenticationMethod objects and their properties. This API will return only a single object in the collection as only one email method can be set for a user. This API is available in the following national cloud deployments. * @param EmailMethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authentication-list-emailmethods?view=graph-rest-1.0 Find more info here */ public function get(?EmailMethodsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EmailAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EmailAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Set a user's emailAuthenticationMethod object. Email authentication is a self-service password reset method. A user may only have one email authentication method. This API is available in the following national cloud deployments. * @param EmailAuthenticationMethod $body The request body * @param EmailMethodsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authentication-post-emailmethods?view=graph-rest-1.0 Find more info here */ public function post(EmailAuthenticationMethod $body, ?EmailMethodsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EmailAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EmailAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?EmailMethodsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?EmailMethodsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(EmailAuthenticationMethod $body, ?Email $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/EmailMethods/Item/EmailAuthenticationMethodItemRequestBuilder.php b/src/Generated/Users/Item/Authentication/EmailMethods/Item/EmailAuthenticationMethodItemRequestBuilder.php index 5098d4fa61a..53b54e88c35 100644 --- a/src/Generated/Users/Item/Authentication/EmailMethods/Item/EmailAuthenticationMethodItemRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/EmailMethods/Item/EmailAuthenticationMethodItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EmailAuthenticationMethod; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a user's emailAuthenticationMethod object. This API is available in the following national cloud deployments. * @param EmailAuthenticationMethodItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/emailauthenticationmethod-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EmailAuthenticationMethodItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a user's single email authentication method object. This API is available in the following national cloud deployments. * @param EmailAuthenticationMethodItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/emailauthenticationmethod-get?view=graph-rest-1.0 Find more info here */ public function get(?EmailAuthenticationMethodItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EmailAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EmailAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a user's email address represented by an emailAuthenticationMethod object. This API is available in the following national cloud deployments. * @param EmailAuthenticationMethod $body The request body * @param EmailAuthenticationMethodItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/emailauthenticationmethod-update?view=graph-rest-1.0 Find more info here */ public function patch(EmailAuthenticationMethod $body, ?EmailAuthenticationMethodItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EmailAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EmailAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?EmailAuthenticationMethodItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?EmailAuthenticationMethodItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?EmailAuthenticationMethodItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(EmailAuthenticationMethod $body, ?Emai $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/Fido2Methods/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Authentication/Fido2Methods/Count/CountRequestBuilder.php index bb833825bd9..1958d7e1f14 100644 --- a/src/Generated/Users/Item/Authentication/Fido2Methods/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/Fido2Methods/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/Fido2Methods/Fido2MethodsRequestBuilder.php b/src/Generated/Users/Item/Authentication/Fido2Methods/Fido2MethodsRequestBuilder.php index 1c87f876736..b940ea81a76 100644 --- a/src/Generated/Users/Item/Authentication/Fido2Methods/Fido2MethodsRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/Fido2Methods/Fido2MethodsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Fido2AuthenticationMethodCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Authentication\Fido2Methods\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of a user's FIDO2 Security Key Authentication Method objects and their properties. This API is available in the following national cloud deployments. * @param Fido2MethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/fido2authenticationmethod-list?view=graph-rest-1.0 Find more info here */ public function get(?Fido2MethodsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Fido2AuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Fido2AuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?Fido2MethodsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?Fido2MethodsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/Fido2Methods/Item/Fido2AuthenticationMethodItemRequestBuilder.php b/src/Generated/Users/Item/Authentication/Fido2Methods/Item/Fido2AuthenticationMethodItemRequestBuilder.php index 1c44b833b92..d1290718390 100644 --- a/src/Generated/Users/Item/Authentication/Fido2Methods/Item/Fido2AuthenticationMethodItemRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/Fido2Methods/Item/Fido2AuthenticationMethodItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Fido2AuthenticationMethod; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,39 +33,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a user's FIDO2 Security Key Authentication Method object. This API is available in the following national cloud deployments. * @param Fido2AuthenticationMethodItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/fido2authenticationmethod-delete?view=graph-rest-1.0 Find more info here */ public function delete(?Fido2AuthenticationMethodItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a user's single FIDO2 Security Key Authentication Method object. This API is available in the following national cloud deployments. * @param Fido2AuthenticationMethodItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/fido2authenticationmethod-get?view=graph-rest-1.0 Find more info here */ public function get(?Fido2AuthenticationMethodItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Fido2AuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Fido2AuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +76,7 @@ public function toDeleteRequestInformation(?Fido2AuthenticationMethodItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -96,7 +90,6 @@ public function toGetRequestInformation(?Fido2AuthenticationMethodItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -104,6 +97,7 @@ public function toGetRequestInformation(?Fido2AuthenticationMethodItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/Methods/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Authentication/Methods/Count/CountRequestBuilder.php index 5aeefa0170f..f90d0288171 100644 --- a/src/Generated/Users/Item/Authentication/Methods/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/Methods/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/Methods/Item/AuthenticationMethodItemRequestBuilder.php b/src/Generated/Users/Item/Authentication/Methods/Item/AuthenticationMethodItemRequestBuilder.php index 77e32b05c83..b872bb284f8 100644 --- a/src/Generated/Users/Item/Authentication/Methods/Item/AuthenticationMethodItemRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/Methods/Item/AuthenticationMethodItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationMethod; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Authentication\Methods\Item\ResetPassword\ResetPasswordRequestBuilder; @@ -42,39 +41,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of an authenticationMethod object. This API is available in the following national cloud deployments. * @param AuthenticationMethodItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationmethod-get?view=graph-rest-1.0 Find more info here */ public function get(?AuthenticationMethodItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property methods in users * @param AuthenticationMethod $body The request body * @param AuthenticationMethodItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AuthenticationMethod $body, ?AuthenticationMethodItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -87,7 +80,6 @@ public function toGetRequestInformation(?AuthenticationMethodItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -95,6 +87,7 @@ public function toGetRequestInformation(?AuthenticationMethodItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -109,11 +102,11 @@ public function toPatchRequestInformation(AuthenticationMethod $body, ?Authentic $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/Methods/Item/ResetPassword/ResetPasswordRequestBuilder.php b/src/Generated/Users/Item/Authentication/Methods/Item/ResetPassword/ResetPasswordRequestBuilder.php index 0929f5d7eed..0539d4ba5a3 100644 --- a/src/Generated/Users/Item/Authentication/Methods/Item/ResetPassword/ResetPasswordRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/Methods/Item/ResetPassword/ResetPasswordRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PasswordResetResponse; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,27 +31,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Reset a user's password, represented by a password authentication method object. This can only be done by an administrator with appropriate permissions and cannot be performed on a user's own account. This flow writes the new password to Azure Active Directory and pushes it to on-premises Active Directory if configured using password writeback. The admin can either provide a new password or have the system generate one. The user is prompted to change their password on their next sign in. This reset is a long-running operation and returns a Location header with a link where the caller can periodically check for the status of the reset operation. This API is available in the following national cloud deployments. + * Reset a user's password, represented by a password authentication method object. This can only be done by an administrator with appropriate permissions and can't be performed on a user's own account. This flow writes the new password to Microsoft Entra ID and pushes it to on-premises Active Directory if configured using password writeback. The admin can either provide a new password or have the system generate one. The user is prompted to change their password on their next sign in. This reset is a long-running operation and returns a Location header with a link where the caller can periodically check for the status of the reset operation. This API is available in the following national cloud deployments. * @param ResetPasswordPostRequestBody $body The request body * @param ResetPasswordRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authenticationmethod-resetpassword?view=graph-rest-1.0 Find more info here */ public function post(ResetPasswordPostRequestBody $body, ?ResetPasswordRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PasswordResetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PasswordResetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Reset a user's password, represented by a password authentication method object. This can only be done by an administrator with appropriate permissions and cannot be performed on a user's own account. This flow writes the new password to Azure Active Directory and pushes it to on-premises Active Directory if configured using password writeback. The admin can either provide a new password or have the system generate one. The user is prompted to change their password on their next sign in. This reset is a long-running operation and returns a Location header with a link where the caller can periodically check for the status of the reset operation. This API is available in the following national cloud deployments. + * Reset a user's password, represented by a password authentication method object. This can only be done by an administrator with appropriate permissions and can't be performed on a user's own account. This flow writes the new password to Microsoft Entra ID and pushes it to on-premises Active Directory if configured using password writeback. The admin can either provide a new password or have the system generate one. The user is prompted to change their password on their next sign in. This reset is a long-running operation and returns a Location header with a link where the caller can periodically check for the status of the reset operation. This API is available in the following national cloud deployments. * @param ResetPasswordPostRequestBody $body The request body * @param ResetPasswordRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -62,11 +58,11 @@ public function toPostRequestInformation(ResetPasswordPostRequestBody $body, ?Re $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/Methods/MethodsRequestBuilder.php b/src/Generated/Users/Item/Authentication/Methods/MethodsRequestBuilder.php index 4d8fcf33cc0..ff3fe7fcc75 100644 --- a/src/Generated/Users/Item/Authentication/Methods/MethodsRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/Methods/MethodsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AuthenticationMethod; use Microsoft\Graph\Generated\Models\AuthenticationMethodCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve a list of authentication methods registered to a user. The authentication methods are defined by the types derived from the authenticationMethod resource type, and only the methods supported on this API version. See Azure AD authentication methods API overview for a list of currently supported methods. This API is available in the following national cloud deployments. + * Retrieve a list of authentication methods registered to a user. The authentication methods are defined by the types derived from the authenticationMethod resource type, and only the methods supported on this API version. See Microsoft Entra authentication methods API overview for a list of currently supported methods. We don't recommend using the authentication methods APIs for scenarios where you need to iterate over your entire user population for auditing or security check purposes. For these types of scenarios, we recommend using the authentication method registration and usage reporting APIs (available on the beta endpoint only). This API is available in the following national cloud deployments. * @param MethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authentication-list-methods?view=graph-rest-1.0 Find more info here */ public function get(?MethodsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to methods for users * @param AuthenticationMethod $body The request body * @param MethodsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AuthenticationMethod $body, ?MethodsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve a list of authentication methods registered to a user. The authentication methods are defined by the types derived from the authenticationMethod resource type, and only the methods supported on this API version. See Azure AD authentication methods API overview for a list of currently supported methods. This API is available in the following national cloud deployments. + * Retrieve a list of authentication methods registered to a user. The authentication methods are defined by the types derived from the authenticationMethod resource type, and only the methods supported on this API version. See Microsoft Entra authentication methods API overview for a list of currently supported methods. We don't recommend using the authentication methods APIs for scenarios where you need to iterate over your entire user population for auditing or security check purposes. For these types of scenarios, we recommend using the authentication method registration and usage reporting APIs (available on the beta endpoint only). This API is available in the following national cloud deployments. * @param MethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?MethodsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?MethodsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AuthenticationMethod $body, ?MethodsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/Methods/MethodsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/Authentication/Methods/MethodsRequestBuilderGetQueryParameters.php index 0b8e0338fff..e4280701ecd 100644 --- a/src/Generated/Users/Item/Authentication/Methods/MethodsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/Authentication/Methods/MethodsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve a list of authentication methods registered to a user. The authentication methods are defined by the types derived from the authenticationMethod resource type, and only the methods supported on this API version. See Azure AD authentication methods API overview for a list of currently supported methods. This API is available in the following national cloud deployments. + * Retrieve a list of authentication methods registered to a user. The authentication methods are defined by the types derived from the authenticationMethod resource type, and only the methods supported on this API version. See Microsoft Entra authentication methods API overview for a list of currently supported methods. We don't recommend using the authentication methods APIs for scenarios where you need to iterate over your entire user population for auditing or security check purposes. For these types of scenarios, we recommend using the authentication method registration and usage reporting APIs (available on the beta endpoint only). This API is available in the following national cloud deployments. */ class MethodsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/Count/CountRequestBuilder.php index b70915d6cd0..8b190dcfa64 100644 --- a/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/Item/Device/DeviceRequestBuilder.php b/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/Item/Device/DeviceRequestBuilder.php index 12150ac389e..e389f727f8b 100644 --- a/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/Item/Device/DeviceRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/Item/Device/DeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Device; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The registered device on which Microsoft Authenticator resides. This property is null if the device isn't registered for passwordless Phone Sign-In. * @param DeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeviceRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeviceRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/Item/MicrosoftAuthenticatorAuthenticationMethodItemRequestBuilder.php b/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/Item/MicrosoftAuthenticatorAuthenticationMethodItemRequestBuilder.php index fa250231955..ac736cd73b4 100644 --- a/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/Item/MicrosoftAuthenticatorAuthenticationMethodItemRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/Item/MicrosoftAuthenticatorAuthenticationMethodItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MicrosoftAuthenticatorAuthenticationMethod; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Authentication\MicrosoftAuthenticatorMethods\Item\Device\DeviceRequestBuilder; @@ -42,39 +41,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a microsoftAuthenticatorAuthenticationMethod object. This API is available in the following national cloud deployments. * @param MicrosoftAuthenticatorAuthenticationMethodItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/microsoftauthenticatorauthenticationmethod-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MicrosoftAuthenticatorAuthenticationMethodItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a microsoftAuthenticatorAuthenticationMethod object. This API is available in the following national cloud deployments. * @param MicrosoftAuthenticatorAuthenticationMethodItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/microsoftauthenticatorauthenticationmethod-get?view=graph-rest-1.0 Find more info here */ public function get(?MicrosoftAuthenticatorAuthenticationMethodItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MicrosoftAuthenticatorAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MicrosoftAuthenticatorAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -91,6 +84,7 @@ public function toDeleteRequestInformation(?MicrosoftAuthenticatorAuthentication $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -104,7 +98,6 @@ public function toGetRequestInformation(?MicrosoftAuthenticatorAuthenticationMet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -112,6 +105,7 @@ public function toGetRequestInformation(?MicrosoftAuthenticatorAuthenticationMet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/MicrosoftAuthenticatorMethodsRequestBuilder.php b/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/MicrosoftAuthenticatorMethodsRequestBuilder.php index b3825a921aa..d1d4a4e1677 100644 --- a/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/MicrosoftAuthenticatorMethodsRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/MicrosoftAuthenticatorMethods/MicrosoftAuthenticatorMethodsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MicrosoftAuthenticatorAuthenticationMethodCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Authentication\MicrosoftAuthenticatorMethods\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the microsoftAuthenticatorAuthenticationMethod objects and their properties. This API is available in the following national cloud deployments. * @param MicrosoftAuthenticatorMethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/microsoftauthenticatorauthenticationmethod-list?view=graph-rest-1.0 Find more info here */ public function get(?MicrosoftAuthenticatorMethodsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MicrosoftAuthenticatorAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MicrosoftAuthenticatorAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?MicrosoftAuthenticatorMethodsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?MicrosoftAuthenticatorMethodsRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/Operations/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Authentication/Operations/Count/CountRequestBuilder.php index ccc3f4c034f..be19b35fd75 100644 --- a/src/Generated/Users/Item/Authentication/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/Operations/Item/LongRunningOperationItemRequestBuilder.php b/src/Generated/Users/Item/Authentication/Operations/Item/LongRunningOperationItemRequestBuilder.php index 2af4c8bcbc1..9bd8dddeea3 100644 --- a/src/Generated/Users/Item/Authentication/Operations/Item/LongRunningOperationItemRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/Operations/Item/LongRunningOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LongRunningOperation; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for users * @param LongRunningOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LongRunningOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the status of a long-running operation, represented by a longRunningOperation object. A long-running operation is initiated when you reset a user's password. This resource type is also the base type for the richLongRunningOperation object that represents the status of a long-running operation on a site or a list. The possible states of the long-running operation are notStarted, running, succeeded, failed, unknownFutureValue where succeeded and failed are terminal states. This API is available in the following national cloud deployments. * @param LongRunningOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/longrunningoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?LongRunningOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in users * @param LongRunningOperation $body The request body * @param LongRunningOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(LongRunningOperation $body, ?LongRunningOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?LongRunningOperationItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?LongRunningOperationItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?LongRunningOperationItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(LongRunningOperation $body, ?LongRunni $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/Operations/OperationsRequestBuilder.php b/src/Generated/Users/Item/Authentication/Operations/OperationsRequestBuilder.php index 7ca9bbbc3ed..711d2608abe 100644 --- a/src/Generated/Users/Item/Authentication/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LongRunningOperation; use Microsoft\Graph\Generated\Models\LongRunningOperationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the status of a long-running operation, represented by a longRunningOperation object. A long-running operation is initiated when you reset a user's password. This resource type is also the base type for the richLongRunningOperation object that represents the status of a long-running operation on a site or a list. The possible states of the long-running operation are notStarted, running, succeeded, failed, unknownFutureValue where succeeded and failed are terminal states. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LongRunningOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for users * @param LongRunningOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LongRunningOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LongRunningOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(LongRunningOperation $body, ?Operations $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/PasswordMethods/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Authentication/PasswordMethods/Count/CountRequestBuilder.php index 56580594dbe..f09d54deec9 100644 --- a/src/Generated/Users/Item/Authentication/PasswordMethods/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/PasswordMethods/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/PasswordMethods/Item/PasswordAuthenticationMethodItemRequestBuilder.php b/src/Generated/Users/Item/Authentication/PasswordMethods/Item/PasswordAuthenticationMethodItemRequestBuilder.php index 542748899b7..48ab4d42cff 100644 --- a/src/Generated/Users/Item/Authentication/PasswordMethods/Item/PasswordAuthenticationMethodItemRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/PasswordMethods/Item/PasswordAuthenticationMethodItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PasswordAuthenticationMethod; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a password that's registered to a user, represented by a passwordAuthenticationMethod object. For security, the password itself will never be returned in the object and the password property is always null. This API is available in the following national cloud deployments. * @param PasswordAuthenticationMethodItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/passwordauthenticationmethod-get?view=graph-rest-1.0 Find more info here */ public function get(?PasswordAuthenticationMethodItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PasswordAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PasswordAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?PasswordAuthenticationMethodItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?PasswordAuthenticationMethodItemRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/PasswordMethods/PasswordMethodsRequestBuilder.php b/src/Generated/Users/Item/Authentication/PasswordMethods/PasswordMethodsRequestBuilder.php index 1646026292f..a3a435010a5 100644 --- a/src/Generated/Users/Item/Authentication/PasswordMethods/PasswordMethodsRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/PasswordMethods/PasswordMethodsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PasswordAuthenticationMethod; use Microsoft\Graph\Generated\Models\PasswordAuthenticationMethodCollectionResponse; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve a list of the passwords registered to a user, represented by a passwordAuthenticationMethod object. This will return exactly one object, as a user can have exactly one password. For security, the password itself will never be returned in the object and the password property is always null. This API is available in the following national cloud deployments. + * Retrieve a list of the passwords registered to a user, represented by a passwordAuthenticationMethod object. This API returns exactly one object, as a user can have exactly one password. For security, the password itself will never be returned in the object and the password property is always null. This API is available in the following national cloud deployments. * @param PasswordMethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authentication-list-passwordmethods?view=graph-rest-1.0 Find more info here */ public function get(?PasswordMethodsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PasswordAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PasswordAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to passwordMethods for users * @param PasswordAuthenticationMethod $body The request body * @param PasswordMethodsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PasswordAuthenticationMethod $body, ?PasswordMethodsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PasswordAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PasswordAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve a list of the passwords registered to a user, represented by a passwordAuthenticationMethod object. This will return exactly one object, as a user can have exactly one password. For security, the password itself will never be returned in the object and the password property is always null. This API is available in the following national cloud deployments. + * Retrieve a list of the passwords registered to a user, represented by a passwordAuthenticationMethod object. This API returns exactly one object, as a user can have exactly one password. For security, the password itself will never be returned in the object and the password property is always null. This API is available in the following national cloud deployments. * @param PasswordMethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?PasswordMethodsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?PasswordMethodsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PasswordAuthenticationMethod $body, ?Pa $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/PasswordMethods/PasswordMethodsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/Authentication/PasswordMethods/PasswordMethodsRequestBuilderGetQueryParameters.php index a86fe8cb5c8..6736d0422eb 100644 --- a/src/Generated/Users/Item/Authentication/PasswordMethods/PasswordMethodsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/Authentication/PasswordMethods/PasswordMethodsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve a list of the passwords registered to a user, represented by a passwordAuthenticationMethod object. This will return exactly one object, as a user can have exactly one password. For security, the password itself will never be returned in the object and the password property is always null. This API is available in the following national cloud deployments. + * Retrieve a list of the passwords registered to a user, represented by a passwordAuthenticationMethod object. This API returns exactly one object, as a user can have exactly one password. For security, the password itself will never be returned in the object and the password property is always null. This API is available in the following national cloud deployments. */ class PasswordMethodsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/Authentication/PhoneMethods/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Authentication/PhoneMethods/Count/CountRequestBuilder.php index e3c8e105d8e..d88c593a712 100644 --- a/src/Generated/Users/Item/Authentication/PhoneMethods/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/PhoneMethods/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/PhoneMethods/Item/DisableSmsSignIn/DisableSmsSignInRequestBuilder.php b/src/Generated/Users/Item/Authentication/PhoneMethods/Item/DisableSmsSignIn/DisableSmsSignInRequestBuilder.php index f707de5be18..a5e77d1b9ee 100644 --- a/src/Generated/Users/Item/Authentication/PhoneMethods/Item/DisableSmsSignIn/DisableSmsSignInRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/PhoneMethods/Item/DisableSmsSignIn/DisableSmsSignInRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Disable SMS sign-in for an existing mobile phone number registered to a user. The number will no longer be available for SMS sign-in, which can prevent your user from signing in. This API is available in the following national cloud deployments. * @param DisableSmsSignInRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/phoneauthenticationmethod-disablesmssignin?view=graph-rest-1.0 Find more info here */ public function post(?DisableSmsSignInRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DisableSmsSignInRequestBuilderPostRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/PhoneMethods/Item/EnableSmsSignIn/EnableSmsSignInRequestBuilder.php b/src/Generated/Users/Item/Authentication/PhoneMethods/Item/EnableSmsSignIn/EnableSmsSignInRequestBuilder.php index 4141e7929e8..77da9ed8bc9 100644 --- a/src/Generated/Users/Item/Authentication/PhoneMethods/Item/EnableSmsSignIn/EnableSmsSignInRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/PhoneMethods/Item/EnableSmsSignIn/EnableSmsSignInRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Enable SMS sign-in for an existing mobile phone number registered to a user. To be successfully enabled: This API is available in the following national cloud deployments. * @param EnableSmsSignInRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/phoneauthenticationmethod-enablesmssignin?view=graph-rest-1.0 Find more info here */ public function post(?EnableSmsSignInRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?EnableSmsSignInRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/PhoneMethods/Item/PhoneAuthenticationMethodItemRequestBuilder.php b/src/Generated/Users/Item/Authentication/PhoneMethods/Item/PhoneAuthenticationMethodItemRequestBuilder.php index e39171989e5..1a7d66cc125 100644 --- a/src/Generated/Users/Item/Authentication/PhoneMethods/Item/PhoneAuthenticationMethodItemRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/PhoneMethods/Item/PhoneAuthenticationMethodItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PhoneAuthenticationMethod; use Microsoft\Graph\Generated\Users\Item\Authentication\PhoneMethods\Item\DisableSmsSignIn\DisableSmsSignInRequestBuilder; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a user's phone authentication method. This removes the phone number from the user and they'll no longer be able to use the number for authentication, whether via SMS or voice calls. A user can't have an alternateMobile number without a mobile number. If you want to remove a mobile number from a user that also has an alternateMobile number, first update the mobile number to the new number, then delete the alternateMobile number. If the phone number is the user's default Azure multi-factor authentication (MFA) authentication method, it can't be deleted. Have the user change their default authentication method, and then delete the number. This API is available in the following national cloud deployments. * @param PhoneAuthenticationMethodItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/phoneauthenticationmethod-delete?view=graph-rest-1.0 Find more info here */ public function delete(?PhoneAuthenticationMethodItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Retrieve a single phoneAuthenticationMethod object for a user. This method is available only for standard Azure AD and B2B users, but not B2C users. This API is available in the following national cloud deployments. + * Retrieve a single phoneAuthenticationMethod object for a user. This method is available only for standard Microsoft Entra ID and B2B users, but not B2C users. This API is available in the following national cloud deployments. * @param PhoneAuthenticationMethodItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/phoneauthenticationmethod-get?view=graph-rest-1.0 Find more info here */ public function get(?PhoneAuthenticationMethodItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PhoneAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PhoneAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a user's phone number associated with a phone authentication method object. You can't change a phone's type. To change a phone's type, add a new number of the desired type and then delete the object with the original type. If a user is enabled by policy to use SMS to sign in and the mobile number is changed, the system will attempt to register the number for use in that system. This API is available in the following national cloud deployments. * @param PhoneAuthenticationMethod $body The request body * @param PhoneAuthenticationMethodItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/phoneauthenticationmethod-update?view=graph-rest-1.0 Find more info here */ public function patch(PhoneAuthenticationMethod $body, ?PhoneAuthenticationMethodItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PhoneAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PhoneAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,11 +109,12 @@ public function toDeleteRequestInformation(?PhoneAuthenticationMethodItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Retrieve a single phoneAuthenticationMethod object for a user. This method is available only for standard Azure AD and B2B users, but not B2C users. This API is available in the following national cloud deployments. + * Retrieve a single phoneAuthenticationMethod object for a user. This method is available only for standard Microsoft Entra ID and B2B users, but not B2C users. This API is available in the following national cloud deployments. * @param PhoneAuthenticationMethodItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -132,7 +123,6 @@ public function toGetRequestInformation(?PhoneAuthenticationMethodItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?PhoneAuthenticationMethodItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(PhoneAuthenticationMethod $body, ?Phon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/PhoneMethods/Item/PhoneAuthenticationMethodItemRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/Authentication/PhoneMethods/Item/PhoneAuthenticationMethodItemRequestBuilderGetQueryParameters.php index e4b1f87c963..73e3aa3966f 100644 --- a/src/Generated/Users/Item/Authentication/PhoneMethods/Item/PhoneAuthenticationMethodItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/Authentication/PhoneMethods/Item/PhoneAuthenticationMethodItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve a single phoneAuthenticationMethod object for a user. This method is available only for standard Azure AD and B2B users, but not B2C users. This API is available in the following national cloud deployments. + * Retrieve a single phoneAuthenticationMethod object for a user. This method is available only for standard Microsoft Entra ID and B2B users, but not B2C users. This API is available in the following national cloud deployments. */ class PhoneAuthenticationMethodItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/Authentication/PhoneMethods/PhoneMethodsRequestBuilder.php b/src/Generated/Users/Item/Authentication/PhoneMethods/PhoneMethodsRequestBuilder.php index 3031774fc50..97623d05c56 100644 --- a/src/Generated/Users/Item/Authentication/PhoneMethods/PhoneMethodsRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/PhoneMethods/PhoneMethodsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PhoneAuthenticationMethod; use Microsoft\Graph\Generated\Models\PhoneAuthenticationMethodCollectionResponse; @@ -53,46 +52,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve a list of phone authentication method objects for a user. This will return up to three objects, as a user can have up to three phones usable for authentication. This method is available only for standard Azure AD and B2B users, but not B2C users. This API is available in the following national cloud deployments. + * Retrieve a list of phone authentication method objects for a user. This will return up to three objects, as a user can have up to three phones usable for authentication. This method is available only for standard Microsoft Entra ID and B2B users, but not B2C users. This API is available in the following national cloud deployments. * @param PhoneMethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authentication-list-phonemethods?view=graph-rest-1.0 Find more info here */ public function get(?PhoneMethodsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PhoneAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PhoneAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a new phone authentication method for a user. A user may only have one phone of each type, captured in the phoneType property. This means, for example, adding a mobile phone to a user with a pre-existing mobile phone fails. Additionally, a user must always have a mobile phone before adding an alternateMobile phone. Adding a phone number makes it available for use in both Azure multi-factor authentication (MFA) and self-service password reset (SSPR), if enabled. Additionally, if a user is enabled by policy to use SMS sign-in and a mobile number is added, the system attempts to register the number for use in that system. This API is available in the following national cloud deployments. * @param PhoneAuthenticationMethod $body The request body * @param PhoneMethodsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authentication-post-phonemethods?view=graph-rest-1.0 Find more info here */ public function post(PhoneAuthenticationMethod $body, ?PhoneMethodsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PhoneAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PhoneAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve a list of phone authentication method objects for a user. This will return up to three objects, as a user can have up to three phones usable for authentication. This method is available only for standard Azure AD and B2B users, but not B2C users. This API is available in the following national cloud deployments. + * Retrieve a list of phone authentication method objects for a user. This will return up to three objects, as a user can have up to three phones usable for authentication. This method is available only for standard Microsoft Entra ID and B2B users, but not B2C users. This API is available in the following national cloud deployments. * @param PhoneMethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PhoneMethodsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PhoneMethodsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(PhoneAuthenticationMethod $body, ?Phone $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/PhoneMethods/PhoneMethodsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/Authentication/PhoneMethods/PhoneMethodsRequestBuilderGetQueryParameters.php index fe33dbf3253..2a32c5df7fe 100644 --- a/src/Generated/Users/Item/Authentication/PhoneMethods/PhoneMethodsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/Authentication/PhoneMethods/PhoneMethodsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve a list of phone authentication method objects for a user. This will return up to three objects, as a user can have up to three phones usable for authentication. This method is available only for standard Azure AD and B2B users, but not B2C users. This API is available in the following national cloud deployments. + * Retrieve a list of phone authentication method objects for a user. This will return up to three objects, as a user can have up to three phones usable for authentication. This method is available only for standard Microsoft Entra ID and B2B users, but not B2C users. This API is available in the following national cloud deployments. */ class PhoneMethodsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/Authentication/SoftwareOathMethods/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Authentication/SoftwareOathMethods/Count/CountRequestBuilder.php index d0020d63dfd..7c9bf41e330 100644 --- a/src/Generated/Users/Item/Authentication/SoftwareOathMethods/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/SoftwareOathMethods/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/SoftwareOathMethods/Item/SoftwareOathAuthenticationMethodItemRequestBuilder.php b/src/Generated/Users/Item/Authentication/SoftwareOathMethods/Item/SoftwareOathAuthenticationMethodItemRequestBuilder.php index 523fbccaeed..236a3dd1266 100644 --- a/src/Generated/Users/Item/Authentication/SoftwareOathMethods/Item/SoftwareOathAuthenticationMethodItemRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/SoftwareOathMethods/Item/SoftwareOathAuthenticationMethodItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SoftwareOathAuthenticationMethod; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,39 +33,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a user's Software OATH token authentication method object. This API is available in the following national cloud deployments. * @param SoftwareOathAuthenticationMethodItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/softwareoathauthenticationmethod-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SoftwareOathAuthenticationMethodItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a user's single Software OATH token authentication method object and its properties. This API is available in the following national cloud deployments. * @param SoftwareOathAuthenticationMethodItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/softwareoathauthenticationmethod-get?view=graph-rest-1.0 Find more info here */ public function get(?SoftwareOathAuthenticationMethodItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SoftwareOathAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SoftwareOathAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +76,7 @@ public function toDeleteRequestInformation(?SoftwareOathAuthenticationMethodItem $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -96,7 +90,6 @@ public function toGetRequestInformation(?SoftwareOathAuthenticationMethodItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -104,6 +97,7 @@ public function toGetRequestInformation(?SoftwareOathAuthenticationMethodItemReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/SoftwareOathMethods/SoftwareOathMethodsRequestBuilder.php b/src/Generated/Users/Item/Authentication/SoftwareOathMethods/SoftwareOathMethodsRequestBuilder.php index 786fdc6d14a..eb7d1047f09 100644 --- a/src/Generated/Users/Item/Authentication/SoftwareOathMethods/SoftwareOathMethodsRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/SoftwareOathMethods/SoftwareOathMethodsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SoftwareOathAuthenticationMethodCollectionResponse; use Microsoft\Graph\Generated\Users\Item\Authentication\SoftwareOathMethods\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of a user's software OATH token authentication method objects and their properties. This API is available in the following national cloud deployments. * @param SoftwareOathMethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authentication-list-softwareoathmethods?view=graph-rest-1.0 Find more info here */ public function get(?SoftwareOathMethodsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SoftwareOathAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SoftwareOathAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SoftwareOathMethodsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SoftwareOathMethodsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/TemporaryAccessPassMethods/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Authentication/TemporaryAccessPassMethods/Count/CountRequestBuilder.php index 64b73fc6a7a..1a282c0ef68 100644 --- a/src/Generated/Users/Item/Authentication/TemporaryAccessPassMethods/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/TemporaryAccessPassMethods/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/TemporaryAccessPassMethods/Item/TemporaryAccessPassAuthenticationMethodItemRequestBuilder.php b/src/Generated/Users/Item/Authentication/TemporaryAccessPassMethods/Item/TemporaryAccessPassAuthenticationMethodItemRequestBuilder.php index db178710ce8..45dbc1345b4 100644 --- a/src/Generated/Users/Item/Authentication/TemporaryAccessPassMethods/Item/TemporaryAccessPassAuthenticationMethodItemRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/TemporaryAccessPassMethods/Item/TemporaryAccessPassAuthenticationMethodItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TemporaryAccessPassAuthenticationMethod; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,39 +33,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a users's temporaryAccessPassAuthenticationMethod object. This API is available in the following national cloud deployments. * @param TemporaryAccessPassAuthenticationMethodItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/temporaryaccesspassauthenticationmethod-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TemporaryAccessPassAuthenticationMethodItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a user's single temporaryAccessPassAuthenticationMethod object. This API is available in the following national cloud deployments. * @param TemporaryAccessPassAuthenticationMethodItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/temporaryaccesspassauthenticationmethod-get?view=graph-rest-1.0 Find more info here */ public function get(?TemporaryAccessPassAuthenticationMethodItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TemporaryAccessPassAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TemporaryAccessPassAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +76,7 @@ public function toDeleteRequestInformation(?TemporaryAccessPassAuthenticationMet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -96,7 +90,6 @@ public function toGetRequestInformation(?TemporaryAccessPassAuthenticationMethod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -104,6 +97,7 @@ public function toGetRequestInformation(?TemporaryAccessPassAuthenticationMethod } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/TemporaryAccessPassMethods/TemporaryAccessPassMethodsRequestBuilder.php b/src/Generated/Users/Item/Authentication/TemporaryAccessPassMethods/TemporaryAccessPassMethodsRequestBuilder.php index 71bee663ce6..3d2fb9e2861 100644 --- a/src/Generated/Users/Item/Authentication/TemporaryAccessPassMethods/TemporaryAccessPassMethodsRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/TemporaryAccessPassMethods/TemporaryAccessPassMethodsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TemporaryAccessPassAuthenticationMethod; use Microsoft\Graph\Generated\Models\TemporaryAccessPassAuthenticationMethodCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of a user's temporaryAccessPassAuthenticationMethod objects and their properties. This API will only return a single object in the collection as a user can have only one Temporary Access Pass method. This API is available in the following national cloud deployments. * @param TemporaryAccessPassMethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authentication-list-temporaryaccesspassmethods?view=graph-rest-1.0 Find more info here */ public function get(?TemporaryAccessPassMethodsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TemporaryAccessPassAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TemporaryAccessPassAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new temporaryAccessPassAuthenticationMethod object on a user. A user can only have one Temporary Access Pass that's usable within its specified lifetime. If the user requires a new Temporary Access Pass while the current Temporary Access Pass is valid, the admin can create a new Temporary Access Pass for the user, the previous Temporary Access Pass will be deleted, and a new Temporary Access Pass will be created. This API is available in the following national cloud deployments. * @param TemporaryAccessPassAuthenticationMethod $body The request body * @param TemporaryAccessPassMethodsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/authentication-post-temporaryaccesspassmethods?view=graph-rest-1.0 Find more info here */ public function post(TemporaryAccessPassAuthenticationMethod $body, ?TemporaryAccessPassMethodsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TemporaryAccessPassAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TemporaryAccessPassAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TemporaryAccessPassMethodsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TemporaryAccessPassMethodsRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TemporaryAccessPassAuthenticationMethod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/Count/CountRequestBuilder.php index d798711bd8c..6dd83f36b29 100644 --- a/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/Item/Device/DeviceRequestBuilder.php b/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/Item/Device/DeviceRequestBuilder.php index d834e713d0e..a4054117240 100644 --- a/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/Item/Device/DeviceRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/Item/Device/DeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Device; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The registered device on which this Windows Hello for Business key resides. Supports $expand. When you get a user's Windows Hello for Business registration information, this property is returned only on a single GET and when you specify ?$expand. For example, GET /users/admin@contoso.com/authentication/windowsHelloForBusinessMethods/_jpuR-TGZtk6aQCLF3BQjA2?$expand=device. * @param DeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeviceRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeviceRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/Item/WindowsHelloForBusinessAuthenticationMethodItemRequestBuilder.php b/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/Item/WindowsHelloForBusinessAuthenticationMethodItemRequestBuilder.php index cba2c3a68ca..52b2c66ee9f 100644 --- a/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/Item/WindowsHelloForBusinessAuthenticationMethodItemRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/Item/WindowsHelloForBusinessAuthenticationMethodItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsHelloForBusinessAuthenticationMethod; use Microsoft\Graph\Generated\Users\Item\Authentication\WindowsHelloForBusinessMethods\Item\Device\DeviceRequestBuilder; @@ -42,39 +41,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a windowsHelloForBusinessAuthenticationMethod object. This API is available in the following national cloud deployments. * @param WindowsHelloForBusinessAuthenticationMethodItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/windowshelloforbusinessauthenticationmethod-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WindowsHelloForBusinessAuthenticationMethodItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a windowsHelloForBusinessAuthenticationMethod object. This API is available in the following national cloud deployments. * @param WindowsHelloForBusinessAuthenticationMethodItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/windowshelloforbusinessauthenticationmethod-get?view=graph-rest-1.0 Find more info here */ public function get(?WindowsHelloForBusinessAuthenticationMethodItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsHelloForBusinessAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsHelloForBusinessAuthenticationMethod::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -91,6 +84,7 @@ public function toDeleteRequestInformation(?WindowsHelloForBusinessAuthenticatio $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -104,7 +98,6 @@ public function toGetRequestInformation(?WindowsHelloForBusinessAuthenticationMe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -112,6 +105,7 @@ public function toGetRequestInformation(?WindowsHelloForBusinessAuthenticationMe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/WindowsHelloForBusinessMethodsRequestBuilder.php b/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/WindowsHelloForBusinessMethodsRequestBuilder.php index 211b5e7022f..8c4f94a02e3 100644 --- a/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/WindowsHelloForBusinessMethodsRequestBuilder.php +++ b/src/Generated/Users/Item/Authentication/WindowsHelloForBusinessMethods/WindowsHelloForBusinessMethodsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsHelloForBusinessAuthenticationMethodCollectionResponse; use Microsoft\Graph\Generated\Users\Item\Authentication\WindowsHelloForBusinessMethods\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the windowsHelloForBusinessAuthenticationMethod objects and their properties. This API is available in the following national cloud deployments. * @param WindowsHelloForBusinessMethodsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/windowshelloforbusinessauthenticationmethod-list?view=graph-rest-1.0 Find more info here */ public function get(?WindowsHelloForBusinessMethodsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsHelloForBusinessAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsHelloForBusinessAuthenticationMethodCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?WindowsHelloForBusinessMethodsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?WindowsHelloForBusinessMethodsRequestBu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php b/src/Generated/Users/Item/Calendar/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php index f64315f2336..a2c6818fce7 100644 --- a/src/Generated/Users/Item/Calendar/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function allowedCalendarSharingRoles * @param AllowedCalendarSharingRolesWithUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AllowedCalendarSharingRolesWithUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AllowedCalendarSharingRolesWithUserGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AllowedCalendarSharingRolesWithUserGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?AllowedCalendarSharingRolesWithUserRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?AllowedCalendarSharingRolesWithUserRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarPermissions/CalendarPermissionsRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarPermissions/CalendarPermissionsRequestBuilder.php index a6b31cd32fb..274493efda0 100644 --- a/src/Generated/Users/Item/Calendar/CalendarPermissions/CalendarPermissionsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarPermissions/CalendarPermissionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CalendarPermission; use Microsoft\Graph\Generated\Models\CalendarPermissionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a collection of calendarPermission resources that describe the identity and roles of users with whom the specified calendar has been shared or delegated. Here, the calendar can be a user calendar or group calendar. This API is available in the following national cloud deployments. * @param CalendarPermissionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-list-calendarpermissions?view=graph-rest-1.0 Find more info here */ public function get(?CalendarPermissionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a calendarPermission resource to specify the identity and role of the user with whom the specified calendar is being shared or delegated. This API is available in the following national cloud deployments. * @param CalendarPermission $body The request body * @param CalendarPermissionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-post-calendarpermissions?view=graph-rest-1.0 Find more info here */ public function post(CalendarPermission $body, ?CalendarPermissionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CalendarPermissionsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CalendarPermissionsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(CalendarPermission $body, ?CalendarPerm $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarPermissions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarPermissions/Count/CountRequestBuilder.php index 0e31b3c1424..5904b7e2bd2 100644 --- a/src/Generated/Users/Item/Calendar/CalendarPermissions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarPermissions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php index 0cbb8bb6914..c4b87304535 100644 --- a/src/Generated/Users/Item/Calendar/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CalendarPermission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete calendarPermission. This API is available in the following national cloud deployments. * @param CalendarPermissionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendarpermission-delete?view=graph-rest-1.0 Find more info here */ public function delete(?CalendarPermissionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the specified permissions object of a user or group calendar that has been shared. This API is available in the following national cloud deployments. * @param CalendarPermissionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendarpermission-get?view=graph-rest-1.0 Find more info here */ public function get(?CalendarPermissionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the permissions assigned to an existing share recipient or delegate, through the corresponding calendarPermission object for a calendar. This API is available in the following national cloud deployments. * @param CalendarPermission $body The request body * @param CalendarPermissionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendarpermission-update?view=graph-rest-1.0 Find more info here */ public function patch(CalendarPermission $body, ?CalendarPermissionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?CalendarPermissionItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?CalendarPermissionItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?CalendarPermissionItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(CalendarPermission $body, ?CalendarPer $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarRequestBuilder.php index 1ce9a856115..100ba859c2e 100644 --- a/src/Generated/Users/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendar\AllowedCalendarSharingRolesWithUser\AllowedCalendarSharingRolesWithUserRequestBuilder; @@ -76,40 +75,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the properties and relationships of a calendar object. The calendar can be one for a user, or the default calendar of a Microsoft 365 group. There are two scenarios where an app can get another user's calendar: This API is available in the following national cloud deployments. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-get?view=graph-rest-1.0 Find more info here */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a calendar object. The calendar can be one for a user, or the default calendar of a Microsoft 365 group. This API is available in the following national cloud deployments. * @param Calendar $body The request body * @param CalendarRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-update?view=graph-rest-1.0 Find more info here */ public function patch(Calendar $body, ?CalendarRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -122,7 +115,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +122,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +137,11 @@ public function toPatchRequestInformation(Calendar $body, ?CalendarRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/CalendarViewRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/CalendarViewRequestBuilder.php index 6bf1243f387..23942ed45ad 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/CalendarViewRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/CalendarViewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendar\CalendarView\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar view for the calendar. Navigation property. Read-only. * @param CalendarViewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-list-calendarview?view=graph-rest-1.0 Find more info here */ public function get(?CalendarViewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Count/CountRequestBuilder.php index 131612a2304..483e2d5dd8a 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Delta/DeltaRequestBuilder.php index 0a63bc74029..908fcec7948 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Accept/AcceptRequestBuilder.php index 2a705dda5f4..298cb1fa9e1 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php index 648c412833f..5207e1e6e84 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/Count/CountRequestBuilder.php index d4586dfa82c..3504f0aa9c1 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 19a3732d2e1..a3419a2dadc 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 534d160f786..ed1637010a0 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Calendar/CalendarRequestBuilder.php index edbfa064538..b8a62c31e2e 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Cancel/CancelRequestBuilder.php index 3238e158eb5..fd50e8dfd2a 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Decline/DeclineRequestBuilder.php index ac890dca52d..0422f8944df 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php index 4cfd6b1f7bd..ffc2f2df8c5 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/EventItemRequestBuilder.php index 7df2bb2db6d..82f83335aa3 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendar\CalendarView\Item\Accept\AcceptRequestBuilder; @@ -122,19 +121,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar view for the calendar. Navigation property. Read-only. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -147,7 +143,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -155,6 +150,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Extensions/Count/CountRequestBuilder.php index 2b4ff6e8cd9..cbdc3cd1c26 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php index d052061daaf..0023419bad2 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 22b96a29356..376480f7826 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Forward/ForwardRequestBuilder.php index 18f4de656c0..11042d63b45 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Count/CountRequestBuilder.php index d56492b9236..72835eb7050 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php index a84b304d551..c0db236c0a4 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/InstancesRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/InstancesRequestBuilder.php index a856f82031c..693fd135afb 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendar\CalendarView\Item\Instances\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php index de983548e5f..ced794d5a33 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php index dec173839a4..5ad91457aa1 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php index e4c1ab3022e..12a2bd36913 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index ef878c40a2a..03df89015ba 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php index f13fb16be52..40b5a8f050e 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php index 6d3d1b94d5d..8f3134dd4ff 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php index 6c3aa140713..5b7e13a4916 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php index 898469f852c..b4fb2d77707 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php index 89b934d941b..48de71beef9 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php index b60578af142..0070e973145 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendar\CalendarView\Item\Instances\Item\Accept\AcceptRequestBuilder; @@ -114,19 +113,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -139,7 +135,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +142,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php index 65e6588d9ee..c9daf224bd3 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php index 368a93f9ba0..9b436c39687 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php index efe73196833..2b08ad092c0 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php index 216429abd5f..1155ce464ba 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index 0353d02f88c..655ed6cb8a6 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index 0499dbca828..e1785baacde 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index 51497586085..4ef1f69cf14 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/Calendar/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index 6c57e349751..05b95adf9cd 100644 --- a/src/Generated/Users/Item/Calendar/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Count/CountRequestBuilder.php index 92c3b3c4d2b..a11e321545c 100644 --- a/src/Generated/Users/Item/Calendar/Events/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Delta/DeltaRequestBuilder.php index f33865d72b1..32e3e5c2372 100644 --- a/src/Generated/Users/Item/Calendar/Events/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/EventsRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/EventsRequestBuilder.php index 4b4f563416a..0a218ca97f3 100644 --- a/src/Generated/Users/Item/Calendar/Events/EventsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/EventsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of events in a calendar. The calendar can be one for a user, or the default calendar of a Microsoft 365 group. The list of events contains single instance meetings and series masters. To get expanded event instances, you can get the calendar view, or get the instances of an event. This API is available in the following national cloud deployments. * @param EventsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-list-events?view=graph-rest-1.0 Find more info here */ public function get(?EventsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new event in a calendar. The calendar can be one for a user, or the default calendar of a Microsoft 365 group. This API is available in the following national cloud deployments. * @param Event $body The request body * @param EventsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-post-events?view=graph-rest-1.0 Find more info here */ public function post(Event $body, ?EventsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?EventsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?EventsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Event $body, ?EventsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Accept/AcceptRequestBuilder.php index 425c6711a0b..7a1ad666ef1 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Attachments/AttachmentsRequestBuilder.php index a6184cdc3f2..083e1ac4574 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Attachments/Count/CountRequestBuilder.php index c509e9db2e3..539780f3ddc 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index c36b3393383..5a5c4049659 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php index aa24072d8ee..675aed99a9d 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Calendar/CalendarRequestBuilder.php index 0b8891ef7e6..ec040a67105 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Cancel/CancelRequestBuilder.php index e7941f18288..a11bb21158a 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Decline/DeclineRequestBuilder.php index f1157a11f24..c0865207787 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/DismissReminder/DismissReminderRequestBuilder.php index 900d2068746..b81f043803a 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/EventItemRequestBuilder.php index c251f10d009..fd456564602 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendar\Events\Item\Accept\AcceptRequestBuilder; @@ -122,57 +121,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property events for users * @param EventItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EventItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The events in the calendar. Navigation property. Read-only. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an event object. This API is available in the following national cloud deployments. * @param Event $body The request body * @param EventItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-update-event?view=graph-rest-1.0 Find more info here */ public function patch(Event $body, ?EventItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -189,6 +179,7 @@ public function toDeleteRequestInformation(?EventItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -202,7 +193,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -210,6 +200,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -224,11 +215,11 @@ public function toPatchRequestInformation(Event $body, ?EventItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Extensions/Count/CountRequestBuilder.php index 2de169b6b32..13c3d486f23 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Extensions/ExtensionsRequestBuilder.php index 8925e5b0489..420ed89ce2b 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 2279a60e492..4ee2c81227c 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Forward/ForwardRequestBuilder.php index 612fa7669e8..a1886899ab4 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Count/CountRequestBuilder.php index b615f96753f..d0a48a0d7b5 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Delta/DeltaRequestBuilder.php index 08b06e6cf39..73cad45a7c9 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/InstancesRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/InstancesRequestBuilder.php index eb5c6edff98..d635aca29c3 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendar\Events\Item\Instances\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php index 5abe97dea7d..1d325e324e5 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php index 3dab0f55ac5..ace99af3f69 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php index 80814c79b38..22f20f9d8e8 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 7ad96290973..0d546dc7010 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php index e3a73df0183..6c7c905656b 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php index f386ca4985b..70c907cf0b0 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php index 10f41434bf4..533cc6e37a7 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php index 8991c6e860f..652add23852 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php index d95c5fba674..d928c3d1bbe 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/EventItemRequestBuilder.php index 4c9ae8b86a2..8b031026f91 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendar\Events\Item\Instances\Item\Accept\AcceptRequestBuilder; @@ -114,19 +113,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -139,7 +135,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +142,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php index 7b735941322..21dc48269b4 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php index 44bea09a213..3418ea8fc87 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php index ae37d709064..3a033dd358c 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php index 4963c15e0fe..f8e243d63aa 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index 4c63074c0eb..de749522eb2 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index eb630a7bf5a..d1601d74ee2 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index d5d12ccfb88..4094c66e7fe 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/Calendar/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index 32b956f90aa..4487fdc5dd0 100644 --- a/src/Generated/Users/Item/Calendar/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendar/GetSchedule/GetScheduleRequestBuilder.php b/src/Generated/Users/Item/Calendar/GetSchedule/GetScheduleRequestBuilder.php index 8ab1d4546e7..710b991e3bc 100644 --- a/src/Generated/Users/Item/Calendar/GetSchedule/GetScheduleRequestBuilder.php +++ b/src/Generated/Users/Item/Calendar/GetSchedule/GetScheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Get the free/busy availability information for a collection of users, distributions lists, or resources (rooms or equipment) for a specified time period. This API is available in the following national cloud deployments. * @param GetSchedulePostRequestBody $body The request body * @param GetScheduleRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-getschedule?view=graph-rest-1.0 Find more info here */ public function post(GetSchedulePostRequestBody $body, ?GetScheduleRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetSchedulePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetSchedulePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetSchedulePostRequestBody $body, ?GetS $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/CalendarGroupsRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/CalendarGroupsRequestBuilder.php index 18ecf56b817..84d17a48036 100644 --- a/src/Generated/Users/Item/CalendarGroups/CalendarGroupsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/CalendarGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CalendarGroup; use Microsoft\Graph\Generated\Models\CalendarGroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the user's calendar groups. This API is available in the following national cloud deployments. * @param CalendarGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-calendargroups?view=graph-rest-1.0 Find more info here */ public function get(?CalendarGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new CalendarGroup. This API is available in the following national cloud deployments. * @param CalendarGroup $body The request body * @param CalendarGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-post-calendargroups?view=graph-rest-1.0 Find more info here */ public function post(CalendarGroup $body, ?CalendarGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CalendarGroupsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CalendarGroupsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(CalendarGroup $body, ?CalendarGroupsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Count/CountRequestBuilder.php index c055eee1fa6..27c3f7dd8fa 100644 --- a/src/Generated/Users/Item/CalendarGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/CalendarGroupItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/CalendarGroupItemRequestBuilder.php index da060c1404b..aad659fafe5 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/CalendarGroupItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/CalendarGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CalendarGroup; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CalendarGroups\Item\Calendars\CalendarsRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a calendar group other than the default calendar group. This API is available in the following national cloud deployments. * @param CalendarGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendargroup-delete?view=graph-rest-1.0 Find more info here */ public function delete(?CalendarGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a calendar group object. This API is available in the following national cloud deployments. * @param CalendarGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendargroup-get?view=graph-rest-1.0 Find more info here */ public function get(?CalendarGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of calendargroup object. This API is available in the following national cloud deployments. * @param CalendarGroup $body The request body * @param CalendarGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendargroup-update?view=graph-rest-1.0 Find more info here */ public function patch(CalendarGroup $body, ?CalendarGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?CalendarGroupItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?CalendarGroupItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?CalendarGroupItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(CalendarGroup $body, ?CalendarGroupIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/CalendarsRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/CalendarsRequestBuilder.php index 6c81b831c7e..06c1dee076e 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/CalendarsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/CalendarsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\CalendarCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of calendars belonging to a calendar group. This API is available in the following national cloud deployments. * @param CalendarsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendargroup-list-calendars?view=graph-rest-1.0 Find more info here */ public function get(?CalendarsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new calendar in a calendar group for a user. This API is available in the following national cloud deployments. * @param Calendar $body The request body * @param CalendarsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendargroup-post-calendars?view=graph-rest-1.0 Find more info here */ public function post(Calendar $body, ?CalendarsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CalendarsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CalendarsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Calendar $body, ?CalendarsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Count/CountRequestBuilder.php index 7fe1f506545..0b7793bcd4d 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php index 49764afbd82..0ea80c0ae8c 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function allowedCalendarSharingRoles * @param AllowedCalendarSharingRolesWithUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AllowedCalendarSharingRolesWithUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AllowedCalendarSharingRolesWithUserGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AllowedCalendarSharingRolesWithUserGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?AllowedCalendarSharingRolesWithUserRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?AllowedCalendarSharingRolesWithUserRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarItemRequestBuilder.php index e0e794ecd46..7698ef0407b 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CalendarGroups\Item\Calendars\Item\AllowedCalendarSharingRolesWithUser\AllowedCalendarSharingRolesWithUserRequestBuilder; @@ -76,56 +75,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property calendars for users * @param CalendarItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CalendarItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The calendars in the calendar group. Navigation property. Read-only. Nullable. * @param CalendarItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property calendars in users * @param Calendar $body The request body * @param CalendarItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Calendar $body, ?CalendarItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -142,6 +132,7 @@ public function toDeleteRequestInformation(?CalendarItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -155,7 +146,6 @@ public function toGetRequestInformation(?CalendarItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -163,6 +153,7 @@ public function toGetRequestInformation(?CalendarItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -177,11 +168,11 @@ public function toPatchRequestInformation(Calendar $body, ?CalendarItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarPermissions/CalendarPermissionsRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarPermissions/CalendarPermissionsRequestBuilder.php index 656698437c0..e9963aa9643 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarPermissions/CalendarPermissionsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarPermissions/CalendarPermissionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CalendarPermission; use Microsoft\Graph\Generated\Models\CalendarPermissionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a collection of calendarPermission resources that describe the identity and roles of users with whom the specified calendar has been shared or delegated. Here, the calendar can be a user calendar or group calendar. This API is available in the following national cloud deployments. * @param CalendarPermissionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-list-calendarpermissions?view=graph-rest-1.0 Find more info here */ public function get(?CalendarPermissionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a calendarPermission resource to specify the identity and role of the user with whom the specified calendar is being shared or delegated. This API is available in the following national cloud deployments. * @param CalendarPermission $body The request body * @param CalendarPermissionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-post-calendarpermissions?view=graph-rest-1.0 Find more info here */ public function post(CalendarPermission $body, ?CalendarPermissionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CalendarPermissionsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CalendarPermissionsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(CalendarPermission $body, ?CalendarPerm $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarPermissions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarPermissions/Count/CountRequestBuilder.php index 092a112be28..2ae8c769685 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarPermissions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarPermissions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php index ea42d4d781b..dc46d7d3896 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CalendarPermission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete calendarPermission. This API is available in the following national cloud deployments. * @param CalendarPermissionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendarpermission-delete?view=graph-rest-1.0 Find more info here */ public function delete(?CalendarPermissionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the specified permissions object of a user or group calendar that has been shared. This API is available in the following national cloud deployments. * @param CalendarPermissionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendarpermission-get?view=graph-rest-1.0 Find more info here */ public function get(?CalendarPermissionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the permissions assigned to an existing share recipient or delegate, through the corresponding calendarPermission object for a calendar. This API is available in the following national cloud deployments. * @param CalendarPermission $body The request body * @param CalendarPermissionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendarpermission-update?view=graph-rest-1.0 Find more info here */ public function patch(CalendarPermission $body, ?CalendarPermissionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?CalendarPermissionItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?CalendarPermissionItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?CalendarPermissionItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(CalendarPermission $body, ?CalendarPer $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/CalendarViewRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/CalendarViewRequestBuilder.php index 46a55000606..60385ab4a97 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/CalendarViewRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/CalendarViewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CalendarGroups\Item\Calendars\Item\CalendarView\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the occurrences, exceptions and single instances of events in a calendar view defined by a time range,from a user's default calendar (../me/calendarView) or some other calendar of the user's. This API is available in the following national cloud deployments. * @param CalendarViewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-list-calendarview?view=graph-rest-1.0 Find more info here */ public function get(?CalendarViewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Count/CountRequestBuilder.php index a9163e25b05..a483f96a7be 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Delta/DeltaRequestBuilder.php index a5f8db4dfa6..e509f5b48d2 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php index cd4e786fe8e..a185f552264 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php index a678e60d816..fc2ce3e9f59 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php index 59e5e6d0671..a2b91b23612 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index bc7c8036181..219c9fb6b62 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 66e7487cb6f..bcee0e19885 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php index 7549474ee13..2f649bacd3b 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php index 070be4e848d..c9f4cb245d9 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php index dd9dd3d4c46..552003d1f5a 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php index e751f4a6aa4..f77b26c65fe 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/EventItemRequestBuilder.php index f16f041ed45..dc2d7361f34 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CalendarGroups\Item\Calendars\Item\CalendarView\Item\Accept\AcceptRequestBuilder; @@ -122,19 +121,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar view for the calendar. Navigation property. Read-only. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -147,7 +143,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -155,6 +150,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php index d54132ea12c..fb28a25cce8 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php index fca1b2e68ae..b51e3dc49d0 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php index f14f2c95508..5410a1abe4d 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php index 83754c9ac09..75f70e7825f 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php index 6ccbf6022a6..102f7b61964 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php index b45bdd984cb..0640ea36d41 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php index 0335a9544e6..e099630405e 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CalendarGroups\Item\Calendars\Item\CalendarView\Item\Instances\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php index a614e91354d..6752d40dd9b 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php index e875e8d659f..f4ca006cb94 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php index 0ea52db91b4..e7c7903a45c 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index e06c49e0ce1..3ce1532435b 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php index de0e8862a26..dabb9d5d001 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php index 8fe95552c04..3ea40fb8994 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php index 117f7d8e138..2b3fbebd837 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php index 8b7e423b887..87efb60ed69 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php index be9763a32a1..bc4b01c5963 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php index ffa0d4acff4..5d7d93458dd 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CalendarGroups\Item\Calendars\Item\CalendarView\Item\Instances\Item\Accept\AcceptRequestBuilder; @@ -114,19 +113,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -139,7 +135,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +142,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php index dce85a3b55b..06672656bdb 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php index 5ada2a16c12..a221f166fe0 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php index bcd4f5984f7..bc096b9db92 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php index 3b2e12320a7..1d4d2c165a0 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index ad8f7b436d5..7a1b4cecb24 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index b2871dfd5c1..ea6c14ecc12 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index e27d140b53f..6663aafce92 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index 5501daf3d0b..d9bf6d8e7aa 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Count/CountRequestBuilder.php index d11431f2704..67cacef8c6b 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Delta/DeltaRequestBuilder.php index b20fdfad5b6..d03271acb92 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/EventsRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/EventsRequestBuilder.php index fd1f9a30585..e9373d33c20 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/EventsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/EventsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of events in a calendar. The calendar can be one for a user, or the default calendar of a Microsoft 365 group. The list of events contains single instance meetings and series masters. To get expanded event instances, you can get the calendar view, or get the instances of an event. This API is available in the following national cloud deployments. * @param EventsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-list-events?view=graph-rest-1.0 Find more info here */ public function get(?EventsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new event in a calendar. The calendar can be one for a user, or the default calendar of a Microsoft 365 group. This API is available in the following national cloud deployments. * @param Event $body The request body * @param EventsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-post-events?view=graph-rest-1.0 Find more info here */ public function post(Event $body, ?EventsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?EventsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?EventsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Event $body, ?EventsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Accept/AcceptRequestBuilder.php index 573af561ebc..55e76e88370 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php index f9efcd0178f..efc04ad4ac4 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/Count/CountRequestBuilder.php index f986aefe62d..c4d727642ef 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 177173692d2..814193ea6ae 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 8f141c1cfae..c8068ea5f85 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Calendar/CalendarRequestBuilder.php index a535c01b657..76d4df39dd0 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Cancel/CancelRequestBuilder.php index 1a0fd3afa72..2683b9da2e6 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Decline/DeclineRequestBuilder.php index 415c752bbba..28318749a0f 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php index f4e247d91a3..d835c4c14ae 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/EventItemRequestBuilder.php index 8d61460366b..47cdae34920 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CalendarGroups\Item\Calendars\Item\Events\Item\Accept\AcceptRequestBuilder; @@ -122,57 +121,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property events for users * @param EventItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EventItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The events in the calendar. Navigation property. Read-only. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an event object. This API is available in the following national cloud deployments. * @param Event $body The request body * @param EventItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-update-event?view=graph-rest-1.0 Find more info here */ public function patch(Event $body, ?EventItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -189,6 +179,7 @@ public function toDeleteRequestInformation(?EventItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -202,7 +193,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -210,6 +200,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -224,11 +215,11 @@ public function toPatchRequestInformation(Event $body, ?EventItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Extensions/Count/CountRequestBuilder.php index 8a059128b58..4f0b4a7c387 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php index 61c61748b7a..87b86df3ae4 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 9dbd5ae36c5..9801a3efb41 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Forward/ForwardRequestBuilder.php index 9bf16289461..b058017e5a3 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Count/CountRequestBuilder.php index c2e305d24c6..dbe7d296258 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php index 429d4d1e274..4b6be8f9da5 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/InstancesRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/InstancesRequestBuilder.php index e7ce4d62c16..4c0aa6ae56a 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CalendarGroups\Item\Calendars\Item\Events\Item\Instances\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php index 015bb495087..6f4b0174cb7 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php index d02677e454d..fe2708195ec 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php index e0b7c420fb5..9c57d929d27 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index f4eeae20738..5544dcd0410 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 803fcd1f6e4..5f1868d6157 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php index ede0ba564ba..efa648bcf1c 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php index 716c8314d3e..b347cfabc43 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php index 2879d3004ea..eaeb8ab573c 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php index e321db4ef60..15377fc95c2 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php index b58a7b79dd2..fd838513878 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CalendarGroups\Item\Calendars\Item\Events\Item\Instances\Item\Accept\AcceptRequestBuilder; @@ -114,19 +113,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -139,7 +135,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +142,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php index e7fafafbac2..dc6f30ee71f 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php index f2447ea3ccf..3e39bf87689 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 72d642c2d33..c4f00041b17 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php index 1b97815757c..5641b97ce07 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index d213680b97f..a3f02456c5e 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index 781e8df4903..20746b2d1d1 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index a1fb91e7287..2cf097cdfd0 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index 8f5dfd70602..33566969c26 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/GetSchedule/GetScheduleRequestBuilder.php b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/GetSchedule/GetScheduleRequestBuilder.php index 1c80b8e514f..c9f25e3eaa3 100644 --- a/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/GetSchedule/GetScheduleRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarGroups/Item/Calendars/Item/GetSchedule/GetScheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Get the free/busy availability information for a collection of users, distributions lists, or resources (rooms or equipment) for a specified time period. This API is available in the following national cloud deployments. * @param GetSchedulePostRequestBody $body The request body * @param GetScheduleRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-getschedule?view=graph-rest-1.0 Find more info here */ public function post(GetSchedulePostRequestBody $body, ?GetScheduleRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetSchedulePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetSchedulePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetSchedulePostRequestBody $body, ?GetS $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/CalendarViewRequestBuilder.php b/src/Generated/Users/Item/CalendarView/CalendarViewRequestBuilder.php index 05f7806b092..3139c74623c 100644 --- a/src/Generated/Users/Item/CalendarView/CalendarViewRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/CalendarViewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CalendarView\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar view for the calendar. Read-only. Nullable. * @param CalendarViewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-calendarview?view=graph-rest-1.0 Find more info here */ public function get(?CalendarViewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Count/CountRequestBuilder.php index c3df92d88ba..908c649cb34 100644 --- a/src/Generated/Users/Item/CalendarView/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Delta/DeltaRequestBuilder.php index 1f55e860e89..93dcfd5ca6c 100644 --- a/src/Generated/Users/Item/CalendarView/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php index 08cac2bfba2..959aaddc230 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php index dbcd9bd5ec2..5ed9b8b57ba 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php index 4c00aef6921..54148520006 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 322194db18d..be1e80d58b7 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 7ed777eee56..99fbdb1a25f 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php index eced2c548a0..9619f4f559d 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php index 645117edfca..93b2ca1dffe 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php index b69bf25f481..e29afefe733 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php index 2d2eaa9abf7..9956da55011 100644 --- a/src/Generated/Users/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/EventItemRequestBuilder.php index a062c250270..88f436175b8 100644 --- a/src/Generated/Users/Item/CalendarView/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CalendarView\Item\Accept\AcceptRequestBuilder; @@ -122,19 +121,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar view for the calendar. Read-only. Nullable. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -147,7 +143,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -155,6 +150,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php index 86892863df2..178a9808ff6 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php index a7b832be8aa..f3ea2d5634e 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php index a5650699f4b..aba4074a8d2 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php index 4e4dffd02a6..04c0526414a 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php index cecbd919438..baf10827618 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php index 9c86a486afa..0d9f5016940 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php index 321b74bec49..ae94fef00ba 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CalendarView\Item\Instances\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php index 2656d9e6d80..daa92ab1f8f 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php index e18d665da7a..78a11334c22 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php index d4ad6cb7e19..3e4d3a3068c 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 8173e259481..6922e53ce78 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 70066db16b1..7288c6c2d06 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php index 692e0a317c6..599541f25a2 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php index 17d5373062a..9ef70aa33dc 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php index 049fe0f3a9b..f32bef8c64c 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php index 8a014296ea5..26746862781 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php index 562252aacf1..74b34185444 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CalendarView\Item\Instances\Item\Accept\AcceptRequestBuilder; @@ -114,19 +113,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -139,7 +135,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +142,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php index 14026a40008..d385d8891bb 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php index 80ec90baa36..cd40aaae5b7 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 436ffcc8703..839e1f80897 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php index e86504f3c21..91aaf8b94f9 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index 3e3950a50cf..8dee9412a7b 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index e7ee4ab6f0f..b93e602d631 100644 --- a/src/Generated/Users/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index b222a2a5b69..7b20febaa1b 100644 --- a/src/Generated/Users/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index 6b2d0112d10..d61c2a0cdf8 100644 --- a/src/Generated/Users/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/CalendarsRequestBuilder.php b/src/Generated/Users/Item/Calendars/CalendarsRequestBuilder.php index 5f34058197a..3a3a0ea7cb3 100644 --- a/src/Generated/Users/Item/Calendars/CalendarsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/CalendarsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\CalendarCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get all the user's calendars (/calendars navigation property), get the calendars from the default calendar group or from a specific calendar group. This API is available in the following national cloud deployments. * @param CalendarsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-calendars?view=graph-rest-1.0 Find more info here */ public function get(?CalendarsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new calendar for a user. This API is available in the following national cloud deployments. * @param Calendar $body The request body * @param CalendarsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-post-calendars?view=graph-rest-1.0 Find more info here */ public function post(Calendar $body, ?CalendarsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CalendarsRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CalendarsRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Calendar $body, ?CalendarsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Count/CountRequestBuilder.php index 0f344ef7a87..97520df7387 100644 --- a/src/Generated/Users/Item/Calendars/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php index a75c0306791..cf4e5ed682f 100644 --- a/src/Generated/Users/Item/Calendars/Item/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/AllowedCalendarSharingRolesWithUser/AllowedCalendarSharingRolesWithUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function allowedCalendarSharingRoles * @param AllowedCalendarSharingRolesWithUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AllowedCalendarSharingRolesWithUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AllowedCalendarSharingRolesWithUserGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AllowedCalendarSharingRolesWithUserGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?AllowedCalendarSharingRolesWithUserRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?AllowedCalendarSharingRolesWithUserRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarItemRequestBuilder.php index 57d59cb94ff..8d537c366b8 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendars\Item\AllowedCalendarSharingRolesWithUser\AllowedCalendarSharingRolesWithUserRequestBuilder; @@ -76,56 +75,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property calendars for users * @param CalendarItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CalendarItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The user's calendars. Read-only. Nullable. * @param CalendarItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property calendars in users * @param Calendar $body The request body * @param CalendarItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Calendar $body, ?CalendarItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -142,6 +132,7 @@ public function toDeleteRequestInformation(?CalendarItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -155,7 +146,6 @@ public function toGetRequestInformation(?CalendarItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -163,6 +153,7 @@ public function toGetRequestInformation(?CalendarItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -177,11 +168,11 @@ public function toPatchRequestInformation(Calendar $body, ?CalendarItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarPermissions/CalendarPermissionsRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarPermissions/CalendarPermissionsRequestBuilder.php index dbb81656620..28ce554827b 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarPermissions/CalendarPermissionsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarPermissions/CalendarPermissionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CalendarPermission; use Microsoft\Graph\Generated\Models\CalendarPermissionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a collection of calendarPermission resources that describe the identity and roles of users with whom the specified calendar has been shared or delegated. Here, the calendar can be a user calendar or group calendar. This API is available in the following national cloud deployments. * @param CalendarPermissionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-list-calendarpermissions?view=graph-rest-1.0 Find more info here */ public function get(?CalendarPermissionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermissionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a calendarPermission resource to specify the identity and role of the user with whom the specified calendar is being shared or delegated. This API is available in the following national cloud deployments. * @param CalendarPermission $body The request body * @param CalendarPermissionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-post-calendarpermissions?view=graph-rest-1.0 Find more info here */ public function post(CalendarPermission $body, ?CalendarPermissionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?CalendarPermissionsRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?CalendarPermissionsRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(CalendarPermission $body, ?CalendarPerm $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarPermissions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarPermissions/Count/CountRequestBuilder.php index 56e1320e276..623bbfda425 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarPermissions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarPermissions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php index 2cf1823c761..5cc87c19713 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarPermissions/Item/CalendarPermissionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CalendarPermission; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete calendarPermission. This API is available in the following national cloud deployments. * @param CalendarPermissionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendarpermission-delete?view=graph-rest-1.0 Find more info here */ public function delete(?CalendarPermissionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the specified permissions object of a user or group calendar that has been shared. This API is available in the following national cloud deployments. * @param CalendarPermissionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendarpermission-get?view=graph-rest-1.0 Find more info here */ public function get(?CalendarPermissionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the permissions assigned to an existing share recipient or delegate, through the corresponding calendarPermission object for a calendar. This API is available in the following national cloud deployments. * @param CalendarPermission $body The request body * @param CalendarPermissionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendarpermission-update?view=graph-rest-1.0 Find more info here */ public function patch(CalendarPermission $body, ?CalendarPermissionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CalendarPermission::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?CalendarPermissionItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?CalendarPermissionItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?CalendarPermissionItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(CalendarPermission $body, ?CalendarPer $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/CalendarViewRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/CalendarViewRequestBuilder.php index 644857695db..5e7b2fe5076 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/CalendarViewRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/CalendarViewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendars\Item\CalendarView\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar view for the calendar. Navigation property. Read-only. * @param CalendarViewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-list-calendarview?view=graph-rest-1.0 Find more info here */ public function get(?CalendarViewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?CalendarViewRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Count/CountRequestBuilder.php index d233953f4ae..93b34fccaf7 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Delta/DeltaRequestBuilder.php index ce6aa0e98e6..e28cc0803cc 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php index bbcc8d171bb..44a51f9982f 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php index f7238d8cd8c..3c8241586b0 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php index f52d2c5106b..b33eda59b7e 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index f9f44f1fed4..b8f654e0a88 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php index d3641f36bbe..2f97d445b03 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php index 46b363d2ceb..332c316b33c 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php index 13676f08ac4..b225f52e388 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php index a88316fd607..f03d3b3bb45 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php index 6b28d5a31a0..f40d705799e 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/EventItemRequestBuilder.php index 64bad1f63af..a7cd7480ce2 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendars\Item\CalendarView\Item\Accept\AcceptRequestBuilder; @@ -122,19 +121,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar view for the calendar. Navigation property. Read-only. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -147,7 +143,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -155,6 +150,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php index da4a51a1943..8b1027a67fb 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php index 0dbef8dd112..ca00f0dcfa2 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php index d098cc55e4f..2a431c364d4 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php index 803416d7fad..d0bab34f1bc 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php index 56c823c089e..18b58ea0e6d 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php index 2383c0f7f92..dbc5f8f454c 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php index 9f7820045c3..695d8ed396a 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendars\Item\CalendarView\Item\Instances\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php index 89163cc2ae3..406ac6b1acf 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php index 26714448492..e5c8eae5c26 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php index d094e3262de..0a0cc12277a 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 8527f2246b2..9ae2fd4db23 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php index df1aace7b2c..ba6a5e2bf32 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php index c58399e7e03..c05eb6b6292 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php index 0187bbdc664..dac841db500 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php index 136325ea24c..f428660734c 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php index df3baa91a4c..4fd5fa8939e 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php index 2ea8e76783a..7ed2639e62e 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendars\Item\CalendarView\Item\Instances\Item\Accept\AcceptRequestBuilder; @@ -114,19 +113,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -139,7 +135,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +142,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php index 5ed9ebd130c..b691851e414 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php index 62f53e4a872..e2b56be05e9 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 5a6557c88c7..bde6fe70c11 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php index c864ba5f572..e09735b7535 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index 2453b008be8..fbadfc079c3 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index e0e1929f409..4bcceec4017 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index cb6550e07be..ce295d1fc89 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index e539ae1962c..b69826def44 100644 --- a/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/CalendarView/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Count/CountRequestBuilder.php index a028606fce5..d240c4ae56c 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Delta/DeltaRequestBuilder.php index f7160497fc3..b06b391dd78 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/EventsRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/EventsRequestBuilder.php index d5cd05b983d..c85a02bb3e9 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/EventsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/EventsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of events in a calendar. The calendar can be one for a user, or the default calendar of a Microsoft 365 group. The list of events contains single instance meetings and series masters. To get expanded event instances, you can get the calendar view, or get the instances of an event. This API is available in the following national cloud deployments. * @param EventsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-list-events?view=graph-rest-1.0 Find more info here */ public function get(?EventsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new event in a calendar. The calendar can be one for a user, or the default calendar of a Microsoft 365 group. This API is available in the following national cloud deployments. * @param Event $body The request body * @param EventsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-post-events?view=graph-rest-1.0 Find more info here */ public function post(Event $body, ?EventsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?EventsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?EventsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Event $body, ?EventsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Accept/AcceptRequestBuilder.php index bb27c1e845d..302f82110eb 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php index 22f1ffcdeba..fa8a3b4c0ac 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/Count/CountRequestBuilder.php index 001f41729e6..193cde612f0 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 03b9d7d3f0f..f7eaeb9ea83 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 5fca1cccfef..af25671ce92 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Calendar/CalendarRequestBuilder.php index ce34c5217a7..ad48110eeab 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Cancel/CancelRequestBuilder.php index f289b2c1293..8ea3e5e27c8 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Decline/DeclineRequestBuilder.php index 4edd3efc235..02a33af92fa 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php index 6866b9814d7..76242096cc2 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/EventItemRequestBuilder.php index 7f2bce4a357..73455432f0a 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendars\Item\Events\Item\Accept\AcceptRequestBuilder; @@ -122,57 +121,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property events for users * @param EventItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EventItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The events in the calendar. Navigation property. Read-only. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update an event object. This API is available in the following national cloud deployments. * @param Event $body The request body * @param EventItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/group-update-event?view=graph-rest-1.0 Find more info here */ public function patch(Event $body, ?EventItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -189,6 +179,7 @@ public function toDeleteRequestInformation(?EventItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -202,7 +193,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -210,6 +200,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -224,11 +215,11 @@ public function toPatchRequestInformation(Event $body, ?EventItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Extensions/Count/CountRequestBuilder.php index 4c8dba27fe5..778255d07f7 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php index 9ec1270cc67..c2e6a1d6500 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php index c02c2503fef..339d9d66010 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Forward/ForwardRequestBuilder.php index fa0c9bf989d..34c1b9db0da 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Count/CountRequestBuilder.php index f792e45e1b8..9d13cd59f53 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php index 7bfcb012f31..ce0516189c0 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/InstancesRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/InstancesRequestBuilder.php index c8783f08f81..01468c8f338 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendars\Item\Events\Item\Instances\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php index fe8059a77fe..674b328b8ec 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php index 9a993e56fda..c9ca16c9473 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php index 90bc2c88d37..5eafc1657f0 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 15dcd277f37..0784b89383a 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 77b8abc97d5..6d4bf76ce38 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php index 4e905ba9216..454b96724c0 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php index be0e21d79c4..a34ed822a5c 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php index 9c5a3f95449..0a9b85a00a2 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php index 9f12dbe5915..4619be85558 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php index 61413d4db65..6ade4034f98 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Calendars\Item\Events\Item\Instances\Item\Accept\AcceptRequestBuilder; @@ -114,19 +113,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -139,7 +135,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +142,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php index d655812c5a4..748156d9b80 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php index 2268781f373..832dc5dbcbf 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php index c171b3525ff..235ddee133d 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php index f432765dd07..770747b6102 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index ab505e6490e..f268af36ba3 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index b7321bd583a..4df994072c2 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index 4292ea4c867..77599d001d4 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index 8c979739513..ea2852538b2 100644 --- a/src/Generated/Users/Item/Calendars/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Calendars/Item/GetSchedule/GetScheduleRequestBuilder.php b/src/Generated/Users/Item/Calendars/Item/GetSchedule/GetScheduleRequestBuilder.php index 68197d189d8..481630e3393 100644 --- a/src/Generated/Users/Item/Calendars/Item/GetSchedule/GetScheduleRequestBuilder.php +++ b/src/Generated/Users/Item/Calendars/Item/GetSchedule/GetScheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Get the free/busy availability information for a collection of users, distributions lists, or resources (rooms or equipment) for a specified time period. This API is available in the following national cloud deployments. * @param GetSchedulePostRequestBody $body The request body * @param GetScheduleRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calendar-getschedule?view=graph-rest-1.0 Find more info here */ public function post(GetSchedulePostRequestBody $body, ?GetScheduleRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetSchedulePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetSchedulePostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetSchedulePostRequestBody $body, ?GetS $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ChangePassword/ChangePasswordRequestBuilder.php b/src/Generated/Users/Item/ChangePassword/ChangePasswordRequestBuilder.php index 99c4a6a94cb..c4215adde48 100644 --- a/src/Generated/Users/Item/ChangePassword/ChangePasswordRequestBuilder.php +++ b/src/Generated/Users/Item/ChangePassword/ChangePasswordRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Enable the user to update their password. Any user can update their password without belonging to any administrator role. This API is available in the following national cloud deployments. * @param ChangePasswordPostRequestBody $body The request body * @param ChangePasswordRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-changepassword?view=graph-rest-1.0 Find more info here */ public function post(ChangePasswordPostRequestBody $body, ?ChangePasswordRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ChangePasswordPostRequestBody $body, ?C $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/ChatsRequestBuilder.php b/src/Generated/Users/Item/Chats/ChatsRequestBuilder.php index ea52d660452..2f99964bfbc 100644 --- a/src/Generated/Users/Item/Chats/ChatsRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/ChatsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Chat; use Microsoft\Graph\Generated\Models\ChatCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of chats that the user is part of. This method supports federation. When a user ID is provided, the calling application must belong to the same tenant that the user belongs to. This API is available in the following national cloud deployments. * @param ChatsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-list?view=graph-rest-1.0 Find more info here */ public function get(?ChatsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to chats for users * @param Chat $body The request body * @param ChatsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Chat $body, ?ChatsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?ChatsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?ChatsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(Chat $body, ?ChatsRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Chats/Count/CountRequestBuilder.php index cc626dd12f0..8af6fc4b1e4 100644 --- a/src/Generated/Users/Item/Chats/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/GetAllMessages/GetAllMessagesRequestBuilder.php b/src/Generated/Users/Item/Chats/GetAllMessages/GetAllMessagesRequestBuilder.php index 7b78a900c04..427c8634997 100644 --- a/src/Generated/Users/Item/Chats/GetAllMessages/GetAllMessagesRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/GetAllMessages/GetAllMessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAllMessages * @param GetAllMessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAllMessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/ChatItemRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/ChatItemRequestBuilder.php index dd8690bc5f9..a04acd95ea9 100644 --- a/src/Generated/Users/Item/Chats/Item/ChatItemRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/ChatItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Chat; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Chats\Item\HideForUser\HideForUserRequestBuilder; @@ -130,57 +129,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property chats for users * @param ChatItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single chat (without its messages). This method supports federation. To access a chat, at least one chat member must belong to the tenant the request initiated from. This API is available in the following national cloud deployments. * @param ChatItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property chats in users * @param Chat $body The request body * @param ChatItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Chat $body, ?ChatItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -197,6 +187,7 @@ public function toDeleteRequestInformation(?ChatItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -210,7 +201,6 @@ public function toGetRequestInformation(?ChatItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -218,6 +208,7 @@ public function toGetRequestInformation(?ChatItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -232,11 +223,11 @@ public function toPatchRequestInformation(Chat $body, ?ChatItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/HideForUser/HideForUserRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/HideForUser/HideForUserRequestBuilder.php index e45d20c0791..41fc8cbb5c0 100644 --- a/src/Generated/Users/Item/Chats/Item/HideForUser/HideForUserRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/HideForUser/HideForUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Hide a chat for a user. This API is available in the following national cloud deployments. * @param HideForUserPostRequestBody $body The request body * @param HideForUserRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-hideforuser?view=graph-rest-1.0 Find more info here */ public function post(HideForUserPostRequestBody $body, ?HideForUserRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(HideForUserPostRequestBody $body, ?Hide $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/InstalledApps/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/InstalledApps/Count/CountRequestBuilder.php index e9529cb6e07..3db2d997011 100644 --- a/src/Generated/Users/Item/Chats/Item/InstalledApps/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/InstalledApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/InstalledApps/InstalledAppsRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/InstalledApps/InstalledAppsRequestBuilder.php index 3e4ed308a61..57bd7c60660 100644 --- a/src/Generated/Users/Item/Chats/Item/InstalledApps/InstalledAppsRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/InstalledApps/InstalledAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppInstallation; use Microsoft\Graph\Generated\Models\TeamsAppInstallationCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all app installations within a chat. This API is available in the following national cloud deployments. * @param InstalledAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-list-installedapps?view=graph-rest-1.0 Find more info here */ public function get(?InstalledAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Install a teamsApp to the specified chat. This API is available in the following national cloud deployments. * @param TeamsAppInstallation $body The request body * @param InstalledAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-post-installedapps?view=graph-rest-1.0 Find more info here */ public function post(TeamsAppInstallation $body, ?InstalledAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?InstalledAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?InstalledAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsAppInstallation $body, ?InstalledA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php index 19d95d147ff..85c4529e337 100644 --- a/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The app that is installed. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php index f40b3f9c2b8..23749ac778d 100644 --- a/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The details of this version of the app. * @param TeamsAppDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppDefinitionRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppDefinitionRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php index 72242926100..4b5985feb66 100644 --- a/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppInstallation; use Microsoft\Graph\Generated\Users\Item\Chats\Item\InstalledApps\Item\TeamsApp\TeamsAppRequestBuilder; @@ -58,58 +57,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Uninstall an app installed within a chat. This API is available in the following national cloud deployments. * @param TeamsAppInstallationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-delete-installedapps?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsAppInstallationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an app installed in a chat. This API is available in the following national cloud deployments. * @param TeamsAppInstallationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-get-installedapps?view=graph-rest-1.0 Find more info here */ public function get(?TeamsAppInstallationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property installedApps in users * @param TeamsAppInstallation $body The request body * @param TeamsAppInstallationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamsAppInstallation $body, ?TeamsAppInstallationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -126,6 +116,7 @@ public function toDeleteRequestInformation(?TeamsAppInstallationItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -139,7 +130,6 @@ public function toGetRequestInformation(?TeamsAppInstallationItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +137,7 @@ public function toGetRequestInformation(?TeamsAppInstallationItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -161,11 +152,11 @@ public function toPatchRequestInformation(TeamsAppInstallation $body, ?TeamsAppI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php index 74a900fbb5c..c323fac3a3e 100644 --- a/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Upgrade an app installation within a chat. This API is available in the following national cloud deployments. * @param UpgradePostRequestBody $body The request body * @param UpgradeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-teamsappinstallation-upgrade?view=graph-rest-1.0 Find more info here */ public function post(UpgradePostRequestBody $body, ?UpgradeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(UpgradePostRequestBody $body, ?UpgradeR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/LastMessagePreview/LastMessagePreviewRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/LastMessagePreview/LastMessagePreviewRequestBuilder.php index 661245d5597..0da2a93e419 100644 --- a/src/Generated/Users/Item/Chats/Item/LastMessagePreview/LastMessagePreviewRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/LastMessagePreview/LastMessagePreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageInfo; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property lastMessagePreview for users * @param LastMessagePreviewRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LastMessagePreviewRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Preview of the last message sent in the chat. Null if no messages have been sent in the chat. Currently, only the list chats operation supports this property. * @param LastMessagePreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastMessagePreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property lastMessagePreview in users * @param ChatMessageInfo $body The request body * @param LastMessagePreviewRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageInfo $body, ?LastMessagePreviewRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?LastMessagePreviewRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?LastMessagePreviewRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?LastMessagePreviewRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ChatMessageInfo $body, ?LastMessagePre $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/MarkChatReadForUser/MarkChatReadForUserRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/MarkChatReadForUser/MarkChatReadForUserRequestBuilder.php index 7a00229c7c9..ad106932b12 100644 --- a/src/Generated/Users/Item/Chats/Item/MarkChatReadForUser/MarkChatReadForUserRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/MarkChatReadForUser/MarkChatReadForUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Mark a chat as read for a user. This API is available in the following national cloud deployments. * @param MarkChatReadForUserPostRequestBody $body The request body * @param MarkChatReadForUserRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-markchatreadforuser?view=graph-rest-1.0 Find more info here */ public function post(MarkChatReadForUserPostRequestBody $body, ?MarkChatReadForUserRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(MarkChatReadForUserPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/MarkChatUnreadForUser/MarkChatUnreadForUserRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/MarkChatUnreadForUser/MarkChatUnreadForUserRequestBuilder.php index 7194313fad9..60ac1285771 100644 --- a/src/Generated/Users/Item/Chats/Item/MarkChatUnreadForUser/MarkChatUnreadForUserRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/MarkChatUnreadForUser/MarkChatUnreadForUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Mark a chat as unread for a user. This API is available in the following national cloud deployments. * @param MarkChatUnreadForUserPostRequestBody $body The request body * @param MarkChatUnreadForUserRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-markchatunreadforuser?view=graph-rest-1.0 Find more info here */ public function post(MarkChatUnreadForUserPostRequestBody $body, ?MarkChatUnreadForUserRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(MarkChatUnreadForUserPostRequestBody $b $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Members/Add/AddRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Members/Add/AddRequestBuilder.php index bf94404b8f2..a1b22c3b258 100644 --- a/src/Generated/Users/Item/Chats/Item/Members/Add/AddRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Members/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add multiple members in a single request to a team. The response provides details about which memberships could and couldn't be created. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmembers-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Members/Count/CountRequestBuilder.php index f7f64ed00c2..bcb8d7ad1b1 100644 --- a/src/Generated/Users/Item/Chats/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Members/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Members/Item/ConversationMemberItemRequestBuilder.php index 469cd928472..d540f111230 100644 --- a/src/Generated/Users/Item/Chats/Item/Members/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Members/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a conversationMember from a chat. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-delete-members?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a conversationMember from a chat. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-get-members?view=graph-rest-1.0 Find more info here */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property members in users * @param ConversationMember $body The request body * @param ConversationMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ConversationMember $body, ?ConversationMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ConversationMemberItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(ConversationMember $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Members/MembersRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Members/MembersRequestBuilder.php index 9a14f3d970e..da9d56510df 100644 --- a/src/Generated/Users/Item/Chats/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all conversation members in a chat or channel. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmember-list?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a conversationMember to a chat. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-post-members?view=graph-rest-1.0 Find more info here */ public function post(ConversationMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ConversationMember $body, ?MembersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Count/CountRequestBuilder.php index 696e18e416c..951f21a4df0 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Delta/DeltaRequestBuilder.php index ddab9de8df1..2d1e187ef8f 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/ChatMessageItemRequestBuilder.php index 64d2e483700..7106e5bf4d4 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Chats\Item\Messages\Item\HostedContents\HostedContentsRequestBuilder; @@ -82,57 +81,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property messages for users * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property messages in users * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -149,6 +139,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -162,7 +153,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -170,6 +160,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -184,11 +175,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php index ced6fc64f0f..6f64d5fb7c8 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php index e9e225567e6..7e95b014738 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ChatMessageHostedContentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for users * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index aef0bcb9797..0b42e319c92 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index 9d4da82f9eb..de7890ba923 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Chats\Item\Messages\Item\HostedContents\Item\Value\ContentRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for users * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in users * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php index 0e0950fc868..f99c00487bc 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Count/CountRequestBuilder.php index 821bbedb491..e3903aa20ce 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php index c9742b7e859..988a8a6ba9e 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php index e9b3b715ec3..ff7ed92a25a 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Chats\Item\Messages\Item\Replies\Item\HostedContents\HostedContentsRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property replies for users * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property replies in users * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php index b04efbe695b..180b01944ee 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php index 03abe901b4d..02a49d94c1e 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ChatMessageHostedContentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for users * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 097b76fa5d5..43e614ff9f1 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index c5c66a53c72..d931f1d78db 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Chats\Item\Messages\Item\Replies\Item\HostedContents\Item\Value\ContentRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for users * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in users * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php index a57fd3cde3b..899789b3277 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php index 43d5bd24e44..e29963bad5c 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php index 3dc135cd14f..b5ffaa9d14f 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index 3a7df4be912..f4993efd242 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php index e3e78b2d21d..9821599049a 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/RepliesRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/RepliesRequestBuilder.php index ef4f1f87ac6..fe1daa430b8 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/RepliesRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/Replies/RepliesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ChatMessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the replies to a message in a channel of a team. This method lists only the replies of the specified message, if any. To get the message itself, simply call get channel message. This API is available in the following national cloud deployments. * @param RepliesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-replies?view=graph-rest-1.0 Find more info here */ public function get(?RepliesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new reply to a chatMessage in a specified channel. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param RepliesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-messagereply?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?RepliesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?RepliesRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php index b8ce2cf7b3a..8fe562fffa8 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php index d623b3051a3..182b126341d 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index f10a60673be..363566b71c8 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php index 0a4f537ed5a..e965fdd2410 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Messages/MessagesRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Messages/MessagesRequestBuilder.php index 7a99db2b432..e0d0b2c3d59 100644 --- a/src/Generated/Users/Item/Chats/Item/Messages/MessagesRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Messages/MessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ChatMessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of messages in a chat. This method supports federation. To list chat messages in application context, the request must be made from the tenant that the channel owner belongs to (represented by the tenantId property on the channel). This API is available in the following national cloud deployments. * @param MessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?MessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Send a new chatMessage in the specified chat. This API can't create a new chat; you must use the list chats method to retrieve the ID of an existing chat before you can create a chat message. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/chat-post-messages?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/chatmessage-post?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?MessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,11 +109,12 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Send a new chatMessage in the specified chat. This API can't create a new chat; you must use the list chats method to retrieve the ID of an existing chat before you can create a chat message. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?MessagesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/PermissionGrants/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/PermissionGrants/Count/CountRequestBuilder.php index b9e155d13e0..c9330fb7ba9 100644 --- a/src/Generated/Users/Item/Chats/Item/PermissionGrants/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/PermissionGrants/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php index 6074acd7137..a9a64ead911 100644 --- a/src/Generated/Users/Item/Chats/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrant; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property permissionGrants for users * @param ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of permissions granted to apps for the chat. * @param ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property permissionGrants in users * @param ResourceSpecificPermissionGrant $body The request body * @param ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ResourceSpecificPermissionGrant $body, ?ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ResourceSpecificPermissionGrantItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilder.php index b6e4e0d4e16..c21cc7dcd69 100644 --- a/src/Generated/Users/Item/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrant; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrantCollectionResponse; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List all resource-specific permission grants on the chat. This list specifies the Azure AD apps that have access to the chat, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the chat. This list specifies the Microsoft Entra apps that have access to the chat, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. * @param PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-list-permissiongrants?view=graph-rest-1.0 Find more info here */ public function get(?PermissionGrantsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to permissionGrants for users * @param ResourceSpecificPermissionGrant $body The request body * @param PermissionGrantsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ResourceSpecificPermissionGrant $body, ?PermissionGrantsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List all resource-specific permission grants on the chat. This list specifies the Azure AD apps that have access to the chat, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the chat. This list specifies the Microsoft Entra apps that have access to the chat, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. * @param PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php index 40ecc146bf4..d71ab8a0c3b 100644 --- a/src/Generated/Users/Item/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/Chats/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List all resource-specific permission grants on the chat. This list specifies the Azure AD apps that have access to the chat, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the chat. This list specifies the Microsoft Entra apps that have access to the chat, along with the corresponding kind of resource-specific access that each app has. This API is available in the following national cloud deployments. */ class PermissionGrantsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/Chats/Item/PinnedMessages/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/PinnedMessages/Count/CountRequestBuilder.php index cbc84930bb8..2c1065fa0b4 100644 --- a/src/Generated/Users/Item/Chats/Item/PinnedMessages/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/PinnedMessages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/PinnedMessages/Item/Message/MessageRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/PinnedMessages/Item/Message/MessageRequestBuilder.php index 3abc3989ca9..fd3e6f8b4ba 100644 --- a/src/Generated/Users/Item/Chats/Item/PinnedMessages/Item/Message/MessageRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/PinnedMessages/Item/Message/MessageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Represents details about the chat message that is pinned. * @param MessageRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MessageRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?MessageRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?MessageRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/PinnedMessages/Item/PinnedChatMessageInfoItemRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/PinnedMessages/Item/PinnedChatMessageInfoItemRequestBuilder.php index 01fd967ad99..fcb0c5a49dd 100644 --- a/src/Generated/Users/Item/Chats/Item/PinnedMessages/Item/PinnedChatMessageInfoItemRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/PinnedMessages/Item/PinnedChatMessageInfoItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PinnedChatMessageInfo; use Microsoft\Graph\Generated\Users\Item\Chats\Item\PinnedMessages\Item\Message\MessageRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unpin a message from a chat. This API is available in the following national cloud deployments. * @param PinnedChatMessageInfoItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-delete-pinnedmessages?view=graph-rest-1.0 Find more info here */ public function delete(?PinnedChatMessageInfoItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of all the pinned messages in the chat. Nullable. * @param PinnedChatMessageInfoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PinnedChatMessageInfoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pinnedMessages in users * @param PinnedChatMessageInfo $body The request body * @param PinnedChatMessageInfoItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PinnedChatMessageInfo $body, ?PinnedChatMessageInfoItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?PinnedChatMessageInfoItemRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?PinnedChatMessageInfoItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?PinnedChatMessageInfoItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(PinnedChatMessageInfo $body, ?PinnedCh $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/PinnedMessages/PinnedMessagesRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/PinnedMessages/PinnedMessagesRequestBuilder.php index 64da568a82c..1a18ab332e7 100644 --- a/src/Generated/Users/Item/Chats/Item/PinnedMessages/PinnedMessagesRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/PinnedMessages/PinnedMessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PinnedChatMessageInfo; use Microsoft\Graph\Generated\Models\PinnedChatMessageInfoCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of pinnedChatMessages in a chat. This API is available in the following national cloud deployments. * @param PinnedMessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-list-pinnedmessages?view=graph-rest-1.0 Find more info here */ public function get(?PinnedMessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Pin a chat message in the specified chat. This API cannot create a new chat; you must use the list chats method to retrieve the ID of an existing chat before you can pin a chat message. This API is available in the following national cloud deployments. * @param PinnedChatMessageInfo $body The request body * @param PinnedMessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-post-pinnedmessages?view=graph-rest-1.0 Find more info here */ public function post(PinnedChatMessageInfo $body, ?PinnedMessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PinnedChatMessageInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PinnedMessagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PinnedMessagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(PinnedChatMessageInfo $body, ?PinnedMes $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php index c163410dade..0c0a5e2209b 100644 --- a/src/Generated/Users/Item/Chats/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Send an activity feed notification in scope of a chat. For more details about sending notifications and the requirements for doing so, see sending Teams activity notifications. This API is available in the following national cloud deployments. * @param SendActivityNotificationPostRequestBody $body The request body * @param SendActivityNotificationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-sendactivitynotification?view=graph-rest-1.0 Find more info here */ public function post(SendActivityNotificationPostRequestBody $body, ?SendActivityNotificationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SendActivityNotificationPostRequestBody $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Tabs/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Tabs/Count/CountRequestBuilder.php index 7026deeb8fb..a9c765103a4 100644 --- a/src/Generated/Users/Item/Chats/Item/Tabs/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Tabs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php index 9ea28117da6..ffeda992d1e 100644 --- a/src/Generated/Users/Item/Chats/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The application that is linked to the tab. This can't be changed after tab creation. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Tabs/Item/TeamsTabItemRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Tabs/Item/TeamsTabItemRequestBuilder.php index 32ef6ce919f..793a85aa500 100644 --- a/src/Generated/Users/Item/Chats/Item/Tabs/Item/TeamsTabItemRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Tabs/Item/TeamsTabItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; use Microsoft\Graph\Generated\Users\Item\Chats\Item\Tabs\Item\TeamsApp\TeamsAppRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove (unpin) a tab from the specified chat. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-delete-tabs?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsTabItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of the specified tab in a chat. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-get-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TeamsTabItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified tab in a chat. This can be used to configure the content of the tab. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TeamsTabItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-patch-tabs?view=graph-rest-1.0 Find more info here */ public function patch(TeamsTab $body, ?TeamsTabItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TeamsTabItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TeamsTab $body, ?TeamsTabItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/Tabs/TabsRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/Tabs/TabsRequestBuilder.php index 728c4930124..48a88a958c5 100644 --- a/src/Generated/Users/Item/Chats/Item/Tabs/TabsRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/Tabs/TabsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; use Microsoft\Graph\Generated\Models\TeamsTabCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of tabs in the specified chat. This API is available in the following national cloud deployments. * @param TabsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-list-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TabsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add (pin) a tab to the specified chat. The corresponding app must already be installed in the chat. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TabsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-post-tabs?view=graph-rest-1.0 Find more info here */ public function post(TeamsTab $body, ?TabsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsTab $body, ?TabsRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Chats/Item/UnhideForUser/UnhideForUserRequestBuilder.php b/src/Generated/Users/Item/Chats/Item/UnhideForUser/UnhideForUserRequestBuilder.php index 557deed9b97..78be1758f01 100644 --- a/src/Generated/Users/Item/Chats/Item/UnhideForUser/UnhideForUserRequestBuilder.php +++ b/src/Generated/Users/Item/Chats/Item/UnhideForUser/UnhideForUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Unhide a chat for a user. This API is available in the following national cloud deployments. * @param UnhideForUserPostRequestBody $body The request body * @param UnhideForUserRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-unhideforuser?view=graph-rest-1.0 Find more info here */ public function post(UnhideForUserPostRequestBody $body, ?UnhideForUserRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(UnhideForUserPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php b/src/Generated/Users/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php index 57121323f58..07c34541170 100644 --- a/src/Generated/Users/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php +++ b/src/Generated/Users/Item/CheckMemberGroups/CheckMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -31,27 +30,24 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0 Find more info here */ public function post(CheckMemberGroupsPostRequestBody $body, ?CheckMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Azure AD. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. + * Check for membership in a specified list of group IDs, and return from that list those groups (identified by IDs) of which the specified user, group, service principal, organizational contact, device, or directory object is a member. This function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct. This API is available in the following national cloud deployments. * @param CheckMemberGroupsPostRequestBody $body The request body * @param CheckMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -61,11 +57,11 @@ public function toPostRequestInformation(CheckMemberGroupsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php b/src/Generated/Users/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php index 7e7833a52d3..b9f646cba9d 100644 --- a/src/Generated/Users/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php +++ b/src/Generated/Users/Item/CheckMemberObjects/CheckMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action checkMemberObjects * @param CheckMemberObjectsPostRequestBody $body The request body * @param CheckMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CheckMemberObjectsPostRequestBody $body, ?CheckMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CheckMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(CheckMemberObjectsPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/ContactFoldersRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/ContactFoldersRequestBuilder.php index 46d8b1158e5..17dd21480f7 100644 --- a/src/Generated/Users/Item/ContactFolders/ContactFoldersRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/ContactFoldersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContactFolder; use Microsoft\Graph\Generated\Models\ContactFolderCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the contact folder collection in the default Contacts folder of the signed-in user. This API is available in the following national cloud deployments. * @param ContactFoldersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-contactfolders?view=graph-rest-1.0 Find more info here */ public function get(?ContactFoldersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContactFolderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContactFolderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new contactFolder under the user's default contacts folder. You can also create a new contactfolder as a child of any specified contact folder. This API is available in the following national cloud deployments. * @param ContactFolder $body The request body * @param ContactFoldersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-post-contactfolders?view=graph-rest-1.0 Find more info here */ public function post(ContactFolder $body, ?ContactFoldersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContactFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContactFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ContactFoldersRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ContactFoldersRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ContactFolder $body, ?ContactFoldersReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Count/CountRequestBuilder.php index 0700f24e17b..cace4cf36bf 100644 --- a/src/Generated/Users/Item/ContactFolders/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Delta/DeltaRequestBuilder.php index bc04fdedde9..011c10a3d47 100644 --- a/src/Generated/Users/Item/ContactFolders/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of contact folders that have been added, deleted, or removed from the user's mailbox. A delta function call for contact folders in a mailbox is similar to a GET request, except that by appropriately applying state tokens in one or more of these calls, you can query for incremental changes in the contact folders. This allows you to maintain and synchronize a local store of a user's contact folders without having to fetch all the contact folders of that mailbox from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contactfolder-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/ChildFoldersRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/ChildFoldersRequestBuilder.php index 4d85b48095c..5eab524fd36 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/ChildFoldersRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/ChildFoldersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContactFolder; use Microsoft\Graph\Generated\Models\ContactFolderCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a collection of child folders under the specified contact folder. This API is available in the following national cloud deployments. * @param ChildFoldersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contactfolder-list-childfolders?view=graph-rest-1.0 Find more info here */ public function get(?ChildFoldersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContactFolderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContactFolderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new contactFolder as a child of a specified folder. You can also create a new contactFolder under the user's default contact folder. This API is available in the following national cloud deployments. * @param ContactFolder $body The request body * @param ChildFoldersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contactfolder-post-childfolders?view=graph-rest-1.0 Find more info here */ public function post(ContactFolder $body, ?ChildFoldersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContactFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContactFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ChildFoldersRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ChildFoldersRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ContactFolder $body, ?ChildFoldersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Count/CountRequestBuilder.php index 330e660be30..ef774d1e68a 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Delta/DeltaRequestBuilder.php index 3b58f86140b..377825947cc 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of contact folders that have been added, deleted, or removed from the user's mailbox. A delta function call for contact folders in a mailbox is similar to a GET request, except that by appropriately applying state tokens in one or more of these calls, you can query for incremental changes in the contact folders. This allows you to maintain and synchronize a local store of a user's contact folders without having to fetch all the contact folders of that mailbox from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contactfolder-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/ContactFolderItemRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/ContactFolderItemRequestBuilder.php index 73e38e378e5..cdc645f5529 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/ContactFolderItemRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/ContactFolderItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContactFolder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\ContactFolders\Item\ChildFolders\Item\Contacts\ContactsRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property childFolders for users * @param ContactFolderItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ContactFolderItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of child folders in the folder. Navigation property. Read-only. Nullable. * @param ContactFolderItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContactFolderItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContactFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContactFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property childFolders in users * @param ContactFolder $body The request body * @param ContactFolderItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ContactFolder $body, ?ContactFolderItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContactFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContactFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?ContactFolderItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?ContactFolderItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?ContactFolderItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(ContactFolder $body, ?ContactFolderIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/ContactsRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/ContactsRequestBuilder.php index b07fef4fff5..04a75a7d718 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/ContactsRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/ContactsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Contact; use Microsoft\Graph\Generated\Models\ContactCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a contact collection from the default Contacts folder of the signed-in user (.../me/contacts), or from the specified contact folder. This API is available in the following national cloud deployments. * @param ContactsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contactfolder-list-contacts?view=graph-rest-1.0 Find more info here */ public function get(?ContactsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a contact to the root Contacts folder or to the contacts endpoint of another contact folder. This API is available in the following national cloud deployments. * @param Contact $body The request body * @param ContactsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contactfolder-post-contacts?view=graph-rest-1.0 Find more info here */ public function post(Contact $body, ?ContactsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ContactsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ContactsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Contact $body, ?ContactsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Count/CountRequestBuilder.php index 0991d735b00..bb844858cbf 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Delta/DeltaRequestBuilder.php index 153da1de9a2..44a496fdf1f 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of contacts that have been added, deleted, or updated in a specified folder. A delta function call for contacts in a folder is similar to a GET request, except that by appropriately applying state tokens in one or more of these calls, you can query for incremental changes in the contacts in that folder. This allows you to maintain and synchronize a local store of a user's contacts without having to fetch the entire set of contacts from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contact-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/ContactItemRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/ContactItemRequestBuilder.php index d0c26385a98..a2fe4ccc7f3 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/ContactItemRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/ContactItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Contact; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\ContactFolders\Item\ChildFolders\Item\Contacts\Item\Extensions\ExtensionsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contacts for users * @param ContactItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ContactItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The contacts in the folder. Navigation property. Read-only. Nullable. * @param ContactItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContactItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contacts in users * @param Contact $body The request body * @param ContactItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Contact $body, ?ContactItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ContactItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ContactItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ContactItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Contact $body, ?ContactItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Extensions/Count/CountRequestBuilder.php index 2522827f8fa..90f325468d7 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Extensions/ExtensionsRequestBuilder.php index 203b8c5f60b..a41d0979c9c 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of open extensions defined for the contact. Read-only. Nullable. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for users * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Extensions/Item/ExtensionItemRequestBuilder.php index ee04c0c3d42..20a58f4ba8a 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of open extensions defined for the contact. Read-only. Nullable. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Photo/PhotoRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Photo/PhotoRequestBuilder.php index bf1ad2faa54..c037e8d62dd 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Photo/PhotoRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Photo/PhotoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProfilePhoto; use Microsoft\Graph\Generated\Users\Item\ContactFolders\Item\ChildFolders\Item\Contacts\Item\Photo\Value\ContentRequestBuilder; @@ -42,38 +41,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Optional contact picture. You can get or set a photo for a contact. * @param PhotoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PhotoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property photo in users * @param ProfilePhoto $body The request body * @param PhotoRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ProfilePhoto $body, ?PhotoRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -86,7 +79,6 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -94,6 +86,7 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -108,11 +101,11 @@ public function toPatchRequestInformation(ProfilePhoto $body, ?PhotoRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Photo/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Photo/Value/ContentRequestBuilder.php index e17e0c227ce..55edcbdd4fa 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Photo/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ChildFolders/Item/Contacts/Item/Photo/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,38 +33,36 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property photo from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property photo in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -82,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -100,7 +98,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/ContactFolderItemRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/ContactFolderItemRequestBuilder.php index aed76650762..39b6dda6edf 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/ContactFolderItemRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/ContactFolderItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ContactFolder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\ContactFolders\Item\ChildFolders\ChildFoldersRequestBuilder; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete contactFolder other than the default contactFolder. This API is available in the following national cloud deployments. * @param ContactFolderItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contactfolder-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ContactFolderItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a contact folder by using the contact folder ID. There are two scenarios where an app can get another user's contact folder: This API is available in the following national cloud deployments. * @param ContactFolderItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contactfolder-get?view=graph-rest-1.0 Find more info here */ public function get(?ContactFolderItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContactFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContactFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of contactfolder object. This API is available in the following national cloud deployments. * @param ContactFolder $body The request body * @param ContactFolderItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contactfolder-update?view=graph-rest-1.0 Find more info here */ public function patch(ContactFolder $body, ?ContactFolderItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContactFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContactFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?ContactFolderItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?ContactFolderItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?ContactFolderItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(ContactFolder $body, ?ContactFolderIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/Contacts/ContactsRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/Contacts/ContactsRequestBuilder.php index ac0099b839f..2c359391ae7 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/Contacts/ContactsRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/Contacts/ContactsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Contact; use Microsoft\Graph\Generated\Models\ContactCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a contact collection from the default Contacts folder of the signed-in user (.../me/contacts), or from the specified contact folder. This API is available in the following national cloud deployments. * @param ContactsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contactfolder-list-contacts?view=graph-rest-1.0 Find more info here */ public function get(?ContactsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a contact to the root Contacts folder or to the contacts endpoint of another contact folder. This API is available in the following national cloud deployments. * @param Contact $body The request body * @param ContactsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contactfolder-post-contacts?view=graph-rest-1.0 Find more info here */ public function post(Contact $body, ?ContactsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ContactsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ContactsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Contact $body, ?ContactsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Count/CountRequestBuilder.php index 773eef8581f..f2805da9b36 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Delta/DeltaRequestBuilder.php index b53aafed6f7..b0586a033b9 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of contacts that have been added, deleted, or updated in a specified folder. A delta function call for contacts in a folder is similar to a GET request, except that by appropriately applying state tokens in one or more of these calls, you can query for incremental changes in the contacts in that folder. This allows you to maintain and synchronize a local store of a user's contacts without having to fetch the entire set of contacts from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contact-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/ContactItemRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/ContactItemRequestBuilder.php index fc2fabd9a94..9c708754342 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/ContactItemRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/ContactItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Contact; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\ContactFolders\Item\Contacts\Item\Extensions\ExtensionsRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property contacts for users * @param ContactItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ContactItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The contacts in the folder. Navigation property. Read-only. Nullable. * @param ContactItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContactItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property contacts in users * @param Contact $body The request body * @param ContactItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Contact $body, ?ContactItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?ContactItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?ContactItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?ContactItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(Contact $body, ?ContactItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Extensions/Count/CountRequestBuilder.php index bac534919a7..f5b60cf5dad 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Extensions/ExtensionsRequestBuilder.php index 7ccb9d8b4d6..ce89a2db7bc 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of open extensions defined for the contact. Read-only. Nullable. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for users * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 63ba6d7bbea..3f791b7e251 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of open extensions defined for the contact. Read-only. Nullable. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Photo/PhotoRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Photo/PhotoRequestBuilder.php index 3ce29bf90a3..5ce44e97793 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Photo/PhotoRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Photo/PhotoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProfilePhoto; use Microsoft\Graph\Generated\Users\Item\ContactFolders\Item\Contacts\Item\Photo\Value\ContentRequestBuilder; @@ -42,38 +41,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Optional contact picture. You can get or set a photo for a contact. * @param PhotoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PhotoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property photo in users * @param ProfilePhoto $body The request body * @param PhotoRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ProfilePhoto $body, ?PhotoRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -86,7 +79,6 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -94,6 +86,7 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -108,11 +101,11 @@ public function toPatchRequestInformation(ProfilePhoto $body, ?PhotoRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Photo/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Photo/Value/ContentRequestBuilder.php index 7dcf1f4430a..bd316d9c0f5 100644 --- a/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Photo/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/ContactFolders/Item/Contacts/Item/Photo/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,38 +33,36 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property photo from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property photo in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -82,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -100,7 +98,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Contacts/ContactsRequestBuilder.php b/src/Generated/Users/Item/Contacts/ContactsRequestBuilder.php index 262362efd1e..d7ca869d28b 100644 --- a/src/Generated/Users/Item/Contacts/ContactsRequestBuilder.php +++ b/src/Generated/Users/Item/Contacts/ContactsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Contact; use Microsoft\Graph\Generated\Models\ContactCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a contact collection from the default contacts folder of the signed-in user. There are two scenarios where an app can get contacts in another user's contact folder: This API is available in the following national cloud deployments. * @param ContactsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-contacts?view=graph-rest-1.0 Find more info here */ public function get(?ContactsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a contact to the root Contacts folder or to the contacts endpoint of another contact folder. This API is available in the following national cloud deployments. * @param Contact $body The request body * @param ContactsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-post-contacts?view=graph-rest-1.0 Find more info here */ public function post(Contact $body, ?ContactsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ContactsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ContactsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Contact $body, ?ContactsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Contacts/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Contacts/Count/CountRequestBuilder.php index 2112536a4bd..2478b0c6429 100644 --- a/src/Generated/Users/Item/Contacts/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Contacts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Contacts/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Contacts/Delta/DeltaRequestBuilder.php index 66112e8129f..102c2adeb71 100644 --- a/src/Generated/Users/Item/Contacts/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Contacts/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of contacts that have been added, deleted, or updated in a specified folder. A delta function call for contacts in a folder is similar to a GET request, except that by appropriately applying state tokens in one or more of these calls, you can query for incremental changes in the contacts in that folder. This allows you to maintain and synchronize a local store of a user's contacts without having to fetch the entire set of contacts from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contact-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Contacts/Item/ContactItemRequestBuilder.php b/src/Generated/Users/Item/Contacts/Item/ContactItemRequestBuilder.php index 32ec19fe4c2..ef34bb03885 100644 --- a/src/Generated/Users/Item/Contacts/Item/ContactItemRequestBuilder.php +++ b/src/Generated/Users/Item/Contacts/Item/ContactItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Contact; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Contacts\Item\Extensions\ExtensionsRequestBuilder; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a contact. This API is available in the following national cloud deployments. * @param ContactItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contact-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ContactItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a contact object. There are two scenarios where an app can get a contact in another user's contact folder: This API is available in the following national cloud deployments. * @param ContactItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contact-get?view=graph-rest-1.0 Find more info here */ public function get(?ContactItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a contact object. This API is available in the following national cloud deployments. * @param Contact $body The request body * @param ContactItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/contact-update?view=graph-rest-1.0 Find more info here */ public function patch(Contact $body, ?ContactItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Contact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?ContactItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?ContactItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?ContactItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(Contact $body, ?ContactItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Contacts/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Contacts/Item/Extensions/Count/CountRequestBuilder.php index 6b4b698daa2..9150fd54233 100644 --- a/src/Generated/Users/Item/Contacts/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Contacts/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Contacts/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Contacts/Item/Extensions/ExtensionsRequestBuilder.php index b81d92b2461..f3538623363 100644 --- a/src/Generated/Users/Item/Contacts/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Contacts/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of open extensions defined for the contact. Read-only. Nullable. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for users * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Contacts/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Contacts/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 764cce5a9ac..c91973d1791 100644 --- a/src/Generated/Users/Item/Contacts/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Contacts/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of open extensions defined for the contact. Read-only. Nullable. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Contacts/Item/Photo/PhotoRequestBuilder.php b/src/Generated/Users/Item/Contacts/Item/Photo/PhotoRequestBuilder.php index ada82abf59b..2fc31a3f504 100644 --- a/src/Generated/Users/Item/Contacts/Item/Photo/PhotoRequestBuilder.php +++ b/src/Generated/Users/Item/Contacts/Item/Photo/PhotoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProfilePhoto; use Microsoft\Graph\Generated\Users\Item\Contacts\Item\Photo\Value\ContentRequestBuilder; @@ -42,38 +41,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Optional contact picture. You can get or set a photo for a contact. * @param PhotoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PhotoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property photo in users * @param ProfilePhoto $body The request body * @param PhotoRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ProfilePhoto $body, ?PhotoRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -86,7 +79,6 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -94,6 +86,7 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -108,11 +101,11 @@ public function toPatchRequestInformation(ProfilePhoto $body, ?PhotoRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Contacts/Item/Photo/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/Contacts/Item/Photo/Value/ContentRequestBuilder.php index 98085f565bf..b1eaa9d24dd 100644 --- a/src/Generated/Users/Item/Contacts/Item/Photo/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Contacts/Item/Photo/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,38 +33,36 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property photo from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property photo in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -82,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -100,7 +98,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CreatedObjects/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CreatedObjects/Count/CountRequestBuilder.php index cbffb1c73d1..f789459111c 100644 --- a/src/Generated/Users/Item/CreatedObjects/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CreatedObjects/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CreatedObjects/CreatedObjectsRequestBuilder.php b/src/Generated/Users/Item/CreatedObjects/CreatedObjectsRequestBuilder.php index ea66b213321..523ea2ed659 100644 --- a/src/Generated/Users/Item/CreatedObjects/CreatedObjectsRequestBuilder.php +++ b/src/Generated/Users/Item/CreatedObjects/CreatedObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CreatedObjects\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of directory objects that were created by the user. This API returns only those directory objects that were created by a user who isn't in any administrator role; otherwise, it returns an empty object. This API is available in the following national cloud deployments. * @param CreatedObjectsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-createdobjects?view=graph-rest-1.0 Find more info here */ public function get(?CreatedObjectsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?CreatedObjectsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?CreatedObjectsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CreatedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/Users/Item/CreatedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php index b216d4fc560..1cc8b1a2c8b 100644 --- a/src/Generated/Users/Item/CreatedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/CreatedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CreatedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Users/Item/CreatedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 2cd53c7837a..734e25c8a1d 100644 --- a/src/Generated/Users/Item/CreatedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Users/Item/CreatedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; use Microsoft\Graph\Generated\Users\Item\CreatedObjects\GraphServicePrincipal\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CreatedObjects/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Users/Item/CreatedObjects/Item/DirectoryObjectItemRequestBuilder.php index db3aaa96f10..4271e36e832 100644 --- a/src/Generated/Users/Item/CreatedObjects/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Users/Item/CreatedObjects/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\CreatedObjects\Item\GraphServicePrincipal\GraphServicePrincipalRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Directory objects that the user created. Read-only. Nullable. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/CreatedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Users/Item/CreatedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index b432232ac84..c385b7a6673 100644 --- a/src/Generated/Users/Item/CreatedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Users/Item/CreatedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/DeviceManagementTroubleshootingEvents/Count/CountRequestBuilder.php b/src/Generated/Users/Item/DeviceManagementTroubleshootingEvents/Count/CountRequestBuilder.php index a1be8510f20..34a4e3f8e39 100644 --- a/src/Generated/Users/Item/DeviceManagementTroubleshootingEvents/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/DeviceManagementTroubleshootingEvents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/DeviceManagementTroubleshootingEvents/DeviceManagementTroubleshootingEventsRequestBuilder.php b/src/Generated/Users/Item/DeviceManagementTroubleshootingEvents/DeviceManagementTroubleshootingEventsRequestBuilder.php index 07ad1f5d7d1..130ef1bb913 100644 --- a/src/Generated/Users/Item/DeviceManagementTroubleshootingEvents/DeviceManagementTroubleshootingEventsRequestBuilder.php +++ b/src/Generated/Users/Item/DeviceManagementTroubleshootingEvents/DeviceManagementTroubleshootingEventsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceManagementTroubleshootingEvent; use Microsoft\Graph\Generated\Models\DeviceManagementTroubleshootingEventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The list of troubleshooting events for this user. * @param DeviceManagementTroubleshootingEventsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceManagementTroubleshootingEventsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to deviceManagementTroubleshootingEvents for users * @param DeviceManagementTroubleshootingEvent $body The request body * @param DeviceManagementTroubleshootingEventsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DeviceManagementTroubleshootingEvent $body, ?DeviceManagementTroubleshootingEventsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DeviceManagementTroubleshootingEventsRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DeviceManagementTroubleshootingEventsRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DeviceManagementTroubleshootingEvent $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/DeviceManagementTroubleshootingEvents/Item/DeviceManagementTroubleshootingEventItemRequestBuilder.php b/src/Generated/Users/Item/DeviceManagementTroubleshootingEvents/Item/DeviceManagementTroubleshootingEventItemRequestBuilder.php index c710d224e77..01881f692cb 100644 --- a/src/Generated/Users/Item/DeviceManagementTroubleshootingEvents/Item/DeviceManagementTroubleshootingEventItemRequestBuilder.php +++ b/src/Generated/Users/Item/DeviceManagementTroubleshootingEvents/Item/DeviceManagementTroubleshootingEventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceManagementTroubleshootingEvent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceManagementTroubleshootingEvents for users * @param DeviceManagementTroubleshootingEventItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceManagementTroubleshootingEventItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of troubleshooting events for this user. * @param DeviceManagementTroubleshootingEventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceManagementTroubleshootingEventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property deviceManagementTroubleshootingEvents in users * @param DeviceManagementTroubleshootingEvent $body The request body * @param DeviceManagementTroubleshootingEventItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DeviceManagementTroubleshootingEvent $body, ?DeviceManagementTroubleshootingEventItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceManagementTroubleshootingEvent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DeviceManagementTroubleshootingEvent $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DeviceManagementTroubleshootingEventIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DeviceManagementTroubleshootingEventIte } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(DeviceManagementTroubleshootingEvent $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/DirectReports/Count/CountRequestBuilder.php b/src/Generated/Users/Item/DirectReports/Count/CountRequestBuilder.php index db59d020888..cee257c31de 100644 --- a/src/Generated/Users/Item/DirectReports/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/DirectReports/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/DirectReports/DirectReportsRequestBuilder.php b/src/Generated/Users/Item/DirectReports/DirectReportsRequestBuilder.php index 9e038e70f9e..3e2a59142a6 100644 --- a/src/Generated/Users/Item/DirectReports/DirectReportsRequestBuilder.php +++ b/src/Generated/Users/Item/DirectReports/DirectReportsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\DirectReports\Count\CountRequestBuilder; @@ -70,20 +69,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The users and contacts that report to the user. (The users and contacts that have their manager property set to this user.) Read-only. Nullable. Supports $expand. * @param DirectReportsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-directreports?view=graph-rest-1.0 Find more info here */ public function get(?DirectReportsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -96,7 +92,6 @@ public function toGetRequestInformation(?DirectReportsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -104,6 +99,7 @@ public function toGetRequestInformation(?DirectReportsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/DirectReports/GraphOrgContact/Count/CountRequestBuilder.php b/src/Generated/Users/Item/DirectReports/GraphOrgContact/Count/CountRequestBuilder.php index 2a39190cd1e..509798522cf 100644 --- a/src/Generated/Users/Item/DirectReports/GraphOrgContact/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/DirectReports/GraphOrgContact/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/DirectReports/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Users/Item/DirectReports/GraphOrgContact/GraphOrgContactRequestBuilder.php index 25b9de684ed..d893eb49fe3 100644 --- a/src/Generated/Users/Item/DirectReports/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Users/Item/DirectReports/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContactCollectionResponse; use Microsoft\Graph\Generated\Users\Item\DirectReports\GraphOrgContact\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.orgContact in the microsoft.graph.directoryObject collection * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContactCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/DirectReports/GraphUser/Count/CountRequestBuilder.php b/src/Generated/Users/Item/DirectReports/GraphUser/Count/CountRequestBuilder.php index b9f84f8d272..6f9e1d589dd 100644 --- a/src/Generated/Users/Item/DirectReports/GraphUser/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/DirectReports/GraphUser/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/DirectReports/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Users/Item/DirectReports/GraphUser/GraphUserRequestBuilder.php index 295dfa63850..d04fd766c7a 100644 --- a/src/Generated/Users/Item/DirectReports/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Users/Item/DirectReports/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; use Microsoft\Graph\Generated\Users\Item\DirectReports\GraphUser\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.user in the microsoft.graph.directoryObject collection * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/DirectReports/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Users/Item/DirectReports/Item/DirectoryObjectItemRequestBuilder.php index fe65fff3086..91cf6fab5ce 100644 --- a/src/Generated/Users/Item/DirectReports/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Users/Item/DirectReports/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\DirectReports\Item\GraphOrgContact\GraphOrgContactRequestBuilder; @@ -50,19 +49,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The users and contacts that report to the user. (The users and contacts that have their manager property set to this user.) Read-only. Nullable. Supports $expand. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -75,7 +71,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -83,6 +78,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/DirectReports/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php b/src/Generated/Users/Item/DirectReports/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php index 5553a46f315..4cea4163ac8 100644 --- a/src/Generated/Users/Item/DirectReports/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php +++ b/src/Generated/Users/Item/DirectReports/Item/GraphOrgContact/GraphOrgContactRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OrgContact; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.orgContact * @param GraphOrgContactRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphOrgContactRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OrgContact::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphOrgContactRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/DirectReports/Item/GraphUser/GraphUserRequestBuilder.php b/src/Generated/Users/Item/DirectReports/Item/GraphUser/GraphUserRequestBuilder.php index f6849bd6eae..d9314b3c4d7 100644 --- a/src/Generated/Users/Item/DirectReports/Item/GraphUser/GraphUserRequestBuilder.php +++ b/src/Generated/Users/Item/DirectReports/Item/GraphUser/GraphUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.user * @param GraphUserRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphUserRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphUserRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Drive/DriveRequestBuilder.php b/src/Generated/Users/Item/Drive/DriveRequestBuilder.php index 8c6ba826367..fba5a2963f6 100644 --- a/src/Generated/Users/Item/Drive/DriveRequestBuilder.php +++ b/src/Generated/Users/Item/Drive/DriveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Drive; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of a Drive resource. A Drive is the top-level container for a file system, such as OneDrive or SharePoint document libraries. This API is available in the following national cloud deployments. * @param DriveRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/drive-get?view=graph-rest-1.0 Find more info here */ public function get(?DriveRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?DriveRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Drives/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Drives/Count/CountRequestBuilder.php index 4dec6b5d6dd..d6c3c1d80e3 100644 --- a/src/Generated/Users/Item/Drives/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Drives/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Drives/DrivesRequestBuilder.php b/src/Generated/Users/Item/Drives/DrivesRequestBuilder.php index 2aa57bf14c3..4f352ba0ec9 100644 --- a/src/Generated/Users/Item/Drives/DrivesRequestBuilder.php +++ b/src/Generated/Users/Item/Drives/DrivesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Drives\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of Drive resources available for a target User, Group, or Site. This API is available in the following national cloud deployments. * @param DrivesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/drive-list?view=graph-rest-1.0 Find more info here */ public function get(?DrivesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?DrivesRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?DrivesRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Drives/Item/DriveItemRequestBuilder.php b/src/Generated/Users/Item/Drives/Item/DriveItemRequestBuilder.php index 208adf696db..ab5f9b271c3 100644 --- a/src/Generated/Users/Item/Drives/Item/DriveItemRequestBuilder.php +++ b/src/Generated/Users/Item/Drives/Item/DriveItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Drive; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A collection of drives available for this user. Read-only. * @param DriveItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DriveItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Drive::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DriveItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/EmployeeExperience/EmployeeExperienceRequestBuilder.php b/src/Generated/Users/Item/EmployeeExperience/EmployeeExperienceRequestBuilder.php index 60f5f21ce52..df041e8e821 100644 --- a/src/Generated/Users/Item/EmployeeExperience/EmployeeExperienceRequestBuilder.php +++ b/src/Generated/Users/Item/EmployeeExperience/EmployeeExperienceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EmployeeExperienceUser; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\EmployeeExperience\LearningCourseActivities\LearningCourseActivitiesRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property employeeExperience for users * @param EmployeeExperienceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?EmployeeExperienceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get employeeExperience from users * @param EmployeeExperienceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EmployeeExperienceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EmployeeExperienceUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EmployeeExperienceUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property employeeExperience in users * @param EmployeeExperienceUser $body The request body * @param EmployeeExperienceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(EmployeeExperienceUser $body, ?EmployeeExperienceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EmployeeExperienceUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EmployeeExperienceUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?EmployeeExperienceRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?EmployeeExperienceRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?EmployeeExperienceRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(EmployeeExperienceUser $body, ?Employe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/EmployeeExperience/LearningCourseActivities/Count/CountRequestBuilder.php b/src/Generated/Users/Item/EmployeeExperience/LearningCourseActivities/Count/CountRequestBuilder.php index 07ca413b98d..f75ef3719f2 100644 --- a/src/Generated/Users/Item/EmployeeExperience/LearningCourseActivities/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/EmployeeExperience/LearningCourseActivities/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/EmployeeExperience/LearningCourseActivities/Item/LearningCourseActivityItemRequestBuilder.php b/src/Generated/Users/Item/EmployeeExperience/LearningCourseActivities/Item/LearningCourseActivityItemRequestBuilder.php index ceaf8dd2e57..d33a1122aeb 100644 --- a/src/Generated/Users/Item/EmployeeExperience/LearningCourseActivities/Item/LearningCourseActivityItemRequestBuilder.php +++ b/src/Generated/Users/Item/EmployeeExperience/LearningCourseActivities/Item/LearningCourseActivityItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LearningCourseActivity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the specified learningCourseActivity object using either an ID or an externalCourseActivityId of the learning provider, or a courseActivityId of a user. This API is available in the following national cloud deployments. * @param LearningCourseActivityItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/learningcourseactivity-get?view=graph-rest-1.0 Find more info here */ public function get(?LearningCourseActivityItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?LearningCourseActivityItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?LearningCourseActivityItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/EmployeeExperience/LearningCourseActivities/LearningCourseActivitiesRequestBuilder.php b/src/Generated/Users/Item/EmployeeExperience/LearningCourseActivities/LearningCourseActivitiesRequestBuilder.php index 34fabef5c90..cc5793df04e 100644 --- a/src/Generated/Users/Item/EmployeeExperience/LearningCourseActivities/LearningCourseActivitiesRequestBuilder.php +++ b/src/Generated/Users/Item/EmployeeExperience/LearningCourseActivities/LearningCourseActivitiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LearningCourseActivityCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\EmployeeExperience\LearningCourseActivities\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the learningCourseActivity objects (assigned or self-initiated) for a user. This API is available in the following national cloud deployments. * @param LearningCourseActivitiesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/learningcourseactivity-list?view=graph-rest-1.0 Find more info here */ public function get(?LearningCourseActivitiesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LearningCourseActivityCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?LearningCourseActivitiesRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?LearningCourseActivitiesRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Events/Count/CountRequestBuilder.php index 9cf918fe666..9126ee9ea94 100644 --- a/src/Generated/Users/Item/Events/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Events/Delta/DeltaRequestBuilder.php index 8b1a2fc22a9..d080d71cfa0 100644 --- a/src/Generated/Users/Item/Events/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/EventsRequestBuilder.php b/src/Generated/Users/Item/Events/EventsRequestBuilder.php index 0c9eb5a4fac..63d67f8d836 100644 --- a/src/Generated/Users/Item/Events/EventsRequestBuilder.php +++ b/src/Generated/Users/Item/Events/EventsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of event objects in the user's mailbox. The list contains single instance meetings and series masters. To get expanded event instances, you can get the calendar view, or get the instances of an event. Currently, this operation returns event bodies in only HTML format. There are two scenarios where an app can get events in another user's calendar: This API is available in the following national cloud deployments. * @param EventsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-events?view=graph-rest-1.0 Find more info here */ public function get(?EventsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an event in the user's default calendar or specified calendar. By default, the allowNewTimeProposals property is set to true when an event is created, which means invitees can propose a different date/time for the event. See Propose new meeting times for more information on how to propose a time, and how to receive and accept a new time proposal. You can specify the time zone for each of the start and end times of the event as part of their values, because the start and end properties are of dateTimeTimeZone type. First find the supported time zones to make sure you set only time zones that have been configured for the user's mailbox server. When an event is sent, the server sends invitations to all the attendees. Setting the location in an event An Exchange administrator can set up a mailbox and an email address for a resource such as a meeting room, or equipment like a projector. Users can then invite the resource as an attendee to a meeting. On behalf of the resource, the server accepts or rejects the meeting request based on the free/busy schedule of the resource. If the server accepts a meeting for the resource, it creates an event for the meeting in the resource's calendar. If the meeting is rescheduled, the server automatically updates the event in the resource's calendar. Another advantage of setting up a mailbox for a resource is to control scheduling of the resource, for example, only executivesor their delegates can book a private meeting room. If you're organizing an event that involves a meeting location: Additionally, if the meeting location has been set up as a resource, or if the event involves some equipment that has been set up as a resource: This API is available in the following national cloud deployments. * @param Event $body The request body * @param EventsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-post-events?view=graph-rest-1.0 Find more info here */ public function post(Event $body, ?EventsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?EventsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?EventsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Event $body, ?EventsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Accept/AcceptRequestBuilder.php index 75131adcea4..f8d9ffe0405 100644 --- a/src/Generated/Users/Item/Events/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php index f1eddbbbd8b..237903dc8de 100644 --- a/src/Generated/Users/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Attachments/Count/CountRequestBuilder.php index fcd66408964..3e016dbd886 100644 --- a/src/Generated/Users/Item/Events/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 7f57ba34325..2ca306e6fb6 100644 --- a/src/Generated/Users/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 900937fc108..3ce736f1acd 100644 --- a/src/Generated/Users/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Calendar/CalendarRequestBuilder.php index d6f60cb6577..a4b81c96846 100644 --- a/src/Generated/Users/Item/Events/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Cancel/CancelRequestBuilder.php index 7ba5d9ba89b..f7a9c2c0be0 100644 --- a/src/Generated/Users/Item/Events/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Decline/DeclineRequestBuilder.php index af770480a9b..8c63c6185a2 100644 --- a/src/Generated/Users/Item/Events/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php index 434c0bfb5f8..94e2287d96e 100644 --- a/src/Generated/Users/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/Events/Item/EventItemRequestBuilder.php index ae24d1ff8c2..33af67de002 100644 --- a/src/Generated/Users/Item/Events/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Events\Item\Accept\AcceptRequestBuilder; @@ -122,59 +121,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Removes the specified event from the containing calendar. If the event is a meeting, deleting the event on the organizer's calendar sends a cancellation message to the meeting attendees. This API is available in the following national cloud deployments. * @param EventItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delete?view=graph-rest-1.0 Find more info here */ public function delete(?EventItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of the specified event object. Currently, this operation returns event bodies in only HTML format. There are two scenarios where an app can get an event in another user's calendar: Since the event resource supports extensions, you can also use the GET operation to get custom properties and extension data in an event instance. This API is available in the following national cloud deployments. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-get?view=graph-rest-1.0 Find more info here */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the event object. This API is available in the following national cloud deployments. * @param Event $body The request body * @param EventItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-update?view=graph-rest-1.0 Find more info here */ public function patch(Event $body, ?EventItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -191,6 +181,7 @@ public function toDeleteRequestInformation(?EventItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -204,7 +195,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -212,6 +202,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -226,11 +217,11 @@ public function toPatchRequestInformation(Event $body, ?EventItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Extensions/Count/CountRequestBuilder.php index f1b8facbcbb..6267b86677e 100644 --- a/src/Generated/Users/Item/Events/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php index 2a15b5eea18..da4adc2a773 100644 --- a/src/Generated/Users/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 80fcbf1b94d..23eb524cecf 100644 --- a/src/Generated/Users/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Forward/ForwardRequestBuilder.php index fe6f2bd1fc4..198e27d516c 100644 --- a/src/Generated/Users/Item/Events/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Count/CountRequestBuilder.php index b188aa31043..d84944cf614 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php index dfeb8e174fc..249679553e3 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of event resources that have been added, deleted, or updated in a calendarView (a range of events defined by start and end dates) of the user's primary calendar. Typically, synchronizing events in a calendarView in a local store entails a round of multiple delta function calls. The initial call is a full synchronization, and every subsequent delta call in the same round gets the incremental changes (additions, deletions, or updates). This allows you to maintain and synchronize a local store of events in the specified calendarView, without having to fetch all the events of that calendar from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/InstancesRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/InstancesRequestBuilder.php index 5b48a2064eb..a07cfe72639 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/InstancesRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/InstancesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EventCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Events\Item\Instances\Count\CountRequestBuilder; @@ -62,20 +61,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param InstancesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-instances?view=graph-rest-1.0 Find more info here */ public function get(?InstancesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EventCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -88,7 +84,6 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -96,6 +91,7 @@ public function toGetRequestInformation(?InstancesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php index 4022b29d786..cd9d45c15de 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/Accept/AcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Accept the specified event in a user calendar. This API is available in the following national cloud deployments. * @param AcceptPostRequestBody $body The request body * @param AcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-accept?view=graph-rest-1.0 Find more info here */ public function post(AcceptPostRequestBody $body, ?AcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(AcceptPostRequestBody $body, ?AcceptReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php index e2ca1239c62..b202663e33f 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of attachment objects attached to an event. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to an existing event. This operation limits the size of the attachment you can add to under 3 MB. If an organizer adds an attachment to a meeting event, the organizer can subsequently update the event to send the attachment and update the event for each attendee as well. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php index 104bb98e91f..90f723978de 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 7e5cb6354c4..6624c03132e 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 870148ae20f..836a2460b3d 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an attachment from a user calendar event, mail message, or group post. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of FileAttachment, ItemAttachment, and referenceAttachment attachments for the event. Navigation property. Read-only. Nullable. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php index b28d3fb92cd..3f329ca08e7 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/Calendar/CalendarRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Calendar; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The calendar that contains the event. Navigation property. Read-only. * @param CalendarRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CalendarRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Calendar::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?CalendarRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php index 8dd17655b54..5c684af3637 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/Cancel/CancelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer of a meeting to send a cancellation message and cancel the event. The action moves the event to the Deleted Items folder. The organizer can also cancel an occurrence of a recurring meeting by providing the occurrence event ID. An attendee calling this action gets an error (HTTP 400 Bad Request), with the followingerror message: 'Your request can't be completed. You need to be an organizer to cancel a meeting.' This action differs from Delete in that Cancel is available to only the organizer, and letsthe organizer send a custom message to the attendees about the cancellation. This API is available in the following national cloud deployments. * @param CancelPostRequestBody $body The request body * @param CancelRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-cancel?view=graph-rest-1.0 Find more info here */ public function post(CancelPostRequestBody $body, ?CancelRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CancelPostRequestBody $body, ?CancelReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php index a66b123abe3..53bc1e2f178 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/Decline/DeclineRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Decline invitation to the specified event in a user calendar. If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param DeclinePostRequestBody $body The request body * @param DeclineRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-decline?view=graph-rest-1.0 Find more info here */ public function post(DeclinePostRequestBody $body, ?DeclineRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeclinePostRequestBody $body, ?DeclineR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php index e62e7cd6bb9..ec5fc749763 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/DismissReminder/DismissReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Dismiss a reminder that has been triggered for an event in a user calendar. This API is available in the following national cloud deployments. * @param DismissReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-dismissreminder?view=graph-rest-1.0 Find more info here */ public function post(?DismissReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DismissReminderRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php index bb4cc975a46..8031e0f2049 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/EventItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Event; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Events\Item\Instances\Item\Accept\AcceptRequestBuilder; @@ -114,19 +113,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. * @param EventItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?EventItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Event::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -139,7 +135,6 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +142,7 @@ public function toGetRequestInformation(?EventItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php index ebe81df5443..a0e82f3e3e6 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php index f0d9604eb91..6fd70c60f7b 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php index d88c2f6d88f..99b83cac50e 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php index 6a5b766637b..440f3c4c9b1 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * This action allows the organizer or attendee of a meeting event to forward the meeting request to a new recipient. If the meeting event is forwarded from an attendee's Microsoft 365 mailbox to another recipient, this action also sends a message to notify the organizer of the forwarding, and adds the recipient to the organizer's copy of the meeting event. This convenience is not available when forwarding from an Outlook.com account. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index cc362da3e1c..2b9c6deae34 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index 8bab29d3a55..73e9718893e 100644 --- a/src/Generated/Users/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/Instances/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php b/src/Generated/Users/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php index 9971e695040..1d52af0b645 100644 --- a/src/Generated/Users/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/SnoozeReminder/SnoozeReminderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Postpone a reminder for an event in a user calendar until a new time. This API is available in the following national cloud deployments. * @param SnoozeReminderPostRequestBody $body The request body * @param SnoozeReminderRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-snoozereminder?view=graph-rest-1.0 Find more info here */ public function post(SnoozeReminderPostRequestBody $body, ?SnoozeReminderRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SnoozeReminderPostRequestBody $body, ?S $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php b/src/Generated/Users/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php index b23909b712a..aad280fca03 100644 --- a/src/Generated/Users/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php +++ b/src/Generated/Users/Item/Events/Item/TentativelyAccept/TentativelyAcceptRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Tentatively accept the specified event in a user calendar. If the event allows proposals for new times, on responding tentative to the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times. This API is available in the following national cloud deployments. * @param TentativelyAcceptPostRequestBody $body The request body * @param TentativelyAcceptRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/event-tentativelyaccept?view=graph-rest-1.0 Find more info here */ public function post(TentativelyAcceptPostRequestBody $body, ?TentativelyAcceptRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(TentativelyAcceptPostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ExportDeviceAndAppManagementData/ExportDeviceAndAppManagementDataRequestBuilder.php b/src/Generated/Users/Item/ExportDeviceAndAppManagementData/ExportDeviceAndAppManagementDataRequestBuilder.php index 06398cd4935..6f9c7cdd921 100644 --- a/src/Generated/Users/Item/ExportDeviceAndAppManagementData/ExportDeviceAndAppManagementDataRequestBuilder.php +++ b/src/Generated/Users/Item/ExportDeviceAndAppManagementData/ExportDeviceAndAppManagementDataRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceAndAppManagementData; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function exportDeviceAndAppManagementData * @param ExportDeviceAndAppManagementDataRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExportDeviceAndAppManagementDataRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceAndAppManagementData::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceAndAppManagementData::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?ExportDeviceAndAppManagementDataRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ExportDeviceAndAppManagementDataWithSkipWithTop/ExportDeviceAndAppManagementDataWithSkipWithTopRequestBuilder.php b/src/Generated/Users/Item/ExportDeviceAndAppManagementDataWithSkipWithTop/ExportDeviceAndAppManagementDataWithSkipWithTopRequestBuilder.php index b95a7d3211e..659812728ed 100644 --- a/src/Generated/Users/Item/ExportDeviceAndAppManagementDataWithSkipWithTop/ExportDeviceAndAppManagementDataWithSkipWithTopRequestBuilder.php +++ b/src/Generated/Users/Item/ExportDeviceAndAppManagementDataWithSkipWithTop/ExportDeviceAndAppManagementDataWithSkipWithTopRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceAndAppManagementData; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -39,19 +38,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function exportDeviceAndAppManagementData * @param ExportDeviceAndAppManagementDataWithSkipWithTopRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExportDeviceAndAppManagementDataWithSkipWithTopRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceAndAppManagementData::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceAndAppManagementData::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -64,11 +60,11 @@ public function toGetRequestInformation(?ExportDeviceAndAppManagementDataWithSki $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ExportPersonalData/ExportPersonalDataRequestBuilder.php b/src/Generated/Users/Item/ExportPersonalData/ExportPersonalDataRequestBuilder.php index cf68b9f1ad7..b71efc6798a 100644 --- a/src/Generated/Users/Item/ExportPersonalData/ExportPersonalDataRequestBuilder.php +++ b/src/Generated/Users/Item/ExportPersonalData/ExportPersonalDataRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Submit a data policy operation request from a company administrator or an application to export an organizational user's data. This data includes the user's data stored in OneDrive and their activity reports. For more guidance about exporting data while complying with regulations, see Data Subject Requests and the GDPR and CCPA. This API is available in the following national cloud deployments. * @param ExportPersonalDataPostRequestBody $body The request body * @param ExportPersonalDataRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-exportpersonaldata?view=graph-rest-1.0 Find more info here */ public function post(ExportPersonalDataPostRequestBody $body, ?ExportPersonalDataRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ExportPersonalDataPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Extensions/Count/CountRequestBuilder.php index 48f54ddc320..6c13c074106 100644 --- a/src/Generated/Users/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Extensions/ExtensionsRequestBuilder.php index a42ae09bd1d..6b30b7a47c0 100644 --- a/src/Generated/Users/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of open extensions defined for the user. Read-only. Supports $expand. Nullable. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for users * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 6c7689d1d81..b216eef827e 100644 --- a/src/Generated/Users/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of open extensions defined for the user. Read-only. Supports $expand. Nullable. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/FindMeetingTimes/FindMeetingTimesRequestBuilder.php b/src/Generated/Users/Item/FindMeetingTimes/FindMeetingTimesRequestBuilder.php index cc6109cbc39..73c944c3cef 100644 --- a/src/Generated/Users/Item/FindMeetingTimes/FindMeetingTimesRequestBuilder.php +++ b/src/Generated/Users/Item/FindMeetingTimes/FindMeetingTimesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MeetingTimeSuggestionsResult; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Suggest meeting times and locations based on organizer and attendee availability, and time or location constraints specified as parameters. If findMeetingTimes cannot return any meeting suggestions, the response would indicate a reason in the emptySuggestionsReason property. Based on this value, you can better adjust the parameters and call findMeetingTimes again. The algorithm used to suggest meeting times and locations undergoes fine-tuning from time to time. In scenarios like test environments where the input parameters and calendar data remain static, expect that the suggested results may differ over time. This API is available in the following national cloud deployments. * @param FindMeetingTimesPostRequestBody $body The request body * @param FindMeetingTimesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-findmeetingtimes?view=graph-rest-1.0 Find more info here */ public function post(FindMeetingTimesPostRequestBody $body, ?FindMeetingTimesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MeetingTimeSuggestionsResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MeetingTimeSuggestionsResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(FindMeetingTimesPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/FollowedSites/Count/CountRequestBuilder.php b/src/Generated/Users/Item/FollowedSites/Count/CountRequestBuilder.php index a0e9f84e30b..3d63f673c44 100644 --- a/src/Generated/Users/Item/FollowedSites/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/FollowedSites/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/FollowedSites/FollowedSitesRequestBuilder.php b/src/Generated/Users/Item/FollowedSites/FollowedSitesRequestBuilder.php index 783dd8ca0a2..f92c207989d 100644 --- a/src/Generated/Users/Item/FollowedSites/FollowedSitesRequestBuilder.php +++ b/src/Generated/Users/Item/FollowedSites/FollowedSitesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SiteCollectionResponse; use Microsoft\Graph\Generated\Users\Item\FollowedSites\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List the sites that have been followed by the signed in user. This API is available in the following national cloud deployments. * @param FollowedSitesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sites-list-followed?view=graph-rest-1.0 Find more info here */ public function get(?FollowedSitesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SiteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SiteCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?FollowedSitesRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?FollowedSitesRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/FollowedSites/Item/SiteItemRequestBuilder.php b/src/Generated/Users/Item/FollowedSites/Item/SiteItemRequestBuilder.php index b103b03043c..2e5ba746675 100644 --- a/src/Generated/Users/Item/FollowedSites/Item/SiteItemRequestBuilder.php +++ b/src/Generated/Users/Item/FollowedSites/Item/SiteItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Site; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get followedSites from users * @param SiteItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SiteItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Site::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SiteItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SiteItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/GetMailTips/GetMailTipsRequestBuilder.php b/src/Generated/Users/Item/GetMailTips/GetMailTipsRequestBuilder.php index ec5405138fb..21c467b6757 100644 --- a/src/Generated/Users/Item/GetMailTips/GetMailTipsRequestBuilder.php +++ b/src/Generated/Users/Item/GetMailTips/GetMailTipsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Get the MailTips of one or more recipients as available to the signed-in user. Note that by making a POST call to the getMailTips action, you can request specific types of MailTips tobe returned for more than one recipient at one time. The requested MailTips are returned in a mailTips collection. This API is available in the following national cloud deployments. * @param GetMailTipsPostRequestBody $body The request body * @param GetMailTipsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-getmailtips?view=graph-rest-1.0 Find more info here */ public function post(GetMailTipsPostRequestBody $body, ?GetMailTipsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMailTipsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMailTipsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMailTipsPostRequestBody $body, ?GetM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/GetManagedAppDiagnosticStatuses/GetManagedAppDiagnosticStatusesRequestBuilder.php b/src/Generated/Users/Item/GetManagedAppDiagnosticStatuses/GetManagedAppDiagnosticStatusesRequestBuilder.php index ac9856864e5..87a05c4b12c 100644 --- a/src/Generated/Users/Item/GetManagedAppDiagnosticStatuses/GetManagedAppDiagnosticStatusesRequestBuilder.php +++ b/src/Generated/Users/Item/GetManagedAppDiagnosticStatuses/GetManagedAppDiagnosticStatusesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets diagnostics validation status for a given user. * @param GetManagedAppDiagnosticStatusesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetManagedAppDiagnosticStatusesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetManagedAppDiagnosticStatusesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetManagedAppDiagnosticStatusesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetManagedAppDiagnosticStatusesRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetManagedAppDiagnosticStatusesRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/GetManagedAppPolicies/GetManagedAppPoliciesRequestBuilder.php b/src/Generated/Users/Item/GetManagedAppPolicies/GetManagedAppPoliciesRequestBuilder.php index 19adc2bbd89..b9818bf41d2 100644 --- a/src/Generated/Users/Item/GetManagedAppPolicies/GetManagedAppPoliciesRequestBuilder.php +++ b/src/Generated/Users/Item/GetManagedAppPolicies/GetManagedAppPoliciesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Gets app restrictions for a given user. * @param GetManagedAppPoliciesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetManagedAppPoliciesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetManagedAppPoliciesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetManagedAppPoliciesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetManagedAppPoliciesRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetManagedAppPoliciesRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/GetManagedDevicesWithAppFailures/GetManagedDevicesWithAppFailuresRequestBuilder.php b/src/Generated/Users/Item/GetManagedDevicesWithAppFailures/GetManagedDevicesWithAppFailuresRequestBuilder.php index c6b6aede680..54199405739 100644 --- a/src/Generated/Users/Item/GetManagedDevicesWithAppFailures/GetManagedDevicesWithAppFailuresRequestBuilder.php +++ b/src/Generated/Users/Item/GetManagedDevicesWithAppFailures/GetManagedDevicesWithAppFailuresRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieves the list of devices with failed apps * @param GetManagedDevicesWithAppFailuresRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetManagedDevicesWithAppFailuresRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetManagedDevicesWithAppFailuresGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetManagedDevicesWithAppFailuresGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetManagedDevicesWithAppFailuresRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetManagedDevicesWithAppFailuresRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php b/src/Generated/Users/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php index 4d69494a385..f2e6455aed2 100644 --- a/src/Generated/Users/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php +++ b/src/Generated/Users/Item/GetMemberGroups/GetMemberGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all the group IDs for the groups that the specified user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. This API returns up to 11,000 group IDs. If more than 11,000 results are available, it returns a 400 Bad Request error with the Directory_ResultSizeLimitExceeded error code. As a workaround, use the List group transitive memberOf API. This API is available in the following national cloud deployments. * @param GetMemberGroupsPostRequestBody $body The request body * @param GetMemberGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmembergroups?view=graph-rest-1.0 Find more info here */ public function post(GetMemberGroupsPostRequestBody $body, ?GetMemberGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberGroupsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberGroupsPostRequestBody $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php b/src/Generated/Users/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php index a307fd86467..9e43f57e273 100644 --- a/src/Generated/Users/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php +++ b/src/Generated/Users/Item/GetMemberObjects/GetMemberObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Return all IDs for the groups, administrative units, and directory roles that a user, group, service principal, organizational contact, device, or directory object is a member of. This function is transitive. Note: Only users and role-enabled groups can be members of directory roles. This API is available in the following national cloud deployments. * @param GetMemberObjectsPostRequestBody $body The request body * @param GetMemberObjectsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-getmemberobjects?view=graph-rest-1.0 Find more info here */ public function post(GetMemberObjectsPostRequestBody $body, ?GetMemberObjectsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetMemberObjectsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(GetMemberObjectsPostRequestBody $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/InferenceClassification/InferenceClassificationRequestBuilder.php b/src/Generated/Users/Item/InferenceClassification/InferenceClassificationRequestBuilder.php index e1d3bea0ce1..b0390359984 100644 --- a/src/Generated/Users/Item/InferenceClassification/InferenceClassificationRequestBuilder.php +++ b/src/Generated/Users/Item/InferenceClassification/InferenceClassificationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\InferenceClassification; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\InferenceClassification\Overrides\OverridesRequestBuilder; @@ -42,38 +41,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Relevance classification of the user's messages based on explicit designations that override inferred relevance or importance. * @param InferenceClassificationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InferenceClassificationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InferenceClassification::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InferenceClassification::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property inferenceClassification in users * @param InferenceClassification $body The request body * @param InferenceClassificationRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(InferenceClassification $body, ?InferenceClassificationRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InferenceClassification::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InferenceClassification::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -86,7 +79,6 @@ public function toGetRequestInformation(?InferenceClassificationRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -94,6 +86,7 @@ public function toGetRequestInformation(?InferenceClassificationRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -108,11 +101,11 @@ public function toPatchRequestInformation(InferenceClassification $body, ?Infere $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/InferenceClassification/Overrides/Count/CountRequestBuilder.php b/src/Generated/Users/Item/InferenceClassification/Overrides/Count/CountRequestBuilder.php index 3417b960a01..695e87f99af 100644 --- a/src/Generated/Users/Item/InferenceClassification/Overrides/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/InferenceClassification/Overrides/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/InferenceClassification/Overrides/Item/InferenceClassificationOverrideItemRequestBuilder.php b/src/Generated/Users/Item/InferenceClassification/Overrides/Item/InferenceClassificationOverrideItemRequestBuilder.php index 91a98fdd2eb..3f31461d410 100644 --- a/src/Generated/Users/Item/InferenceClassification/Overrides/Item/InferenceClassificationOverrideItemRequestBuilder.php +++ b/src/Generated/Users/Item/InferenceClassification/Overrides/Item/InferenceClassificationOverrideItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\InferenceClassificationOverride; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an override specified by its ID. This API is available in the following national cloud deployments. * @param InferenceClassificationOverrideItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/inferenceclassificationoverride-delete?view=graph-rest-1.0 Find more info here */ public function delete(?InferenceClassificationOverrideItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. * @param InferenceClassificationOverrideItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InferenceClassificationOverrideItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InferenceClassificationOverride::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InferenceClassificationOverride::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Change the classifyAs field of an override as specified. You cannot use PATCH to change any other fields in an inferenceClassificationOverride instance. If an override exists for a sender and the sender changes his/her display name, you can use POST to force an update to the name field in the existing override. If an override exists for a sender and the sender changes his/her SMTP address, deleting the existing override and creating a new one withthe new SMTP address is the only way to 'update' the override for this sender. This API is available in the following national cloud deployments. * @param InferenceClassificationOverride $body The request body * @param InferenceClassificationOverrideItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/inferenceclassificationoverride-update?view=graph-rest-1.0 Find more info here */ public function patch(InferenceClassificationOverride $body, ?InferenceClassificationOverrideItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InferenceClassificationOverride::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InferenceClassificationOverride::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?InferenceClassificationOverrideItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?InferenceClassificationOverrideItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?InferenceClassificationOverrideItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(InferenceClassificationOverride $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/InferenceClassification/Overrides/OverridesRequestBuilder.php b/src/Generated/Users/Item/InferenceClassification/Overrides/OverridesRequestBuilder.php index 508cac06030..b159053e9ee 100644 --- a/src/Generated/Users/Item/InferenceClassification/Overrides/OverridesRequestBuilder.php +++ b/src/Generated/Users/Item/InferenceClassification/Overrides/OverridesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\InferenceClassificationOverride; use Microsoft\Graph\Generated\Models\InferenceClassificationOverrideCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the overrides that a user has set up to always classify messages from certain senders in specific ways. Each override corresponds to an SMTP address of a sender. Initially, a user does not have any overrides. This API is available in the following national cloud deployments. * @param OverridesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/inferenceclassification-list-overrides?view=graph-rest-1.0 Find more info here */ public function get(?OverridesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InferenceClassificationOverrideCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InferenceClassificationOverrideCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an override for a sender identified by an SMTP address. Future messages from that SMTP address will be consistently classifiedas specified in the override. Note This API is available in the following national cloud deployments. * @param InferenceClassificationOverride $body The request body * @param OverridesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/inferenceclassification-post-overrides?view=graph-rest-1.0 Find more info here */ public function post(InferenceClassificationOverride $body, ?OverridesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [InferenceClassificationOverride::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [InferenceClassificationOverride::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OverridesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OverridesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(InferenceClassificationOverride $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/InsightsRequestBuilder.php b/src/Generated/Users/Item/Insights/InsightsRequestBuilder.php index 1e5f9dcfcec..dc5d58722d4 100644 --- a/src/Generated/Users/Item/Insights/InsightsRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/InsightsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OfficeGraphInsights; use Microsoft\Graph\Generated\Users\Item\Insights\Shared\SharedRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property insights for users * @param InsightsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?InsightsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get insights from users * @param InsightsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?InsightsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfficeGraphInsights::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfficeGraphInsights::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property insights in users * @param OfficeGraphInsights $body The request body * @param InsightsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OfficeGraphInsights $body, ?InsightsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfficeGraphInsights::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfficeGraphInsights::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?InsightsRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?InsightsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?InsightsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(OfficeGraphInsights $body, ?InsightsRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/Shared/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Insights/Shared/Count/CountRequestBuilder.php index d683fb9174f..a67abfaad0b 100644 --- a/src/Generated/Users/Item/Insights/Shared/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/Shared/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/Shared/Item/LastSharedMethod/LastSharedMethodRequestBuilder.php b/src/Generated/Users/Item/Insights/Shared/Item/LastSharedMethod/LastSharedMethodRequestBuilder.php index 6494f19de92..6a8f5a63231 100644 --- a/src/Generated/Users/Item/Insights/Shared/Item/LastSharedMethod/LastSharedMethodRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/Shared/Item/LastSharedMethod/LastSharedMethodRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Entity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get lastSharedMethod from users * @param LastSharedMethodRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LastSharedMethodRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Entity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Entity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?LastSharedMethodRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?LastSharedMethodRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/Shared/Item/Resource/ResourceRequestBuilder.php b/src/Generated/Users/Item/Insights/Shared/Item/Resource/ResourceRequestBuilder.php index 7d3686395d9..0b7eab8ced0 100644 --- a/src/Generated/Users/Item/Insights/Shared/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/Shared/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Entity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Used for navigating to the item that was shared. For file attachments, the type is fileAttachment. For linked attachments, the type is driveItem. * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Entity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Entity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/Shared/Item/SharedInsightItemRequestBuilder.php b/src/Generated/Users/Item/Insights/Shared/Item/SharedInsightItemRequestBuilder.php index 0b2a51e9ec5..bf8059c3e7a 100644 --- a/src/Generated/Users/Item/Insights/Shared/Item/SharedInsightItemRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/Shared/Item/SharedInsightItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedInsight; use Microsoft\Graph\Generated\Users\Item\Insights\Shared\Item\LastSharedMethod\LastSharedMethodRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property shared for users * @param SharedInsightItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SharedInsightItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Calculated relationship identifying documents shared with or by the user. This includes URLs, file attachments, and reference attachments to OneDrive for Business and SharePoint files found in Outlook messages and meetings. This also includes URLs and reference attachments to Teams conversations. Ordered by recency of share. * @param SharedInsightItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SharedInsightItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedInsight::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedInsight::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property shared in users * @param SharedInsight $body The request body * @param SharedInsightItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SharedInsight $body, ?SharedInsightItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedInsight::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedInsight::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?SharedInsightItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?SharedInsightItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?SharedInsightItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(SharedInsight $body, ?SharedInsightIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/Shared/SharedRequestBuilder.php b/src/Generated/Users/Item/Insights/Shared/SharedRequestBuilder.php index b300b2055ac..bc11c0add3e 100644 --- a/src/Generated/Users/Item/Insights/Shared/SharedRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/Shared/SharedRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedInsight; use Microsoft\Graph\Generated\Models\SharedInsightCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Calculated insight that includes the list of documents shared with a user. This insight includes documents hosted on OneDrive/SharePoint in the user's Microsoft 365 tenant that are shared with the user, and documents that are attached as files and sent to the user. This API is available in the following national cloud deployments. * @param SharedRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/insights-list-shared?view=graph-rest-1.0 Find more info here */ public function get(?SharedRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedInsightCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedInsightCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to shared for users * @param SharedInsight $body The request body * @param SharedRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SharedInsight $body, ?SharedRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedInsight::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedInsight::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SharedRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SharedRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SharedInsight $body, ?SharedRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/Trending/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Insights/Trending/Count/CountRequestBuilder.php index 8ee137777dc..04ab086da41 100644 --- a/src/Generated/Users/Item/Insights/Trending/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/Trending/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/Trending/Item/Resource/ResourceRequestBuilder.php b/src/Generated/Users/Item/Insights/Trending/Item/Resource/ResourceRequestBuilder.php index 6b966508712..6f3ec2ed772 100644 --- a/src/Generated/Users/Item/Insights/Trending/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/Trending/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Entity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Used for navigating to the trending document. * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Entity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Entity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/Trending/Item/TrendingItemRequestBuilder.php b/src/Generated/Users/Item/Insights/Trending/Item/TrendingItemRequestBuilder.php index 5550d12a63c..a35ba3bb7ca 100644 --- a/src/Generated/Users/Item/Insights/Trending/Item/TrendingItemRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/Trending/Item/TrendingItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Trending; use Microsoft\Graph\Generated\Users\Item\Insights\Trending\Item\Resource\ResourceRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property trending for users * @param TrendingItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TrendingItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Calculated relationship identifying documents trending around a user. Trending documents are calculated based on activity of the user's closest network of people and include files stored in OneDrive for Business and SharePoint. Trending insights help the user to discover potentially useful content that the user has access to, but has never viewed before. * @param TrendingItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TrendingItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Trending::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Trending::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property trending in users * @param Trending $body The request body * @param TrendingItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Trending $body, ?TrendingItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Trending::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Trending::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?TrendingItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?TrendingItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?TrendingItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Trending $body, ?TrendingItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/Trending/TrendingRequestBuilder.php b/src/Generated/Users/Item/Insights/Trending/TrendingRequestBuilder.php index 66825f82295..1cdf84d4fec 100644 --- a/src/Generated/Users/Item/Insights/Trending/TrendingRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/Trending/TrendingRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Trending; use Microsoft\Graph\Generated\Models\TrendingCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Calculated insight that includes a list of documents trending around the user. This API is available in the following national cloud deployments. * @param TrendingRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/insights-list-trending?view=graph-rest-1.0 Find more info here */ public function get(?TrendingRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TrendingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TrendingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to trending for users * @param Trending $body The request body * @param TrendingRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Trending $body, ?TrendingRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Trending::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Trending::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TrendingRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TrendingRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Trending $body, ?TrendingRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/Used/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Insights/Used/Count/CountRequestBuilder.php index 894ced2902f..3d4c0bdd525 100644 --- a/src/Generated/Users/Item/Insights/Used/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/Used/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/Used/Item/Resource/ResourceRequestBuilder.php b/src/Generated/Users/Item/Insights/Used/Item/Resource/ResourceRequestBuilder.php index 3b7ab9466b7..50f2c180fd4 100644 --- a/src/Generated/Users/Item/Insights/Used/Item/Resource/ResourceRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/Used/Item/Resource/ResourceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Entity; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Used for navigating to the item that was used. For file attachments, the type is fileAttachment. For linked attachments, the type is driveItem. * @param ResourceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Entity::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Entity::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ResourceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/Used/Item/UsedInsightItemRequestBuilder.php b/src/Generated/Users/Item/Insights/Used/Item/UsedInsightItemRequestBuilder.php index 72009028dd4..3c1575693c5 100644 --- a/src/Generated/Users/Item/Insights/Used/Item/UsedInsightItemRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/Used/Item/UsedInsightItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UsedInsight; use Microsoft\Graph\Generated\Users\Item\Insights\Used\Item\Resource\ResourceRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property used for users * @param UsedInsightItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?UsedInsightItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Calculated relationship identifying the latest documents viewed or modified by a user, including OneDrive for Business and SharePoint documents, ranked by recency of use. * @param UsedInsightItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?UsedInsightItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UsedInsight::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UsedInsight::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property used in users * @param UsedInsight $body The request body * @param UsedInsightItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UsedInsight $body, ?UsedInsightItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UsedInsight::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UsedInsight::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?UsedInsightItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?UsedInsightItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?UsedInsightItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(UsedInsight $body, ?UsedInsightItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Insights/Used/UsedRequestBuilder.php b/src/Generated/Users/Item/Insights/Used/UsedRequestBuilder.php index 7997f55f89c..d6492f6f4bf 100644 --- a/src/Generated/Users/Item/Insights/Used/UsedRequestBuilder.php +++ b/src/Generated/Users/Item/Insights/Used/UsedRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UsedInsight; use Microsoft\Graph\Generated\Models\UsedInsightCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Calculate and list the documents that a user has viewed or modified. For the signed-in user:- This method includes documents that the user has modified; see example 1. - Using an $orderby query parameter on the lastAccessedDateTime property returns the most recently viewed documents that the user might or might not not have modified; see example 2. For other users, this method includes only documents that the user has modified. This API is available in the following national cloud deployments. * @param UsedRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/insights-list-used?view=graph-rest-1.0 Find more info here */ public function get(?UsedRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UsedInsightCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UsedInsightCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to used for users * @param UsedInsight $body The request body * @param UsedRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UsedInsight $body, ?UsedRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UsedInsight::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UsedInsight::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?UsedRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?UsedRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(UsedInsight $body, ?UsedRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Count/CountRequestBuilder.php index a50fa510f1e..43615219228 100644 --- a/src/Generated/Users/Item/JoinedTeams/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/GetAllMessages/GetAllMessagesRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/GetAllMessages/GetAllMessagesRequestBuilder.php index d6e3e6f7c4f..74a5e3355b8 100644 --- a/src/Generated/Users/Item/JoinedTeams/GetAllMessages/GetAllMessagesRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/GetAllMessages/GetAllMessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAllMessages * @param GetAllMessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAllMessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/AllChannels/AllChannelsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/AllChannels/AllChannelsRequestBuilder.php index fd624d98be1..c3a3b004c3a 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/AllChannels/AllChannelsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/AllChannels/AllChannelsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChannelCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\AllChannels\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of channels either in this team or shared with this team (incoming channels). This API is available in the following national cloud deployments. * @param AllChannelsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-allchannels?view=graph-rest-1.0 Find more info here */ public function get(?AllChannelsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?AllChannelsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?AllChannelsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/AllChannels/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/AllChannels/Count/CountRequestBuilder.php index 8650ee02be0..0cb5b9f01f0 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/AllChannels/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/AllChannels/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/AllChannels/Item/ChannelItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/AllChannels/Item/ChannelItemRequestBuilder.php index 2138d22eead..3afcea4811f 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/AllChannels/Item/ChannelItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/AllChannels/Item/ChannelItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List of channels either hosted in or shared with the team (incoming channels). * @param ChannelItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChannelItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Archive/ArchiveRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Archive/ArchiveRequestBuilder.php index f3ca8516358..ee6a38a14ed 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Archive/ArchiveRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Archive/ArchiveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Archive the specified team. When a team is archived, users can no longer send or like messages on any channel in the team, edit the team's name, description, or other settings, or in general make most changes to the team.Membership changes to the team continue to be allowed. Archiving is an async operation. A team is archived once the async operation completes successfully, which may occur subsequent to a response from this API. To archive a team, the team and group must have an owner. To restore a team from its archived state, use the API to unarchive. This API is available in the following national cloud deployments. * @param ArchivePostRequestBody $body The request body * @param ArchiveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-archive?view=graph-rest-1.0 Find more info here */ public function post(ArchivePostRequestBody $body, ?ArchiveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ArchivePostRequestBody $body, ?ArchiveR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/ChannelsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/ChannelsRequestBuilder.php index e90e7d89792..6eae443a72d 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/ChannelsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/ChannelsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ChannelCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of channels in this team. This API is available in the following national cloud deployments. * @param ChannelsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list?view=graph-rest-1.0 Find more info here */ public function get(?ChannelsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new channel in a team, as specified in the request body. When you create a channel, the maximum length of the channel's displayName is 50 characters. This is the name that appears to the user in Microsoft Teams. If you're creating a private channel, you can add a maximum of 200 members. This API is available in the following national cloud deployments. * @param Channel $body The request body * @param ChannelsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post?view=graph-rest-1.0 Find more info here */ public function post(Channel $body, ?ChannelsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ChannelsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ChannelsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Channel $body, ?ChannelsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Count/CountRequestBuilder.php index 045d2effb60..78c9ac754e1 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php index 2dd7fea3934..6733a3e3e0d 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/GetAllMessages/GetAllMessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getAllMessages * @param GetAllMessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetAllMessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetAllMessagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?GetAllMessagesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/ChannelItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/ChannelItemRequestBuilder.php index 2d0e96150d0..1dc8602635c 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/ChannelItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/ChannelItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Channels\Item\CompleteMigration\CompleteMigrationRequestBuilder; @@ -106,59 +105,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the channel. This API is available in the following national cloud deployments. * @param ChannelItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ChannelItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a channel. This method supports federation. Only a user who is a member of the shared channel can retrieve channel information. This API is available in the following national cloud deployments. * @param ChannelItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get?view=graph-rest-1.0 Find more info here */ public function get(?ChannelItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified channel. This API is available in the following national cloud deployments. * @param Channel $body The request body * @param ChannelItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-patch?view=graph-rest-1.0 Find more info here */ public function patch(Channel $body, ?ChannelItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -175,6 +165,7 @@ public function toDeleteRequestInformation(?ChannelItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -188,7 +179,6 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -196,6 +186,7 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -210,11 +201,11 @@ public function toPatchRequestInformation(Channel $body, ?ChannelItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php index fad7374b326..f4503f51962 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/CompleteMigration/CompleteMigrationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Complete the message migration process by removing migration mode from a channel in a team. Migration mode is a special state that prevents certain operations, like sending messages and adding members, during the data migration process. After a completeMigration request is made, you can't import additional messages into the team. You can add members to the team after the request returns a successful response. This API is available in the following national cloud deployments. * @param CompleteMigrationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-completemigration?view=graph-rest-1.0 Find more info here */ public function post(?CompleteMigrationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CompleteMigrationRequestBuilderPostReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php index 97ddfc015d3..467bc25b09d 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function doesUserHaveAccess * @param DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php index c0aee7d3e67..6aa3c1348cf 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/FilesFolder/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php index ccc01d79160..478940d321c 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/FilesFolder/FilesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Channels\Item\FilesFolder\Content\ContentRequestBuilder; @@ -42,20 +41,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the metadata for the location where the files of a channel are stored. This API is available in the following national cloud deployments. * @param FilesFolderRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?FilesFolderRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -68,7 +64,6 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -76,6 +71,7 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/Add/AddRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/Add/AddRequestBuilder.php index 90ed1ff80c4..45d1ebc67e3 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/Add/AddRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add multiple members in a single request to a team. The response provides details about which memberships could and couldn't be created. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmembers-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/Count/CountRequestBuilder.php index 3130f4b9b71..ca5a978ce80 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php index ca15c7d05da..0fc74101fa2 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,65 +31,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-delete-members?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/conversationmember-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-members?view=graph-rest-1.0 Find more info here */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the role of a conversationMember in a team or channel. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param ConversationMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmember-update?view=graph-rest-1.0 Find more info here */ public function patch(ConversationMember $body, ?ConversationMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ConversationMemberItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ConversationMember $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/MembersRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/MembersRequestBuilder.php index c44f594c0c8..f469d354d31 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of conversationMembers from a channel. This method supports federation. Only a user who is a member of the shared channel can retrieve the channel member list. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a conversationMember to a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-members?view=graph-rest-1.0 Find more info here */ public function post(ConversationMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ConversationMember $body, ?MembersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Count/CountRequestBuilder.php index e5cf849dc38..139fc23096f 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Delta/DeltaRequestBuilder.php index 1c98c7a3fad..14c09da2b8b 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php index e62e87eb0ce..6b32679d12c 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Channels\Item\Messages\Item\HostedContents\HostedContentsRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property messages for users * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a chatMessage object. With the exception of the policyViolation property, all properties of a chatMessage can be updated in delegated permissions scenarios.Only the policyViolation property of a chatMessage can be updated in application permissions scenarios. The update only works for chats where members are Microsoft Teams users. If one of the participants is using Skype, the operation will fail. This method does not support federation. Only the user in the tenant who sent the message can perform data loss prevention (DLP) updates on the specified chat message. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-update?view=graph-rest-1.0 Find more info here */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php index 70d4a7d8e18..ca7c44edf6a 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php index e835eadd96c..5af6149da16 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ChatMessageHostedContentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for users * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index e3241a955f7..e5e778ca9e3 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index 05a89514a98..0b87fbc9020 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Channels\Item\Messages\Item\HostedContents\Item\Value\ContentRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for users * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in users * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php index 699de958014..aa468baf161 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php index 1683efb4bc7..404ae618c84 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php index b8a443c4a97..0ea93148398 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php index 92204e2b0d1..441997181f6 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Channels\Item\Messages\Item\Replies\Item\HostedContents\HostedContentsRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property replies for users * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property replies in users * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php index 13088960ceb..cda35f641b4 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php index 982d45ddc14..336b2acccfc 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ChatMessageHostedContentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for users * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 8acdcbd5512..8a1e98c32bb 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index 2ec4cbcd8d9..d798d54cae9 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Channels\Item\Messages\Item\Replies\Item\HostedContents\Item\Value\ContentRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for users * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in users * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php index 0c87e2a09e3..d0edd1ca5a4 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php index 7354663bf24..4fb8199e1a5 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php index f2228e9adab..6e0d698082a 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index db9b57b847b..8e1ec306ad6 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php index 7992ca87145..0540bcdf92c 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php index 56b393c0aaf..069c18a7d34 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/Replies/RepliesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ChatMessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the replies to a message in a channel of a team. This method lists only the replies of the specified message, if any. To get the message itself, simply call get channel message. This API is available in the following national cloud deployments. * @param RepliesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-replies?view=graph-rest-1.0 Find more info here */ public function get(?RepliesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new reply to a chatMessage in a specified channel. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param RepliesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-messagereply?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?RepliesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?RepliesRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php index 5c229ce03bf..d4ddc5e6fb6 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php index b2e2cce6277..90e5e63ba48 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index 5089e05153c..3261e4de641 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php index 0772878c07b..ddfd1128d52 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/MessagesRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/MessagesRequestBuilder.php index e4ac216d7d7..5797df85fc7 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/MessagesRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Messages/MessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ChatMessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of messages (without the replies) in a channel of a team. To get the replies for a message, call the list message replies or the get message reply API. This method supports federation. To list channel messages in application context, the request must be made from the tenant that the channel owner belongs to (represented by the tenantId property on the channel). This API is available in the following national cloud deployments. * @param MessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?MessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-post-messages?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/chatmessage-post?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?MessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,11 +109,12 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?MessagesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php index 48d10fe4dd1..8795066fe95 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/ProvisionEmail/ProvisionEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProvisionChannelEmailResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Provision an email address for a channel. Microsoft Teams doesn't automatically provision an email address for a channel by default. To have Teams provision an email address, you can call provisionEmail, or through the Teams user interface, select Get email address, which triggers Teams to generate an email address if it has not already provisioned one. To remove the email address of a channel, use the removeEmail method. This API is available in the following national cloud deployments. * @param ProvisionEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-provisionemail?view=graph-rest-1.0 Find more info here */ public function post(?ProvisionEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ProvisionEmailRequestBuilderPostReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php index e9794ca4cee..304e37623ba 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/RemoveEmail/RemoveEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove the email address of a channel. You can remove an email address only if it was provisioned using the provisionEmail method or through the Microsoft Teams client. This API is available in the following national cloud deployments. * @param RemoveEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-removeemail?view=graph-rest-1.0 Find more info here */ public function post(?RemoveEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RemoveEmailRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php index 973c489ac91..05bb79b7215 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php index ef07c5b3845..1669765fffb 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Channels\Item\SharedWithTeams\Item\AllowedMembers\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of conversationMembers who can access a shared channel. This method does not return the following conversationMembers from the team:- Users with Guest role- Users who are externally authenticated in the tenant This API is available in the following national cloud deployments. * @param AllowedMembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list-allowedmembers?view=graph-rest-1.0 Find more info here */ public function get(?AllowedMembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php index 06c470a07cd..84f78c64d3a 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php index 21b7f8bb3a3..b50ca842d73 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A collection of team members who have access to the shared channel. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php index f36009eb053..390e8e8689d 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfo; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Channels\Item\SharedWithTeams\Item\AllowedMembers\AllowedMembersRequestBuilder; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unshare a channel with a team by deleting the corresponding sharedWithChannelTeamInfo resource. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a team that has been shared with a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-get?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sharedWithTeams in users * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SharedWithChannelTeamInfo $body, ?SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?SharedWithChannelTeamInfoItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(SharedWithChannelTeamInfo $body, ?Shar $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php index e0ad04b475d..799fae02861 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/Item/Team/TeamRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get team from users * @param TeamRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php index 20efce0f8d1..d0bae7714eb 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/SharedWithTeams/SharedWithTeamsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfo; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfoCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of teams that has been shared a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithTeamsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithTeamsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sharedWithTeams for users * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithTeamsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SharedWithChannelTeamInfo $body, ?SharedWithTeamsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SharedWithChannelTeamInfo $body, ?Share $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/Count/CountRequestBuilder.php index 794293693cd..1b963e857f2 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php index 6a25fdb44c4..87501720e13 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The application that is linked to the tab. This can't be changed after tab creation. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php index 71028166fd0..26d7510e94c 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/Item/TeamsTabItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Channels\Item\Tabs\Item\TeamsApp\TeamsAppRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Removes (unpins) a tab from the specified channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-delete-tabs?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsTabItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of the specified tab in a channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TeamsTabItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified tab.This can be used to configure the content of the tab. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TeamsTabItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-patch-tabs?view=graph-rest-1.0 Find more info here */ public function patch(TeamsTab $body, ?TeamsTabItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TeamsTabItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TeamsTab $body, ?TeamsTabItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/TabsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/TabsRequestBuilder.php index 5d7d5a187f2..14c712e34d4 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/TabsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Channels/Item/Tabs/TabsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; use Microsoft\Graph\Generated\Models\TeamsTabCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of tabs in the specified channel within a team. This API is available in the following national cloud deployments. * @param TabsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TabsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Adds (pins) a tab to the specified channel within a team. The corresponding app must already be installed in the team. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TabsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-tabs?view=graph-rest-1.0 Find more info here */ public function post(TeamsTab $body, ?TabsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsTab $body, ?TabsRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/CompleteMigration/CompleteMigrationRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/CompleteMigration/CompleteMigrationRequestBuilder.php index 116482a8d99..05b56627450 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/CompleteMigration/CompleteMigrationRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/CompleteMigration/CompleteMigrationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Complete the message migration process by removing migration mode from a team. Migration mode is a special state where certain operations are barred, like message POST and membership operations during the data migration process. After a completeMigration request is made, you can't import additional messages into the team. You can add members to the team after the request returns a successful response. This API is available in the following national cloud deployments. * @param CompleteMigrationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-completemigration?view=graph-rest-1.0 Find more info here */ public function post(?CompleteMigrationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CompleteMigrationRequestBuilderPostReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/EscapedClone/CloneRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/EscapedClone/CloneRequestBuilder.php index 817e3b78bec..ac2910143c9 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/EscapedClone/CloneRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/EscapedClone/CloneRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a copy of a team. This operation also creates a copy of the corresponding group.You can specify which parts of the team to clone: When tabs are cloned, they aren't configured. The tabs are displayed on the tab bar in Microsoft Teams, and the first time a user opens them, they must go through the configuration screen. If the user who opens the tab doesn't have permission to configure apps, they'll see a message that says that the tab isn't configured. Cloning is a long-running operation. After the POST clone returns, you need to GET the operation returned by the Location: header to see if it's running, succeeded, or failed. You should continue to GET until the status isn't running. The recommended delay between GETs is 5 seconds. This API is available in the following national cloud deployments. * @param ClonePostRequestBody $body The request body * @param CloneRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-clone?view=graph-rest-1.0 Find more info here */ public function post(ClonePostRequestBody $body, ?CloneRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ClonePostRequestBody $body, ?CloneReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Group/GroupRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Group/GroupRequestBuilder.php index a55beb45bf9..33b091c9710 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Group/GroupRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Group/GroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Group\ServiceProvisioningErrors\ServiceProvisioningErrorsRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get group from users * @param GroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GroupRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php index fb3751343d6..222f4085f21 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Group/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 286c1ede12f..1c957423d40 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Group/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Group\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/IncomingChannels/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/IncomingChannels/Count/CountRequestBuilder.php index 13ce9adaa99..a7f51544e5f 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/IncomingChannels/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/IncomingChannels/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/IncomingChannels/IncomingChannelsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/IncomingChannels/IncomingChannelsRequestBuilder.php index 3850667e624..dbc172347e0 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/IncomingChannels/IncomingChannelsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/IncomingChannels/IncomingChannelsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChannelCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\IncomingChannels\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of incoming channels (channels shared with a team). This API is available in the following national cloud deployments. * @param IncomingChannelsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-incomingchannels?view=graph-rest-1.0 Find more info here */ public function get(?IncomingChannelsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChannelCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?IncomingChannelsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?IncomingChannelsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/IncomingChannels/Item/ChannelItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/IncomingChannels/Item/ChannelItemRequestBuilder.php index 694acd55776..361584fe2d0 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/IncomingChannels/Item/ChannelItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/IncomingChannels/Item/ChannelItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove an incoming channel (a channel shared with a team) from a team. * @param ChannelItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-delete-incomingchannels?view=graph-rest-1.0 Find more info here */ public function delete(?ChannelItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * List of channels shared with the team. * @param ChannelItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ChannelItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?ChannelItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?ChannelItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Count/CountRequestBuilder.php index 83534bfd48a..360fe88aab0 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/InstalledAppsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/InstalledAppsRequestBuilder.php index 1ba926fd773..7fbaa535134 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/InstalledAppsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/InstalledAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppInstallation; use Microsoft\Graph\Generated\Models\TeamsAppInstallationCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of apps installed in the specified team. This API is available in the following national cloud deployments. * @param InstalledAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-installedapps?view=graph-rest-1.0 Find more info here */ public function get(?InstalledAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Install an app to the specified team. This API is available in the following national cloud deployments. * @param TeamsAppInstallation $body The request body * @param InstalledAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-post-installedapps?view=graph-rest-1.0 Find more info here */ public function post(TeamsAppInstallation $body, ?InstalledAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?InstalledAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?InstalledAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsAppInstallation $body, ?InstalledA $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php index 38aa5a7fa39..b1f1db8864e 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The app that is installed. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php index 59a21098238..b8a3855cdc6 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The details of this version of the app. * @param TeamsAppDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppDefinitionRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppDefinitionRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php index b51abf08c42..31a9fe8cbb6 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/TeamsAppInstallationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppInstallation; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\InstalledApps\Item\TeamsApp\TeamsAppRequestBuilder; @@ -58,58 +57,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Uninstalls an app from the specified team. This API is available in the following national cloud deployments. * @param TeamsAppInstallationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-delete-installedapps?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsAppInstallationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the app installed in the specified team. This API is available in the following national cloud deployments. * @param TeamsAppInstallationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-get-installedapps?view=graph-rest-1.0 Find more info here */ public function get(?TeamsAppInstallationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property installedApps in users * @param TeamsAppInstallation $body The request body * @param TeamsAppInstallationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamsAppInstallation $body, ?TeamsAppInstallationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -126,6 +116,7 @@ public function toDeleteRequestInformation(?TeamsAppInstallationItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -139,7 +130,6 @@ public function toGetRequestInformation(?TeamsAppInstallationItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +137,7 @@ public function toGetRequestInformation(?TeamsAppInstallationItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -161,11 +152,11 @@ public function toPatchRequestInformation(TeamsAppInstallation $body, ?TeamsAppI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php index 13549008440..63db11b6a55 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/InstalledApps/Item/Upgrade/UpgradeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Upgrade an app installation within a chat. This API is available in the following national cloud deployments. * @param UpgradePostRequestBody $body The request body * @param UpgradeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chat-teamsappinstallation-upgrade?view=graph-rest-1.0 Find more info here */ public function post(UpgradePostRequestBody $body, ?UpgradeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(UpgradePostRequestBody $body, ?UpgradeR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Members/Add/AddRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Members/Add/AddRequestBuilder.php index 2db679cb5ba..de1c7091afe 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Members/Add/AddRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Members/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add multiple members in a single request to a team. The response provides details about which memberships could and couldn't be created. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmembers-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Members/Count/CountRequestBuilder.php index 63961956185..d004c4bd9a0 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Members/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Members/Item/ConversationMemberItemRequestBuilder.php index a196928b0cb..c1ba2b5af89 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Members/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Members/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a conversationMember from a team. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-delete-members?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a conversationMember from a team. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-get-members?view=graph-rest-1.0 Find more info here */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the role of a conversationMember in a team. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param ConversationMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-update-members?view=graph-rest-1.0 Find more info here */ public function patch(ConversationMember $body, ?ConversationMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ConversationMemberItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ConversationMember $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Members/MembersRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Members/MembersRequestBuilder.php index 0b989f722c3..66d8ad3a86e 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the conversationMember collection of a team. The membership IDs returned by the server must be treated as opaque strings. The client should not try to parse or make assumptions about these resource IDs. In the future, membership results may include users from various tenants, as indicated in the response. Clients should avoid assuming that all members exclusively belong to the current tenant. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a new conversationMember to a team. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-post-members?view=graph-rest-1.0 Find more info here */ public function post(ConversationMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ConversationMember $body, ?MembersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Operations/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Operations/Count/CountRequestBuilder.php index 0981f84383a..4a0c2951757 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Operations/Item/TeamsAsyncOperationItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Operations/Item/TeamsAsyncOperationItemRequestBuilder.php index ba73543e288..4f3d436e565 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Operations/Item/TeamsAsyncOperationItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Operations/Item/TeamsAsyncOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAsyncOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for users * @param TeamsAsyncOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TeamsAsyncOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The async operations that ran or are running on this team. * @param TeamsAsyncOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAsyncOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in users * @param TeamsAsyncOperation $body The request body * @param TeamsAsyncOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamsAsyncOperation $body, ?TeamsAsyncOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?TeamsAsyncOperationItemRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?TeamsAsyncOperationItemRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?TeamsAsyncOperationItemRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(TeamsAsyncOperation $body, ?TeamsAsync $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Operations/OperationsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Operations/OperationsRequestBuilder.php index c3dc0b42fae..b0dae568391 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAsyncOperation; use Microsoft\Graph\Generated\Models\TeamsAsyncOperationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The async operations that ran or are running on this team. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for users * @param TeamsAsyncOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TeamsAsyncOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAsyncOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(TeamsAsyncOperation $body, ?OperationsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/Count/CountRequestBuilder.php index e4d7312d105..e68c480267e 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php index 6f2b365b04a..3de49343f44 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/Item/ResourceSpecificPermissionGrantItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrant; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property permissionGrants for users * @param ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ResourceSpecificPermissionGrantItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of permissions granted to apps to access the team. * @param ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourceSpecificPermissionGrantItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property permissionGrants in users * @param ResourceSpecificPermissionGrant $body The request body * @param ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ResourceSpecificPermissionGrant $body, ?ResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ResourceSpecificPermissionGrantItemR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ResourceSpecificPermissionGrantItemRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/PermissionGrantsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/PermissionGrantsRequestBuilder.php index 004ebe9da53..cd51ada4b2a 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/PermissionGrantsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/PermissionGrantsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrant; use Microsoft\Graph\Generated\Models\ResourceSpecificPermissionGrantCollectionResponse; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * List all resource-specific permission grants on the team. This list specifies the Azure AD apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the team. This list specifies the Microsoft Entra apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. * @param PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-list-permissiongrants?view=graph-rest-1.0 Find more info here */ public function get(?PermissionGrantsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to permissionGrants for users * @param ResourceSpecificPermissionGrant $body The request body * @param PermissionGrantsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ResourceSpecificPermissionGrant $body, ?PermissionGrantsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ResourceSpecificPermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * List all resource-specific permission grants on the team. This list specifies the Azure AD apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the team. This list specifies the Microsoft Entra apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. * @param PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?PermissionGrantsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ResourceSpecificPermissionGrant $body, $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php index b5ee0c5dc59..a63ec0cd4e6 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PermissionGrants/PermissionGrantsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * List all resource-specific permission grants on the team. This list specifies the Azure AD apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. + * List all resource-specific permission grants on the team. This list specifies the Microsoft Entra apps that have access to the team, along with each app's corresponding type of resource-specific access. This API is available in the following national cloud deployments. */ class PermissionGrantsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Photo/PhotoRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Photo/PhotoRequestBuilder.php index 800b7ad64be..b839c502e65 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Photo/PhotoRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Photo/PhotoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProfilePhoto; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Photo\Value\ContentRequestBuilder; @@ -40,45 +39,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Azure Active Directory. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. + * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Microsoft Entra ID. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. * @param PhotoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/profilephoto-get?view=graph-rest-1.0 Find more info here */ public function get(?PhotoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property photo in users * @param ProfilePhoto $body The request body * @param PhotoRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ProfilePhoto $body, ?PhotoRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Azure Active Directory. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. + * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Microsoft Entra ID. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. * @param PhotoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -87,7 +80,6 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -95,6 +87,7 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -109,11 +102,11 @@ public function toPatchRequestInformation(ProfilePhoto $body, ?PhotoRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Photo/PhotoRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/JoinedTeams/Item/Photo/PhotoRequestBuilderGetQueryParameters.php index 73aa03ffb9d..64017d12fb0 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Photo/PhotoRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Photo/PhotoRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Azure Active Directory. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. + * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Microsoft Entra ID. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. */ class PhotoRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Photo/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Photo/Value/ContentRequestBuilder.php index b305a213a44..9df02ffa67e 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Photo/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Photo/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property photo from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/profilephoto-get?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property photo in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/CompleteMigration/CompleteMigrationRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/CompleteMigration/CompleteMigrationRequestBuilder.php index 47450d3e6a9..ab71524683e 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/CompleteMigration/CompleteMigrationRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/CompleteMigration/CompleteMigrationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Complete the message migration process by removing migration mode from a channel in a team. Migration mode is a special state that prevents certain operations, like sending messages and adding members, during the data migration process. After a completeMigration request is made, you can't import additional messages into the team. You can add members to the team after the request returns a successful response. This API is available in the following national cloud deployments. * @param CompleteMigrationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-completemigration?view=graph-rest-1.0 Find more info here */ public function post(?CompleteMigrationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?CompleteMigrationRequestBuilderPostReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php index 80009829f2b..024599a1fab 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalName/DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function doesUserHaveAccess * @param DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DoesUserHaveAccessuserIdUserIdTenantIdTenantIdUserPrincipalNameUserPrincipalNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DoesUserHaveAccessuserIdUserIdTenantIdT } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/FilesFolder/Content/ContentRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/FilesFolder/Content/ContentRequestBuilder.php index a6502ab0518..5c63803dafd 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/FilesFolder/Content/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/FilesFolder/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream, if the item represents a file. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream, if the item represents a file. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/FilesFolder/FilesFolderRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/FilesFolder/FilesFolderRequestBuilder.php index 93110773cb3..d6a33848096 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/FilesFolder/FilesFolderRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/FilesFolder/FilesFolderRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DriveItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\PrimaryChannel\FilesFolder\Content\ContentRequestBuilder; @@ -42,20 +41,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the metadata for the location where the files of a channel are stored. This API is available in the following national cloud deployments. * @param FilesFolderRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-filesfolder?view=graph-rest-1.0 Find more info here */ public function get(?FilesFolderRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DriveItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -68,7 +64,6 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -76,6 +71,7 @@ public function toGetRequestInformation(?FilesFolderRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/Add/AddRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/Add/AddRequestBuilder.php index cffda8c43d0..f764abc2dce 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/Add/AddRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/Add/AddRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Add multiple members in a single request to a team. The response provides details about which memberships could and couldn't be created. This API is available in the following national cloud deployments. * @param AddPostRequestBody $body The request body * @param AddRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmembers-add?view=graph-rest-1.0 Find more info here */ public function post(AddPostRequestBody $body, ?AddRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AddPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(AddPostRequestBody $body, ?AddRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/Count/CountRequestBuilder.php index df050a676a7..7773aca496e 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/Item/ConversationMemberItemRequestBuilder.php index 1ab3bb17f04..75f3afe3b8b 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,65 +31,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-delete-members?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/conversationmember-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ConversationMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-members?view=graph-rest-1.0 Find more info here */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the role of a conversationMember in a team or channel. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param ConversationMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/conversationmember-update?view=graph-rest-1.0 Find more info here */ public function patch(ConversationMember $body, ?ConversationMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Delete a conversationMember from a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. + * Delete a conversationMember from a channel. This API is available in the following national cloud deployments. * @param ConversationMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ConversationMemberItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ConversationMember $body, ?Conversatio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/MembersRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/MembersRequestBuilder.php index ed9700b2c05..b784d22831a 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/MembersRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of conversationMembers from a channel. This method supports federation. Only a user who is a member of the shared channel can retrieve the channel member list. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-members?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a conversationMember to a channel. This operation is allowed only for channels with a membershipType value of private or shared. This API is available in the following national cloud deployments. * @param ConversationMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-members?view=graph-rest-1.0 Find more info here */ public function post(ConversationMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ConversationMember $body, ?MembersReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Count/CountRequestBuilder.php index ee1a9764887..5c45a6e56dc 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Delta/DeltaRequestBuilder.php index 22b54cbd210..4f6b51a775d 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/ChatMessageItemRequestBuilder.php index 9967402f1c7..83e5d9d3571 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\PrimaryChannel\Messages\Item\HostedContents\HostedContentsRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property messages for users * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update a chatMessage object. With the exception of the policyViolation property, all properties of a chatMessage can be updated in delegated permissions scenarios.Only the policyViolation property of a chatMessage can be updated in application permissions scenarios. The update only works for chats where members are Microsoft Teams users. If one of the participants is using Skype, the operation will fail. This method does not support federation. Only the user in the tenant who sent the message can perform data loss prevention (DLP) updates on the specified chat message. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-update?view=graph-rest-1.0 Find more info here */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/Count/CountRequestBuilder.php index 9db786d31b2..913c4429ed7 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilder.php index 56122d27a7a..8285187e3f0 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ChatMessageHostedContentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for users * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 67c5a767c0d..bbb1de8a007 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index e116e95f83d..0fc97315f13 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\PrimaryChannel\Messages\Item\HostedContents\Item\Value\ContentRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for users * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in users * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php index ebb35fb5abb..c434daa0119 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Count/CountRequestBuilder.php index b552163ff6d..84c46dbc5f7 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Delta/DeltaRequestBuilder.php index f3e1f6b69cd..1d954ae0a06 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php index 32eaf96fbe3..ba63ae96017 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/ChatMessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\PrimaryChannel\Messages\Item\Replies\Item\HostedContents\HostedContentsRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property replies for users * @param ChatMessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a single message or a message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property replies in users * @param ChatMessage $body The request body * @param ChatMessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessage $body, ?ChatMessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?ChatMessageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?ChatMessageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(ChatMessage $body, ?ChatMessageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php index c79c6bb192f..b6850ff672d 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php index 52a72c5cb1f..fe4bc153303 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ChatMessageHostedContentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -53,45 +52,39 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?HostedContentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to hostedContents for users * @param ChatMessageHostedContent $body The request body * @param HostedContentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ChatMessageHostedContent $body, ?HostedContentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. * @param HostedContentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -100,7 +93,6 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?HostedContentsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(ChatMessageHostedContent $body, ?Hosted $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php index 4338dacebe6..52f2fcc4bc9 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/HostedContentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. + * Retrieve the list of chatMessageHostedContent objects from a message. This API only lists the hosted content objects. To get the content bytes, see get chatmessage hosted content This API is available in the following national cloud deployments. The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference. */ class HostedContentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php index 1292238e021..623f6b47e4b 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/ChatMessageHostedContentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessageHostedContent; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\PrimaryChannel\Messages\Item\Replies\Item\HostedContents\Item\Value\ContentRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property hostedContents for users * @param ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ChatMessageHostedContentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of chatMessageHostedContent object. This API is available in the following national cloud deployments. * @param ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessagehostedcontent-get?view=graph-rest-1.0 Find more info here */ public function get(?ChatMessageHostedContentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property hostedContents in users * @param ChatMessageHostedContent $body The request body * @param ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ChatMessageHostedContent $body, ?ChatMessageHostedContentItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageHostedContent::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?ChatMessageHostedContentItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?ChatMessageHostedContentItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ChatMessageHostedContent $body, ?ChatM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php index 7f883ffa318..542ad955388 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/HostedContents/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property hostedContents from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-hostedcontents?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property hostedContents in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php index 1cbad1834ff..8e47e77b1d9 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php index 148d2507315..3d99fa8975b 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index 76983e397d8..077b086b759 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php index c667a749b7f..9e5713f9dfe 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/RepliesRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/RepliesRequestBuilder.php index eb99f9a314b..7fca59b68c1 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/RepliesRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/Replies/RepliesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ChatMessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List all the replies to a message in a channel of a team. This method lists only the replies of the specified message, if any. To get the message itself, simply call get channel message. This API is available in the following national cloud deployments. * @param RepliesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-list-replies?view=graph-rest-1.0 Find more info here */ public function get(?RepliesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new reply to a chatMessage in a specified channel. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param RepliesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-messagereply?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?RepliesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?RepliesRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?RepliesRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/SetReaction/SetReactionRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/SetReaction/SetReactionRequestBuilder.php index 2a36fa18251..3d51a5837c3 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/SetReaction/SetReactionRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/SetReaction/SetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action setReaction * @param SetReactionPostRequestBody $body The request body * @param SetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SetReactionPostRequestBody $body, ?SetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(SetReactionPostRequestBody $body, ?SetR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php index 2c30ca3148c..5b2403a7102 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/SoftDelete/SoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param SoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-softdelete?view=graph-rest-1.0 Find more info here */ public function post(?SoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SoftDeleteRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php index 121d49013d2..113d65cd412 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/UndoSoftDelete/UndoSoftDeleteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Undo soft deletion of a single chatMessage or a chat message reply in a channel or a chat. This API is available in the following national cloud deployments. * @param UndoSoftDeleteRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/chatmessage-undosoftdelete?view=graph-rest-1.0 Find more info here */ public function post(?UndoSoftDeleteRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UndoSoftDeleteRequestBuilderPostReques $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php index 0b797ece2c9..255f8c2a6c5 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/Item/UnsetReaction/UnsetReactionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action unsetReaction * @param UnsetReactionPostRequestBody $body The request body * @param UnsetReactionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(UnsetReactionPostRequestBody $body, ?UnsetReactionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(UnsetReactionPostRequestBody $body, ?Un $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/MessagesRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/MessagesRequestBuilder.php index e0ac79e7f54..ddea13b9b03 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/MessagesRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Messages/MessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChatMessage; use Microsoft\Graph\Generated\Models\ChatMessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of messages (without the replies) in a channel of a team. To get the replies for a message, call the list message replies or the get message reply API. This method supports federation. To list channel messages in application context, the request must be made from the tenant that the channel owner belongs to (represented by the tenantId property on the channel). This API is available in the following national cloud deployments. * @param MessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?MessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/channel-post-messages?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/chatmessage-post?view=graph-rest-1.0 Find more info here */ public function post(ChatMessage $body, ?MessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChatMessage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,11 +109,12 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Send a new chatMessage in the specified channel. This API is available in the following national cloud deployments. + * Send a new chatMessage in the specified channel or a chat. This API is available in the following national cloud deployments. * @param ChatMessage $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -131,11 +124,11 @@ public function toPostRequestInformation(ChatMessage $body, ?MessagesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/PrimaryChannelRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/PrimaryChannelRequestBuilder.php index 3892619be92..7bcf76c994d 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/PrimaryChannelRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/PrimaryChannelRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Channel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\PrimaryChannel\CompleteMigration\CompleteMigrationRequestBuilder; @@ -106,57 +105,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property primaryChannel for users * @param PrimaryChannelRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PrimaryChannelRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the default channel, General, of a team. This API is available in the following national cloud deployments. * @param PrimaryChannelRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-get-primarychannel?view=graph-rest-1.0 Find more info here */ public function get(?PrimaryChannelRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property primaryChannel in users * @param Channel $body The request body * @param PrimaryChannelRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Channel $body, ?PrimaryChannelRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Channel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -173,6 +163,7 @@ public function toDeleteRequestInformation(?PrimaryChannelRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -186,7 +177,6 @@ public function toGetRequestInformation(?PrimaryChannelRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -194,6 +184,7 @@ public function toGetRequestInformation(?PrimaryChannelRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -208,11 +199,11 @@ public function toPatchRequestInformation(Channel $body, ?PrimaryChannelRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/ProvisionEmail/ProvisionEmailRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/ProvisionEmail/ProvisionEmailRequestBuilder.php index a5ebc0e39ae..d0aa9fa9894 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/ProvisionEmail/ProvisionEmailRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/ProvisionEmail/ProvisionEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProvisionChannelEmailResult; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Provision an email address for a channel. Microsoft Teams doesn't automatically provision an email address for a channel by default. To have Teams provision an email address, you can call provisionEmail, or through the Teams user interface, select Get email address, which triggers Teams to generate an email address if it has not already provisioned one. To remove the email address of a channel, use the removeEmail method. This API is available in the following national cloud deployments. * @param ProvisionEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-provisionemail?view=graph-rest-1.0 Find more info here */ public function post(?ProvisionEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProvisionChannelEmailResult::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ProvisionEmailRequestBuilderPostReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/RemoveEmail/RemoveEmailRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/RemoveEmail/RemoveEmailRequestBuilder.php index 26362c5c367..a8cce9ff8b8 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/RemoveEmail/RemoveEmailRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/RemoveEmail/RemoveEmailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove the email address of a channel. You can remove an email address only if it was provisioned using the provisionEmail method or through the Microsoft Teams client. This API is available in the following national cloud deployments. * @param RemoveEmailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-removeemail?view=graph-rest-1.0 Find more info here */ public function post(?RemoveEmailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RemoveEmailRequestBuilderPostRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Count/CountRequestBuilder.php index 136db361327..69a6a6697c7 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php index e9932a15c72..306c811af37 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/AllowedMembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMemberCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\PrimaryChannel\SharedWithTeams\Item\AllowedMembers\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of conversationMembers who can access a shared channel. This method does not return the following conversationMembers from the team:- Users with Guest role- Users who are externally authenticated in the tenant This API is available in the following national cloud deployments. * @param AllowedMembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list-allowedmembers?view=graph-rest-1.0 Find more info here */ public function get(?AllowedMembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?AllowedMembersRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php index c2a56905d5b..7bc241e587b 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php index 5431d118a5b..424eb61fbb4 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/AllowedMembers/Item/ConversationMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ConversationMember; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * A collection of team members who have access to the shared channel. * @param ConversationMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ConversationMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ConversationMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ConversationMemberItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php index 2ea139f70ba..7a2288b8d7d 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/SharedWithChannelTeamInfoItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfo; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\PrimaryChannel\SharedWithTeams\Item\AllowedMembers\AllowedMembersRequestBuilder; @@ -50,58 +49,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Unshare a channel with a team by deleting the corresponding sharedWithChannelTeamInfo resource. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a team that has been shared with a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-get?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithChannelTeamInfoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sharedWithTeams in users * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SharedWithChannelTeamInfo $body, ?SharedWithChannelTeamInfoItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -118,6 +108,7 @@ public function toDeleteRequestInformation(?SharedWithChannelTeamInfoItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -131,7 +122,6 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -139,6 +129,7 @@ public function toGetRequestInformation(?SharedWithChannelTeamInfoItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -153,11 +144,11 @@ public function toPatchRequestInformation(SharedWithChannelTeamInfo $body, ?Shar $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/Team/TeamRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/Team/TeamRequestBuilder.php index e8380b43e4c..c9692789e06 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/Team/TeamRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/Item/Team/TeamRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get team from users * @param TeamRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/SharedWithTeamsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/SharedWithTeamsRequestBuilder.php index 7dbfb434ae9..b26bd94ff79 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/SharedWithTeamsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/SharedWithTeams/SharedWithTeamsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfo; use Microsoft\Graph\Generated\Models\SharedWithChannelTeamInfoCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of teams that has been shared a specified channel. This operation is allowed only for channels with a membershipType value of shared. This API is available in the following national cloud deployments. * @param SharedWithTeamsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sharedwithchannelteaminfo-list?view=graph-rest-1.0 Find more info here */ public function get(?SharedWithTeamsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sharedWithTeams for users * @param SharedWithChannelTeamInfo $body The request body * @param SharedWithTeamsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SharedWithChannelTeamInfo $body, ?SharedWithTeamsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SharedWithChannelTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SharedWithTeamsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SharedWithChannelTeamInfo $body, ?Share $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/Count/CountRequestBuilder.php index 976cbfef484..8473fe9eb31 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php index dadcb644882..40d2602e4cc 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The application that is linked to the tab. This can't be changed after tab creation. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/Item/TeamsTabItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/Item/TeamsTabItemRequestBuilder.php index 13ec59603b4..d6707eb23cf 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/Item/TeamsTabItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/Item/TeamsTabItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\PrimaryChannel\Tabs\Item\TeamsApp\TeamsAppRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Removes (unpins) a tab from the specified channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-delete-tabs?view=graph-rest-1.0 Find more info here */ public function delete(?TeamsTabItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of the specified tab in a channel within a team. This API is available in the following national cloud deployments. * @param TeamsTabItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-get-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TeamsTabItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified tab.This can be used to configure the content of the tab. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TeamsTabItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-patch-tabs?view=graph-rest-1.0 Find more info here */ public function patch(TeamsTab $body, ?TeamsTabItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TeamsTabItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TeamsTabItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TeamsTab $body, ?TeamsTabItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/TabsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/TabsRequestBuilder.php index 5d5e2c7ef9a..124002043d9 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/TabsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/PrimaryChannel/Tabs/TabsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTab; use Microsoft\Graph\Generated\Models\TeamsTabCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of tabs in the specified channel within a team. This API is available in the following national cloud deployments. * @param TabsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-list-tabs?view=graph-rest-1.0 Find more info here */ public function get(?TabsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTabCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Adds (pins) a tab to the specified channel within a team. The corresponding app must already be installed in the team. This API is available in the following national cloud deployments. * @param TeamsTab $body The request body * @param TabsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/channel-post-tabs?view=graph-rest-1.0 Find more info here */ public function post(TeamsTab $body, ?TabsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTab::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TabsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamsTab $body, ?TabsRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OfferShiftRequests/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OfferShiftRequests/Count/CountRequestBuilder.php index d3962172880..23a570d529a 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OfferShiftRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OfferShiftRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OfferShiftRequests/Item/OfferShiftRequestItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OfferShiftRequests/Item/OfferShiftRequestItemRequestBuilder.php index cca63dacef3..9a55788ea6a 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OfferShiftRequests/Item/OfferShiftRequestItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OfferShiftRequests/Item/OfferShiftRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OfferShiftRequest; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property offerShiftRequests for users * @param OfferShiftRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OfferShiftRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an offerShiftRequest object. This API is available in the following national cloud deployments. * @param OfferShiftRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/offershiftrequest-get?view=graph-rest-1.0 Find more info here */ public function get(?OfferShiftRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property offerShiftRequests in users * @param OfferShiftRequest $body The request body * @param OfferShiftRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OfferShiftRequest $body, ?OfferShiftRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?OfferShiftRequestItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?OfferShiftRequestItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?OfferShiftRequestItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(OfferShiftRequest $body, ?OfferShiftRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OfferShiftRequests/OfferShiftRequestsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OfferShiftRequests/OfferShiftRequestsRequestBuilder.php index 348f958855c..32b2a2bc68a 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OfferShiftRequests/OfferShiftRequestsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OfferShiftRequests/OfferShiftRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OfferShiftRequest; use Microsoft\Graph\Generated\Models\OfferShiftRequestCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of all offerShiftRequest objects in a team. This API is available in the following national cloud deployments. * @param OfferShiftRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/offershiftrequest-list?view=graph-rest-1.0 Find more info here */ public function get(?OfferShiftRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an instance of an offerShiftRequest. This API is available in the following national cloud deployments. * @param OfferShiftRequest $body The request body * @param OfferShiftRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/offershiftrequest-post?view=graph-rest-1.0 Find more info here */ public function post(OfferShiftRequest $body, ?OfferShiftRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OfferShiftRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OfferShiftRequestsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OfferShiftRequestsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OfferShiftRequest $body, ?OfferShiftReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShiftChangeRequests/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShiftChangeRequests/Count/CountRequestBuilder.php index 844aa278acd..057a6e30345 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShiftChangeRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShiftChangeRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShiftChangeRequests/Item/OpenShiftChangeRequestItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShiftChangeRequests/Item/OpenShiftChangeRequestItemRequestBuilder.php index bdb1e2169db..cc99cff0c9d 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShiftChangeRequests/Item/OpenShiftChangeRequestItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShiftChangeRequests/Item/OpenShiftChangeRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OpenShiftChangeRequest; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property openShiftChangeRequests for users * @param OpenShiftChangeRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OpenShiftChangeRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an openShiftChangeRequest object. This API is available in the following national cloud deployments. * @param OpenShiftChangeRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshiftchangerequest-get?view=graph-rest-1.0 Find more info here */ public function get(?OpenShiftChangeRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property openShiftChangeRequests in users * @param OpenShiftChangeRequest $body The request body * @param OpenShiftChangeRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OpenShiftChangeRequest $body, ?OpenShiftChangeRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?OpenShiftChangeRequestItemRequestBui $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?OpenShiftChangeRequestItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?OpenShiftChangeRequestItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(OpenShiftChangeRequest $body, ?OpenShi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShiftChangeRequests/OpenShiftChangeRequestsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShiftChangeRequests/OpenShiftChangeRequestsRequestBuilder.php index 69e18b9cf18..e6bcac35c92 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShiftChangeRequests/OpenShiftChangeRequestsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShiftChangeRequests/OpenShiftChangeRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OpenShiftChangeRequest; use Microsoft\Graph\Generated\Models\OpenShiftChangeRequestCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of openShiftChangeRequest objects in a team. This API is available in the following national cloud deployments. * @param OpenShiftChangeRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshiftchangerequest-list?view=graph-rest-1.0 Find more info here */ public function get(?OpenShiftChangeRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create instance of an openShiftChangeRequest object. This API is available in the following national cloud deployments. * @param OpenShiftChangeRequest $body The request body * @param OpenShiftChangeRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshiftchangerequest-post?view=graph-rest-1.0 Find more info here */ public function post(OpenShiftChangeRequest $body, ?OpenShiftChangeRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OpenShiftChangeRequestsRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OpenShiftChangeRequestsRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OpenShiftChangeRequest $body, ?OpenShif $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShifts/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShifts/Count/CountRequestBuilder.php index 4a9204d04b1..7c91a5ae035 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShifts/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShifts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShifts/Item/OpenShiftItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShifts/Item/OpenShiftItemRequestBuilder.php index 63589ec9a87..2de331e0922 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShifts/Item/OpenShiftItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShifts/Item/OpenShiftItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OpenShift; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an openShift object. This API is available in the following national cloud deployments. * @param OpenShiftItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-delete?view=graph-rest-1.0 Find more info here */ public function delete(?OpenShiftItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an openshift object. This API is available in the following national cloud deployments. * @param OpenShiftItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-get?view=graph-rest-1.0 Find more info here */ public function get(?OpenShiftItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of an openShift object. * @param OpenShift $body The request body * @param OpenShiftItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-update?view=graph-rest-1.0 Find more info here */ public function patch(OpenShift $body, ?OpenShiftItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?OpenShiftItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?OpenShiftItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?OpenShiftItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(OpenShift $body, ?OpenShiftItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShifts/OpenShiftsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShifts/OpenShiftsRequestBuilder.php index 5e44232a8c7..7145ecbf0e3 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShifts/OpenShiftsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/OpenShifts/OpenShiftsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OpenShift; use Microsoft\Graph\Generated\Models\OpenShiftCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List openShift objects in a team. This API is available in the following national cloud deployments. * @param OpenShiftsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-list?view=graph-rest-1.0 Find more info here */ public function get(?OpenShiftsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShiftCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an instance of an openShift object. This API is available in the following national cloud deployments. * @param OpenShift $body The request body * @param OpenShiftsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/openshift-post?view=graph-rest-1.0 Find more info here */ public function post(OpenShift $body, ?OpenShiftsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OpenShift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?OpenShiftsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?OpenShiftsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OpenShift $body, ?OpenShiftsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/ScheduleRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/ScheduleRequestBuilder.php index 3c0b3da22f8..f9fd7d91636 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/ScheduleRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/ScheduleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Schedule; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Schedule\OfferShiftRequests\OfferShiftRequestsRequestBuilder; @@ -114,57 +113,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property schedule for users * @param ScheduleRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ScheduleRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a schedule object. The schedule creation process conforms to the One API guideline for resource based long running operations (RELO).When clients use the PUT method, if the schedule is provisioned, the operation updates the schedule; otherwise, the operation starts the schedule provisioning process in the background. During schedule provisioning, clients can use the GET method to get the schedule and look at the provisionStatus property for the current state of the provisioning. If the provisioning failed, clients can get additional information from the provisionStatusCode property. Clients can also inspect the configuration of the schedule. This API is available in the following national cloud deployments. * @param ScheduleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-get?view=graph-rest-1.0 Find more info here */ public function get(?ScheduleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Schedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Schedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property schedule in users * @param Schedule $body The request body * @param ScheduleRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(Schedule $body, ?ScheduleRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Schedule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Schedule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -181,6 +171,7 @@ public function toDeleteRequestInformation(?ScheduleRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -194,7 +185,6 @@ public function toGetRequestInformation(?ScheduleRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -202,6 +192,7 @@ public function toGetRequestInformation(?ScheduleRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -216,11 +207,11 @@ public function toPutRequestInformation(Schedule $body, ?ScheduleRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SchedulingGroups/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SchedulingGroups/Count/CountRequestBuilder.php index 6fc36fbcdf8..7df050dbfae 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SchedulingGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SchedulingGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SchedulingGroups/Item/SchedulingGroupItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SchedulingGroups/Item/SchedulingGroupItemRequestBuilder.php index df036e96a3a..bf59ceaa654 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SchedulingGroups/Item/SchedulingGroupItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SchedulingGroups/Item/SchedulingGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SchedulingGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Mark a schedulingGroup as inactive by setting its isActive property.This method does not remove the schedulingGroup from the schedule. Existing shift instances assigned to the scheduling group remain part of the group. This API is available in the following national cloud deployments. * @param SchedulingGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedulinggroup-delete?view=graph-rest-1.0 Find more info here */ public function delete(?SchedulingGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a schedulingGroup by ID. This API is available in the following national cloud deployments. * @param SchedulingGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedulinggroup-get?view=graph-rest-1.0 Find more info here */ public function get(?SchedulingGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Replace an existing schedulingGroup. If the specified schedulingGroup doesn't exist, this method returns 404 Not found. * @param SchedulingGroup $body The request body * @param SchedulingGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedulinggroup-put?view=graph-rest-1.0 Find more info here */ public function patch(SchedulingGroup $body, ?SchedulingGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?SchedulingGroupItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?SchedulingGroupItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?SchedulingGroupItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(SchedulingGroup $body, ?SchedulingGrou $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SchedulingGroups/SchedulingGroupsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SchedulingGroups/SchedulingGroupsRequestBuilder.php index 09cfaa84ff2..bddccbabe20 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SchedulingGroups/SchedulingGroupsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SchedulingGroups/SchedulingGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SchedulingGroup; use Microsoft\Graph\Generated\Models\SchedulingGroupCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of schedulingGroups in this schedule. This API is available in the following national cloud deployments. * @param SchedulingGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-list-schedulinggroups?view=graph-rest-1.0 Find more info here */ public function get(?SchedulingGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new schedulingGroup. This API is available in the following national cloud deployments. * @param SchedulingGroup $body The request body * @param SchedulingGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-post-schedulinggroups?view=graph-rest-1.0 Find more info here */ public function post(SchedulingGroup $body, ?SchedulingGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SchedulingGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SchedulingGroupsRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SchedulingGroupsRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SchedulingGroup $body, ?SchedulingGroup $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Share/ShareRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Share/ShareRequestBuilder.php index b6ee2020f58..190ba09d4ab 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Share/ShareRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Share/ShareRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Share a schedule time range with schedule members.Make the collections of shift, openshift and timeOff items in the specified time range of the schedule viewable by the specified team members, including employees and managers.Each shift, openshift and timeOff instance in a schedule supports a draft version and a shared version of the item. The draft version is viewable by only managers, and the shared version is viewable by employees and managers. For each shift, openshift and timeOff instance in the specified time range, the share action updates the shared version from the draft version, so that in addition to managers, employees can also view the most current information about the item. The notifyTeam parameter further specifies which employees can view the item. This API is available in the following national cloud deployments. * @param SharePostRequestBody $body The request body * @param ShareRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-share?view=graph-rest-1.0 Find more info here */ public function post(SharePostRequestBody $body, ?ShareRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SharePostRequestBody $body, ?ShareReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Shifts/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Shifts/Count/CountRequestBuilder.php index 1e51251de0f..037df573ce9 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Shifts/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Shifts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Shifts/Item/ShiftItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Shifts/Item/ShiftItemRequestBuilder.php index 939a5ab9626..a66ab0c9c90 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Shifts/Item/ShiftItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Shifts/Item/ShiftItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Shift; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a shift from the schedule. This API is available in the following national cloud deployments. * @param ShiftItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shift-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ShiftItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a shift object by ID. This API is available in the following national cloud deployments. * @param ShiftItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shift-get?view=graph-rest-1.0 Find more info here */ public function get(?ShiftItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Replace an existing shift. If the specified shift doesn't exist, this method returns 404 Not found. The duration of a shift can't be less than 1 minute or longer than 24 hours. * @param Shift $body The request body * @param ShiftItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shift-put?view=graph-rest-1.0 Find more info here */ public function patch(Shift $body, ?ShiftItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ShiftItemRequestBuilderDeleteRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ShiftItemRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ShiftItemRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(Shift $body, ?ShiftItemRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Shifts/ShiftsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Shifts/ShiftsRequestBuilder.php index cab98923e2a..bc6175b3d61 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Shifts/ShiftsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/Shifts/ShiftsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Shift; use Microsoft\Graph\Generated\Models\ShiftCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of shift instances in a schedule. This API is available in the following national cloud deployments. * @param ShiftsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-list-shifts?view=graph-rest-1.0 Find more info here */ public function get(?ShiftsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ShiftCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ShiftCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new shift instance in a schedule. The duration of a shift cannot be less than 1 minute or longer than 24 hours. This API is available in the following national cloud deployments. * @param Shift $body The request body * @param ShiftsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-post-shifts?view=graph-rest-1.0 Find more info here */ public function post(Shift $body, ?ShiftsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Shift::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ShiftsRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ShiftsRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(Shift $body, ?ShiftsRequestBuilderPostR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SwapShiftsChangeRequests/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SwapShiftsChangeRequests/Count/CountRequestBuilder.php index 59c7d3e2046..5bcb9cdb057 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SwapShiftsChangeRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SwapShiftsChangeRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SwapShiftsChangeRequests/Item/SwapShiftsChangeRequestItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SwapShiftsChangeRequests/Item/SwapShiftsChangeRequestItemRequestBuilder.php index b182ad49812..864eb9e5c8f 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SwapShiftsChangeRequests/Item/SwapShiftsChangeRequestItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SwapShiftsChangeRequests/Item/SwapShiftsChangeRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SwapShiftsChangeRequest; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property swapShiftsChangeRequests for users * @param SwapShiftsChangeRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SwapShiftsChangeRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a swapShiftsChangeRequest object. This API is available in the following national cloud deployments. * @param SwapShiftsChangeRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/swapshiftschangerequest-get?view=graph-rest-1.0 Find more info here */ public function get(?SwapShiftsChangeRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property swapShiftsChangeRequests in users * @param SwapShiftsChangeRequest $body The request body * @param SwapShiftsChangeRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SwapShiftsChangeRequest $body, ?SwapShiftsChangeRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?SwapShiftsChangeRequestItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?SwapShiftsChangeRequestItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?SwapShiftsChangeRequestItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(SwapShiftsChangeRequest $body, ?SwapSh $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SwapShiftsChangeRequests/SwapShiftsChangeRequestsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SwapShiftsChangeRequests/SwapShiftsChangeRequestsRequestBuilder.php index 0dd8ec6fa40..dca89284c53 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SwapShiftsChangeRequests/SwapShiftsChangeRequestsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/SwapShiftsChangeRequests/SwapShiftsChangeRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SwapShiftsChangeRequest; use Microsoft\Graph\Generated\Models\SwapShiftsChangeRequestCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of swapShiftsChangeRequest objects in the team. This API is available in the following national cloud deployments. * @param SwapShiftsChangeRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/swapshiftschangerequest-list?view=graph-rest-1.0 Find more info here */ public function get(?SwapShiftsChangeRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an instance of a swapShiftsChangeRequest object. This API is available in the following national cloud deployments. * @param SwapShiftsChangeRequest $body The request body * @param SwapShiftsChangeRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/swapshiftschangerequest-post?view=graph-rest-1.0 Find more info here */ public function post(SwapShiftsChangeRequest $body, ?SwapShiftsChangeRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SwapShiftsChangeRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SwapShiftsChangeRequestsRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SwapShiftsChangeRequestsRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SwapShiftsChangeRequest $body, ?SwapShi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffReasons/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffReasons/Count/CountRequestBuilder.php index b8ae76340ca..41590339f77 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffReasons/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffReasons/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffReasons/Item/TimeOffReasonItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffReasons/Item/TimeOffReasonItemRequestBuilder.php index 2b72fdf9096..4af2342ffed 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffReasons/Item/TimeOffReasonItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffReasons/Item/TimeOffReasonItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOffReason; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Mark a timeOffReason as inactive by setting the isActive property. Every team must include at least one timeoff reason. This method doesn't remove the specified timeOffReason instance. timeOffItem instances that have been assigned this reason remain assigned to this reason. This API is available in the following national cloud deployments. * @param TimeOffReasonItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffreason-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TimeOffReasonItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a timeOffReason object by ID. This API is available in the following national cloud deployments. * @param TimeOffReasonItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffreason-get?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffReasonItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Replace an existing timeOffReason. If the specified timeOffReason doesn't exist, this method returns 404 Not found. * @param TimeOffReason $body The request body * @param TimeOffReasonItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffreason-put?view=graph-rest-1.0 Find more info here */ public function patch(TimeOffReason $body, ?TimeOffReasonItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?TimeOffReasonItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?TimeOffReasonItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?TimeOffReasonItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(TimeOffReason $body, ?TimeOffReasonIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffReasons/TimeOffReasonsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffReasons/TimeOffReasonsRequestBuilder.php index a9af0dc3da7..6c3431b2dd3 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffReasons/TimeOffReasonsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffReasons/TimeOffReasonsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOffReason; use Microsoft\Graph\Generated\Models\TimeOffReasonCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of timeOffReasons in a schedule. This API is available in the following national cloud deployments. * @param TimeOffReasonsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-list-timeoffreasons?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffReasonsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReasonCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReasonCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new timeOffReason. This API is available in the following national cloud deployments. * @param TimeOffReason $body The request body * @param TimeOffReasonsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-post-timeoffreasons?view=graph-rest-1.0 Find more info here */ public function post(TimeOffReason $body, ?TimeOffReasonsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffReason::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TimeOffReasonsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TimeOffReasonsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TimeOffReason $body, ?TimeOffReasonsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffRequests/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffRequests/Count/CountRequestBuilder.php index 232063f1362..e8e78bb8032 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffRequests/Item/TimeOffRequestItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffRequests/Item/TimeOffRequestItemRequestBuilder.php index c9a9349dea4..97a3e9fadb2 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffRequests/Item/TimeOffRequestItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffRequests/Item/TimeOffRequestItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOffRequest; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a timeOffRequest object. This API is available in the following national cloud deployments. * @param TimeOffRequestItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffrequest-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TimeOffRequestItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a timeoffrequest object. This API is available in the following national cloud deployments. * @param TimeOffRequestItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffrequest-get?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffRequestItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property timeOffRequests in users * @param TimeOffRequest $body The request body * @param TimeOffRequestItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TimeOffRequest $body, ?TimeOffRequestItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?TimeOffRequestItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?TimeOffRequestItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?TimeOffRequestItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(TimeOffRequest $body, ?TimeOffRequestI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffRequests/TimeOffRequestsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffRequests/TimeOffRequestsRequestBuilder.php index 7634a489c26..d8ee85320b2 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffRequests/TimeOffRequestsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimeOffRequests/TimeOffRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOffRequest; use Microsoft\Graph\Generated\Models\TimeOffRequestCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of timeOffRequest objects in the team. This API is available in the following national cloud deployments. * @param TimeOffRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoffrequest-list?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequestCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to timeOffRequests for users * @param TimeOffRequest $body The request body * @param TimeOffRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(TimeOffRequest $body, ?TimeOffRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffRequest::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TimeOffRequestsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TimeOffRequestsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(TimeOffRequest $body, ?TimeOffRequestsR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimesOff/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimesOff/Count/CountRequestBuilder.php index 4239160161f..95f420ace88 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimesOff/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimesOff/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimesOff/Item/TimeOffItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimesOff/Item/TimeOffItemRequestBuilder.php index 16f6018c408..1c41a004713 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimesOff/Item/TimeOffItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimesOff/Item/TimeOffItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOff; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a timeOff instance from a schedule. This API is available in the following national cloud deployments. * @param TimeOffItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoff-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TimeOffItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a timeOff object by ID. This API is available in the following national cloud deployments. * @param TimeOffItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoff-get?view=graph-rest-1.0 Find more info here */ public function get(?TimeOffItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Replace an existing timeOff object. If the specified timeOff object doesn't exist, this method returns 404 Not found. * @param TimeOff $body The request body * @param TimeOffItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/timeoff-put?view=graph-rest-1.0 Find more info here */ public function patch(TimeOff $body, ?TimeOffItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?TimeOffItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?TimeOffItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?TimeOffItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(TimeOff $body, ?TimeOffItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimesOff/TimesOffRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimesOff/TimesOffRequestBuilder.php index f995899322b..6fba7d63032 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimesOff/TimesOffRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Schedule/TimesOff/TimesOffRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TimeOff; use Microsoft\Graph\Generated\Models\TimeOffCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of timeOff instances in a schedule. This API is available in the following national cloud deployments. * @param TimesOffRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-list-timesoff?view=graph-rest-1.0 Find more info here */ public function get(?TimesOffRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOffCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOffCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new timeOff instance in a schedule. This API is available in the following national cloud deployments. * @param TimeOff $body The request body * @param TimesOffRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/schedule-post-timesoff?view=graph-rest-1.0 Find more info here */ public function post(TimeOff $body, ?TimesOffRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TimeOff::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TimesOffRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TimesOffRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TimeOff $body, ?TimesOffRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php index 2da85ff8a89..27607f12f47 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/SendActivityNotification/SendActivityNotificationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Send an activity feed notification in the scope of a team. For more details about sending notifications and the requirements for doing so, seesending Teams activity notifications. This API is available in the following national cloud deployments. * @param SendActivityNotificationPostRequestBody $body The request body * @param SendActivityNotificationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-sendactivitynotification?view=graph-rest-1.0 Find more info here */ public function post(SendActivityNotificationPostRequestBody $body, ?SendActivityNotificationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SendActivityNotificationPostRequestBody $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Tags/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Tags/Count/CountRequestBuilder.php index a5ed6f9a042..90ee761714a 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Tags/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Tags/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/Members/Count/CountRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/Members/Count/CountRequestBuilder.php index 8a115158883..d6c9b715ced 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/Members/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/Members/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/Members/Item/TeamworkTagMemberItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/Members/Item/TeamworkTagMemberItemRequestBuilder.php index e25441931f3..18d3d1d3153 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/Members/Item/TeamworkTagMemberItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/Members/Item/TeamworkTagMemberItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamworkTagMember; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a member from a standard tag in a team. This API is available in the following national cloud deployments. * @param TeamworkTagMemberItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktagmember-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TeamworkTagMemberItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a member of a standard tag in a team. This API is available in the following national cloud deployments. * @param TeamworkTagMemberItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktagmember-get?view=graph-rest-1.0 Find more info here */ public function get(?TeamworkTagMemberItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property members in users * @param TeamworkTagMember $body The request body * @param TeamworkTagMemberItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(TeamworkTagMember $body, ?TeamworkTagMemberItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?TeamworkTagMemberItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?TeamworkTagMemberItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?TeamworkTagMemberItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(TeamworkTagMember $body, ?TeamworkTagM $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/Members/MembersRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/Members/MembersRequestBuilder.php index 7bfc0bd75db..a23888c0c19 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/Members/MembersRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/Members/MembersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamworkTagMember; use Microsoft\Graph\Generated\Models\TeamworkTagMemberCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the members of a standard tag in a team and their properties. This API is available in the following national cloud deployments. * @param MembersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktagmember-list?view=graph-rest-1.0 Find more info here */ public function get(?MembersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMemberCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new teamworkTagMember object in a team. This API is available in the following national cloud deployments. * @param TeamworkTagMember $body The request body * @param MembersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktagmember-post?view=graph-rest-1.0 Find more info here */ public function post(TeamworkTagMember $body, ?MembersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagMember::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?MembersRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamworkTagMember $body, ?MembersReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/TeamworkTagItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/TeamworkTagItemRequestBuilder.php index aa9822a52b2..3cf2d7444d5 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/TeamworkTagItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Tags/Item/TeamworkTagItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamworkTag; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\Tags\Item\Members\MembersRequestBuilder; @@ -42,59 +41,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a tag object permanently. This API is available in the following national cloud deployments. * @param TeamworkTagItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TeamworkTagItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a tag object. This API is available in the following national cloud deployments. * @param TeamworkTagItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-get?view=graph-rest-1.0 Find more info here */ public function get(?TeamworkTagItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a tag object. This API is available in the following national cloud deployments. * @param TeamworkTag $body The request body * @param TeamworkTagItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-update?view=graph-rest-1.0 Find more info here */ public function patch(TeamworkTag $body, ?TeamworkTagItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -111,6 +101,7 @@ public function toDeleteRequestInformation(?TeamworkTagItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -124,7 +115,6 @@ public function toGetRequestInformation(?TeamworkTagItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -132,6 +122,7 @@ public function toGetRequestInformation(?TeamworkTagItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -146,11 +137,11 @@ public function toPatchRequestInformation(TeamworkTag $body, ?TeamworkTagItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Tags/TagsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Tags/TagsRequestBuilder.php index c03ce015828..d5975ac60a8 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Tags/TagsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Tags/TagsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamworkTag; use Microsoft\Graph\Generated\Models\TeamworkTagCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the tag objects and their properties. This API is available in the following national cloud deployments. * @param TagsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-list?view=graph-rest-1.0 Find more info here */ public function get(?TagsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTagCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a standard tag for members in a team. This API is available in the following national cloud deployments. * @param TeamworkTag $body The request body * @param TagsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/teamworktag-post?view=graph-rest-1.0 Find more info here */ public function post(TeamworkTag $body, ?TagsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamworkTag::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?TagsRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?TagsRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(TeamworkTag $body, ?TagsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/TeamItemRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/TeamItemRequestBuilder.php index 34b577c8fc9..21de19fe88a 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/TeamItemRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/TeamItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Graph\Generated\Users\Item\JoinedTeams\Item\AllChannels\AllChannelsRequestBuilder; @@ -178,56 +177,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property joinedTeams for users * @param TeamItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TeamItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get joinedTeams from users * @param TeamItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property joinedTeams in users * @param Team $body The request body * @param TeamItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Team $body, ?TeamItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -244,6 +234,7 @@ public function toDeleteRequestInformation(?TeamItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -257,7 +248,6 @@ public function toGetRequestInformation(?TeamItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -265,6 +255,7 @@ public function toGetRequestInformation(?TeamItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -279,11 +270,11 @@ public function toPatchRequestInformation(Team $body, ?TeamItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Template/TemplateRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Template/TemplateRequestBuilder.php index 6656fb305a6..a99739d0351 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Template/TemplateRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Template/TemplateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsTemplate; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The template this team was created from. See available templates. * @param TemplateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TemplateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsTemplate::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TemplateRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TemplateRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/Item/Unarchive/UnarchiveRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/Item/Unarchive/UnarchiveRequestBuilder.php index c95b098d67a..ff15acbe294 100644 --- a/src/Generated/Users/Item/JoinedTeams/Item/Unarchive/UnarchiveRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/Item/Unarchive/UnarchiveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore an archived team. This restores users' ability to send messages and edit the team, abiding by tenant and team settings. A Team is archived using the archive API. Unarchiving is an async operation. A team is unarchived once the async operation completes successfully, which may occur subsequent to a response from this API. This API is available in the following national cloud deployments. * @param UnarchiveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/team-unarchive?view=graph-rest-1.0 Find more info here */ public function post(?UnarchiveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?UnarchiveRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/JoinedTeams/JoinedTeamsRequestBuilder.php b/src/Generated/Users/Item/JoinedTeams/JoinedTeamsRequestBuilder.php index 69fbb7d61a1..072508ba85e 100644 --- a/src/Generated/Users/Item/JoinedTeams/JoinedTeamsRequestBuilder.php +++ b/src/Generated/Users/Item/JoinedTeams/JoinedTeamsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Graph\Generated\Models\TeamCollectionResponse; @@ -63,39 +62,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the teams in Microsoft Teams that the user is a direct member of. This API is available in the following national cloud deployments. * @param JoinedTeamsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-joinedteams?view=graph-rest-1.0 Find more info here */ public function get(?JoinedTeamsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to joinedTeams for users * @param Team $body The request body * @param JoinedTeamsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Team $body, ?JoinedTeamsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,7 +101,6 @@ public function toGetRequestInformation(?JoinedTeamsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -116,6 +108,7 @@ public function toGetRequestInformation(?JoinedTeamsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -130,11 +123,11 @@ public function toPostRequestInformation(Team $body, ?JoinedTeamsRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/LicenseDetails/Count/CountRequestBuilder.php b/src/Generated/Users/Item/LicenseDetails/Count/CountRequestBuilder.php index 313cadf5b30..de1969afb51 100644 --- a/src/Generated/Users/Item/LicenseDetails/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/LicenseDetails/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/LicenseDetails/Item/LicenseDetailsItemRequestBuilder.php b/src/Generated/Users/Item/LicenseDetails/Item/LicenseDetailsItemRequestBuilder.php index c4cfde41e34..0837c8b8c2e 100644 --- a/src/Generated/Users/Item/LicenseDetails/Item/LicenseDetailsItemRequestBuilder.php +++ b/src/Generated/Users/Item/LicenseDetails/Item/LicenseDetailsItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LicenseDetails; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property licenseDetails for users * @param LicenseDetailsItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?LicenseDetailsItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A collection of this user's license details. Read-only. * @param LicenseDetailsItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LicenseDetailsItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LicenseDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LicenseDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property licenseDetails in users * @param LicenseDetails $body The request body * @param LicenseDetailsItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(LicenseDetails $body, ?LicenseDetailsItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LicenseDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LicenseDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?LicenseDetailsItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?LicenseDetailsItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?LicenseDetailsItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(LicenseDetails $body, ?LicenseDetailsI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/LicenseDetails/LicenseDetailsRequestBuilder.php b/src/Generated/Users/Item/LicenseDetails/LicenseDetailsRequestBuilder.php index 990a1e9dfb4..251ea8154e1 100644 --- a/src/Generated/Users/Item/LicenseDetails/LicenseDetailsRequestBuilder.php +++ b/src/Generated/Users/Item/LicenseDetails/LicenseDetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LicenseDetails; use Microsoft\Graph\Generated\Models\LicenseDetailsCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of licenseDetails objects for enterprise users. This API returns details for licenses that are directly assigned and those transitively assigned through memberships in licensed groups. This API is available in the following national cloud deployments. * @param LicenseDetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-licensedetails?view=graph-rest-1.0 Find more info here */ public function get(?LicenseDetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LicenseDetailsCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LicenseDetailsCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to licenseDetails for users * @param LicenseDetails $body The request body * @param LicenseDetailsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(LicenseDetails $body, ?LicenseDetailsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LicenseDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LicenseDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?LicenseDetailsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?LicenseDetailsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(LicenseDetails $body, ?LicenseDetailsRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Count/CountRequestBuilder.php index 4c5406ed2c0..fe3696b869c 100644 --- a/src/Generated/Users/Item/MailFolders/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Delta/DeltaRequestBuilder.php index eae3c862019..36f65d13a1f 100644 --- a/src/Generated/Users/Item/MailFolders/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of mail folders that have been added, deleted, or removed from the user's mailbox. A delta function call for mail folders in a mailbox is similar to a GET request, except that by appropriatelyapplying state tokens in one or more of these calls,you can query for incremental changes in the mail folders. This allows you to maintain and synchronizea local store of a user's mail folders without having to fetch all the mail folders of that mailbox from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/ChildFoldersRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/ChildFoldersRequestBuilder.php index 6b33c05db7c..1d68d9ace1f 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/ChildFoldersRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/ChildFoldersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailFolder; use Microsoft\Graph\Generated\Models\MailFolderCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of child folders in the mailFolder. * @param ChildFoldersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-list-childfolders?view=graph-rest-1.0 Find more info here */ public function get(?ChildFoldersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailFolderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailFolderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new child mailFolder. If you intend a new folder to be hidden, you must set the isHidden property to true on creation. This API is available in the following national cloud deployments. * @param MailFolder $body The request body * @param ChildFoldersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-post-childfolders?view=graph-rest-1.0 Find more info here */ public function post(MailFolder $body, ?ChildFoldersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ChildFoldersRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ChildFoldersRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(MailFolder $body, ?ChildFoldersRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Count/CountRequestBuilder.php index c6f6c041247..c047ae704b0 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Delta/DeltaRequestBuilder.php index f0116bcfb32..6cdb664b5d4 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of mail folders that have been added, deleted, or removed from the user's mailbox. A delta function call for mail folders in a mailbox is similar to a GET request, except that by appropriatelyapplying state tokens in one or more of these calls,you can query for incremental changes in the mail folders. This allows you to maintain and synchronizea local store of a user's mail folders without having to fetch all the mail folders of that mailbox from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Copy/CopyRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Copy/CopyRequestBuilder.php index 159fa3e7f06..5e79b36410e 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Copy/CopyRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Copy/CopyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailFolder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a mailfolder and its contents to another mailfolder. This API is available in the following national cloud deployments. * @param CopyPostRequestBody $body The request body * @param CopyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-copy?view=graph-rest-1.0 Find more info here */ public function post(CopyPostRequestBody $body, ?CopyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyPostRequestBody $body, ?CopyRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MailFolderItemRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MailFolderItemRequestBuilder.php index 1a2174b54d4..4678d1e0a9a 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MailFolderItemRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MailFolderItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailFolder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\MailFolders\Item\ChildFolders\Item\Copy\CopyRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property childFolders for users * @param MailFolderItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MailFolderItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of child folders in the mailFolder. * @param MailFolderItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailFolderItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property childFolders in users * @param MailFolder $body The request body * @param MailFolderItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailFolder $body, ?MailFolderItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?MailFolderItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?MailFolderItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?MailFolderItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(MailFolder $body, ?MailFolderItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MessageRules/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MessageRules/Count/CountRequestBuilder.php index 9b76088ac1e..6ba60cb6ddf 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MessageRules/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MessageRules/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MessageRules/Item/MessageRuleItemRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MessageRules/Item/MessageRuleItemRequestBuilder.php index e19576efbee..c3c7cbd4e86 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MessageRules/Item/MessageRuleItemRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MessageRules/Item/MessageRuleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MessageRule; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the specified messageRule object. This API is available in the following national cloud deployments. * @param MessageRuleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/messagerule-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MessageRuleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a messageRule object. This API is available in the following national cloud deployments. * @param MessageRuleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/messagerule-get?view=graph-rest-1.0 Find more info here */ public function get(?MessageRuleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MessageRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MessageRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Change writable properties on a messageRule object and save the changes. This API is available in the following national cloud deployments. * @param MessageRule $body The request body * @param MessageRuleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/messagerule-update?view=graph-rest-1.0 Find more info here */ public function patch(MessageRule $body, ?MessageRuleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MessageRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MessageRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MessageRuleItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MessageRuleItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MessageRuleItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MessageRule $body, ?MessageRuleItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MessageRules/MessageRulesRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MessageRules/MessageRulesRequestBuilder.php index e41eca9dd1d..67c0eace3ad 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MessageRules/MessageRulesRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/MessageRules/MessageRulesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MessageRule; use Microsoft\Graph\Generated\Models\MessageRuleCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get all the messageRule objects defined for the user's inbox. This API is available in the following national cloud deployments. * @param MessageRulesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-list-messagerules?view=graph-rest-1.0 Find more info here */ public function get(?MessageRulesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MessageRuleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MessageRuleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a messageRule object by specifying a set of conditions and actions. Outlook carries out those actions if an incoming message in the user's Inbox meets the specified conditions. This API is available in the following national cloud deployments. * @param MessageRule $body The request body * @param MessageRulesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-post-messagerules?view=graph-rest-1.0 Find more info here */ public function post(MessageRule $body, ?MessageRulesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MessageRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MessageRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?MessageRulesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?MessageRulesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MessageRule $body, ?MessageRulesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Count/CountRequestBuilder.php index cc3cb2f0068..5f532907479 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Delta/DeltaRequestBuilder.php index 02a4442d0f8..4a16d41406f 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of messages that have been added, deleted, or updated in a specified folder. A delta function call for messages in a folder is similar to a GET request, except that by appropriatelyapplying state tokens in one or more of these calls, you can [query for incremental changes in the messages inthat folder](/graph/delta-query-messages). This allows you to maintain and synchronize a local store of a user's messages withouthaving to fetch the entire set of messages from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilder.php index 936dbf904b7..831e4fda485 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -61,46 +60,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve a list of attachment objects. This API is available in the following national cloud deployments. + * Retrieve a list of attachment objects attached to a message. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/eventmessage-list-attachments?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/message-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to a message. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. You can add an attachment to an existing message by posting to its attachments collection, or you canadd an attachment to a message that is being created and sent on the fly. This operation limits the size of the attachment you can add to under 3 MB. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve a list of attachment objects. This API is available in the following national cloud deployments. + * Retrieve a list of attachment objects attached to a message. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilderGetQueryParameters.php index bec945d134f..3d8348f5ec2 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve a list of attachment objects. This API is available in the following national cloud deployments. + * Retrieve a list of attachment objects attached to a message. This API is available in the following national cloud deployments. */ class AttachmentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/Count/CountRequestBuilder.php index d34dafe888d..7eb64fb2518 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 3d109f992f6..fe7c045bf41 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/Item/AttachmentItemRequestBuilder.php index a9357031826..017cb24912e 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attachments for users * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-get?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Copy/CopyRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Copy/CopyRequestBuilder.php index 078c7c09640..d84ed0081e4 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Copy/CopyRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Copy/CopyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a message to a folder within the user's mailbox. This API is available in the following national cloud deployments. * @param CopyPostRequestBody $body The request body * @param CopyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-copy?view=graph-rest-1.0 Find more info here */ public function post(CopyPostRequestBody $body, ?CopyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyPostRequestBody $body, ?CopyRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/CreateForward/CreateForwardRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/CreateForward/CreateForwardRequestBuilder.php index 548313107f4..6c0e2cdf9b5 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/CreateForward/CreateForwardRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/CreateForward/CreateForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a draft to forward an existing message, in either JSON or MIME format. When using JSON format, you can:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- Specify either the toRecipients parameter or the toRecipients property of the message parameter. Specifying both or specifying neither will return an HTTP 400 Bad Request error.- Update the draft later to add content to the body or change other message properties. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. Send the draft message in a subsequent operation. Alternatively, forward a message in a single operation. This API is available in the following national cloud deployments. * @param CreateForwardPostRequestBody $body The request body * @param CreateForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-createforward?view=graph-rest-1.0 Find more info here */ public function post(CreateForwardPostRequestBody $body, ?CreateForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateForwardPostRequestBody $body, ?Cr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/CreateReply/CreateReplyRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/CreateReply/CreateReplyRequestBuilder.php index 3a2ad8ea435..e6088892a16 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/CreateReply/CreateReplyRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/CreateReply/CreateReplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a draft to reply to the sender of a message in either JSON or MIME format. When using JSON format:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- If replyTo is specified in the original message, per Internet Message Format (RFC 2822), you should send the reply to the recipients in replyTo, and not the recipients in from.- You can update the draft later to add reply content to the body or change other message properties. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. Send the draft message in a subsequent operation. Alternatively, reply to a message in a single operation. This API is available in the following national cloud deployments. * @param CreateReplyPostRequestBody $body The request body * @param CreateReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-createreply?view=graph-rest-1.0 Find more info here */ public function post(CreateReplyPostRequestBody $body, ?CreateReplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateReplyPostRequestBody $body, ?Crea $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/CreateReplyAll/CreateReplyAllRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/CreateReplyAll/CreateReplyAllRequestBuilder.php index 74ea05c74ba..9c1d4aa2ce4 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/CreateReplyAll/CreateReplyAllRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/CreateReplyAll/CreateReplyAllRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a draft to reply to the sender and all recipients of a message in either JSON or MIME format. When using JSON format:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- If the original message specifies a recipient in the replyTo property, per Internet Message Format (RFC 2822), you should send the reply to the recipients in the replyTo and toRecipients properties, and not the recipients in the from and toRecipients properties.- You can update the draft later to add reply content to the body or change other message properties. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. Send the draft message in a subsequent operation. Alternatively, reply-all to a message in a single action. This API is available in the following national cloud deployments. * @param CreateReplyAllPostRequestBody $body The request body * @param CreateReplyAllRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-createreplyall?view=graph-rest-1.0 Find more info here */ public function post(CreateReplyAllPostRequestBody $body, ?CreateReplyAllRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateReplyAllPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Extensions/Count/CountRequestBuilder.php index cc9ebd624cf..ac0bafaf7f0 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Extensions/ExtensionsRequestBuilder.php index f0148b57bc2..c4f1aee7e70 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 195302ba07b..801dc8f62de 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Forward/ForwardRequestBuilder.php index 8a4f7e39689..7b27aad274d 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Forward a message using either JSON or MIME format. When using JSON format, you can:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- Specify either the toRecipients parameter or the toRecipients property of the message parameter. Specifying both or specifying neither will return an HTTP 400 Bad Request error. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. This method saves the message in the Sent Items folder. Alternatively, create a draft to forward a message, and send it later. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/MessageItemRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/MessageItemRequestBuilder.php index c6bf79e8b84..04d8c9b9d4c 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/MessageItemRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/MessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\MailFolders\Item\ChildFolders\Item\Messages\Item\Attachments\AttachmentsRequestBuilder; @@ -130,56 +129,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property messages for users * @param MessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of messages in the mailFolder. * @param MessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property messages in users * @param Message $body The request body * @param MessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Message $body, ?MessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -196,6 +186,7 @@ public function toDeleteRequestInformation(?MessageItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -209,7 +200,6 @@ public function toGetRequestInformation(?MessageItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -217,6 +207,7 @@ public function toGetRequestInformation(?MessageItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -231,11 +222,11 @@ public function toPatchRequestInformation(Message $body, ?MessageItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Move/MoveRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Move/MoveRequestBuilder.php index caa45758348..4f0573a95f5 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Move/MoveRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Move/MoveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Move a message to another folder within the specified user's mailbox. This creates a new copy of the message in the destination folder and removes the original message. This API is available in the following national cloud deployments. * @param MovePostRequestBody $body The request body * @param MoveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-move?view=graph-rest-1.0 Find more info here */ public function post(MovePostRequestBody $body, ?MoveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(MovePostRequestBody $body, ?MoveRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Reply/ReplyRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Reply/ReplyRequestBuilder.php index e935a30c138..6cbdf1bf678 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Reply/ReplyRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Reply/ReplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Reply to the sender of a message using either JSON or MIME format. When using JSON format:* Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.* If the original message specifies a recipient in the replyTo property, per Internet Message Format (RFC 2822), send the reply to the recipients in replyTo and not the recipient in the from property. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. This method saves the message in the Sent Items folder. Alternatively, create a draft to reply to an existing message and send it later. This API is available in the following national cloud deployments. * @param ReplyPostRequestBody $body The request body * @param ReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-reply?view=graph-rest-1.0 Find more info here */ public function post(ReplyPostRequestBody $body, ?ReplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ReplyPostRequestBody $body, ?ReplyReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/ReplyAll/ReplyAllRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/ReplyAll/ReplyAllRequestBuilder.php index 626c4563f2b..aa7917528a8 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/ReplyAll/ReplyAllRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/ReplyAll/ReplyAllRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Reply to all recipients of a message using either JSON or MIME format. When using JSON format:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- If the original message specifies a recipient in the replyTo property, per Internet Message Format (RFC 2822), send the reply to the recipients in replyTo and not the recipient in the from property. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. This method saves the message in the Sent Items folder. Alternatively, create a draft to reply-all to a message and send it later. This API is available in the following national cloud deployments. * @param ReplyAllPostRequestBody $body The request body * @param ReplyAllRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-replyall?view=graph-rest-1.0 Find more info here */ public function post(ReplyAllPostRequestBody $body, ?ReplyAllRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ReplyAllPostRequestBody $body, ?ReplyAl $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Send/SendRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Send/SendRequestBuilder.php index 0558748e652..4b147a3ebd0 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Send/SendRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Send/SendRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Send an existing draft message. The draft message can be a new message draft, reply draft, reply-all draft, or a forward draft. This method saves the message in the Sent Items folder. Alternatively, send a new message in a single operation. This API is available in the following national cloud deployments. * @param SendRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-send?view=graph-rest-1.0 Find more info here */ public function post(?SendRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SendRequestBuilderPostRequestConfigura $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Value/ContentRequestBuilder.php index f95fc359302..f95feb5a52d 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property messages from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property messages in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/MessagesRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/MessagesRequestBuilder.php index e084f3929c8..db78d6c8668 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/MessagesRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Messages/MessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\MessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get all the messages in the specified user's mailbox, or those messages in a specified folder in the mailbox. This API is available in the following national cloud deployments. * @param MessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?MessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new Message in a mailfolder. This API is available in the following national cloud deployments. * @param Message $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-post-messages?view=graph-rest-1.0 Find more info here */ public function post(Message $body, ?MessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Message $body, ?MessagesRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Move/MoveRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Move/MoveRequestBuilder.php index da0860d0670..725f61fc87d 100644 --- a/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Move/MoveRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/ChildFolders/Item/Move/MoveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailFolder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Move a mailfolder and its contents to another mailfolder. This API is available in the following national cloud deployments. * @param MovePostRequestBody $body The request body * @param MoveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-move?view=graph-rest-1.0 Find more info here */ public function post(MovePostRequestBody $body, ?MoveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(MovePostRequestBody $body, ?MoveRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Copy/CopyRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Copy/CopyRequestBuilder.php index 4589f7bf996..f8435395399 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Copy/CopyRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Copy/CopyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailFolder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a mailfolder and its contents to another mailfolder. This API is available in the following national cloud deployments. * @param CopyPostRequestBody $body The request body * @param CopyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-copy?view=graph-rest-1.0 Find more info here */ public function post(CopyPostRequestBody $body, ?CopyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyPostRequestBody $body, ?CopyRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/MailFolderItemRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/MailFolderItemRequestBuilder.php index 7804171225d..e3500cd92d8 100644 --- a/src/Generated/Users/Item/MailFolders/Item/MailFolderItemRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/MailFolderItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailFolder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\MailFolders\Item\ChildFolders\ChildFoldersRequestBuilder; @@ -74,59 +73,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the specified mailFolder. The folder can be a mailSearchFolder. You can specify a mail folder by its folder ID, or by its well-known folder name, if one exists. This API is available in the following national cloud deployments. * @param MailFolderItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MailFolderItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The user's mail folders. Read-only. Nullable. * @param MailFolderItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-get?view=graph-rest-1.0 Find more info here */ public function get(?MailFolderItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update the properties of mailfolder object. This API is available in the following national cloud deployments. + * Update the writable properties of a mailSearchFolder object. This API is available in the following national cloud deployments. * @param MailFolder $body The request body * @param MailFolderItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/mailfolder-update?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/mailsearchfolder-update?view=graph-rest-1.0 Find more info here */ public function patch(MailFolder $body, ?MailFolderItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -143,6 +133,7 @@ public function toDeleteRequestInformation(?MailFolderItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -156,7 +147,6 @@ public function toGetRequestInformation(?MailFolderItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -164,11 +154,12 @@ public function toGetRequestInformation(?MailFolderItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the properties of mailfolder object. This API is available in the following national cloud deployments. + * Update the writable properties of a mailSearchFolder object. This API is available in the following national cloud deployments. * @param MailFolder $body The request body * @param MailFolderItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -178,11 +169,11 @@ public function toPatchRequestInformation(MailFolder $body, ?MailFolderItemReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/MessageRules/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/MessageRules/Count/CountRequestBuilder.php index 86f37dd695d..4a23f944161 100644 --- a/src/Generated/Users/Item/MailFolders/Item/MessageRules/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/MessageRules/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/MessageRules/Item/MessageRuleItemRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/MessageRules/Item/MessageRuleItemRequestBuilder.php index 0f186ac4955..15226d53462 100644 --- a/src/Generated/Users/Item/MailFolders/Item/MessageRules/Item/MessageRuleItemRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/MessageRules/Item/MessageRuleItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MessageRule; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the specified messageRule object. This API is available in the following national cloud deployments. * @param MessageRuleItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/messagerule-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MessageRuleItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of a messageRule object. This API is available in the following national cloud deployments. * @param MessageRuleItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/messagerule-get?view=graph-rest-1.0 Find more info here */ public function get(?MessageRuleItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MessageRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MessageRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Change writable properties on a messageRule object and save the changes. This API is available in the following national cloud deployments. * @param MessageRule $body The request body * @param MessageRuleItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/messagerule-update?view=graph-rest-1.0 Find more info here */ public function patch(MessageRule $body, ?MessageRuleItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MessageRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MessageRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?MessageRuleItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?MessageRuleItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?MessageRuleItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(MessageRule $body, ?MessageRuleItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/MessageRules/MessageRulesRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/MessageRules/MessageRulesRequestBuilder.php index ab20b512ebc..5b2ce0761a7 100644 --- a/src/Generated/Users/Item/MailFolders/Item/MessageRules/MessageRulesRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/MessageRules/MessageRulesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MessageRule; use Microsoft\Graph\Generated\Models\MessageRuleCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get all the messageRule objects defined for the user's inbox. This API is available in the following national cloud deployments. * @param MessageRulesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-list-messagerules?view=graph-rest-1.0 Find more info here */ public function get(?MessageRulesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MessageRuleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MessageRuleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a messageRule object by specifying a set of conditions and actions. Outlook carries out those actions if an incoming message in the user's Inbox meets the specified conditions. This API is available in the following national cloud deployments. * @param MessageRule $body The request body * @param MessageRulesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-post-messagerules?view=graph-rest-1.0 Find more info here */ public function post(MessageRule $body, ?MessageRulesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MessageRule::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MessageRule::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?MessageRulesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?MessageRulesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(MessageRule $body, ?MessageRulesRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Count/CountRequestBuilder.php index 8e90767319d..6bab3513b4c 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Delta/DeltaRequestBuilder.php index 22e3878ed9c..9b75aa95bb1 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of messages that have been added, deleted, or updated in a specified folder. A delta function call for messages in a folder is similar to a GET request, except that by appropriatelyapplying state tokens in one or more of these calls, you can [query for incremental changes in the messages inthat folder](/graph/delta-query-messages). This allows you to maintain and synchronize a local store of a user's messages withouthaving to fetch the entire set of messages from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilder.php index 3b68142f124..81188d86343 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -61,46 +60,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve a list of attachment objects. This API is available in the following national cloud deployments. + * Retrieve a list of attachment objects attached to a message. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/eventmessage-list-attachments?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/message-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to a message. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. You can add an attachment to an existing message by posting to its attachments collection, or you canadd an attachment to a message that is being created and sent on the fly. This operation limits the size of the attachment you can add to under 3 MB. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve a list of attachment objects. This API is available in the following national cloud deployments. + * Retrieve a list of attachment objects attached to a message. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilderGetQueryParameters.php index 310e98a0620..b6e484f70a7 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/AttachmentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve a list of attachment objects. This API is available in the following national cloud deployments. + * Retrieve a list of attachment objects attached to a message. This API is available in the following national cloud deployments. */ class AttachmentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/Count/CountRequestBuilder.php index 11884b800bb..dc85d4a5ace 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 0ea7cac878f..32e81fa17c0 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/Item/AttachmentItemRequestBuilder.php index 093cb602c46..73575455633 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attachments for users * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-get?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Copy/CopyRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Copy/CopyRequestBuilder.php index 527eaa83529..24d63c2efc7 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Copy/CopyRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Copy/CopyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a message to a folder within the user's mailbox. This API is available in the following national cloud deployments. * @param CopyPostRequestBody $body The request body * @param CopyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-copy?view=graph-rest-1.0 Find more info here */ public function post(CopyPostRequestBody $body, ?CopyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyPostRequestBody $body, ?CopyRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/CreateForward/CreateForwardRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/CreateForward/CreateForwardRequestBuilder.php index 1b086b98851..99ca7ed77a8 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/CreateForward/CreateForwardRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/CreateForward/CreateForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a draft to forward an existing message, in either JSON or MIME format. When using JSON format, you can:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- Specify either the toRecipients parameter or the toRecipients property of the message parameter. Specifying both or specifying neither will return an HTTP 400 Bad Request error.- Update the draft later to add content to the body or change other message properties. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. Send the draft message in a subsequent operation. Alternatively, forward a message in a single operation. This API is available in the following national cloud deployments. * @param CreateForwardPostRequestBody $body The request body * @param CreateForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-createforward?view=graph-rest-1.0 Find more info here */ public function post(CreateForwardPostRequestBody $body, ?CreateForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateForwardPostRequestBody $body, ?Cr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/CreateReply/CreateReplyRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/CreateReply/CreateReplyRequestBuilder.php index 7c3c36a7039..8f9035762ce 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/CreateReply/CreateReplyRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/CreateReply/CreateReplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a draft to reply to the sender of a message in either JSON or MIME format. When using JSON format:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- If replyTo is specified in the original message, per Internet Message Format (RFC 2822), you should send the reply to the recipients in replyTo, and not the recipients in from.- You can update the draft later to add reply content to the body or change other message properties. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. Send the draft message in a subsequent operation. Alternatively, reply to a message in a single operation. This API is available in the following national cloud deployments. * @param CreateReplyPostRequestBody $body The request body * @param CreateReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-createreply?view=graph-rest-1.0 Find more info here */ public function post(CreateReplyPostRequestBody $body, ?CreateReplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateReplyPostRequestBody $body, ?Crea $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/CreateReplyAll/CreateReplyAllRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/CreateReplyAll/CreateReplyAllRequestBuilder.php index 8168eac4f58..2e58f922a08 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/CreateReplyAll/CreateReplyAllRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/CreateReplyAll/CreateReplyAllRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a draft to reply to the sender and all recipients of a message in either JSON or MIME format. When using JSON format:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- If the original message specifies a recipient in the replyTo property, per Internet Message Format (RFC 2822), you should send the reply to the recipients in the replyTo and toRecipients properties, and not the recipients in the from and toRecipients properties.- You can update the draft later to add reply content to the body or change other message properties. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. Send the draft message in a subsequent operation. Alternatively, reply-all to a message in a single action. This API is available in the following national cloud deployments. * @param CreateReplyAllPostRequestBody $body The request body * @param CreateReplyAllRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-createreplyall?view=graph-rest-1.0 Find more info here */ public function post(CreateReplyAllPostRequestBody $body, ?CreateReplyAllRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateReplyAllPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Extensions/Count/CountRequestBuilder.php index 7d52ce8c52e..f9b83f1b971 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Extensions/ExtensionsRequestBuilder.php index 1efaee142a0..acdf5db40d6 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 45aaaba8acd..3e2a52ad5f4 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Forward/ForwardRequestBuilder.php index 3709e207825..9f6f978396b 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Forward a message using either JSON or MIME format. When using JSON format, you can:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- Specify either the toRecipients parameter or the toRecipients property of the message parameter. Specifying both or specifying neither will return an HTTP 400 Bad Request error. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. This method saves the message in the Sent Items folder. Alternatively, create a draft to forward a message, and send it later. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/MessageItemRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/MessageItemRequestBuilder.php index b177fe83636..5ffe1e6f1f0 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/MessageItemRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/MessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\MailFolders\Item\Messages\Item\Attachments\AttachmentsRequestBuilder; @@ -130,56 +129,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property messages for users * @param MessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of messages in the mailFolder. * @param MessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property messages in users * @param Message $body The request body * @param MessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Message $body, ?MessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -196,6 +186,7 @@ public function toDeleteRequestInformation(?MessageItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -209,7 +200,6 @@ public function toGetRequestInformation(?MessageItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -217,6 +207,7 @@ public function toGetRequestInformation(?MessageItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -231,11 +222,11 @@ public function toPatchRequestInformation(Message $body, ?MessageItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Move/MoveRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Move/MoveRequestBuilder.php index afb4983d2e1..7608ce4a4b4 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Move/MoveRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Move/MoveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Move a message to another folder within the specified user's mailbox. This creates a new copy of the message in the destination folder and removes the original message. This API is available in the following national cloud deployments. * @param MovePostRequestBody $body The request body * @param MoveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-move?view=graph-rest-1.0 Find more info here */ public function post(MovePostRequestBody $body, ?MoveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(MovePostRequestBody $body, ?MoveRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Reply/ReplyRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Reply/ReplyRequestBuilder.php index b575ec5b98f..73893672ca9 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Reply/ReplyRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Reply/ReplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Reply to the sender of a message using either JSON or MIME format. When using JSON format:* Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.* If the original message specifies a recipient in the replyTo property, per Internet Message Format (RFC 2822), send the reply to the recipients in replyTo and not the recipient in the from property. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. This method saves the message in the Sent Items folder. Alternatively, create a draft to reply to an existing message and send it later. This API is available in the following national cloud deployments. * @param ReplyPostRequestBody $body The request body * @param ReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-reply?view=graph-rest-1.0 Find more info here */ public function post(ReplyPostRequestBody $body, ?ReplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ReplyPostRequestBody $body, ?ReplyReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/ReplyAll/ReplyAllRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/ReplyAll/ReplyAllRequestBuilder.php index a52516f671e..60ffbafca32 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/ReplyAll/ReplyAllRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/ReplyAll/ReplyAllRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Reply to all recipients of a message using either JSON or MIME format. When using JSON format:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- If the original message specifies a recipient in the replyTo property, per Internet Message Format (RFC 2822), send the reply to the recipients in replyTo and not the recipient in the from property. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. This method saves the message in the Sent Items folder. Alternatively, create a draft to reply-all to a message and send it later. This API is available in the following national cloud deployments. * @param ReplyAllPostRequestBody $body The request body * @param ReplyAllRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-replyall?view=graph-rest-1.0 Find more info here */ public function post(ReplyAllPostRequestBody $body, ?ReplyAllRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ReplyAllPostRequestBody $body, ?ReplyAl $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Send/SendRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Send/SendRequestBuilder.php index 413bd086400..c0afcdb33d5 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Send/SendRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Send/SendRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Send an existing draft message. The draft message can be a new message draft, reply draft, reply-all draft, or a forward draft. This method saves the message in the Sent Items folder. Alternatively, send a new message in a single operation. This API is available in the following national cloud deployments. * @param SendRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-send?view=graph-rest-1.0 Find more info here */ public function post(?SendRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SendRequestBuilderPostRequestConfigura $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Value/ContentRequestBuilder.php index 263fccc39fc..108cf638c13 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property messages from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property messages in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Messages/MessagesRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Messages/MessagesRequestBuilder.php index 67d902cc0ca..d55e2463e35 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Messages/MessagesRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Messages/MessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\MessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get all the messages in the specified user's mailbox, or those messages in a specified folder in the mailbox. This API is available in the following national cloud deployments. * @param MessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?MessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new Message in a mailfolder. This API is available in the following national cloud deployments. * @param Message $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-post-messages?view=graph-rest-1.0 Find more info here */ public function post(Message $body, ?MessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Message $body, ?MessagesRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/Item/Move/MoveRequestBuilder.php b/src/Generated/Users/Item/MailFolders/Item/Move/MoveRequestBuilder.php index 2966f8b2964..f922443b675 100644 --- a/src/Generated/Users/Item/MailFolders/Item/Move/MoveRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/Item/Move/MoveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailFolder; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Move a mailfolder and its contents to another mailfolder. This API is available in the following national cloud deployments. * @param MovePostRequestBody $body The request body * @param MoveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/mailfolder-move?view=graph-rest-1.0 Find more info here */ public function post(MovePostRequestBody $body, ?MoveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(MovePostRequestBody $body, ?MoveRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailFolders/MailFoldersRequestBuilder.php b/src/Generated/Users/Item/MailFolders/MailFoldersRequestBuilder.php index 3024e2aced9..af291078b6d 100644 --- a/src/Generated/Users/Item/MailFolders/MailFoldersRequestBuilder.php +++ b/src/Generated/Users/Item/MailFolders/MailFoldersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailFolder; use Microsoft\Graph\Generated\Models\MailFolderCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The user's mail folders. Read-only. Nullable. * @param MailFoldersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-mailfolders?view=graph-rest-1.0 Find more info here */ public function get(?MailFoldersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailFolderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailFolderCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to create a new mail folder in the root folder of the user's mailbox. If you intend a new folder to be hidden, you must set the isHidden property to true on creation. This API is available in the following national cloud deployments. * @param MailFolder $body The request body * @param MailFoldersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-post-mailfolders?view=graph-rest-1.0 Find more info here */ public function post(MailFolder $body, ?MailFoldersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailFolder::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MailFoldersRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?MailFoldersRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(MailFolder $body, ?MailFoldersRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MailboxSettings/MailboxSettingsRequestBuilder.php b/src/Generated/Users/Item/MailboxSettings/MailboxSettingsRequestBuilder.php index 8d53f23b27b..b182bb550ba 100644 --- a/src/Generated/Users/Item/MailboxSettings/MailboxSettingsRequestBuilder.php +++ b/src/Generated/Users/Item/MailboxSettings/MailboxSettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MailboxSettings; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Settings for the primary mailbox of the signed-in user. You can get or update settings for sending automatic replies to incoming messages, locale and time zone. Returned only on $select. * @param MailboxSettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?MailboxSettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update property mailboxSettings value. * @param MailboxSettings $body The request body * @param MailboxSettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MailboxSettings $body, ?MailboxSettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MailboxSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -78,7 +71,6 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -86,6 +78,7 @@ public function toGetRequestInformation(?MailboxSettingsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -100,11 +93,11 @@ public function toPatchRequestInformation(MailboxSettings $body, ?MailboxSetting $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedAppRegistrations/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ManagedAppRegistrations/Count/CountRequestBuilder.php index a278858d765..c34e35c3543 100644 --- a/src/Generated/Users/Item/ManagedAppRegistrations/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedAppRegistrations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedAppRegistrations/Item/ManagedAppRegistrationItemRequestBuilder.php b/src/Generated/Users/Item/ManagedAppRegistrations/Item/ManagedAppRegistrationItemRequestBuilder.php index e716fd6e854..5c3fcfe98e0 100644 --- a/src/Generated/Users/Item/ManagedAppRegistrations/Item/ManagedAppRegistrationItemRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedAppRegistrations/Item/ManagedAppRegistrationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedAppRegistration; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Zero or more managed app registrations that belong to the user. * @param ManagedAppRegistrationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedAppRegistrationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppRegistration::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppRegistration::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ManagedAppRegistrationItemRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ManagedAppRegistrationItemRequestBuilde } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedAppRegistrations/ManagedAppRegistrationsRequestBuilder.php b/src/Generated/Users/Item/ManagedAppRegistrations/ManagedAppRegistrationsRequestBuilder.php index d6009d1d171..909eabf22fd 100644 --- a/src/Generated/Users/Item/ManagedAppRegistrations/ManagedAppRegistrationsRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedAppRegistrations/ManagedAppRegistrationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedAppRegistrationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\ManagedAppRegistrations\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Zero or more managed app registrations that belong to the user. * @param ManagedAppRegistrationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedAppRegistrationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppRegistrationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedAppRegistrationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?ManagedAppRegistrationsRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?ManagedAppRegistrationsRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Count/CountRequestBuilder.php index 88d85c0be7c..8d1e36aa048 100644 --- a/src/Generated/Users/Item/ManagedDevices/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/BypassActivationLock/BypassActivationLockRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/BypassActivationLock/BypassActivationLockRequestBuilder.php index a984ad971fd..96a1ad77718 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/BypassActivationLock/BypassActivationLockRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/BypassActivationLock/BypassActivationLockRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Bypass activation lock * @param BypassActivationLockRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-bypassactivationlock?view=graph-rest-1.0 Find more info here */ public function post(?BypassActivationLockRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?BypassActivationLockRequestBuilderPost $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/CleanWindowsDevice/CleanWindowsDeviceRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/CleanWindowsDevice/CleanWindowsDeviceRequestBuilder.php index 66fbbf2506d..0ab36b15a96 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/CleanWindowsDevice/CleanWindowsDeviceRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/CleanWindowsDevice/CleanWindowsDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Clean Windows device * @param CleanWindowsDevicePostRequestBody $body The request body * @param CleanWindowsDeviceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-cleanwindowsdevice?view=graph-rest-1.0 Find more info here */ public function post(CleanWindowsDevicePostRequestBody $body, ?CleanWindowsDeviceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(CleanWindowsDevicePostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/DeleteUserFromSharedAppleDevice/DeleteUserFromSharedAppleDeviceRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/DeleteUserFromSharedAppleDevice/DeleteUserFromSharedAppleDeviceRequestBuilder.php index 3a3e6b66831..6ab2d32cf06 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/DeleteUserFromSharedAppleDevice/DeleteUserFromSharedAppleDeviceRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/DeleteUserFromSharedAppleDevice/DeleteUserFromSharedAppleDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Delete user from shared Apple device * @param DeleteUserFromSharedAppleDevicePostRequestBody $body The request body * @param DeleteUserFromSharedAppleDeviceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-deleteuserfromsharedappledevice?view=graph-rest-1.0 Find more info here */ public function post(DeleteUserFromSharedAppleDevicePostRequestBody $body, ?DeleteUserFromSharedAppleDeviceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(DeleteUserFromSharedAppleDevicePostRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/DeviceCategory/DeviceCategoryRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/DeviceCategory/DeviceCategoryRequestBuilder.php index 82d9c9ade23..222cff1d72b 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/DeviceCategory/DeviceCategoryRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/DeviceCategory/DeviceCategoryRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceCategory; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceCategory for users * @param DeviceCategoryRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceCategoryRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the deviceCategory object. * @param DeviceCategoryRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-devicecategory-get?view=graph-rest-1.0 Find more info here */ public function get(?DeviceCategoryRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a deviceCategory object. * @param DeviceCategory $body The request body * @param DeviceCategoryRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-devicecategory-update?view=graph-rest-1.0 Find more info here */ public function patch(DeviceCategory $body, ?DeviceCategoryRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DeviceCategoryRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DeviceCategoryRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DeviceCategoryRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(DeviceCategory $body, ?DeviceCategoryR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/DeviceCompliancePolicyStates/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/DeviceCompliancePolicyStates/Count/CountRequestBuilder.php index 500c6154df2..c2f46892ee5 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/DeviceCompliancePolicyStates/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/DeviceCompliancePolicyStates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/DeviceCompliancePolicyStates/DeviceCompliancePolicyStatesRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/DeviceCompliancePolicyStates/DeviceCompliancePolicyStatesRequestBuilder.php index bff7e126096..973585bf655 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/DeviceCompliancePolicyStates/DeviceCompliancePolicyStatesRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/DeviceCompliancePolicyStates/DeviceCompliancePolicyStatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceCompliancePolicyState; use Microsoft\Graph\Generated\Models\DeviceCompliancePolicyStateCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Device compliance policy states for this device. * @param DeviceCompliancePolicyStatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceCompliancePolicyStatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to deviceCompliancePolicyStates for users * @param DeviceCompliancePolicyState $body The request body * @param DeviceCompliancePolicyStatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DeviceCompliancePolicyState $body, ?DeviceCompliancePolicyStatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DeviceCompliancePolicyStatesRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DeviceCompliancePolicyStatesRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DeviceCompliancePolicyState $body, ?Dev $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/DeviceCompliancePolicyStates/Item/DeviceCompliancePolicyStateItemRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/DeviceCompliancePolicyStates/Item/DeviceCompliancePolicyStateItemRequestBuilder.php index ccb0cffc650..61f367da08d 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/DeviceCompliancePolicyStates/Item/DeviceCompliancePolicyStateItemRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/DeviceCompliancePolicyStates/Item/DeviceCompliancePolicyStateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceCompliancePolicyState; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceCompliancePolicyStates for users * @param DeviceCompliancePolicyStateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceCompliancePolicyStateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Device compliance policy states for this device. * @param DeviceCompliancePolicyStateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceCompliancePolicyStateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property deviceCompliancePolicyStates in users * @param DeviceCompliancePolicyState $body The request body * @param DeviceCompliancePolicyStateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DeviceCompliancePolicyState $body, ?DeviceCompliancePolicyStateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCompliancePolicyState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DeviceCompliancePolicyStateItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DeviceCompliancePolicyStateItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DeviceCompliancePolicyStateItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(DeviceCompliancePolicyState $body, ?De $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/DeviceConfigurationStates/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/DeviceConfigurationStates/Count/CountRequestBuilder.php index 31e3f34c09e..047910a1dd2 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/DeviceConfigurationStates/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/DeviceConfigurationStates/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/DeviceConfigurationStates/DeviceConfigurationStatesRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/DeviceConfigurationStates/DeviceConfigurationStatesRequestBuilder.php index 8982634b0f6..d01ff5cdae2 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/DeviceConfigurationStates/DeviceConfigurationStatesRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/DeviceConfigurationStates/DeviceConfigurationStatesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceConfigurationState; use Microsoft\Graph\Generated\Models\DeviceConfigurationStateCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Device configuration states for this device. * @param DeviceConfigurationStatesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceConfigurationStatesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to deviceConfigurationStates for users * @param DeviceConfigurationState $body The request body * @param DeviceConfigurationStatesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DeviceConfigurationState $body, ?DeviceConfigurationStatesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?DeviceConfigurationStatesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?DeviceConfigurationStatesRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DeviceConfigurationState $body, ?Device $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/DeviceConfigurationStates/Item/DeviceConfigurationStateItemRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/DeviceConfigurationStates/Item/DeviceConfigurationStateItemRequestBuilder.php index 95a54f5d4ab..d36e7424295 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/DeviceConfigurationStates/Item/DeviceConfigurationStateItemRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/DeviceConfigurationStates/Item/DeviceConfigurationStateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceConfigurationState; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property deviceConfigurationStates for users * @param DeviceConfigurationStateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceConfigurationStateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Device configuration states for this device. * @param DeviceConfigurationStateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceConfigurationStateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property deviceConfigurationStates in users * @param DeviceConfigurationState $body The request body * @param DeviceConfigurationStateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DeviceConfigurationState $body, ?DeviceConfigurationStateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceConfigurationState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?DeviceConfigurationStateItemRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?DeviceConfigurationStateItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?DeviceConfigurationStateItemRequestBuil } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(DeviceConfigurationState $body, ?Devic $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/DisableLostMode/DisableLostModeRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/DisableLostMode/DisableLostModeRequestBuilder.php index 8aaf737fafc..b49e7b917d5 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/DisableLostMode/DisableLostModeRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/DisableLostMode/DisableLostModeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Disable lost mode * @param DisableLostModeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-disablelostmode?view=graph-rest-1.0 Find more info here */ public function post(?DisableLostModeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?DisableLostModeRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/LocateDevice/LocateDeviceRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/LocateDevice/LocateDeviceRequestBuilder.php index 4b914fdf4f8..f4f1034f14e 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/LocateDevice/LocateDeviceRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/LocateDevice/LocateDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Locate a device * @param LocateDeviceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-locatedevice?view=graph-rest-1.0 Find more info here */ public function post(?LocateDeviceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?LocateDeviceRequestBuilderPostRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/Count/CountRequestBuilder.php index 76d1d3fd3d9..cf103ff9cb4 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/Item/CreateDownloadUrl/CreateDownloadUrlRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/Item/CreateDownloadUrl/CreateDownloadUrlRequestBuilder.php index cc9ee5b8812..77a45c7b51a 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/Item/CreateDownloadUrl/CreateDownloadUrlRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/Item/CreateDownloadUrl/CreateDownloadUrlRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action createDownloadUrl * @param CreateDownloadUrlRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?CreateDownloadUrlRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CreateDownloadUrlPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CreateDownloadUrlPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toPostRequestInformation(?CreateDownloadUrlRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/Item/DeviceLogCollectionResponseItemRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/Item/DeviceLogCollectionResponseItemRequestBuilder.php index 9404b533180..81e682ac6d5 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/Item/DeviceLogCollectionResponseItemRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/Item/DeviceLogCollectionResponseItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceLogCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\ManagedDevices\Item\LogCollectionRequests\Item\CreateDownloadUrl\CreateDownloadUrlRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property logCollectionRequests for users * @param DeviceLogCollectionResponseItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DeviceLogCollectionResponseItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * List of log collection requests * @param DeviceLogCollectionResponseItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeviceLogCollectionResponseItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property logCollectionRequests in users * @param DeviceLogCollectionResponse $body The request body * @param DeviceLogCollectionResponseItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(DeviceLogCollectionResponse $body, ?DeviceLogCollectionResponseItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?DeviceLogCollectionResponseItemReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?DeviceLogCollectionResponseItemRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?DeviceLogCollectionResponseItemRequestB } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(DeviceLogCollectionResponse $body, ?De $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/LogCollectionRequestsRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/LogCollectionRequestsRequestBuilder.php index 417e8055db9..d909681d925 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/LogCollectionRequestsRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/LogCollectionRequests/LogCollectionRequestsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceLogCollectionResponse; use Microsoft\Graph\Generated\Models\DeviceLogCollectionResponseCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List of log collection requests * @param LogCollectionRequestsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?LogCollectionRequestsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to logCollectionRequests for users * @param DeviceLogCollectionResponse $body The request body * @param LogCollectionRequestsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(DeviceLogCollectionResponse $body, ?LogCollectionRequestsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceLogCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?LogCollectionRequestsRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?LogCollectionRequestsRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(DeviceLogCollectionResponse $body, ?Log $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/LogoutSharedAppleDeviceActiveUser/LogoutSharedAppleDeviceActiveUserRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/LogoutSharedAppleDeviceActiveUser/LogoutSharedAppleDeviceActiveUserRequestBuilder.php index 66361266e23..48aed14cecf 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/LogoutSharedAppleDeviceActiveUser/LogoutSharedAppleDeviceActiveUserRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/LogoutSharedAppleDeviceActiveUser/LogoutSharedAppleDeviceActiveUserRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Logout shared Apple device active user * @param LogoutSharedAppleDeviceActiveUserRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-logoutsharedappledeviceactiveuser?view=graph-rest-1.0 Find more info here */ public function post(?LogoutSharedAppleDeviceActiveUserRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?LogoutSharedAppleDeviceActiveUserReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/ManagedDeviceItemRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/ManagedDeviceItemRequestBuilder.php index d8845f11716..3a84cca6dd7 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/ManagedDeviceItemRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/ManagedDeviceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedDevice; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\ManagedDevices\Item\BypassActivationLock\BypassActivationLockRequestBuilder; @@ -226,56 +225,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property managedDevices for users * @param ManagedDeviceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ManagedDeviceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The managed devices associated with the user. * @param ManagedDeviceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedDeviceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property managedDevices in users * @param ManagedDevice $body The request body * @param ManagedDeviceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ManagedDevice $body, ?ManagedDeviceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -292,6 +282,7 @@ public function toDeleteRequestInformation(?ManagedDeviceItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -305,7 +296,6 @@ public function toGetRequestInformation(?ManagedDeviceItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -313,6 +303,7 @@ public function toGetRequestInformation(?ManagedDeviceItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -327,11 +318,11 @@ public function toPatchRequestInformation(ManagedDevice $body, ?ManagedDeviceIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/RebootNow/RebootNowRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/RebootNow/RebootNowRequestBuilder.php index 9d3b4072c2c..fd0355ef485 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/RebootNow/RebootNowRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/RebootNow/RebootNowRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reboot device * @param RebootNowRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-rebootnow?view=graph-rest-1.0 Find more info here */ public function post(?RebootNowRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RebootNowRequestBuilderPostRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/RecoverPasscode/RecoverPasscodeRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/RecoverPasscode/RecoverPasscodeRequestBuilder.php index 5a1c169dfa3..db1302688d1 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/RecoverPasscode/RecoverPasscodeRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/RecoverPasscode/RecoverPasscodeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Recover passcode * @param RecoverPasscodeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-recoverpasscode?view=graph-rest-1.0 Find more info here */ public function post(?RecoverPasscodeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RecoverPasscodeRequestBuilderPostReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/RemoteLock/RemoteLockRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/RemoteLock/RemoteLockRequestBuilder.php index 82eb94f7d9f..fb837c9a63c 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/RemoteLock/RemoteLockRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/RemoteLock/RemoteLockRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remote lock * @param RemoteLockRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-remotelock?view=graph-rest-1.0 Find more info here */ public function post(?RemoteLockRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RemoteLockRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/RequestRemoteAssistance/RequestRemoteAssistanceRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/RequestRemoteAssistance/RequestRemoteAssistanceRequestBuilder.php index 471b78a112a..4f0e4b2c5fa 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/RequestRemoteAssistance/RequestRemoteAssistanceRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/RequestRemoteAssistance/RequestRemoteAssistanceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Request remote assistance * @param RequestRemoteAssistanceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-requestremoteassistance?view=graph-rest-1.0 Find more info here */ public function post(?RequestRemoteAssistanceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RequestRemoteAssistanceRequestBuilderP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/ResetPasscode/ResetPasscodeRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/ResetPasscode/ResetPasscodeRequestBuilder.php index 05493e1f83b..84eb3debe34 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/ResetPasscode/ResetPasscodeRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/ResetPasscode/ResetPasscodeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Reset passcode * @param ResetPasscodeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-resetpasscode?view=graph-rest-1.0 Find more info here */ public function post(?ResetPasscodeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ResetPasscodeRequestBuilderPostRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/Retire/RetireRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/Retire/RetireRequestBuilder.php index faf5dda47fe..b302ad20af8 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/Retire/RetireRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/Retire/RetireRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retire a device * @param RetireRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-retire?view=graph-rest-1.0 Find more info here */ public function post(?RetireRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RetireRequestBuilderPostRequestConfigu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/ShutDown/ShutDownRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/ShutDown/ShutDownRequestBuilder.php index c5617c9cb00..51b21d56fb0 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/ShutDown/ShutDownRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/ShutDown/ShutDownRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Shut down device * @param ShutDownRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-shutdown?view=graph-rest-1.0 Find more info here */ public function post(?ShutDownRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ShutDownRequestBuilderPostRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/SyncDevice/SyncDeviceRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/SyncDevice/SyncDeviceRequestBuilder.php index 160d3661cfa..fe1ac69a5b0 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/SyncDevice/SyncDeviceRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/SyncDevice/SyncDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Not yet documented * @param SyncDeviceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-syncdevice?view=graph-rest-1.0 Find more info here */ public function post(?SyncDeviceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SyncDeviceRequestBuilderPostRequestCon $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/UpdateWindowsDeviceAccount/UpdateWindowsDeviceAccountRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/UpdateWindowsDeviceAccount/UpdateWindowsDeviceAccountRequestBuilder.php index 6142a0a20d8..1599e545064 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/UpdateWindowsDeviceAccount/UpdateWindowsDeviceAccountRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/UpdateWindowsDeviceAccount/UpdateWindowsDeviceAccountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param UpdateWindowsDeviceAccountPostRequestBody $body The request body * @param UpdateWindowsDeviceAccountRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-updatewindowsdeviceaccount?view=graph-rest-1.0 Find more info here */ public function post(UpdateWindowsDeviceAccountPostRequestBody $body, ?UpdateWindowsDeviceAccountRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(UpdateWindowsDeviceAccountPostRequestBo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/Users/UsersRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/Users/UsersRequestBuilder.php index 812a2685554..b5a167088b1 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/Users/UsersRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/Users/UsersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserCollectionResponse; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the user objects. * @param UsersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-user-list?view=graph-rest-1.0 Find more info here */ public function get(?UsersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?UsersRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?UsersRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/WindowsDefenderScan/WindowsDefenderScanRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/WindowsDefenderScan/WindowsDefenderScanRequestBuilder.php index 2c8ec6dd9b2..a90ada38403 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/WindowsDefenderScan/WindowsDefenderScanRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/WindowsDefenderScan/WindowsDefenderScanRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Not yet documented * @param WindowsDefenderScanPostRequestBody $body The request body * @param WindowsDefenderScanRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-windowsdefenderscan?view=graph-rest-1.0 Find more info here */ public function post(WindowsDefenderScanPostRequestBody $body, ?WindowsDefenderScanRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(WindowsDefenderScanPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/WindowsDefenderUpdateSignatures/WindowsDefenderUpdateSignaturesRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/WindowsDefenderUpdateSignatures/WindowsDefenderUpdateSignaturesRequestBuilder.php index e822014bdc3..4a255a03337 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/WindowsDefenderUpdateSignatures/WindowsDefenderUpdateSignaturesRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/WindowsDefenderUpdateSignatures/WindowsDefenderUpdateSignaturesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Not yet documented * @param WindowsDefenderUpdateSignaturesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-windowsdefenderupdatesignatures?view=graph-rest-1.0 Find more info here */ public function post(?WindowsDefenderUpdateSignaturesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?WindowsDefenderUpdateSignaturesRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Count/CountRequestBuilder.php index e80556e7b11..82173868ee4 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/DetectedMalwareStateRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/DetectedMalwareStateRequestBuilder.php index ae1d2fcc245..ad5fb0b0873 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/DetectedMalwareStateRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/DetectedMalwareStateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsDeviceMalwareState; use Microsoft\Graph\Generated\Models\WindowsDeviceMalwareStateCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the windowsDeviceMalwareState objects. * @param DetectedMalwareStateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsdevicemalwarestate-list?view=graph-rest-1.0 Find more info here */ public function get(?DetectedMalwareStateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareStateCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new windowsDeviceMalwareState object. * @param WindowsDeviceMalwareState $body The request body * @param DetectedMalwareStateRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsdevicemalwarestate-create?view=graph-rest-1.0 Find more info here */ public function post(WindowsDeviceMalwareState $body, ?DetectedMalwareStateRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?DetectedMalwareStateRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?DetectedMalwareStateRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(WindowsDeviceMalwareState $body, ?Detec $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Item/WindowsDeviceMalwareStateItemRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Item/WindowsDeviceMalwareStateItemRequestBuilder.php index 08158654718..975d94177d6 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Item/WindowsDeviceMalwareStateItemRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/DetectedMalwareState/Item/WindowsDeviceMalwareStateItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsDeviceMalwareState; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a windowsDeviceMalwareState. * @param WindowsDeviceMalwareStateItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsdevicemalwarestate-delete?view=graph-rest-1.0 Find more info here */ public function delete(?WindowsDeviceMalwareStateItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the windowsDeviceMalwareState object. * @param WindowsDeviceMalwareStateItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsdevicemalwarestate-get?view=graph-rest-1.0 Find more info here */ public function get(?WindowsDeviceMalwareStateItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a windowsDeviceMalwareState object. * @param WindowsDeviceMalwareState $body The request body * @param WindowsDeviceMalwareStateItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsdevicemalwarestate-update?view=graph-rest-1.0 Find more info here */ public function patch(WindowsDeviceMalwareState $body, ?WindowsDeviceMalwareStateItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsDeviceMalwareState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?WindowsDeviceMalwareStateItemRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?WindowsDeviceMalwareStateItemRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?WindowsDeviceMalwareStateItemRequestBui } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(WindowsDeviceMalwareState $body, ?Wind $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/WindowsProtectionStateRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/WindowsProtectionStateRequestBuilder.php index eb2d2bb954f..a7a675664d7 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/WindowsProtectionStateRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/WindowsProtectionState/WindowsProtectionStateRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\WindowsProtectionState; use Microsoft\Graph\Generated\Users\Item\ManagedDevices\Item\WindowsProtectionState\DetectedMalwareState\DetectedMalwareStateRequestBuilder; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property windowsProtectionState for users * @param WindowsProtectionStateRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?WindowsProtectionStateRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read properties and relationships of the windowsProtectionState object. * @param WindowsProtectionStateRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsprotectionstate-get?view=graph-rest-1.0 Find more info here */ public function get(?WindowsProtectionStateRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsProtectionState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsProtectionState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a windowsProtectionState object. * @param WindowsProtectionState $body The request body * @param WindowsProtectionStateRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-windowsprotectionstate-update?view=graph-rest-1.0 Find more info here */ public function patch(WindowsProtectionState $body, ?WindowsProtectionStateRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [WindowsProtectionState::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [WindowsProtectionState::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?WindowsProtectionStateRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?WindowsProtectionStateRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?WindowsProtectionStateRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(WindowsProtectionState $body, ?Windows $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/Item/Wipe/WipeRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/Item/Wipe/WipeRequestBuilder.php index 0911497319f..da82550e3f1 100644 --- a/src/Generated/Users/Item/ManagedDevices/Item/Wipe/WipeRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/Item/Wipe/WipeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Wipe a device * @param WipePostRequestBody $body The request body * @param WipeRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-manageddevice-wipe?view=graph-rest-1.0 Find more info here */ public function post(WipePostRequestBody $body, ?WipeRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(WipePostRequestBody $body, ?WipeRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ManagedDevices/ManagedDevicesRequestBuilder.php b/src/Generated/Users/Item/ManagedDevices/ManagedDevicesRequestBuilder.php index 2bb054e6c4d..7656168d09a 100644 --- a/src/Generated/Users/Item/ManagedDevices/ManagedDevicesRequestBuilder.php +++ b/src/Generated/Users/Item/ManagedDevices/ManagedDevicesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ManagedDevice; use Microsoft\Graph\Generated\Models\ManagedDeviceCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The managed devices associated with the user. * @param ManagedDevicesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ManagedDevicesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to managedDevices for users * @param ManagedDevice $body The request body * @param ManagedDevicesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ManagedDevice $body, ?ManagedDevicesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ManagedDevice::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ManagedDevicesRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ManagedDevicesRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ManagedDevice $body, ?ManagedDevicesReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Manager/ManagerRequestBuilder.php b/src/Generated/Users/Item/Manager/ManagerRequestBuilder.php index 80bbf41a86f..d3c8621907d 100644 --- a/src/Generated/Users/Item/Manager/ManagerRequestBuilder.php +++ b/src/Generated/Users/Item/Manager/ManagerRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Manager\Ref\RefRequestBuilder; @@ -42,39 +41,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a user's manager. This API is available in the following national cloud deployments. * @param ManagerRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-delete-manager?view=graph-rest-1.0 Find more info here */ public function delete(?ManagerRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns the user or organizational contact assigned as the user's manager. Optionally, you can expand the manager's chain up to the root node. This API is available in the following national cloud deployments. * @param ManagerRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-manager?view=graph-rest-1.0 Find more info here */ public function get(?ManagerRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -91,6 +84,7 @@ public function toDeleteRequestInformation(?ManagerRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -104,7 +98,6 @@ public function toGetRequestInformation(?ManagerRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -112,6 +105,7 @@ public function toGetRequestInformation(?ManagerRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Manager/Ref/RefRequestBuilder.php b/src/Generated/Users/Item/Manager/Ref/RefRequestBuilder.php index 1f58021f511..2bd4500fe94 100644 --- a/src/Generated/Users/Item/Manager/Ref/RefRequestBuilder.php +++ b/src/Generated/Users/Item/Manager/Ref/RefRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ReferenceUpdate; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,52 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Remove a user's manager. This API is available in the following national cloud deployments. * @param RefRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-delete-manager?view=graph-rest-1.0 Find more info here */ public function delete(?RefRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Returns the user or organizational contact assigned as the user's manager. Optionally, you can expand the manager's chain up to the root node. This API is available in the following national cloud deployments. * @param RefRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-manager?view=graph-rest-1.0 Find more info here */ public function get(?RefRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'string', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'string', $errorMappings); + return $result; } /** * Assign a user's manager. This API is available in the following national cloud deployments. * @param ReferenceUpdate $body The request body * @param RefRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-post-manager?view=graph-rest-1.0 Find more info here */ public function put(ReferenceUpdate $body, ?RefRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -103,6 +95,7 @@ public function toDeleteRequestInformation(?RefRequestBuilderDeleteRequestConfig $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,11 +109,11 @@ public function toGetRequestInformation(?RefRequestBuilderGetRequestConfiguratio $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -139,6 +132,7 @@ public function toPutRequestInformation(ReferenceUpdate $body, ?RefRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/MemberOf/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MemberOf/Count/CountRequestBuilder.php index 3bc75fc2be5..34d6fa8a539 100644 --- a/src/Generated/Users/Item/MemberOf/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MemberOf/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php index 69474bca500..3a920b91b91 100644 --- a/src/Generated/Users/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Users/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index 3c835410338..9aa092b29dc 100644 --- a/src/Generated/Users/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Users/Item/MemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnitCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\MemberOf\GraphAdministrativeUnit\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.administrativeUnit in the microsoft.graph.directoryObject collection * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php index 3add0b58de1..67bd238e7bd 100644 --- a/src/Generated/Users/Item/MemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php b/src/Generated/Users/Item/MemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php index 0ced25dedc2..2fb7127a7d3 100644 --- a/src/Generated/Users/Item/MemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php +++ b/src/Generated/Users/Item/MemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryRoleCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\MemberOf\GraphDirectoryRole\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.directoryRole in the microsoft.graph.directoryObject collection * @param GraphDirectoryRoleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDirectoryRoleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Users/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php index 7a6d1a81945..16fae912521 100644 --- a/src/Generated/Users/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/MemberOf/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Users/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php index b1f988934bf..e0364fea7a9 100644 --- a/src/Generated/Users/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Users/Item/MemberOf/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\MemberOf\GraphGroup\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Users/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php index bb99b62263d..c56d2e9a1a2 100644 --- a/src/Generated/Users/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Users/Item/MemberOf/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\MemberOf\Item\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The groups and directory roles that the user is a member of. Read-only. Nullable. Supports $expand. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Users/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index dbe18782e05..c0d1c31f3c8 100644 --- a/src/Generated/Users/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Users/Item/MemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnit; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.administrativeUnit * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php b/src/Generated/Users/Item/MemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php index 935cfe7eebc..a0c05b43374 100644 --- a/src/Generated/Users/Item/MemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php +++ b/src/Generated/Users/Item/MemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.directoryRole * @param GraphDirectoryRoleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDirectoryRoleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Users/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php index a43aa6b3bcd..b8194dd641c 100644 --- a/src/Generated/Users/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Users/Item/MemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/MemberOf/MemberOfRequestBuilder.php b/src/Generated/Users/Item/MemberOf/MemberOfRequestBuilder.php index fda7dbf1d0d..f08e9b99a5c 100644 --- a/src/Generated/Users/Item/MemberOf/MemberOfRequestBuilder.php +++ b/src/Generated/Users/Item/MemberOf/MemberOfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\MemberOf\Count\CountRequestBuilder; @@ -78,20 +77,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The groups and directory roles that the user is a member of. Read-only. Nullable. Supports $expand. * @param MemberOfRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-memberof?view=graph-rest-1.0 Find more info here */ public function get(?MemberOfRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -104,7 +100,6 @@ public function toGetRequestInformation(?MemberOfRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -112,6 +107,7 @@ public function toGetRequestInformation(?MemberOfRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Messages/Count/CountRequestBuilder.php index cd83d026955..12cc78d8dce 100644 --- a/src/Generated/Users/Item/Messages/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Messages/Delta/DeltaRequestBuilder.php index 649e7d349c1..93c2f5ecdbf 100644 --- a/src/Generated/Users/Item/Messages/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a set of messages that have been added, deleted, or updated in a specified folder. A delta function call for messages in a folder is similar to a GET request, except that by appropriatelyapplying state tokens in one or more of these calls, you can [query for incremental changes in the messages inthat folder](/graph/delta-query-messages). This allows you to maintain and synchronize a local store of a user's messages withouthaving to fetch the entire set of messages from the server every time. This API is available in the following national cloud deployments. * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-delta?view=graph-rest-1.0 Find more info here */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/Attachments/AttachmentsRequestBuilder.php index e6ddb4a23a3..ebcff7b8796 100644 --- a/src/Generated/Users/Item/Messages/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\AttachmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -61,46 +60,40 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Retrieve a list of attachment objects. This API is available in the following national cloud deployments. + * Retrieve a list of attachment objects attached to a message. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/eventmessage-list-attachments?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/message-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Use this API to add an attachment to a message. An attachment can be one of the following types: All these types of attachment resources are derived from the attachmentresource. You can add an attachment to an existing message by posting to its attachments collection, or you canadd an attachment to a message that is being created and sent on the fly. This operation limits the size of the attachment you can add to under 3 MB. This API is available in the following national cloud deployments. * @param Attachment $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(Attachment $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Retrieve a list of attachment objects. This API is available in the following national cloud deployments. + * Retrieve a list of attachment objects attached to a message. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(Attachment $body, ?AttachmentsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/Attachments/AttachmentsRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/Messages/Item/Attachments/AttachmentsRequestBuilderGetQueryParameters.php index 5a32e8acbfa..cbd59783ccb 100644 --- a/src/Generated/Users/Item/Messages/Item/Attachments/AttachmentsRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/Messages/Item/Attachments/AttachmentsRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Retrieve a list of attachment objects. This API is available in the following national cloud deployments. + * Retrieve a list of attachment objects attached to a message. This API is available in the following national cloud deployments. */ class AttachmentsRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/Messages/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/Attachments/Count/CountRequestBuilder.php index b81ac5fa550..cfd37f82311 100644 --- a/src/Generated/Users/Item/Messages/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 608643014b3..a9106e54603 100644 --- a/src/Generated/Users/Item/Messages/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/Attachments/Item/AttachmentItemRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/Attachments/Item/AttachmentItemRequestBuilder.php index f69be667d28..65ec3c3410a 100644 --- a/src/Generated/Users/Item/Messages/Item/Attachments/Item/AttachmentItemRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/Attachments/Item/AttachmentItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Attachment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,38 +33,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attachments for users * @param AttachmentItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttachmentItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties, relationships, or raw contents of an attachment that is attached to a user event, message, or group post. An attachment can be one of the following types: All these types of attachments are derived from the attachment resource. This API is available in the following national cloud deployments. * @param AttachmentItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attachment-get?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Attachment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -82,6 +75,7 @@ public function toDeleteRequestInformation(?AttachmentItemRequestBuilderDeleteRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -95,7 +89,6 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -103,6 +96,7 @@ public function toGetRequestInformation(?AttachmentItemRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/Copy/CopyRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/Copy/CopyRequestBuilder.php index 434f0257911..1b86a594350 100644 --- a/src/Generated/Users/Item/Messages/Item/Copy/CopyRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/Copy/CopyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a message to a folder within the user's mailbox. This API is available in the following national cloud deployments. * @param CopyPostRequestBody $body The request body * @param CopyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-copy?view=graph-rest-1.0 Find more info here */ public function post(CopyPostRequestBody $body, ?CopyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyPostRequestBody $body, ?CopyRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/CreateForward/CreateForwardRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/CreateForward/CreateForwardRequestBuilder.php index bee849b731d..51a9d2cc99f 100644 --- a/src/Generated/Users/Item/Messages/Item/CreateForward/CreateForwardRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/CreateForward/CreateForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a draft to forward an existing message, in either JSON or MIME format. When using JSON format, you can:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- Specify either the toRecipients parameter or the toRecipients property of the message parameter. Specifying both or specifying neither will return an HTTP 400 Bad Request error.- Update the draft later to add content to the body or change other message properties. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. Send the draft message in a subsequent operation. Alternatively, forward a message in a single operation. This API is available in the following national cloud deployments. * @param CreateForwardPostRequestBody $body The request body * @param CreateForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-createforward?view=graph-rest-1.0 Find more info here */ public function post(CreateForwardPostRequestBody $body, ?CreateForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateForwardPostRequestBody $body, ?Cr $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/CreateReply/CreateReplyRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/CreateReply/CreateReplyRequestBuilder.php index acaa76cbaab..93ae4b8a7e3 100644 --- a/src/Generated/Users/Item/Messages/Item/CreateReply/CreateReplyRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/CreateReply/CreateReplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a draft to reply to the sender of a message in either JSON or MIME format. When using JSON format:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- If replyTo is specified in the original message, per Internet Message Format (RFC 2822), you should send the reply to the recipients in replyTo, and not the recipients in from.- You can update the draft later to add reply content to the body or change other message properties. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. Send the draft message in a subsequent operation. Alternatively, reply to a message in a single operation. This API is available in the following national cloud deployments. * @param CreateReplyPostRequestBody $body The request body * @param CreateReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-createreply?view=graph-rest-1.0 Find more info here */ public function post(CreateReplyPostRequestBody $body, ?CreateReplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateReplyPostRequestBody $body, ?Crea $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/CreateReplyAll/CreateReplyAllRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/CreateReplyAll/CreateReplyAllRequestBuilder.php index d058269db7a..4b2f390c200 100644 --- a/src/Generated/Users/Item/Messages/Item/CreateReplyAll/CreateReplyAllRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/CreateReplyAll/CreateReplyAllRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create a draft to reply to the sender and all recipients of a message in either JSON or MIME format. When using JSON format:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- If the original message specifies a recipient in the replyTo property, per Internet Message Format (RFC 2822), you should send the reply to the recipients in the replyTo and toRecipients properties, and not the recipients in the from and toRecipients properties.- You can update the draft later to add reply content to the body or change other message properties. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. Send the draft message in a subsequent operation. Alternatively, reply-all to a message in a single action. This API is available in the following national cloud deployments. * @param CreateReplyAllPostRequestBody $body The request body * @param CreateReplyAllRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-createreplyall?view=graph-rest-1.0 Find more info here */ public function post(CreateReplyAllPostRequestBody $body, ?CreateReplyAllRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateReplyAllPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/Extensions/Count/CountRequestBuilder.php index 4afe0b4c55b..d06478bcf05 100644 --- a/src/Generated/Users/Item/Messages/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/Extensions/ExtensionsRequestBuilder.php index 01b0b462a7a..966724e579d 100644 --- a/src/Generated/Users/Item/Messages/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/Extensions/Item/ExtensionItemRequestBuilder.php index e251107c2fc..6506cfcac1f 100644 --- a/src/Generated/Users/Item/Messages/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an open extension (openTypeExtension object) from the specified instance of a resource. For the list of resources that support open extensions, see the table in the Permissions section. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get an open extension (openTypeExtension object) identified by name or fully qualified name. The table in the Permissions section lists the resources that support open extensions. The following table lists the three scenarios where you can get an open extension from a supported resource instance. This API is available in the following national cloud deployments. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/Forward/ForwardRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/Forward/ForwardRequestBuilder.php index 6397419ac55..f3e78ab9f4d 100644 --- a/src/Generated/Users/Item/Messages/Item/Forward/ForwardRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/Forward/ForwardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Forward a message using either JSON or MIME format. When using JSON format, you can:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- Specify either the toRecipients parameter or the toRecipients property of the message parameter. Specifying both or specifying neither will return an HTTP 400 Bad Request error. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. This method saves the message in the Sent Items folder. Alternatively, create a draft to forward a message, and send it later. This API is available in the following national cloud deployments. * @param ForwardPostRequestBody $body The request body * @param ForwardRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-forward?view=graph-rest-1.0 Find more info here */ public function post(ForwardPostRequestBody $body, ?ForwardRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ForwardPostRequestBody $body, ?ForwardR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/MessageItemRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/MessageItemRequestBuilder.php index 139dae7af02..7f1f60a0472 100644 --- a/src/Generated/Users/Item/Messages/Item/MessageItemRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/MessageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Messages\Item\Attachments\AttachmentsRequestBuilder; @@ -128,65 +127,56 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Delete eventMessage. This API is available in the following national cloud deployments. + * Delete a message in the specified user's mailbox, or delete a relationship of the message. This API is available in the following national cloud deployments. * @param MessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/eventmessage-delete?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/message-delete?view=graph-rest-1.0 Find more info here */ public function delete(?MessageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The messages in a mailbox or folder. Read-only. Nullable. * @param MessageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/eventmessage-get?view=graph-rest-1.0 Find more info here */ public function get(?MessageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update the properties of an eventMessage object. This API is available in the following national cloud deployments. + * Update the properties of a message object. This API is available in the following national cloud deployments. * @param Message $body The request body * @param MessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/eventmessage-update?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/message-update?view=graph-rest-1.0 Find more info here */ public function patch(Message $body, ?MessageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Delete eventMessage. This API is available in the following national cloud deployments. + * Delete a message in the specified user's mailbox, or delete a relationship of the message. This API is available in the following national cloud deployments. * @param MessageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -199,6 +189,7 @@ public function toDeleteRequestInformation(?MessageItemRequestBuilderDeleteReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -212,7 +203,6 @@ public function toGetRequestInformation(?MessageItemRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -220,11 +210,12 @@ public function toGetRequestInformation(?MessageItemRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the properties of an eventMessage object. This API is available in the following national cloud deployments. + * Update the properties of a message object. This API is available in the following national cloud deployments. * @param Message $body The request body * @param MessageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -234,11 +225,11 @@ public function toPatchRequestInformation(Message $body, ?MessageItemRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/Move/MoveRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/Move/MoveRequestBuilder.php index ebeaf521369..09740f85356 100644 --- a/src/Generated/Users/Item/Messages/Item/Move/MoveRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/Move/MoveRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Move a message to another folder within the specified user's mailbox. This creates a new copy of the message in the destination folder and removes the original message. This API is available in the following national cloud deployments. * @param MovePostRequestBody $body The request body * @param MoveRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-move?view=graph-rest-1.0 Find more info here */ public function post(MovePostRequestBody $body, ?MoveRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(MovePostRequestBody $body, ?MoveRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/Reply/ReplyRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/Reply/ReplyRequestBuilder.php index ba0f3b218d6..9520a9a76bb 100644 --- a/src/Generated/Users/Item/Messages/Item/Reply/ReplyRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/Reply/ReplyRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Reply to the sender of a message using either JSON or MIME format. When using JSON format:* Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.* If the original message specifies a recipient in the replyTo property, per Internet Message Format (RFC 2822), send the reply to the recipients in replyTo and not the recipient in the from property. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. This method saves the message in the Sent Items folder. Alternatively, create a draft to reply to an existing message and send it later. This API is available in the following national cloud deployments. * @param ReplyPostRequestBody $body The request body * @param ReplyRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-reply?view=graph-rest-1.0 Find more info here */ public function post(ReplyPostRequestBody $body, ?ReplyRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ReplyPostRequestBody $body, ?ReplyReque $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/ReplyAll/ReplyAllRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/ReplyAll/ReplyAllRequestBuilder.php index 08883a46eb0..62395b2bc40 100644 --- a/src/Generated/Users/Item/Messages/Item/ReplyAll/ReplyAllRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/ReplyAll/ReplyAllRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Reply to all recipients of a message using either JSON or MIME format. When using JSON format:- Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.- If the original message specifies a recipient in the replyTo property, per Internet Message Format (RFC 2822), send the reply to the recipients in replyTo and not the recipient in the from property. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- Add any attachments and S/MIME properties to the MIME content. This method saves the message in the Sent Items folder. Alternatively, create a draft to reply-all to a message and send it later. This API is available in the following national cloud deployments. * @param ReplyAllPostRequestBody $body The request body * @param ReplyAllRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-replyall?view=graph-rest-1.0 Find more info here */ public function post(ReplyAllPostRequestBody $body, ?ReplyAllRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ReplyAllPostRequestBody $body, ?ReplyAl $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/Send/SendRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/Send/SendRequestBuilder.php index 0ca9255f555..2715bbf5d3a 100644 --- a/src/Generated/Users/Item/Messages/Item/Send/SendRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/Send/SendRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Send an existing draft message. The draft message can be a new message draft, reply draft, reply-all draft, or a forward draft. This method saves the message in the Sent Items folder. Alternatively, send a new message in a single operation. This API is available in the following national cloud deployments. * @param SendRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/message-send?view=graph-rest-1.0 Find more info here */ public function post(?SendRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?SendRequestBuilderPostRequestConfigura $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/Item/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/Messages/Item/Value/ContentRequestBuilder.php index 37c05c7a8d9..b358c78ce9f 100644 --- a/src/Generated/Users/Item/Messages/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property messages from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/user-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property messages in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Messages/MessagesRequestBuilder.php b/src/Generated/Users/Item/Messages/MessagesRequestBuilder.php index e7c204d99c5..d72196325e0 100644 --- a/src/Generated/Users/Item/Messages/MessagesRequestBuilder.php +++ b/src/Generated/Users/Item/Messages/MessagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Message; use Microsoft\Graph\Generated\Models\MessageCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The messages in a mailbox or folder. Read-only. Nullable. * @param MessagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/opentypeextension-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/user-list-messages?view=graph-rest-1.0 Find more info here */ public function get(?MessagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MessageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. + * Create a draft of a new message in either JSON or MIME format. When using JSON format, you can:- Include an attachment to the message.- Update the draft later to add content to the body or change other message properties. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- /* Add any attachments and S/MIME properties to the MIME content. By default, this operation saves the draft in the Drafts folder. Send the draft message in a subsequent operation. Alternatively, send a new message in a single operation, or create a draft to forward, reply and reply-all to an existing message. This API is available in the following national cloud deployments. * @param Message $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/opentypeextension-post-opentypeextension?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/user-post-messages?view=graph-rest-1.0 Find more info here */ public function post(Message $body, ?MessagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Message::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,11 +109,12 @@ public function toGetRequestInformation(?MessagesRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create an open extension (openTypeExtension object) and add custom properties in a new or existing instance of a resource. You can create an open extension in a resource instance and store custom data to it all in the same operation, except for specific resources. The table in the Permissions section lists the resources that support open extensions. This API is available in the following national cloud deployments. + * Create a draft of a new message in either JSON or MIME format. When using JSON format, you can:- Include an attachment to the message.- Update the draft later to add content to the body or change other message properties. When using MIME format:- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.- /* Add any attachments and S/MIME properties to the MIME content. By default, this operation saves the draft in the Drafts folder. Send the draft message in a subsequent operation. Alternatively, send a new message in a single operation, or create a draft to forward, reply and reply-all to an existing message. This API is available in the following national cloud deployments. * @param Message $body The request body * @param MessagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -131,11 +124,11 @@ public function toPostRequestInformation(Message $body, ?MessagesRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Oauth2PermissionGrants/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Oauth2PermissionGrants/Count/CountRequestBuilder.php index c92c4fabcdb..967a695ed47 100644 --- a/src/Generated/Users/Item/Oauth2PermissionGrants/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Oauth2PermissionGrants/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Oauth2PermissionGrants/Item/OAuth2PermissionGrantItemRequestBuilder.php b/src/Generated/Users/Item/Oauth2PermissionGrants/Item/OAuth2PermissionGrantItemRequestBuilder.php index 93e0f0e1bf3..6869ac93b1e 100644 --- a/src/Generated/Users/Item/Oauth2PermissionGrants/Item/OAuth2PermissionGrantItemRequestBuilder.php +++ b/src/Generated/Users/Item/Oauth2PermissionGrants/Item/OAuth2PermissionGrantItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\OAuth2PermissionGrant; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get oauth2PermissionGrants from users * @param OAuth2PermissionGrantItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OAuth2PermissionGrantItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrant::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?OAuth2PermissionGrantItemRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?OAuth2PermissionGrantItemRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Oauth2PermissionGrants/Oauth2PermissionGrantsRequestBuilder.php b/src/Generated/Users/Item/Oauth2PermissionGrants/Oauth2PermissionGrantsRequestBuilder.php index 24dba992e4c..ac6f7f76e85 100644 --- a/src/Generated/Users/Item/Oauth2PermissionGrants/Oauth2PermissionGrantsRequestBuilder.php +++ b/src/Generated/Users/Item/Oauth2PermissionGrants/Oauth2PermissionGrantsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\OAuth2PermissionGrantCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Oauth2PermissionGrants\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of oAuth2PermissionGrant entities, which represent delegated permissions granted to enable a client application to access an API on behalf of the user. This API is available in the following national cloud deployments. * @param Oauth2PermissionGrantsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-oauth2permissiongrants?view=graph-rest-1.0 Find more info here */ public function get(?Oauth2PermissionGrantsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OAuth2PermissionGrantCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?Oauth2PermissionGrantsRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?Oauth2PermissionGrantsRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Count/CountRequestBuilder.php index eecba0e16c1..85af3d6f72f 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php index fc489e60959..d9410eba3e0 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/GetNotebookFromWebUrl/GetNotebookFromWebUrlRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CopyNotebookModel; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Retrieve the properties and relationships of a notebook object by using its URL path. The location can be user notebooks on Microsoft 365, group notebooks, or SharePoint site-hosted team notebooks on Microsoft 365. This API is available in the following national cloud deployments. * @param GetNotebookFromWebUrlPostRequestBody $body The request body * @param GetNotebookFromWebUrlRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-getnotebookfromweburl?view=graph-rest-1.0 Find more info here */ public function post(GetNotebookFromWebUrlPostRequestBody $body, ?GetNotebookFromWebUrlRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CopyNotebookModel::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CopyNotebookModel::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(GetNotebookFromWebUrlPostRequestBody $b $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php index 357e8031a97..5291117d8f4 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/GetRecentNotebooksWithIncludePersonalNotebooks/GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getRecentNotebooks * @param GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetRecentNotebooksWithIncludePersonalNotebooksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetRecentNotebooksWithIncludePersonalNotebooksGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetRecentNotebooksWithIncludePersonalNotebooksGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?GetRecentNotebooksWithIncludePersonalNo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?GetRecentNotebooksWithIncludePersonalNo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php index 7f2cfe054c4..e1f8e3b748c 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/CopyNotebook/CopyNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyNotebookPostRequestBody $body The request body * @param CopyNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-copynotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyNotebookPostRequestBody $body, ?CopyNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyNotebookPostRequestBody $body, ?Cop $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php index 8f7d76ebc05..c5ab46c2258 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/NotebookItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Onenote\Notebooks\Item\CopyNotebook\CopyNotebookRequestBuilder; @@ -58,57 +57,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property notebooks for users * @param NotebookItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?NotebookItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a notebook object. This API is available in the following national cloud deployments. * @param NotebookItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-get?view=graph-rest-1.0 Find more info here */ public function get(?NotebookItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property notebooks in users * @param Notebook $body The request body * @param NotebookItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Notebook $body, ?NotebookItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -125,6 +115,7 @@ public function toDeleteRequestInformation(?NotebookItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -138,7 +129,6 @@ public function toGetRequestInformation(?NotebookItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -146,6 +136,7 @@ public function toGetRequestInformation(?NotebookItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -160,11 +151,11 @@ public function toPatchRequestInformation(Notebook $body, ?NotebookItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php index f68d87864e6..f16a970ceab 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php index e3609972fe4..6787d8c77f8 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section group. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index 3c9564c9cdf..df93d617fdd 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section group. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php index ef62acda4f3..7ec8757aa3e 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Graph\Generated\Users\Item\Onenote\Notebooks\Item\SectionGroups\Item\ParentNotebook\ParentNotebookRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sectionGroups for users * @param SectionGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SectionGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The section groups in the notebook. Read-only. Nullable. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sectionGroups in users * @param SectionGroup $body The request body * @param SectionGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SectionGroup $body, ?SectionGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?SectionGroupItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(SectionGroup $body, ?SectionGroupItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php index b35482e6fa3..0e31f4e838a 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php index 57d3a72e0f7..22954d29003 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section groups in the section. Read-only. Nullable. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php index b856a60115a..64a3b8e2170 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroupCollectionResponse; use Microsoft\Graph\Generated\Users\Item\Onenote\Notebooks\Item\SectionGroups\Item\SectionGroups\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of section groups from the specified section group. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php index d034d5ab9b0..1af58c72ba9 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index 657d4d454c1..f72e0c6f7b8 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index 92871f30052..f60e79dc71f 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php index b39a73cc74f..6a1c739d1ab 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Users\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for users * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The sections in the section group. Read-only. Nullable. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in users * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php index 401bda570ce..72f40d99b6b 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index 30a69565dfb..40a60d61d0a 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index 5d60e469a8e..f0f8dbbec21 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index 041b8def31f..8c23430839b 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Users\Item\Onenote\Notebooks\Item\SectionGroups\Item\Sections\Item\Pages\Item\Content\ContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for users * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in users * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index fb59458e174..af6336bf6a3 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 839ddee7c7c..35e510d09f7 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index d78937245fe..47cd1af0c20 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index 6d6de61ad0b..af73fbc3941 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php index 1cae56f83b8..016d6b0abec 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Models\OnenotePageCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 5c7a8364d1a..c1dc787c68f 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index 7820b46f13f..349115e89f6 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php index a3b7cd5a9fb..bde732634a7 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/Item/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Models\OnenoteSectionCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects from the specified section group. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new onenoteSection in the specified section group. This API is available in the following national cloud deployments. * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-post-sections?view=graph-rest-1.0 Find more info here */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php index b91f6657c49..80c8a0833dc 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Graph\Generated\Models\SectionGroupCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of section groups from the specified notebook. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new section group in the specified notebook. This API is available in the following national cloud deployments. * @param SectionGroup $body The request body * @param SectionGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-post-sectiongroups?view=graph-rest-1.0 Find more info here */ public function post(SectionGroup $body, ?SectionGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(SectionGroup $body, ?SectionGroupsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php index 657ee49a0be..f39253d224f 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index 039284f9d2b..01e78322444 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index e3abddad217..3240b6ab7dd 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php index 6c422266efe..78218f7be58 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Users\Item\Onenote\Notebooks\Item\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for users * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The sections in the notebook. Read-only. Nullable. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in users * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php index baf848d2a06..d69b161b3f7 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index 4410974f50c..b7fbf35c28c 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index d9674212d63..05151f20e0e 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index f14f73845f0..e0ef9c8935d 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Users\Item\Onenote\Notebooks\Item\Sections\Item\Pages\Item\Content\ContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for users * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in users * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 9d0f9e8c629..2094fb590e0 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 0abdc0655b1..ee49ff9081a 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index 5bf2be421ee..0570c879acf 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index f4b6e4e48f6..d1a93e88129 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php index a6338ad48cc..6a98c22601c 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Models\OnenotePageCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 58c6d9d311b..688a42573fd 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index e9139e81a92..d60623a35cc 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php index 056488ea71f..26975374d4c 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/Item/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Models\OnenoteSectionCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects from the specified notebook. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new onenoteSection in the specified notebook. This API is available in the following national cloud deployments. * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/notebook-post-sections?view=graph-rest-1.0 Find more info here */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Notebooks/NotebooksRequestBuilder.php b/src/Generated/Users/Item/Onenote/Notebooks/NotebooksRequestBuilder.php index d31bc58313e..881d86fdc26 100644 --- a/src/Generated/Users/Item/Onenote/Notebooks/NotebooksRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Notebooks/NotebooksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\NotebookCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -64,20 +63,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of notebook objects. This API is available in the following national cloud deployments. * @param NotebooksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-notebooks?view=graph-rest-1.0 Find more info here */ public function get(?NotebooksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [NotebookCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [NotebookCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,20 +89,17 @@ public function getRecentNotebooksWithIncludePersonalNotebooks(bool $includePers * Create a new OneNote notebook. This API is available in the following national cloud deployments. * @param Notebook $body The request body * @param NotebooksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-post-notebooks?view=graph-rest-1.0 Find more info here */ public function post(Notebook $body, ?NotebooksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,7 +112,6 @@ public function toGetRequestInformation(?NotebooksRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -127,6 +119,7 @@ public function toGetRequestInformation(?NotebooksRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -141,11 +134,11 @@ public function toPostRequestInformation(Notebook $body, ?NotebooksRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/OnenoteRequestBuilder.php b/src/Generated/Users/Item/Onenote/OnenoteRequestBuilder.php index ed14021378e..3be479190a8 100644 --- a/src/Generated/Users/Item/Onenote/OnenoteRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/OnenoteRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Onenote; use Microsoft\Graph\Generated\Users\Item\Onenote\Notebooks\NotebooksRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property onenote for users * @param OnenoteRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get onenote from users * @param OnenoteRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property onenote in users * @param Onenote $body The request body * @param OnenoteRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Onenote $body, ?OnenoteRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Onenote::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenoteRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenoteRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenoteRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(Onenote $body, ?OnenoteRequestBuilderP $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Operations/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/Operations/Count/CountRequestBuilder.php index a4a49094f53..159b40ea782 100644 --- a/src/Generated/Users/Item/Onenote/Operations/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Operations/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php index 6da3e36af85..1b303af0470 100644 --- a/src/Generated/Users/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Operations/Item/OnenoteOperationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,57 +33,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property operations for users * @param OnenoteOperationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteOperationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the status of a long-running OneNote operation. This applies to operations that return the Operation-Location header in the response, such as CopyNotebook, CopyToNotebook, CopyToSectionGroup, and CopyToSection. You can poll the Operation-Location endpoint until the status property returns completed or failed. If the status is completed, the resourceLocation property contains the resource endpoint URI. If the status is failed, the error and @api.diagnostics properties provide error information. This API is available in the following national cloud deployments. * @param OnenoteOperationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenoteoperation-get?view=graph-rest-1.0 Find more info here */ public function get(?OnenoteOperationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property operations in users * @param OnenoteOperation $body The request body * @param OnenoteOperationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteOperation $body, ?OnenoteOperationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,6 +91,7 @@ public function toDeleteRequestInformation(?OnenoteOperationItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -114,7 +105,6 @@ public function toGetRequestInformation(?OnenoteOperationItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -122,6 +112,7 @@ public function toGetRequestInformation(?OnenoteOperationItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -136,11 +127,11 @@ public function toPatchRequestInformation(OnenoteOperation $body, ?OnenoteOperat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Operations/OperationsRequestBuilder.php b/src/Generated/Users/Item/Onenote/Operations/OperationsRequestBuilder.php index 30efaae4638..1424b4a7280 100644 --- a/src/Generated/Users/Item/Onenote/Operations/OperationsRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Operations/OperationsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Graph\Generated\Models\OnenoteOperationCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the status of a long-running OneNote operation. This applies to operations that return the Operation-Location header in the response, such as CopyNotebook, CopyToNotebook, CopyToSectionGroup, and CopyToSection. You can poll the Operation-Location endpoint until the status property returns completed or failed. If the status is completed, the resourceLocation property contains the resource endpoint URI. If the status is failed, the error and @api.diagnostics properties provide error information. This API is available in the following national cloud deployments. * @param OperationsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OperationsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to operations for users * @param OnenoteOperation $body The request body * @param OperationsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenoteOperation $body, ?OperationsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?OperationsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(OnenoteOperation $body, ?OperationsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Pages/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/Pages/Count/CountRequestBuilder.php index 06b57492787..a91e264c368 100644 --- a/src/Generated/Users/Item/Onenote/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Users/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php index bf097d9c92e..02408f0f808 100644 --- a/src/Generated/Users/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Users/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index 9062ce3a69a..57ed1e0654c 100644 --- a/src/Generated/Users/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php index efd9ef8ed8e..a306b6f4c5a 100644 --- a/src/Generated/Users/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Users\Item\Onenote\Pages\Item\Content\ContentRequestBuilder; @@ -82,58 +81,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a OneNote page. This API is available in the following national cloud deployments. * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-delete?view=graph-rest-1.0 Find more info here */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a page object. Getting page information Access a page's metadata by page identifier: Getting page content You can use the page's content endpoint to get the HTML content of a page: The includeIDs=true query option is used to update pages. This API is available in the following national cloud deployments. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-get?view=graph-rest-1.0 Find more info here */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in users * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -150,6 +140,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -163,7 +154,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -171,6 +161,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -185,11 +176,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Users/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 96c1246b51c..52a6431d66a 100644 --- a/src/Generated/Users/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 2ff7e870714..7eb7585a92b 100644 --- a/src/Generated/Users/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Users/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index 3f1062f35b8..5d2f1a8fef6 100644 --- a/src/Generated/Users/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Users/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php index 6ace703d80d..73607a0e5a0 100644 --- a/src/Generated/Users/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Pages/PagesRequestBuilder.php b/src/Generated/Users/Item/Onenote/Pages/PagesRequestBuilder.php index aebdb1e0629..d29db8b2059 100644 --- a/src/Generated/Users/Item/Onenote/Pages/PagesRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Models\OnenotePageCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new OneNote page in the default section of the default notebook. To create a page in a different section in the default notebook, you can use the sectionName query parameter. Example: ../onenote/pages?sectionName=My%20section The POST /onenote/pages operation is used only to create pages in the current user's default notebook. If you're targeting other notebooks, you can create pages in a specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Resources/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/Resources/Count/CountRequestBuilder.php index 5a08d006dfd..a9db50f847c 100644 --- a/src/Generated/Users/Item/Onenote/Resources/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Resources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php b/src/Generated/Users/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php index 7064e945679..420e9a50c67 100644 --- a/src/Generated/Users/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Resources/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteResource; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content stream * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content stream * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php index 9e528e39744..c8e0445c8b6 100644 --- a/src/Generated/Users/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Resources/Item/OnenoteResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteResource; use Microsoft\Graph\Generated\Users\Item\Onenote\Resources\Item\Content\ContentRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property resources for users * @param OnenoteResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The image and other file resources in OneNote pages. Getting a resources collection isn't supported, but you can get the binary content of a specific resource. Read-only. Nullable. * @param OnenoteResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property resources in users * @param OnenoteResource $body The request body * @param OnenoteResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteResource $body, ?OnenoteResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?OnenoteResourceItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?OnenoteResourceItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?OnenoteResourceItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(OnenoteResource $body, ?OnenoteResourc $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Resources/ResourcesRequestBuilder.php b/src/Generated/Users/Item/Onenote/Resources/ResourcesRequestBuilder.php index 4f5796c468b..59782c0ae7f 100644 --- a/src/Generated/Users/Item/Onenote/Resources/ResourcesRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Resources/ResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteResource; use Microsoft\Graph\Generated\Models\OnenoteResourceCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The image and other file resources in OneNote pages. Getting a resources collection isn't supported, but you can get the binary content of a specific resource. Read-only. Nullable. * @param ResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to resources for users * @param OnenoteResource $body The request body * @param ResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenoteResource $body, ?ResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ResourcesRequestBuilderGetRequestConfig } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(OnenoteResource $body, ?ResourcesReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php index ecf6f86a050..ff1eb5968d9 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php index 4b368ffe558..3958e39bb5f 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section group. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index 900d5065da6..c34e8a40c6d 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section group. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php index 297f681932c..1f0df5267bd 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Graph\Generated\Users\Item\Onenote\SectionGroups\Item\ParentNotebook\ParentNotebookRequestBuilder; @@ -66,57 +65,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sectionGroups for users * @param SectionGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SectionGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a sectionGroup object. This API is available in the following national cloud deployments. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-get?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sectionGroups in users * @param SectionGroup $body The request body * @param SectionGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(SectionGroup $body, ?SectionGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,6 +123,7 @@ public function toDeleteRequestInformation(?SectionGroupItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -146,7 +137,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -154,6 +144,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -168,11 +159,11 @@ public function toPatchRequestInformation(SectionGroup $body, ?SectionGroupItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php index 64b0aef987a..e5e89a72b49 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroups/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php index a089fe9ba8c..5528ca1d847 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroups/Item/SectionGroupItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section groups in the section. Read-only. Nullable. * @param SectionGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SectionGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SectionGroupItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php index a1935930ffa..d04b2fe1677 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroupCollectionResponse; use Microsoft\Graph\Generated\Users\Item\Onenote\SectionGroups\Item\SectionGroups\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of section groups from the specified section group. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php index ec1845065fd..d803b2d6df7 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index 1b44a7582e4..e295d68a88c 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index f63c4812cd5..9cdb47f9960 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php index 03a54587f19..97b33554def 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Users\Item\Onenote\SectionGroups\Item\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; @@ -74,56 +73,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for users * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The sections in the section group. Read-only. Nullable. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in users * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -140,6 +130,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -153,7 +144,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -161,6 +151,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -175,11 +166,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php index a2e48ede5aa..cba63b7a807 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index 91cc8eea43f..7fd60f8f660 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index d38469c4d97..3d226558af8 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index 78047214d33..5811ddb1006 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Users\Item\Onenote\SectionGroups\Item\Sections\Item\Pages\Item\Content\ContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for users * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in users * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 314853c2a92..d6f21d4ced2 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index e63f55b7aa7..53b47dffc89 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index 357abbc9f8d..633ea029596 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index 2c83ba75dbd..7ff1619cd85 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php index 92ad9f130c1..c15a58e7989 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Models\OnenotePageCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index ef2d7d24fc1..7eea2b05b57 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index 3f137e1b833..5270a714703 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php index aa5e14b69a4..9dd2cc8b090 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/Item/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Models\OnenoteSectionCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects from the specified section group. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new onenoteSection in the specified section group. This API is available in the following national cloud deployments. * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/sectiongroup-post-sections?view=graph-rest-1.0 Find more info here */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php b/src/Generated/Users/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php index aec68875485..74e17bc570c 100644 --- a/src/Generated/Users/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/SectionGroups/SectionGroupsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Graph\Generated\Models\SectionGroupCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of sectionGroup objects. This API is available in the following national cloud deployments. * @param SectionGroupsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-sectiongroups?view=graph-rest-1.0 Find more info here */ public function get(?SectionGroupsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sectionGroups for users * @param SectionGroup $body The request body * @param SectionGroupsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(SectionGroup $body, ?SectionGroupsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SectionGroupsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(SectionGroup $body, ?SectionGroupsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Count/CountRequestBuilder.php index 9be09214a7a..56a638d0c7a 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php index b7c8644e56d..0ddabe0786d 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/CopyToNotebook/CopyToNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToNotebookPostRequestBody $body The request body * @param CopyToNotebookRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytonotebook?view=graph-rest-1.0 Find more info here */ public function post(CopyToNotebookPostRequestBody $body, ?CopyToNotebookRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToNotebookPostRequestBody $body, ?C $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php index f737c93a42f..463da19dfdd 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/CopyToSectionGroup/CopyToSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionGroupPostRequestBody $body The request body * @param CopyToSectionGroupRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-copytosectiongroup?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionGroupPostRequestBody $body, ?CopyToSectionGroupRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionGroupPostRequestBody $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php index f54e44c1c0c..7f44a957041 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/OnenoteSectionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Users\Item\Onenote\Sections\Item\CopyToNotebook\CopyToNotebookRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property sections for users * @param OnenoteSectionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenoteSectionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a onenoteSection object. This API is available in the following national cloud deployments. * @param OnenoteSectionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-get?view=graph-rest-1.0 Find more info here */ public function get(?OnenoteSectionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property sections in users * @param OnenoteSection $body The request body * @param OnenoteSectionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenoteSection $body, ?OnenoteSectionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?OnenoteSectionItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?OnenoteSectionItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(OnenoteSection $body, ?OnenoteSectionI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php index 60cd5a08c59..7f9c7c27596 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php index 59f31659219..e0bf6b4a446 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The page's HTML content. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The page's HTML content. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php index 1c05786ed08..fe3cb4067ac 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/CopyToSection/CopyToSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteOperation; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Copy a page to a specific section. For copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. This API is available in the following national cloud deployments. * @param CopyToSectionPostRequestBody $body The request body * @param CopyToSectionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 Find more info here */ public function post(CopyToSectionPostRequestBody $body, ?CopyToSectionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteOperation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CopyToSectionPostRequestBody $body, ?Co $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php index 7fef84b0689..a4ae5967d9b 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/OnenotePageItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Users\Item\Onenote\Sections\Item\Pages\Item\Content\ContentRequestBuilder; @@ -82,56 +81,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property pages for users * @param OnenotePageItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?OnenotePageItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of pages in the section. Read-only. Nullable. * @param OnenotePageItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OnenotePageItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property pages in users * @param OnenotePage $body The request body * @param OnenotePageItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(OnenotePage $body, ?OnenotePageItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -148,6 +138,7 @@ public function toDeleteRequestInformation(?OnenotePageItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -161,7 +152,6 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -169,6 +159,7 @@ public function toGetRequestInformation(?OnenotePageItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -183,11 +174,11 @@ public function toPatchRequestInformation(OnenotePage $body, ?OnenotePageItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php index 3316308819b..9ee999f5b59 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/OnenotePatchContent/OnenotePatchContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Invoke action onenotePatchContent * @param OnenotePatchContentPostRequestBody $body The request body * @param OnenotePatchContentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenotePatchContentPostRequestBody $body, ?OnenotePatchContentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -64,6 +60,7 @@ public function toPostRequestInformation(OnenotePatchContentPostRequestBody $bod $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php index bd5f44de877..64414b40461 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the page. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php index 731a3c49020..eabdc749101 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/ParentSection/ParentSectionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section that contains the page. Read-only. * @param ParentSectionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php index 73a542e1ad1..74e743bb17c 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/Item/Preview/PreviewRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePagePreview; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function preview * @param PreviewRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PreviewRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePagePreview::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toGetRequestInformation(?PreviewRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php index 63dc753cc19..88708a82732 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/Pages/PagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenotePage; use Microsoft\Graph\Generated\Models\OnenotePageCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of page objects from the specified section. This API is available in the following national cloud deployments. * @param PagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-list-pages?view=graph-rest-1.0 Find more info here */ public function get(?PagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePageCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new page in the specified section. This API is available in the following national cloud deployments. * @param OnenotePage $body The request body * @param PagesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/section-post-pages?view=graph-rest-1.0 Find more info here */ public function post(OnenotePage $body, ?PagesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenotePage::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?PagesRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OnenotePage $body, ?PagesRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php index b0117aae2e2..41492e6158a 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/ParentNotebook/ParentNotebookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Notebook; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The notebook that contains the section. Read-only. * @param ParentNotebookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentNotebookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Notebook::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentNotebookRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php index a3ee0f69bdf..8c5fffb611e 100644 --- a/src/Generated/Users/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/Item/ParentSectionGroup/ParentSectionGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\SectionGroup; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The section group that contains the section. Read-only. * @param ParentSectionGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ParentSectionGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SectionGroup::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?ParentSectionGroupRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Onenote/Sections/SectionsRequestBuilder.php b/src/Generated/Users/Item/Onenote/Sections/SectionsRequestBuilder.php index ba11ff6fb55..b76a8988e80 100644 --- a/src/Generated/Users/Item/Onenote/Sections/SectionsRequestBuilder.php +++ b/src/Generated/Users/Item/Onenote/Sections/SectionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnenoteSection; use Microsoft\Graph\Generated\Models\OnenoteSectionCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of onenoteSection objects. This API is available in the following national cloud deployments. * @param SectionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onenote-list-sections?view=graph-rest-1.0 Find more info here */ public function get(?SectionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSectionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to sections for users * @param OnenoteSection $body The request body * @param SectionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(OnenoteSection $body, ?SectionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnenoteSection::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?SectionsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(OnenoteSection $body, ?SectionsRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Count/CountRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Count/CountRequestBuilder.php index fdbbd709fd6..6acacf828b6 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/CreateOrGet/CreateOrGetRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/CreateOrGet/CreateOrGetRequestBuilder.php index c24da5188d6..031718a44e1 100644 --- a/src/Generated/Users/Item/OnlineMeetings/CreateOrGet/CreateOrGetRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/CreateOrGet/CreateOrGetRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnlineMeeting; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an onlineMeeting object with a custom specified external ID. If the external ID already exists, this API will return the onlineMeeting object with that external ID. This API is available in the following national cloud deployments. * @param CreateOrGetPostRequestBody $body The request body * @param CreateOrGetRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-createorget?view=graph-rest-1.0 Find more info here */ public function post(CreateOrGetPostRequestBody $body, ?CreateOrGetRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateOrGetPostRequestBody $body, ?Crea $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/AttendanceReportsRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/AttendanceReportsRequestBuilder.php index 61278fd1e26..7eed25aecdc 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/AttendanceReportsRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/AttendanceReportsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MeetingAttendanceReport; use Microsoft\Graph\Generated\Models\MeetingAttendanceReportCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of meetingAttendanceReport objects for an onlineMeeting. Each time an online meeting ends, an attendance report is generated for that session. This API is available in the following national cloud deployments. * @param AttendanceReportsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/meetingattendancereport-list?view=graph-rest-1.0 Find more info here */ public function get(?AttendanceReportsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReportCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReportCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to attendanceReports for users * @param MeetingAttendanceReport $body The request body * @param AttendanceReportsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(MeetingAttendanceReport $body, ?AttendanceReportsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReport::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReport::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?AttendanceReportsRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?AttendanceReportsRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(MeetingAttendanceReport $body, ?Attenda $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Count/CountRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Count/CountRequestBuilder.php index 89d2b37ac63..eb32b0eaa84 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/AttendanceRecordsRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/AttendanceRecordsRequestBuilder.php index 56a635419ef..d85198e070c 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/AttendanceRecordsRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/AttendanceRecordsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AttendanceRecord; use Microsoft\Graph\Generated\Models\AttendanceRecordCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of attendanceRecord objects and their properties. This API is available in the following national cloud deployments. * @param AttendanceRecordsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/attendancerecord-list?view=graph-rest-1.0 Find more info here */ public function get(?AttendanceRecordsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecordCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to attendanceRecords for users * @param AttendanceRecord $body The request body * @param AttendanceRecordsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AttendanceRecord $body, ?AttendanceRecordsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?AttendanceRecordsRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?AttendanceRecordsRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AttendanceRecord $body, ?AttendanceReco $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Count/CountRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Count/CountRequestBuilder.php index 5ff510b9be8..e2562a337a1 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Item/AttendanceRecordItemRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Item/AttendanceRecordItemRequestBuilder.php index b6d42295243..bbce3b9981d 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Item/AttendanceRecordItemRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/AttendanceRecords/Item/AttendanceRecordItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AttendanceRecord; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attendanceRecords for users * @param AttendanceRecordItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttendanceRecordItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * List of attendance records of an attendance report. Read-only. * @param AttendanceRecordItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttendanceRecordItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property attendanceRecords in users * @param AttendanceRecord $body The request body * @param AttendanceRecordItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AttendanceRecord $body, ?AttendanceRecordItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecord::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttendanceRecord::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?AttendanceRecordItemRequestBuilderDe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?AttendanceRecordItemRequestBuilderGetRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?AttendanceRecordItemRequestBuilderGetRe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(AttendanceRecord $body, ?AttendanceRec $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/MeetingAttendanceReportItemRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/MeetingAttendanceReportItemRequestBuilder.php index 81c19075eee..142ac17921a 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/MeetingAttendanceReportItemRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/AttendanceReports/Item/MeetingAttendanceReportItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\MeetingAttendanceReport; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\OnlineMeetings\Item\AttendanceReports\Item\AttendanceRecords\AttendanceRecordsRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attendanceReports for users * @param MeetingAttendanceReportItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?MeetingAttendanceReportItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the meetingAttendanceReport for an onlineMeeting. Each time an online meeting ends, an attendance report will be generated for that session. This API is available in the following national cloud deployments. * @param MeetingAttendanceReportItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/meetingattendancereport-get?view=graph-rest-1.0 Find more info here */ public function get(?MeetingAttendanceReportItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReport::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReport::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property attendanceReports in users * @param MeetingAttendanceReport $body The request body * @param MeetingAttendanceReportItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(MeetingAttendanceReport $body, ?MeetingAttendanceReportItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReport::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [MeetingAttendanceReport::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,6 +99,7 @@ public function toDeleteRequestInformation(?MeetingAttendanceReportItemRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -122,7 +113,6 @@ public function toGetRequestInformation(?MeetingAttendanceReportItemRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?MeetingAttendanceReportItemRequestBuild } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(MeetingAttendanceReport $body, ?Meetin $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/AttendeeReport/AttendeeReportRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/AttendeeReport/AttendeeReportRequestBuilder.php index 1534d5ce7da..5444013aa96 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/AttendeeReport/AttendeeReportRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/AttendeeReport/AttendeeReportRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get attendeeReport for the navigation property onlineMeetings from users * @param AttendeeReportRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-get?view=graph-rest-1.0 Find more info here */ public function get(?AttendeeReportRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update attendeeReport for the navigation property onlineMeetings in users * @param StreamInterface $body Binary request body * @param AttendeeReportRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?AttendeeReportRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?AttendeeReportRequestBuilderGetRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?AttendeeReportRe $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/GetVirtualAppointmentJoinWebUrl/GetVirtualAppointmentJoinWebUrlRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/GetVirtualAppointmentJoinWebUrl/GetVirtualAppointmentJoinWebUrlRequestBuilder.php index 526518becc7..1785ed03503 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/GetVirtualAppointmentJoinWebUrl/GetVirtualAppointmentJoinWebUrlRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/GetVirtualAppointmentJoinWebUrl/GetVirtualAppointmentJoinWebUrlRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function getVirtualAppointmentJoinWebUrl * @param GetVirtualAppointmentJoinWebUrlRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GetVirtualAppointmentJoinWebUrlRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GetVirtualAppointmentJoinWebUrlGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GetVirtualAppointmentJoinWebUrlGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,11 +54,11 @@ public function toGetRequestInformation(?GetVirtualAppointmentJoinWebUrlRequestB $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/OnlineMeetingItemRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/OnlineMeetingItemRequestBuilder.php index fdee162aec3..ee901fea32c 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/OnlineMeetingItemRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/OnlineMeetingItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnlineMeeting; use Microsoft\Graph\Generated\Users\Item\OnlineMeetings\Item\AttendanceReports\AttendanceReportsRequestBuilder; @@ -66,59 +65,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete an onlineMeeting object. This API is available in the following national cloud deployments. * @param OnlineMeetingItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-delete?view=graph-rest-1.0 Find more info here */ public function delete(?OnlineMeetingItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of an onlineMeeting object. For example, you can: Teams live event attendee report (deprecated) is an online meeting artifact. For details, see Online meeting artifacts and permissions. This API is available in the following national cloud deployments. * @param OnlineMeetingItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-get?view=graph-rest-1.0 Find more info here */ public function get(?OnlineMeetingItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the specified onlineMeeting object. Please see Request body section for the list of properties that support updating. This API is available in the following national cloud deployments. * @param OnlineMeeting $body The request body * @param OnlineMeetingItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-update?view=graph-rest-1.0 Find more info here */ public function patch(OnlineMeeting $body, ?OnlineMeetingItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -135,6 +125,7 @@ public function toDeleteRequestInformation(?OnlineMeetingItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -148,7 +139,6 @@ public function toGetRequestInformation(?OnlineMeetingItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -156,6 +146,7 @@ public function toGetRequestInformation(?OnlineMeetingItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -170,11 +161,11 @@ public function toPatchRequestInformation(OnlineMeeting $body, ?OnlineMeetingIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Count/CountRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Count/CountRequestBuilder.php index 0f8a0683c75..b97a2c06fa0 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Item/CallTranscriptItemRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Item/CallTranscriptItemRequestBuilder.php index 69045ee2207..3be1d7c38e5 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Item/CallTranscriptItemRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Item/CallTranscriptItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CallTranscript; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\OnlineMeetings\Item\Transcripts\Item\Content\ContentRequestBuilder; @@ -50,57 +49,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property transcripts for users * @param CallTranscriptItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?CallTranscriptItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve a callTranscript object associated with a scheduled onlineMeeting. This API doesn't support getting call transcripts from channel meetings. Retrieving the transcript returns the metadata of the single transcript associated with the online meeting. Retrieving the content of the transcript returns the stream of text associated with the transcript. This API is available in the following national cloud deployments. * @param CallTranscriptItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/calltranscript-get?view=graph-rest-1.0 Find more info here */ public function get(?CallTranscriptItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property transcripts in users * @param CallTranscript $body The request body * @param CallTranscriptItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(CallTranscript $body, ?CallTranscriptItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -117,6 +107,7 @@ public function toDeleteRequestInformation(?CallTranscriptItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -130,7 +121,6 @@ public function toGetRequestInformation(?CallTranscriptItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -138,6 +128,7 @@ public function toGetRequestInformation(?CallTranscriptItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -152,11 +143,11 @@ public function toPatchRequestInformation(CallTranscript $body, ?CallTranscriptI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Item/Content/ContentRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Item/Content/ContentRequestBuilder.php index f5fd5051bed..863d595fbdf 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CallTranscript; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,39 +34,35 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content of the transcript. Read-only. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-list-transcripts?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content of the transcript. Read-only. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -84,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -98,12 +94,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Item/MetadataContent/MetadataContentRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Item/MetadataContent/MetadataContentRequestBuilder.php index b4bac565c17..71730057596 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Item/MetadataContent/MetadataContentRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/Item/MetadataContent/MetadataContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The time-aligned metadata of the utterances in the transcript. Read-only. * @param MetadataContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-list-transcripts?view=graph-rest-1.0 Find more info here */ public function get(?MetadataContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The time-aligned metadata of the utterances in the transcript. Read-only. * @param StreamInterface $body Binary request body * @param MetadataContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?MetadataContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?MetadataContentRequestBuilderGetRequest $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?MetadataContentR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/TranscriptsRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/TranscriptsRequestBuilder.php index d70f3e3d594..539628245de 100644 --- a/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/TranscriptsRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/Item/Transcripts/TranscriptsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\CallTranscript; use Microsoft\Graph\Generated\Models\CallTranscriptCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of callTranscript objects associated with a scheduled onlineMeeting. This API doesn't support getting call transcripts from channel meetings. This API is available in the following national cloud deployments. * @param TranscriptsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-list-transcripts?view=graph-rest-1.0 Find more info here */ public function get(?TranscriptsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallTranscriptCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallTranscriptCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to transcripts for users * @param CallTranscript $body The request body * @param TranscriptsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(CallTranscript $body, ?TranscriptsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [CallTranscript::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TranscriptsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TranscriptsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(CallTranscript $body, ?TranscriptsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/OnlineMeetings/OnlineMeetingsRequestBuilder.php b/src/Generated/Users/Item/OnlineMeetings/OnlineMeetingsRequestBuilder.php index 05f4a504a7d..f45f2383685 100644 --- a/src/Generated/Users/Item/OnlineMeetings/OnlineMeetingsRequestBuilder.php +++ b/src/Generated/Users/Item/OnlineMeetings/OnlineMeetingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OnlineMeeting; use Microsoft\Graph\Generated\Models\OnlineMeetingCollectionResponse; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the properties and relationships of an onlineMeeting object. For example, you can: Teams live event attendee report (deprecated) is an online meeting artifact. For details, see Online meeting artifacts and permissions. This API is available in the following national cloud deployments. * @param OnlineMeetingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/onlinemeeting-get?view=graph-rest-1.0 Find more info here */ public function get(?OnlineMeetingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeetingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeetingCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an online meeting on behalf of a user. This API is available in the following national cloud deployments. * @param OnlineMeeting $body The request body * @param OnlineMeetingsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/application-post-onlinemeetings?view=graph-rest-1.0 Find more info here */ public function post(OnlineMeeting $body, ?OnlineMeetingsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OnlineMeeting::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?OnlineMeetingsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?OnlineMeetingsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(OnlineMeeting $body, ?OnlineMeetingsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Outlook/MasterCategories/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Outlook/MasterCategories/Count/CountRequestBuilder.php index e23db18373a..717d3ff546f 100644 --- a/src/Generated/Users/Item/Outlook/MasterCategories/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Outlook/MasterCategories/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Outlook/MasterCategories/Item/OutlookCategoryItemRequestBuilder.php b/src/Generated/Users/Item/Outlook/MasterCategories/Item/OutlookCategoryItemRequestBuilder.php index 4645e39e48d..8dcb63f9581 100644 --- a/src/Generated/Users/Item/Outlook/MasterCategories/Item/OutlookCategoryItemRequestBuilder.php +++ b/src/Generated/Users/Item/Outlook/MasterCategories/Item/OutlookCategoryItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OutlookCategory; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete the specified outlookCategory object. This API is available in the following national cloud deployments. * @param OutlookCategoryItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/outlookcategory-delete?view=graph-rest-1.0 Find more info here */ public function delete(?OutlookCategoryItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get the properties and relationships of the specified outlookCategory object. This API is available in the following national cloud deployments. * @param OutlookCategoryItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/outlookcategory-get?view=graph-rest-1.0 Find more info here */ public function get(?OutlookCategoryItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OutlookCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OutlookCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the writable property, color, of the specified outlookCategory object. You can't modify the displayName propertyonce you have created the category. This API is available in the following national cloud deployments. * @param OutlookCategory $body The request body * @param OutlookCategoryItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/outlookcategory-update?view=graph-rest-1.0 Find more info here */ public function patch(OutlookCategory $body, ?OutlookCategoryItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OutlookCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OutlookCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?OutlookCategoryItemRequestBuilderDel $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?OutlookCategoryItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?OutlookCategoryItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(OutlookCategory $body, ?OutlookCategor $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Outlook/MasterCategories/MasterCategoriesRequestBuilder.php b/src/Generated/Users/Item/Outlook/MasterCategories/MasterCategoriesRequestBuilder.php index cf751f02770..3c465b41f46 100644 --- a/src/Generated/Users/Item/Outlook/MasterCategories/MasterCategoriesRequestBuilder.php +++ b/src/Generated/Users/Item/Outlook/MasterCategories/MasterCategoriesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OutlookCategory; use Microsoft\Graph\Generated\Models\OutlookCategoryCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get all the categories that have been defined for the user. This API is available in the following national cloud deployments. * @param MasterCategoriesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/outlookuser-list-mastercategories?view=graph-rest-1.0 Find more info here */ public function get(?MasterCategoriesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OutlookCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OutlookCategoryCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create an outlookCategory object in the user's master list of categories. This API is available in the following national cloud deployments. * @param OutlookCategory $body The request body * @param MasterCategoriesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/outlookuser-post-mastercategories?view=graph-rest-1.0 Find more info here */ public function post(OutlookCategory $body, ?MasterCategoriesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OutlookCategory::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OutlookCategory::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?MasterCategoriesRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?MasterCategoriesRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(OutlookCategory $body, ?MasterCategorie $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Outlook/OutlookRequestBuilder.php b/src/Generated/Users/Item/Outlook/OutlookRequestBuilder.php index 57cb43043b9..743a9f6cb51 100644 --- a/src/Generated/Users/Item/Outlook/OutlookRequestBuilder.php +++ b/src/Generated/Users/Item/Outlook/OutlookRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\OutlookUser; use Microsoft\Graph\Generated\Users\Item\Outlook\MasterCategories\MasterCategoriesRequestBuilder; @@ -59,19 +58,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get outlook from users * @param OutlookRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?OutlookRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [OutlookUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [OutlookUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -93,7 +89,6 @@ public function toGetRequestInformation(?OutlookRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -101,6 +96,7 @@ public function toGetRequestInformation(?OutlookRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Outlook/SupportedLanguages/SupportedLanguagesRequestBuilder.php b/src/Generated/Users/Item/Outlook/SupportedLanguages/SupportedLanguagesRequestBuilder.php index 4fcc1231984..4c9839ed5c9 100644 --- a/src/Generated/Users/Item/Outlook/SupportedLanguages/SupportedLanguagesRequestBuilder.php +++ b/src/Generated/Users/Item/Outlook/SupportedLanguages/SupportedLanguagesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of locales and languages that are supported for the user, as configured on the user's mailbox server. When setting up an Outlook client, the user selects the preferred language from this supported list. You can subsequently get the preferred language bygetting the user's mailbox settings. This API is available in the following national cloud deployments. * @param SupportedLanguagesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/outlookuser-supportedlanguages?view=graph-rest-1.0 Find more info here */ public function get(?SupportedLanguagesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SupportedLanguagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SupportedLanguagesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?SupportedLanguagesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?SupportedLanguagesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Outlook/SupportedTimeZones/SupportedTimeZonesRequestBuilder.php b/src/Generated/Users/Item/Outlook/SupportedTimeZones/SupportedTimeZonesRequestBuilder.php index 4bbee3ef790..7fb9be96517 100644 --- a/src/Generated/Users/Item/Outlook/SupportedTimeZones/SupportedTimeZonesRequestBuilder.php +++ b/src/Generated/Users/Item/Outlook/SupportedTimeZones/SupportedTimeZonesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function supportedTimeZones * @param SupportedTimeZonesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SupportedTimeZonesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SupportedTimeZonesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SupportedTimeZonesGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?SupportedTimeZonesRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?SupportedTimeZonesRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Outlook/SupportedTimeZonesWithTimeZoneStandard/SupportedTimeZonesWithTimeZoneStandardRequestBuilder.php b/src/Generated/Users/Item/Outlook/SupportedTimeZonesWithTimeZoneStandard/SupportedTimeZonesWithTimeZoneStandardRequestBuilder.php index cae7862f97c..21a04d5ac54 100644 --- a/src/Generated/Users/Item/Outlook/SupportedTimeZonesWithTimeZoneStandard/SupportedTimeZonesWithTimeZoneStandardRequestBuilder.php +++ b/src/Generated/Users/Item/Outlook/SupportedTimeZonesWithTimeZoneStandard/SupportedTimeZonesWithTimeZoneStandardRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -36,19 +35,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function supportedTimeZones * @param SupportedTimeZonesWithTimeZoneStandardRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?SupportedTimeZonesWithTimeZoneStandardRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [SupportedTimeZonesWithTimeZoneStandardGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [SupportedTimeZonesWithTimeZoneStandardGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,7 +57,6 @@ public function toGetRequestInformation(?SupportedTimeZonesWithTimeZoneStandardR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -69,6 +64,7 @@ public function toGetRequestInformation(?SupportedTimeZonesWithTimeZoneStandardR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedDevices/Count/CountRequestBuilder.php b/src/Generated/Users/Item/OwnedDevices/Count/CountRequestBuilder.php index 2b15a2cfacc..be21b1b8d63 100644 --- a/src/Generated/Users/Item/OwnedDevices/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedDevices/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedDevices/GraphAppRoleAssignment/Count/CountRequestBuilder.php b/src/Generated/Users/Item/OwnedDevices/GraphAppRoleAssignment/Count/CountRequestBuilder.php index a0a3d1c0ef8..e56d86d1e36 100644 --- a/src/Generated/Users/Item/OwnedDevices/GraphAppRoleAssignment/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedDevices/GraphAppRoleAssignment/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedDevices/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/Users/Item/OwnedDevices/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index 25112f11186..4f7a8041cf8 100644 --- a/src/Generated/Users/Item/OwnedDevices/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedDevices/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\OwnedDevices\GraphAppRoleAssignment\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.appRoleAssignment in the microsoft.graph.directoryObject collection * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedDevices/GraphDevice/Count/CountRequestBuilder.php b/src/Generated/Users/Item/OwnedDevices/GraphDevice/Count/CountRequestBuilder.php index f7ddbb67717..f950a46319e 100644 --- a/src/Generated/Users/Item/OwnedDevices/GraphDevice/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedDevices/GraphDevice/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedDevices/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Users/Item/OwnedDevices/GraphDevice/GraphDeviceRequestBuilder.php index 9ad824dc278..d9fbd06055e 100644 --- a/src/Generated/Users/Item/OwnedDevices/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedDevices/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\OwnedDevices\GraphDevice\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.device in the microsoft.graph.directoryObject collection * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedDevices/GraphEndpoint/Count/CountRequestBuilder.php b/src/Generated/Users/Item/OwnedDevices/GraphEndpoint/Count/CountRequestBuilder.php index fb47ae309e4..b3746a800ce 100644 --- a/src/Generated/Users/Item/OwnedDevices/GraphEndpoint/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedDevices/GraphEndpoint/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedDevices/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/Users/Item/OwnedDevices/GraphEndpoint/GraphEndpointRequestBuilder.php index b4415d134ba..df5a6ac7009 100644 --- a/src/Generated/Users/Item/OwnedDevices/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedDevices/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EndpointCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\OwnedDevices\GraphEndpoint\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.endpoint in the microsoft.graph.directoryObject collection * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedDevices/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Users/Item/OwnedDevices/Item/DirectoryObjectItemRequestBuilder.php index 82ecb307c8d..d485bf33fb6 100644 --- a/src/Generated/Users/Item/OwnedDevices/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedDevices/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\OwnedDevices\Item\GraphAppRoleAssignment\GraphAppRoleAssignmentRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Devices that are owned by the user. Read-only. Nullable. Supports $expand and $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1). * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedDevices/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/Users/Item/OwnedDevices/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index 482b8458280..6f1939f0497 100644 --- a/src/Generated/Users/Item/OwnedDevices/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedDevices/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.appRoleAssignment * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedDevices/Item/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Users/Item/OwnedDevices/Item/GraphDevice/GraphDeviceRequestBuilder.php index 7ed2ada391b..a2ffbc04a2c 100644 --- a/src/Generated/Users/Item/OwnedDevices/Item/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedDevices/Item/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Device; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.device * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedDevices/Item/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/Users/Item/OwnedDevices/Item/GraphEndpoint/GraphEndpointRequestBuilder.php index 24f55a3b54d..909d165f315 100644 --- a/src/Generated/Users/Item/OwnedDevices/Item/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedDevices/Item/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Endpoint; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.endpoint * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedDevices/OwnedDevicesRequestBuilder.php b/src/Generated/Users/Item/OwnedDevices/OwnedDevicesRequestBuilder.php index f7152933d1a..ab7131f8559 100644 --- a/src/Generated/Users/Item/OwnedDevices/OwnedDevicesRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedDevices/OwnedDevicesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\OwnedDevices\Count\CountRequestBuilder; @@ -78,20 +77,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Devices that are owned by the user. Read-only. Nullable. Supports $expand and $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1). * @param OwnedDevicesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-owneddevices?view=graph-rest-1.0 Find more info here */ public function get(?OwnedDevicesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -104,7 +100,6 @@ public function toGetRequestInformation(?OwnedDevicesRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -112,6 +107,7 @@ public function toGetRequestInformation(?OwnedDevicesRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedObjects/Count/CountRequestBuilder.php b/src/Generated/Users/Item/OwnedObjects/Count/CountRequestBuilder.php index 622d9dcc854..75e875162fd 100644 --- a/src/Generated/Users/Item/OwnedObjects/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedObjects/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedObjects/GraphApplication/Count/CountRequestBuilder.php b/src/Generated/Users/Item/OwnedObjects/GraphApplication/Count/CountRequestBuilder.php index a9c73053cdf..4116ee22938 100644 --- a/src/Generated/Users/Item/OwnedObjects/GraphApplication/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedObjects/GraphApplication/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedObjects/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Users/Item/OwnedObjects/GraphApplication/GraphApplicationRequestBuilder.php index 3f343a1f5fa..bd2891eb3bb 100644 --- a/src/Generated/Users/Item/OwnedObjects/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedObjects/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ApplicationCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\OwnedObjects\GraphApplication\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.application in the microsoft.graph.directoryObject collection * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ApplicationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedObjects/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Users/Item/OwnedObjects/GraphGroup/Count/CountRequestBuilder.php index c5decbd9395..29efd5ca370 100644 --- a/src/Generated/Users/Item/OwnedObjects/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedObjects/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedObjects/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Users/Item/OwnedObjects/GraphGroup/GraphGroupRequestBuilder.php index 11de7fa9cac..1ce20209a93 100644 --- a/src/Generated/Users/Item/OwnedObjects/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedObjects/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\OwnedObjects\GraphGroup\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php b/src/Generated/Users/Item/OwnedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php index 33b8f62ec89..4d73a5779aa 100644 --- a/src/Generated/Users/Item/OwnedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedObjects/GraphServicePrincipal/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Users/Item/OwnedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 5c51544dcad..cc598150045 100644 --- a/src/Generated/Users/Item/OwnedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedObjects/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipalCollectionResponse; use Microsoft\Graph\Generated\Users\Item\OwnedObjects\GraphServicePrincipal\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.servicePrincipal in the microsoft.graph.directoryObject collection * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipalCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedObjects/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Users/Item/OwnedObjects/Item/DirectoryObjectItemRequestBuilder.php index e1466b77e6d..3a0b11d76a1 100644 --- a/src/Generated/Users/Item/OwnedObjects/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedObjects/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\OwnedObjects\Item\GraphApplication\GraphApplicationRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Directory objects that are owned by the user. Read-only. Nullable. Supports $expand, $select nested in $expand, and $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1). * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedObjects/Item/GraphApplication/GraphApplicationRequestBuilder.php b/src/Generated/Users/Item/OwnedObjects/Item/GraphApplication/GraphApplicationRequestBuilder.php index 3fa43cd36f1..5ba6e38e09c 100644 --- a/src/Generated/Users/Item/OwnedObjects/Item/GraphApplication/GraphApplicationRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedObjects/Item/GraphApplication/GraphApplicationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Application; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.application * @param GraphApplicationRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphApplicationRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Application::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphApplicationRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedObjects/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Users/Item/OwnedObjects/Item/GraphGroup/GraphGroupRequestBuilder.php index 20f24236ddb..04bab3cfa28 100644 --- a/src/Generated/Users/Item/OwnedObjects/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedObjects/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php b/src/Generated/Users/Item/OwnedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php index 68142bc8d14..a79945dc304 100644 --- a/src/Generated/Users/Item/OwnedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedObjects/Item/GraphServicePrincipal/GraphServicePrincipalRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServicePrincipal; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.servicePrincipal * @param GraphServicePrincipalRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphServicePrincipalRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServicePrincipal::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphServicePrincipalRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/OwnedObjects/OwnedObjectsRequestBuilder.php b/src/Generated/Users/Item/OwnedObjects/OwnedObjectsRequestBuilder.php index 150ec59e65c..500bc533e8c 100644 --- a/src/Generated/Users/Item/OwnedObjects/OwnedObjectsRequestBuilder.php +++ b/src/Generated/Users/Item/OwnedObjects/OwnedObjectsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\OwnedObjects\Count\CountRequestBuilder; @@ -78,20 +77,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Directory objects that are owned by the user. Read-only. Nullable. Supports $expand, $select nested in $expand, and $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1). * @param OwnedObjectsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-ownedobjects?view=graph-rest-1.0 Find more info here */ public function get(?OwnedObjectsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -104,7 +100,6 @@ public function toGetRequestInformation(?OwnedObjectsRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -112,6 +107,7 @@ public function toGetRequestInformation(?OwnedObjectsRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/People/Count/CountRequestBuilder.php b/src/Generated/Users/Item/People/Count/CountRequestBuilder.php index 4c63a57b9da..c978aa64195 100644 --- a/src/Generated/Users/Item/People/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/People/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/People/Item/PersonItemRequestBuilder.php b/src/Generated/Users/Item/People/Item/PersonItemRequestBuilder.php index d8d442fa4ff..61f9d88e6a2 100644 --- a/src/Generated/Users/Item/People/Item/PersonItemRequestBuilder.php +++ b/src/Generated/Users/Item/People/Item/PersonItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Person; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * People that are relevant to the user. Read-only. Nullable. * @param PersonItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PersonItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Person::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Person::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?PersonItemRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?PersonItemRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/People/PeopleRequestBuilder.php b/src/Generated/Users/Item/People/PeopleRequestBuilder.php index a10c308ea2e..6299de20ca1 100644 --- a/src/Generated/Users/Item/People/PeopleRequestBuilder.php +++ b/src/Generated/Users/Item/People/PeopleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PersonCollectionResponse; use Microsoft\Graph\Generated\Users\Item\People\Count\CountRequestBuilder; @@ -54,20 +53,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a collection of person objects ordered by their relevance to the user, which is determined by the user's communication and collaboration patterns, and business relationships. You can get this information via the People API. For examples, see the Examples section and the article Use the People API to get information about the people most relevant to you. This API is available in the following national cloud deployments. * @param PeopleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-people?view=graph-rest-1.0 Find more info here */ public function get(?PeopleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PersonCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PersonCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -80,7 +76,6 @@ public function toGetRequestInformation(?PeopleRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -88,6 +83,7 @@ public function toGetRequestInformation(?PeopleRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Photo/PhotoRequestBuilder.php b/src/Generated/Users/Item/Photo/PhotoRequestBuilder.php index c4295c343fa..524b8982cc8 100644 --- a/src/Generated/Users/Item/Photo/PhotoRequestBuilder.php +++ b/src/Generated/Users/Item/Photo/PhotoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProfilePhoto; use Microsoft\Graph\Generated\Users\Item\Photo\Value\ContentRequestBuilder; @@ -42,57 +41,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property photo for users * @param PhotoRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PhotoRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** - * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Azure Active Directory. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. + * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Microsoft Entra ID. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. * @param PhotoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/profilephoto-get?view=graph-rest-1.0 Find more info here */ public function get(?PhotoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property photo in users * @param ProfilePhoto $body The request body * @param PhotoRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ProfilePhoto $body, ?PhotoRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,11 +99,12 @@ public function toDeleteRequestInformation(?PhotoRequestBuilderDeleteRequestConf $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Azure Active Directory. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. + * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Microsoft Entra ID. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. * @param PhotoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -122,7 +113,6 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -130,6 +120,7 @@ public function toGetRequestInformation(?PhotoRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -144,11 +135,11 @@ public function toPatchRequestInformation(ProfilePhoto $body, ?PhotoRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Photo/PhotoRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/Photo/PhotoRequestBuilderGetQueryParameters.php index ac6dd631009..3459c5f1e0d 100644 --- a/src/Generated/Users/Item/Photo/PhotoRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/Photo/PhotoRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Azure Active Directory. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. + * Get the specified profilePhoto or its metadata (profilePhoto properties). The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240,360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they are stored in Microsoft Entra ID. You can get the metadata of the largest available photo, or specify a size to get the metadata for that photo size.If the size you request is not available, you can still get a smaller size that the user has uploaded and made available.For example, if the user uploads a photo that is 504x504 pixels, all but the 648x648 size of photo will be available for download. This API is available in the following national cloud deployments. */ class PhotoRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/Photo/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/Photo/Value/ContentRequestBuilder.php index fc009e7f8a6..9b08a7da89e 100644 --- a/src/Generated/Users/Item/Photo/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Photo/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property photo from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/profilephoto-get?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property photo in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Photos/Item/ProfilePhotoItemRequestBuilder.php b/src/Generated/Users/Item/Photos/Item/ProfilePhotoItemRequestBuilder.php index c82078b1827..971d372283d 100644 --- a/src/Generated/Users/Item/Photos/Item/ProfilePhotoItemRequestBuilder.php +++ b/src/Generated/Users/Item/Photos/Item/ProfilePhotoItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProfilePhoto; use Microsoft\Graph\Generated\Users\Item\Photos\Item\Value\ContentRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get photos from users * @param ProfilePhotoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ProfilePhotoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhoto::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ProfilePhotoItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ProfilePhotoItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Photos/Item/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/Photos/Item/Value/ContentRequestBuilder.php index f03463dc564..af606be216c 100644 --- a/src/Generated/Users/Item/Photos/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Photos/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,38 +33,36 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property photos from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property photos in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -82,6 +79,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -100,7 +98,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Photos/PhotosRequestBuilder.php b/src/Generated/Users/Item/Photos/PhotosRequestBuilder.php index 52f11e0cd1b..6773041402b 100644 --- a/src/Generated/Users/Item/Photos/PhotosRequestBuilder.php +++ b/src/Generated/Users/Item/Photos/PhotosRequestBuilder.php @@ -4,10 +4,8 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ProfilePhotoCollectionResponse; -use Microsoft\Graph\Generated\Users\Item\Photos\Count\CountRequestBuilder; use Microsoft\Graph\Generated\Users\Item\Photos\Item\ProfilePhotoItemRequestBuilder; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -19,13 +17,6 @@ */ class PhotosRequestBuilder extends BaseRequestBuilder { - /** - * Provides operations to count the resources in the collection. - */ - public function count(): CountRequestBuilder { - return new CountRequestBuilder($this->pathParameters, $this->requestAdapter); - } - /** * Provides operations to manage the photos property of the microsoft.graph.user entity. * @param string $profilePhotoId The unique identifier of profilePhoto @@ -43,7 +34,7 @@ public function byProfilePhotoId(string $profilePhotoId): ProfilePhotoItemReques * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. */ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { - parent::__construct($requestAdapter, [], '{+baseurl}/users/{user%2Did}/photos{?%24top,%24skip,%24filter,%24count,%24orderby,%24select}'); + parent::__construct($requestAdapter, [], '{+baseurl}/users/{user%2Did}/photos{?%24top,%24skip,%24filter,%24orderby,%24select}'); if (is_array($pathParametersOrRawUrl)) { $this->pathParameters = $pathParametersOrRawUrl; } else { @@ -54,19 +45,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get photos from users * @param PhotosRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PhotosRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhotoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ProfilePhotoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +67,6 @@ public function toGetRequestInformation(?PhotosRequestBuilderGetRequestConfigura $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +74,7 @@ public function toGetRequestInformation(?PhotosRequestBuilderGetRequestConfigura } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Photos/PhotosRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/Photos/PhotosRequestBuilderGetQueryParameters.php index 4f707d66311..4d6481a16c1 100644 --- a/src/Generated/Users/Item/Photos/PhotosRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/Photos/PhotosRequestBuilderGetQueryParameters.php @@ -9,12 +9,6 @@ */ class PhotosRequestBuilderGetQueryParameters { - /** - * @QueryParameter("%24count") - * @var bool|null $count Include count of items - */ - public ?bool $count = null; - /** * @QueryParameter("%24filter") * @var string|null $filter Filter items by property values @@ -47,15 +41,13 @@ class PhotosRequestBuilderGetQueryParameters /** * Instantiates a new photosRequestBuilderGetQueryParameters and sets the default values. - * @param bool|null $count Include count of items * @param string|null $filter Filter items by property values * @param array|null $orderby Order items by property values * @param array|null $select Select properties to be returned * @param int|null $skip Skip the first n items * @param int|null $top Show only the first n items */ - public function __construct(?bool $count = null, ?string $filter = null, ?array $orderby = null, ?array $select = null, ?int $skip = null, ?int $top = null) { - $this->count = $count; + public function __construct(?string $filter = null, ?array $orderby = null, ?array $select = null, ?int $skip = null, ?int $top = null) { $this->filter = $filter; $this->orderby = $orderby; $this->select = $select; diff --git a/src/Generated/Users/Item/Photos/PhotosRequestBuilderGetRequestConfiguration.php b/src/Generated/Users/Item/Photos/PhotosRequestBuilderGetRequestConfiguration.php index 9f23249b4f5..6fd571a0891 100644 --- a/src/Generated/Users/Item/Photos/PhotosRequestBuilderGetRequestConfiguration.php +++ b/src/Generated/Users/Item/Photos/PhotosRequestBuilderGetRequestConfiguration.php @@ -28,7 +28,6 @@ public function __construct(?array $headers = null, ?array $options = null, ?Pho /** * Instantiates a new photosRequestBuilderGetQueryParameters. - * @param bool|null $count Include count of items * @param string|null $filter Filter items by property values * @param array|null $orderby Order items by property values * @param array|null $select Select properties to be returned @@ -36,8 +35,8 @@ public function __construct(?array $headers = null, ?array $options = null, ?Pho * @param int|null $top Show only the first n items * @return PhotosRequestBuilderGetQueryParameters */ - public static function createQueryParameters(?bool $count = null, ?string $filter = null, ?array $orderby = null, ?array $select = null, ?int $skip = null, ?int $top = null): PhotosRequestBuilderGetQueryParameters { - return new PhotosRequestBuilderGetQueryParameters($count, $filter, $orderby, $select, $skip, $top); + public static function createQueryParameters(?string $filter = null, ?array $orderby = null, ?array $select = null, ?int $skip = null, ?int $top = null): PhotosRequestBuilderGetQueryParameters { + return new PhotosRequestBuilderGetQueryParameters($filter, $orderby, $select, $skip, $top); } } diff --git a/src/Generated/Users/Item/Planner/PlannerRequestBuilder.php b/src/Generated/Users/Item/Planner/PlannerRequestBuilder.php index 450cb620c11..ed425910b21 100644 --- a/src/Generated/Users/Item/Planner/PlannerRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/PlannerRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerUser; use Microsoft\Graph\Generated\Users\Item\Planner\Plans\PlansRequestBuilder; @@ -50,56 +49,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property planner for users * @param PlannerRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Entry-point to the Planner resource that might exist for a user. Read-only. * @param PlannerRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property planner in users * @param PlannerUser $body The request body * @param PlannerRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerUser $body, ?PlannerRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerUser::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerUser::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -116,6 +106,7 @@ public function toDeleteRequestInformation(?PlannerRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -129,7 +120,6 @@ public function toGetRequestInformation(?PlannerRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -137,6 +127,7 @@ public function toGetRequestInformation(?PlannerRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -151,11 +142,11 @@ public function toPatchRequestInformation(PlannerUser $body, ?PlannerRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Count/CountRequestBuilder.php index 3eb1a379e37..c977515605c 100644 --- a/src/Generated/Users/Item/Planner/Plans/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/BucketsRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/BucketsRequestBuilder.php index f396778419c..90be26bdc88 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/BucketsRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/BucketsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucket; use Microsoft\Graph\Generated\Models\PlannerBucketCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannerBucket objects contained by a plannerPlan object. This API is available in the following national cloud deployments. * @param BucketsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplan-list-buckets?view=graph-rest-1.0 Find more info here */ public function get(?BucketsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to buckets for users * @param PlannerBucket $body The request body * @param BucketsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PlannerBucket $body, ?BucketsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?BucketsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?BucketsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PlannerBucket $body, ?BucketsRequestBui $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Count/CountRequestBuilder.php index 37a9459d355..77c5ea66632 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/PlannerBucketItemRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/PlannerBucketItemRequestBuilder.php index 10252646cfc..2ab56d2b8a2 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/PlannerBucketItemRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/PlannerBucketItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucket; use Microsoft\Graph\Generated\Users\Item\Planner\Plans\Item\Buckets\Item\Tasks\TasksRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property buckets for users * @param PlannerBucketItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerBucketItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Collection of buckets in the plan. * @param PlannerBucketItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerBucketItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property buckets in users * @param PlannerBucket $body The request body * @param PlannerBucketItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerBucket $body, ?PlannerBucketItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucket::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?PlannerBucketItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?PlannerBucketItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?PlannerBucketItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(PlannerBucket $body, ?PlannerBucketIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Count/CountRequestBuilder.php index 0df8d36110c..f5fd6031da1 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php index 553eed82068..f8b588ccaeb 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerAssignedToTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignedToTaskBoardFormat for users * @param AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerAssignedToTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignedToTaskBoardFormat in users * @param PlannerAssignedToTaskBoardTaskFormat $body The request body * @param AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerAssignedToTaskBoardTaskFormat $body, ?AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AssignedToTaskBoardFormatRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerAssignedToTaskBoardTaskFormat $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php index 50d4aff962d..e6abd596783 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucketTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property bucketTaskBoardFormat for users * @param BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerBucketTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param BucketTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?BucketTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property bucketTaskBoardFormat in users * @param PlannerBucketTaskBoardTaskFormat $body The request body * @param BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerBucketTaskBoardTaskFormat $body, ?BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?BucketTaskBoardFormatRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerBucketTaskBoardTaskFormat $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php index d99067bdffd..b236b68270a 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTaskDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for users * @param DetailsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DetailsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerTaskDetails object. This API is available in the following national cloud deployments. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-get?view=graph-rest-1.0 Find more info here */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in users * @param PlannerTaskDetails $body The request body * @param DetailsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerTaskDetails $body, ?DetailsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DetailsRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerTaskDetails $body, ?DetailsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php index 0ee6adee2ba..92ee6ce4e66 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Users\Item\Planner\Plans\Item\Buckets\Item\Tasks\Item\AssignedToTaskBoardFormat\AssignedToTaskBoardFormatRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for users * @param PlannerTaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerTaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. The collection of tasks in the bucket. * @param PlannerTaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerTaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in users * @param PlannerTask $body The request body * @param PlannerTaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerTask $body, ?PlannerTaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?PlannerTaskItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(PlannerTask $body, ?PlannerTaskItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php index 92cb81db00d..55050c96033 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerProgressTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property progressTaskBoardFormat for users * @param ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerProgressTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property progressTaskBoardFormat in users * @param PlannerProgressTaskBoardTaskFormat $body The request body * @param ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerProgressTaskBoardTaskFormat $body, ?ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ProgressTaskBoardFormatRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerProgressTaskBoardTaskFormat $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/TasksRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/TasksRequestBuilder.php index 6a06ee882da..5f84128150c 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Buckets/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Models\PlannerTaskCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannerTask objects associated to a plannerBucket object. This API is available in the following national cloud deployments. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbucket-list-tasks?view=graph-rest-1.0 Find more info here */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for users * @param PlannerTask $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PlannerTask $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PlannerTask $body, ?TasksRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Details/DetailsRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Details/DetailsRequestBuilder.php index 5a4924c10e8..f661e88245b 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerPlanDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for users * @param DetailsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DetailsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerPlanDetails object. This API is available in the following national cloud deployments. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplandetails-get?view=graph-rest-1.0 Find more info here */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in users * @param PlannerPlanDetails $body The request body * @param DetailsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplandetails-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerPlanDetails $body, ?DetailsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DetailsRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerPlanDetails $body, ?DetailsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/PlannerPlanItemRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/PlannerPlanItemRequestBuilder.php index 4c7e759ded9..529240e8c8b 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/PlannerPlanItemRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/PlannerPlanItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerPlan; use Microsoft\Graph\Generated\Users\Item\Planner\Plans\Item\Buckets\BucketsRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property plans for users * @param PlannerPlanItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerPlanItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Returns the plannerTasks assigned to the user. * @param PlannerPlanItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerPlanItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property plans in users * @param PlannerPlan $body The request body * @param PlannerPlanItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerPlan $body, ?PlannerPlanItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?PlannerPlanItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?PlannerPlanItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?PlannerPlanItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(PlannerPlan $body, ?PlannerPlanItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Count/CountRequestBuilder.php index faf537fa45f..2d3d115c762 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php index a23f9e61565..30554b66d90 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerAssignedToTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignedToTaskBoardFormat for users * @param AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerAssignedToTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignedToTaskBoardFormat in users * @param PlannerAssignedToTaskBoardTaskFormat $body The request body * @param AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerAssignedToTaskBoardTaskFormat $body, ?AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AssignedToTaskBoardFormatRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerAssignedToTaskBoardTaskFormat $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php index d61151e7968..1773edcc3bc 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucketTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property bucketTaskBoardFormat for users * @param BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerBucketTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param BucketTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?BucketTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property bucketTaskBoardFormat in users * @param PlannerBucketTaskBoardTaskFormat $body The request body * @param BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerBucketTaskBoardTaskFormat $body, ?BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?BucketTaskBoardFormatRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerBucketTaskBoardTaskFormat $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/Details/DetailsRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/Details/DetailsRequestBuilder.php index cc15d21f6fc..c7dfa14874b 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTaskDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for users * @param DetailsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DetailsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerTaskDetails object. This API is available in the following national cloud deployments. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-get?view=graph-rest-1.0 Find more info here */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in users * @param PlannerTaskDetails $body The request body * @param DetailsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerTaskDetails $body, ?DetailsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DetailsRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerTaskDetails $body, ?DetailsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php index ab8e62affde..4cd92bcad38 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/PlannerTaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Users\Item\Planner\Plans\Item\Tasks\Item\AssignedToTaskBoardFormat\AssignedToTaskBoardFormatRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for users * @param PlannerTaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerTaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Collection of tasks in the plan. * @param PlannerTaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerTaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in users * @param PlannerTask $body The request body * @param PlannerTaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerTask $body, ?PlannerTaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?PlannerTaskItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(PlannerTask $body, ?PlannerTaskItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php index c907402646a..c4a90b562ff 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerProgressTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property progressTaskBoardFormat for users * @param ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerProgressTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property progressTaskBoardFormat in users * @param PlannerProgressTaskBoardTaskFormat $body The request body * @param ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerProgressTaskBoardTaskFormat $body, ?ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ProgressTaskBoardFormatRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerProgressTaskBoardTaskFormat $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/TasksRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/TasksRequestBuilder.php index 1e3276de171..4934b665527 100644 --- a/src/Generated/Users/Item/Planner/Plans/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Models\PlannerTaskCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannerTask objects associated with a plannerPlan object. This API is available in the following national cloud deployments. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerplan-list-tasks?view=graph-rest-1.0 Find more info here */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for users * @param PlannerTask $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PlannerTask $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PlannerTask $body, ?TasksRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Plans/PlansRequestBuilder.php b/src/Generated/Users/Item/Planner/Plans/PlansRequestBuilder.php index a21b45ee8a3..a1046a30eba 100644 --- a/src/Generated/Users/Item/Planner/Plans/PlansRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Plans/PlansRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerPlan; use Microsoft\Graph\Generated\Models\PlannerPlanCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannerplan objects shared with a user object. This API is available in the following national cloud deployments. * @param PlansRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/planneruser-list-plans?view=graph-rest-1.0 Find more info here */ public function get(?PlansRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlanCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to plans for users * @param PlannerPlan $body The request body * @param PlansRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PlannerPlan $body, ?PlansRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerPlan::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?PlansRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?PlansRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PlannerPlan $body, ?PlansRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Tasks/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Planner/Tasks/Count/CountRequestBuilder.php index 006d59afa3d..145eca899dc 100644 --- a/src/Generated/Users/Item/Planner/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php b/src/Generated/Users/Item/Planner/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php index fd63ad1467a..49de80bda9d 100644 --- a/src/Generated/Users/Item/Planner/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Tasks/Item/AssignedToTaskBoardFormat/AssignedToTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerAssignedToTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property assignedToTaskBoardFormat for users * @param AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AssignedToTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerAssignedToTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?AssignedToTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property assignedToTaskBoardFormat in users * @param PlannerAssignedToTaskBoardTaskFormat $body The request body * @param AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerassignedtotaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerAssignedToTaskBoardTaskFormat $body, ?AssignedToTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerAssignedToTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?AssignedToTaskBoardFormatRequestBuil $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?AssignedToTaskBoardFormatRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerAssignedToTaskBoardTaskFormat $ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php b/src/Generated/Users/Item/Planner/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php index 5c08834c84d..92468908e50 100644 --- a/src/Generated/Users/Item/Planner/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Tasks/Item/BucketTaskBoardFormat/BucketTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerBucketTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property bucketTaskBoardFormat for users * @param BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?BucketTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerBucketTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param BucketTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?BucketTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property bucketTaskBoardFormat in users * @param PlannerBucketTaskBoardTaskFormat $body The request body * @param BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerbuckettaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerBucketTaskBoardTaskFormat $body, ?BucketTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerBucketTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?BucketTaskBoardFormatRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?BucketTaskBoardFormatRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerBucketTaskBoardTaskFormat $body $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Tasks/Item/Details/DetailsRequestBuilder.php b/src/Generated/Users/Item/Planner/Tasks/Item/Details/DetailsRequestBuilder.php index 4a6b6424c21..2d213306a18 100644 --- a/src/Generated/Users/Item/Planner/Tasks/Item/Details/DetailsRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Tasks/Item/Details/DetailsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTaskDetails; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property details for users * @param DetailsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?DetailsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a plannerTaskDetails object. This API is available in the following national cloud deployments. * @param DetailsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-get?view=graph-rest-1.0 Find more info here */ public function get(?DetailsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property details in users * @param PlannerTaskDetails $body The request body * @param DetailsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannertaskdetails-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerTaskDetails $body, ?DetailsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskDetails::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?DetailsRequestBuilderDeleteRequestCo $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?DetailsRequestBuilderGetRequestConfigur } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerTaskDetails $body, ?DetailsRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Tasks/Item/PlannerTaskItemRequestBuilder.php b/src/Generated/Users/Item/Planner/Tasks/Item/PlannerTaskItemRequestBuilder.php index 1cad737cabc..c4fb8145f96 100644 --- a/src/Generated/Users/Item/Planner/Tasks/Item/PlannerTaskItemRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Tasks/Item/PlannerTaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Users\Item\Planner\Tasks\Item\AssignedToTaskBoardFormat\AssignedToTaskBoardFormatRequestBuilder; @@ -66,56 +65,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property tasks for users * @param PlannerTaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PlannerTaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read-only. Nullable. Returns the plannerPlans shared with the user. * @param PlannerTaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?PlannerTaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property tasks in users * @param PlannerTask $body The request body * @param PlannerTaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(PlannerTask $body, ?PlannerTaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -132,6 +122,7 @@ public function toDeleteRequestInformation(?PlannerTaskItemRequestBuilderDeleteR $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -145,7 +136,6 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -153,6 +143,7 @@ public function toGetRequestInformation(?PlannerTaskItemRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -167,11 +158,11 @@ public function toPatchRequestInformation(PlannerTask $body, ?PlannerTaskItemReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php b/src/Generated/Users/Item/Planner/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php index 840e8aa6f44..adde50aad99 100644 --- a/src/Generated/Users/Item/Planner/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Tasks/Item/ProgressTaskBoardFormat/ProgressTaskBoardFormatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerProgressTaskBoardTaskFormat; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property progressTaskBoardFormat for users * @param ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ProgressTaskBoardFormatRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of plannerProgressTaskBoardTaskFormat object. This API is available in the following national cloud deployments. * @param ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-get?view=graph-rest-1.0 Find more info here */ public function get(?ProgressTaskBoardFormatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property progressTaskBoardFormat in users * @param PlannerProgressTaskBoardTaskFormat $body The request body * @param ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/plannerprogresstaskboardtaskformat-update?view=graph-rest-1.0 Find more info here */ public function patch(PlannerProgressTaskBoardTaskFormat $body, ?ProgressTaskBoardFormatRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerProgressTaskBoardTaskFormat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ProgressTaskBoardFormatRequestBuilde $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ProgressTaskBoardFormatRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(PlannerProgressTaskBoardTaskFormat $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Planner/Tasks/TasksRequestBuilder.php b/src/Generated/Users/Item/Planner/Tasks/TasksRequestBuilder.php index 45ddaa200fe..d200abd62d9 100644 --- a/src/Generated/Users/Item/Planner/Tasks/TasksRequestBuilder.php +++ b/src/Generated/Users/Item/Planner/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\PlannerTask; use Microsoft\Graph\Generated\Models\PlannerTaskCollectionResponse; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve a list of plannertask objects assigned to a User. This API is available in the following national cloud deployments. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/planneruser-list-tasks?view=graph-rest-1.0 Find more info here */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to tasks for users * @param PlannerTask $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(PlannerTask $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [PlannerTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(PlannerTask $body, ?TasksRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Presence/ClearPresence/ClearPresenceRequestBuilder.php b/src/Generated/Users/Item/Presence/ClearPresence/ClearPresenceRequestBuilder.php index bee9c2adaa1..758dacdf8ca 100644 --- a/src/Generated/Users/Item/Presence/ClearPresence/ClearPresenceRequestBuilder.php +++ b/src/Generated/Users/Item/Presence/ClearPresence/ClearPresenceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Clear the application's presence session for a user. If it is the user's only presence session, the user's presence will change to Offline/Offline. For details about presences sessions, see presence: setPresence. This API is available in the following national cloud deployments. * @param ClearPresencePostRequestBody $body The request body * @param ClearPresenceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/presence-clearpresence?view=graph-rest-1.0 Find more info here */ public function post(ClearPresencePostRequestBody $body, ?ClearPresenceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ClearPresencePostRequestBody $body, ?Cl $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Presence/ClearUserPreferredPresence/ClearUserPreferredPresenceRequestBuilder.php b/src/Generated/Users/Item/Presence/ClearUserPreferredPresence/ClearUserPreferredPresenceRequestBuilder.php index 4ed3fedd1a3..07025c86469 100644 --- a/src/Generated/Users/Item/Presence/ClearUserPreferredPresence/ClearUserPreferredPresenceRequestBuilder.php +++ b/src/Generated/Users/Item/Presence/ClearUserPreferredPresence/ClearUserPreferredPresenceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Clear the preferred availability and activity status for a user. This API is available in the following national cloud deployments. * @param ClearUserPreferredPresenceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/presence-clearuserpreferredpresence?view=graph-rest-1.0 Find more info here */ public function post(?ClearUserPreferredPresenceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?ClearUserPreferredPresenceRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Presence/PresenceRequestBuilder.php b/src/Generated/Users/Item/Presence/PresenceRequestBuilder.php index 759812d74bd..8c846e254cf 100644 --- a/src/Generated/Users/Item/Presence/PresenceRequestBuilder.php +++ b/src/Generated/Users/Item/Presence/PresenceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Presence; use Microsoft\Graph\Generated\Users\Item\Presence\ClearPresence\ClearPresenceRequestBuilder; @@ -74,57 +73,48 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property presence for users * @param PresenceRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?PresenceRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get a user's presence information. This API is available in the following national cloud deployments. * @param PresenceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/presence-get?view=graph-rest-1.0 Find more info here */ public function get(?PresenceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Presence::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Presence::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property presence in users * @param Presence $body The request body * @param PresenceRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Presence $body, ?PresenceRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Presence::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Presence::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -141,6 +131,7 @@ public function toDeleteRequestInformation(?PresenceRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -154,7 +145,6 @@ public function toGetRequestInformation(?PresenceRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -162,6 +152,7 @@ public function toGetRequestInformation(?PresenceRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -176,11 +167,11 @@ public function toPatchRequestInformation(Presence $body, ?PresenceRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Presence/SetPresence/SetPresenceRequestBuilder.php b/src/Generated/Users/Item/Presence/SetPresence/SetPresenceRequestBuilder.php index 42c6e04a6b0..5bb48e5a69b 100644 --- a/src/Generated/Users/Item/Presence/SetPresence/SetPresenceRequestBuilder.php +++ b/src/Generated/Users/Item/Presence/SetPresence/SetPresenceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Set the state of a user's presence session as an application. This API is available in the following national cloud deployments. * @param SetPresencePostRequestBody $body The request body * @param SetPresenceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/presence-setpresence?view=graph-rest-1.0 Find more info here */ public function post(SetPresencePostRequestBody $body, ?SetPresenceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetPresencePostRequestBody $body, ?SetP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Presence/SetStatusMessage/SetStatusMessageRequestBuilder.php b/src/Generated/Users/Item/Presence/SetStatusMessage/SetStatusMessageRequestBuilder.php index 211696694f7..79477ecf6de 100644 --- a/src/Generated/Users/Item/Presence/SetStatusMessage/SetStatusMessageRequestBuilder.php +++ b/src/Generated/Users/Item/Presence/SetStatusMessage/SetStatusMessageRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Set a presence status message for a user. An optional expiration date and time can be supplied. This API is available in the following national cloud deployments. * @param SetStatusMessagePostRequestBody $body The request body * @param SetStatusMessageRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/presence-setstatusmessage?view=graph-rest-1.0 Find more info here */ public function post(SetStatusMessagePostRequestBody $body, ?SetStatusMessageRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetStatusMessagePostRequestBody $body, $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Presence/SetUserPreferredPresence/SetUserPreferredPresenceRequestBuilder.php b/src/Generated/Users/Item/Presence/SetUserPreferredPresence/SetUserPreferredPresenceRequestBuilder.php index 31cdfdc404a..99938ffc418 100644 --- a/src/Generated/Users/Item/Presence/SetUserPreferredPresence/SetUserPreferredPresenceRequestBuilder.php +++ b/src/Generated/Users/Item/Presence/SetUserPreferredPresence/SetUserPreferredPresenceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Set the preferred availability and activity status for a user. If the preferred presence of a user is set, the user's presence shows as the preferred status. Preferred presence takes effect only when at least one presence session exists for the user. Otherwise, the user's presence shows as Offline. A presence session is created as a result of a successful setPresence operation, or if the user is signed in on a Microsoft Teams client. For more details, see presence sessions and time-out and expiration. This API is available in the following national cloud deployments. * @param SetUserPreferredPresencePostRequestBody $body The request body * @param SetUserPreferredPresenceRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/presence-setuserpreferredpresence?view=graph-rest-1.0 Find more info here */ public function post(SetUserPreferredPresencePostRequestBody $body, ?SetUserPreferredPresenceRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SetUserPreferredPresencePostRequestBody $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/RegisteredDevices/Count/CountRequestBuilder.php b/src/Generated/Users/Item/RegisteredDevices/Count/CountRequestBuilder.php index 46ab7d1e57a..6294a352ed5 100644 --- a/src/Generated/Users/Item/RegisteredDevices/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/RegisteredDevices/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RegisteredDevices/GraphAppRoleAssignment/Count/CountRequestBuilder.php b/src/Generated/Users/Item/RegisteredDevices/GraphAppRoleAssignment/Count/CountRequestBuilder.php index 7c12d44de57..e3529b9bab7 100644 --- a/src/Generated/Users/Item/RegisteredDevices/GraphAppRoleAssignment/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/RegisteredDevices/GraphAppRoleAssignment/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RegisteredDevices/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/Users/Item/RegisteredDevices/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index c878ae2310d..e9f0d953c5f 100644 --- a/src/Generated/Users/Item/RegisteredDevices/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/Users/Item/RegisteredDevices/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignmentCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\RegisteredDevices\GraphAppRoleAssignment\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.appRoleAssignment in the microsoft.graph.directoryObject collection * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignmentCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RegisteredDevices/GraphDevice/Count/CountRequestBuilder.php b/src/Generated/Users/Item/RegisteredDevices/GraphDevice/Count/CountRequestBuilder.php index 10d71b6f9fe..de8e183e899 100644 --- a/src/Generated/Users/Item/RegisteredDevices/GraphDevice/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/RegisteredDevices/GraphDevice/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RegisteredDevices/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Users/Item/RegisteredDevices/GraphDevice/GraphDeviceRequestBuilder.php index be37fa577b4..737f8188081 100644 --- a/src/Generated/Users/Item/RegisteredDevices/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Users/Item/RegisteredDevices/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DeviceCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\RegisteredDevices\GraphDevice\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.device in the microsoft.graph.directoryObject collection * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeviceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RegisteredDevices/GraphEndpoint/Count/CountRequestBuilder.php b/src/Generated/Users/Item/RegisteredDevices/GraphEndpoint/Count/CountRequestBuilder.php index 84ed6bcc008..d2ea6f7774a 100644 --- a/src/Generated/Users/Item/RegisteredDevices/GraphEndpoint/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/RegisteredDevices/GraphEndpoint/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RegisteredDevices/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/Users/Item/RegisteredDevices/GraphEndpoint/GraphEndpointRequestBuilder.php index 6897101cd80..f0aead11239 100644 --- a/src/Generated/Users/Item/RegisteredDevices/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/Users/Item/RegisteredDevices/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\EndpointCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\RegisteredDevices\GraphEndpoint\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.endpoint in the microsoft.graph.directoryObject collection * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [EndpointCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RegisteredDevices/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Users/Item/RegisteredDevices/Item/DirectoryObjectItemRequestBuilder.php index 71d473e769a..5a934c0a633 100644 --- a/src/Generated/Users/Item/RegisteredDevices/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Users/Item/RegisteredDevices/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\RegisteredDevices\Item\GraphAppRoleAssignment\GraphAppRoleAssignmentRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Devices that are registered for the user. Read-only. Nullable. Supports $expand and returns up to 100 objects. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RegisteredDevices/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php b/src/Generated/Users/Item/RegisteredDevices/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php index 26b3cca0ffb..e3338b43140 100644 --- a/src/Generated/Users/Item/RegisteredDevices/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php +++ b/src/Generated/Users/Item/RegisteredDevices/Item/GraphAppRoleAssignment/GraphAppRoleAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AppRoleAssignment; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.appRoleAssignment * @param GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAppRoleAssignmentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AppRoleAssignment::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAppRoleAssignmentRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RegisteredDevices/Item/GraphDevice/GraphDeviceRequestBuilder.php b/src/Generated/Users/Item/RegisteredDevices/Item/GraphDevice/GraphDeviceRequestBuilder.php index fca36a708ea..5036b93ca20 100644 --- a/src/Generated/Users/Item/RegisteredDevices/Item/GraphDevice/GraphDeviceRequestBuilder.php +++ b/src/Generated/Users/Item/RegisteredDevices/Item/GraphDevice/GraphDeviceRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Device; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.device * @param GraphDeviceRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDeviceRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Device::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphDeviceRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RegisteredDevices/Item/GraphEndpoint/GraphEndpointRequestBuilder.php b/src/Generated/Users/Item/RegisteredDevices/Item/GraphEndpoint/GraphEndpointRequestBuilder.php index 88ed88e4301..99f095a3596 100644 --- a/src/Generated/Users/Item/RegisteredDevices/Item/GraphEndpoint/GraphEndpointRequestBuilder.php +++ b/src/Generated/Users/Item/RegisteredDevices/Item/GraphEndpoint/GraphEndpointRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Endpoint; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.endpoint * @param GraphEndpointRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphEndpointRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Endpoint::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphEndpointRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RegisteredDevices/RegisteredDevicesRequestBuilder.php b/src/Generated/Users/Item/RegisteredDevices/RegisteredDevicesRequestBuilder.php index 553bb0280aa..671489b1911 100644 --- a/src/Generated/Users/Item/RegisteredDevices/RegisteredDevicesRequestBuilder.php +++ b/src/Generated/Users/Item/RegisteredDevices/RegisteredDevicesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\RegisteredDevices\Count\CountRequestBuilder; @@ -78,20 +77,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Devices that are registered for the user. Read-only. Nullable. Supports $expand and returns up to 100 objects. * @param RegisteredDevicesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-registereddevices?view=graph-rest-1.0 Find more info here */ public function get(?RegisteredDevicesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -104,7 +100,6 @@ public function toGetRequestInformation(?RegisteredDevicesRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -112,6 +107,7 @@ public function toGetRequestInformation(?RegisteredDevicesRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ReminderViewWithStartDateTimeWithEndDateTime/ReminderViewWithStartDateTimeWithEndDateTimeRequestBuilder.php b/src/Generated/Users/Item/ReminderViewWithStartDateTimeWithEndDateTime/ReminderViewWithStartDateTimeWithEndDateTimeRequestBuilder.php index d6d7fdb9534..4771db2c07e 100644 --- a/src/Generated/Users/Item/ReminderViewWithStartDateTimeWithEndDateTime/ReminderViewWithStartDateTimeWithEndDateTimeRequestBuilder.php +++ b/src/Generated/Users/Item/ReminderViewWithStartDateTimeWithEndDateTime/ReminderViewWithStartDateTimeWithEndDateTimeRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -38,19 +37,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function reminderView * @param ReminderViewWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ReminderViewWithStartDateTimeWithEndDateTimeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ReminderViewWithStartDateTimeWithEndDateTimeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ReminderViewWithStartDateTimeWithEndDateTimeGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -63,7 +59,6 @@ public function toGetRequestInformation(?ReminderViewWithStartDateTimeWithEndDat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -71,6 +66,7 @@ public function toGetRequestInformation(?ReminderViewWithStartDateTimeWithEndDat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RemoveAllDevicesFromManagement/RemoveAllDevicesFromManagementRequestBuilder.php b/src/Generated/Users/Item/RemoveAllDevicesFromManagement/RemoveAllDevicesFromManagementRequestBuilder.php index 96526fd70f8..da2fdf31cdf 100644 --- a/src/Generated/Users/Item/RemoveAllDevicesFromManagement/RemoveAllDevicesFromManagementRequestBuilder.php +++ b/src/Generated/Users/Item/RemoveAllDevicesFromManagement/RemoveAllDevicesFromManagementRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retire all devices from management for this user * @param RemoveAllDevicesFromManagementRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-devices-user-removealldevicesfrommanagement?view=graph-rest-1.0 Find more info here */ public function post(?RemoveAllDevicesFromManagementRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -63,6 +59,7 @@ public function toPostRequestInformation(?RemoveAllDevicesFromManagementRequestB $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ReprocessLicenseAssignment/ReprocessLicenseAssignmentRequestBuilder.php b/src/Generated/Users/Item/ReprocessLicenseAssignment/ReprocessLicenseAssignmentRequestBuilder.php index 0040a45daf3..d3a2d10eea3 100644 --- a/src/Generated/Users/Item/ReprocessLicenseAssignment/ReprocessLicenseAssignmentRequestBuilder.php +++ b/src/Generated/Users/Item/ReprocessLicenseAssignment/ReprocessLicenseAssignmentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -32,26 +31,23 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Reprocess all group-based license assignments for the user. To learn more about group-based licensing, see What is group-based licensing in Azure Active Directory. Also see Identify and resolve license assignment problems for a group in Azure Active Directory for more details. This API is available in the following national cloud deployments. + * Reprocess all group-based license assignments for the user. To learn more about group-based licensing, see What is group-based licensing in Microsoft Entra ID. Also see Identify and resolve license assignment problems for a group in Microsoft Entra ID for more details. This API is available in the following national cloud deployments. * @param ReprocessLicenseAssignmentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-reprocesslicenseassignment?view=graph-rest-1.0 Find more info here */ public function post(?ReprocessLicenseAssignmentRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Reprocess all group-based license assignments for the user. To learn more about group-based licensing, see What is group-based licensing in Azure Active Directory. Also see Identify and resolve license assignment problems for a group in Azure Active Directory for more details. This API is available in the following national cloud deployments. + * Reprocess all group-based license assignments for the user. To learn more about group-based licensing, see What is group-based licensing in Microsoft Entra ID. Also see Identify and resolve license assignment problems for a group in Microsoft Entra ID for more details. This API is available in the following national cloud deployments. * @param ReprocessLicenseAssignmentRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -60,11 +56,11 @@ public function toPostRequestInformation(?ReprocessLicenseAssignmentRequestBuild $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Restore/RestoreRequestBuilder.php b/src/Generated/Users/Item/Restore/RestoreRequestBuilder.php index 7a4c460b18c..73ef1dcc377 100644 --- a/src/Generated/Users/Item/Restore/RestoreRequestBuilder.php +++ b/src/Generated/Users/Item/Restore/RestoreRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. However, security groups cannot be restored. A recently deleted item remains available for up to 30 days. After 30 days, the item is permanently deleted. This API is available in the following national cloud deployments. * @param RestoreRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directory-deleteditems-restore?view=graph-rest-1.0 Find more info here */ public function post(?RestoreRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,11 +56,11 @@ public function toPostRequestInformation(?RestoreRequestBuilderPostRequestConfig $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RetryServiceProvisioning/RetryServiceProvisioningRequestBuilder.php b/src/Generated/Users/Item/RetryServiceProvisioning/RetryServiceProvisioningRequestBuilder.php index c50d90ce2f6..984bdad526e 100644 --- a/src/Generated/Users/Item/RetryServiceProvisioning/RetryServiceProvisioningRequestBuilder.php +++ b/src/Generated/Users/Item/RetryServiceProvisioning/RetryServiceProvisioningRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke action retryServiceProvisioning * @param RetryServiceProvisioningRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(?RetryServiceProvisioningRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -62,6 +58,7 @@ public function toPostRequestInformation(?RetryServiceProvisioningRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } diff --git a/src/Generated/Users/Item/RevokeSignInSessions/RevokeSignInSessionsRequestBuilder.php b/src/Generated/Users/Item/RevokeSignInSessions/RevokeSignInSessionsRequestBuilder.php index d4db2c4743e..0377ca35e1f 100644 --- a/src/Generated/Users/Item/RevokeSignInSessions/RevokeSignInSessionsRequestBuilder.php +++ b/src/Generated/Users/Item/RevokeSignInSessions/RevokeSignInSessionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,20 +32,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invalidates all the refresh tokens issued to applications for a user (as well as session cookies in a user's browser), by resetting the signInSessionsValidFromDateTime user property to the current date-time. Typically, this operation is performed (by the user or an administrator) if the user has a lost or stolen device. This operation prevents access to the organization's data through applications on the device by requiring the user to sign in again to all applications that they have previously consented to, independent of device. This API is available in the following national cloud deployments. * @param RevokeSignInSessionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-revokesigninsessions?view=graph-rest-1.0 Find more info here */ public function post(?RevokeSignInSessionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [RevokeSignInSessionsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [RevokeSignInSessionsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,11 +55,11 @@ public function toPostRequestInformation(?RevokeSignInSessionsRequestBuilderPost $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ScopedRoleMemberOf/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ScopedRoleMemberOf/Count/CountRequestBuilder.php index 06696fcdac0..1135ed6c054 100644 --- a/src/Generated/Users/Item/ScopedRoleMemberOf/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ScopedRoleMemberOf/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ScopedRoleMemberOf/Item/ScopedRoleMembershipItemRequestBuilder.php b/src/Generated/Users/Item/ScopedRoleMemberOf/Item/ScopedRoleMembershipItemRequestBuilder.php index 7689bcd94b1..29015682ec0 100644 --- a/src/Generated/Users/Item/ScopedRoleMemberOf/Item/ScopedRoleMembershipItemRequestBuilder.php +++ b/src/Generated/Users/Item/ScopedRoleMemberOf/Item/ScopedRoleMembershipItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ScopedRoleMembership; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property scopedRoleMemberOf for users * @param ScopedRoleMembershipItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ScopedRoleMembershipItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get scopedRoleMemberOf from users * @param ScopedRoleMembershipItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopedRoleMembershipItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property scopedRoleMemberOf in users * @param ScopedRoleMembership $body The request body * @param ScopedRoleMembershipItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(ScopedRoleMembership $body, ?ScopedRoleMembershipItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ScopedRoleMembershipItemRequestBuild $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ScopedRoleMembershipItemRequestBuilderG $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ScopedRoleMembershipItemRequestBuilderG } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(ScopedRoleMembership $body, ?ScopedRol $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ScopedRoleMemberOf/ScopedRoleMemberOfRequestBuilder.php b/src/Generated/Users/Item/ScopedRoleMemberOf/ScopedRoleMemberOfRequestBuilder.php index 02b2bb293f6..93b8e00e19a 100644 --- a/src/Generated/Users/Item/ScopedRoleMemberOf/ScopedRoleMemberOfRequestBuilder.php +++ b/src/Generated/Users/Item/ScopedRoleMemberOf/ScopedRoleMemberOfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ScopedRoleMembership; use Microsoft\Graph\Generated\Models\ScopedRoleMembershipCollectionResponse; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get scopedRoleMemberOf from users * @param ScopedRoleMemberOfRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ScopedRoleMemberOfRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembershipCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembershipCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to scopedRoleMemberOf for users * @param ScopedRoleMembership $body The request body * @param ScopedRoleMemberOfRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(ScopedRoleMembership $body, ?ScopedRoleMemberOfRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ScopedRoleMembership::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ScopedRoleMemberOfRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ScopedRoleMemberOfRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(ScopedRoleMembership $body, ?ScopedRole $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/SendMail/SendMailRequestBuilder.php b/src/Generated/Users/Item/SendMail/SendMailRequestBuilder.php index 5bc762085a2..c8c790cc779 100644 --- a/src/Generated/Users/Item/SendMail/SendMailRequestBuilder.php +++ b/src/Generated/Users/Item/SendMail/SendMailRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Send the message specified in the request body using either JSON or MIME format. When using JSON format, you can include a file attachment in the same sendMail action call. When using MIME format: This method saves the message in the Sent Items folder. Alternatively, create a draft message to send later. To learn more about the steps involved in the backend before a mail is delivered to recipients, see here. This API is available in the following national cloud deployments. * @param SendMailPostRequestBody $body The request body * @param SendMailRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-sendmail?view=graph-rest-1.0 Find more info here */ public function post(SendMailPostRequestBody $body, ?SendMailRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SendMailPostRequestBody $body, ?SendMai $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php b/src/Generated/Users/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php index 5499ffb87ad..5d2e5c511fc 100644 --- a/src/Generated/Users/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/ServiceProvisioningErrors/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php b/src/Generated/Users/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php index 7f796fdff76..ee8ba1bfb85 100644 --- a/src/Generated/Users/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php +++ b/src/Generated/Users/Item/ServiceProvisioningErrors/ServiceProvisioningErrorsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ServiceProvisioningErrorCollectionResponse; use Microsoft\Graph\Generated\Users\Item\ServiceProvisioningErrors\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get serviceProvisioningErrors property value * @param ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ServiceProvisioningErrorsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ServiceProvisioningErrorCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?ServiceProvisioningErrorsRequestBuilder } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Settings/SettingsRequestBuilder.php b/src/Generated/Users/Item/Settings/SettingsRequestBuilder.php index 1ad5a4062b4..827f1a363c7 100644 --- a/src/Generated/Users/Item/Settings/SettingsRequestBuilder.php +++ b/src/Generated/Users/Item/Settings/SettingsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserSettings; use Microsoft\Graph\Generated\Users\Item\Settings\ShiftPreferences\ShiftPreferencesRequestBuilder; @@ -42,58 +41,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property settings for users * @param SettingsRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?SettingsRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the user and organization userSettings object.To learn how to update the properties of the userSettings object, see update user settings. This API is available in the following national cloud deployments. * @param SettingsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/usersettings-get?view=graph-rest-1.0 Find more info here */ public function get(?SettingsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of the userSettings object. Users in the same organization can have different settings based on their preference or on the organization policies. To get the user current settings, see current user settings. This API is available in the following national cloud deployments. * @param UserSettings $body The request body * @param SettingsRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/usersettings-update?view=graph-rest-1.0 Find more info here */ public function patch(UserSettings $body, ?SettingsRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserSettings::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserSettings::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -110,6 +100,7 @@ public function toDeleteRequestInformation(?SettingsRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -123,7 +114,6 @@ public function toGetRequestInformation(?SettingsRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -131,6 +121,7 @@ public function toGetRequestInformation(?SettingsRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -145,11 +136,11 @@ public function toPatchRequestInformation(UserSettings $body, ?SettingsRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Settings/ShiftPreferences/ShiftPreferencesRequestBuilder.php b/src/Generated/Users/Item/Settings/ShiftPreferences/ShiftPreferencesRequestBuilder.php index 87b62198719..ab731486eca 100644 --- a/src/Generated/Users/Item/Settings/ShiftPreferences/ShiftPreferencesRequestBuilder.php +++ b/src/Generated/Users/Item/Settings/ShiftPreferences/ShiftPreferencesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\ShiftPreferences; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,58 +33,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property shiftPreferences for users * @param ShiftPreferencesRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ShiftPreferencesRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the properties and relationships of a shiftPreferences object by ID. This API is available in the following national cloud deployments. * @param ShiftPreferencesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shiftpreferences-get?view=graph-rest-1.0 Find more info here */ public function get(?ShiftPreferencesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ShiftPreferences::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ShiftPreferences::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties and relationships of a shiftPreferences object. This API is available in the following national cloud deployments. * @param ShiftPreferences $body The request body * @param ShiftPreferencesRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/shiftpreferences-put?view=graph-rest-1.0 Find more info here */ public function patch(ShiftPreferences $body, ?ShiftPreferencesRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ShiftPreferences::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ShiftPreferences::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -102,6 +92,7 @@ public function toDeleteRequestInformation(?ShiftPreferencesRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -115,7 +106,6 @@ public function toGetRequestInformation(?ShiftPreferencesRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -123,6 +113,7 @@ public function toGetRequestInformation(?ShiftPreferencesRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -137,11 +128,11 @@ public function toPatchRequestInformation(ShiftPreferences $body, ?ShiftPreferen $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Teamwork/AssociatedTeams/AssociatedTeamsRequestBuilder.php b/src/Generated/Users/Item/Teamwork/AssociatedTeams/AssociatedTeamsRequestBuilder.php index 1ad7022061f..979245fa989 100644 --- a/src/Generated/Users/Item/Teamwork/AssociatedTeams/AssociatedTeamsRequestBuilder.php +++ b/src/Generated/Users/Item/Teamwork/AssociatedTeams/AssociatedTeamsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AssociatedTeamInfo; use Microsoft\Graph\Generated\Models\AssociatedTeamInfoCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,39 +54,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the list of teams in Microsoft Teams that a user is associated with.Currently, a user can be associated with a team in two different ways: This API is available in the following national cloud deployments. * @param AssociatedTeamsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/associatedteaminfo-list?view=graph-rest-1.0 Find more info here */ public function get(?AssociatedTeamsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AssociatedTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AssociatedTeamInfoCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to associatedTeams for users * @param AssociatedTeamInfo $body The request body * @param AssociatedTeamsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(AssociatedTeamInfo $body, ?AssociatedTeamsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AssociatedTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AssociatedTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,7 +93,6 @@ public function toGetRequestInformation(?AssociatedTeamsRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -108,6 +100,7 @@ public function toGetRequestInformation(?AssociatedTeamsRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -122,11 +115,11 @@ public function toPostRequestInformation(AssociatedTeamInfo $body, ?AssociatedTe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Teamwork/AssociatedTeams/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Teamwork/AssociatedTeams/Count/CountRequestBuilder.php index d045d311ac5..c4080ca4ead 100644 --- a/src/Generated/Users/Item/Teamwork/AssociatedTeams/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Teamwork/AssociatedTeams/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Teamwork/AssociatedTeams/Item/AssociatedTeamInfoItemRequestBuilder.php b/src/Generated/Users/Item/Teamwork/AssociatedTeams/Item/AssociatedTeamInfoItemRequestBuilder.php index 0389134a257..16520b907f6 100644 --- a/src/Generated/Users/Item/Teamwork/AssociatedTeams/Item/AssociatedTeamInfoItemRequestBuilder.php +++ b/src/Generated/Users/Item/Teamwork/AssociatedTeams/Item/AssociatedTeamInfoItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AssociatedTeamInfo; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Teamwork\AssociatedTeams\Item\Team\TeamRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property associatedTeams for users * @param AssociatedTeamInfoItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AssociatedTeamInfoItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The list of associatedTeamInfo objects that a user is associated with. * @param AssociatedTeamInfoItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AssociatedTeamInfoItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AssociatedTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AssociatedTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property associatedTeams in users * @param AssociatedTeamInfo $body The request body * @param AssociatedTeamInfoItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AssociatedTeamInfo $body, ?AssociatedTeamInfoItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AssociatedTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AssociatedTeamInfo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AssociatedTeamInfoItemRequestBuilder $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AssociatedTeamInfoItemRequestBuilderGet $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AssociatedTeamInfoItemRequestBuilderGet } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AssociatedTeamInfo $body, ?AssociatedT $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Teamwork/AssociatedTeams/Item/Team/TeamRequestBuilder.php b/src/Generated/Users/Item/Teamwork/AssociatedTeams/Item/Team/TeamRequestBuilder.php index 99f94f5f94d..5e8647939c8 100644 --- a/src/Generated/Users/Item/Teamwork/AssociatedTeams/Item/Team/TeamRequestBuilder.php +++ b/src/Generated/Users/Item/Teamwork/AssociatedTeams/Item/Team/TeamRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Team; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get team from users * @param TeamRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Team::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Teamwork/InstalledApps/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Teamwork/InstalledApps/Count/CountRequestBuilder.php index 35d232a70d6..2e89fbe3478 100644 --- a/src/Generated/Users/Item/Teamwork/InstalledApps/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Teamwork/InstalledApps/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Teamwork/InstalledApps/InstalledAppsRequestBuilder.php b/src/Generated/Users/Item/Teamwork/InstalledApps/InstalledAppsRequestBuilder.php index 251b81816cd..185630a60c1 100644 --- a/src/Generated/Users/Item/Teamwork/InstalledApps/InstalledAppsRequestBuilder.php +++ b/src/Generated/Users/Item/Teamwork/InstalledApps/InstalledAppsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserScopeTeamsAppInstallation; use Microsoft\Graph\Generated\Models\UserScopeTeamsAppInstallationCollectionResponse; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the list of apps installed in the personal scope of the specified user. This API is available in the following national cloud deployments. * @param InstalledAppsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/userteamwork-list-installedapps?view=graph-rest-1.0 Find more info here */ public function get(?InstalledAppsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserScopeTeamsAppInstallationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserScopeTeamsAppInstallationCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Install an app in the personal scope of the specified user. This API is available in the following national cloud deployments. * @param UserScopeTeamsAppInstallation $body The request body * @param InstalledAppsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/userteamwork-post-installedapps?view=graph-rest-1.0 Find more info here */ public function post(UserScopeTeamsAppInstallation $body, ?InstalledAppsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserScopeTeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserScopeTeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?InstalledAppsRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?InstalledAppsRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(UserScopeTeamsAppInstallation $body, ?I $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Teamwork/InstalledApps/Item/Chat/ChatRequestBuilder.php b/src/Generated/Users/Item/Teamwork/InstalledApps/Item/Chat/ChatRequestBuilder.php index 10105d1ff0a..5c95763ef76 100644 --- a/src/Generated/Users/Item/Teamwork/InstalledApps/Item/Chat/ChatRequestBuilder.php +++ b/src/Generated/Users/Item/Teamwork/InstalledApps/Item/Chat/ChatRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Chat; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Retrieve the chat of the specified user and Teams app. This API is available in the following national cloud deployments. * @param ChatRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/userscopeteamsappinstallation-get-chat?view=graph-rest-1.0 Find more info here */ public function get(?ChatRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Chat::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -60,7 +56,6 @@ public function toGetRequestInformation(?ChatRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -68,6 +63,7 @@ public function toGetRequestInformation(?ChatRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Teamwork/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php b/src/Generated/Users/Item/Teamwork/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php index c3efa7d0974..57ed759a1be 100644 --- a/src/Generated/Users/Item/Teamwork/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php +++ b/src/Generated/Users/Item/Teamwork/InstalledApps/Item/TeamsApp/TeamsAppRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsApp; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The app that is installed. * @param TeamsAppRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsApp::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Teamwork/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php b/src/Generated/Users/Item/Teamwork/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php index 6ebb8d694f4..4bd83ff7d5f 100644 --- a/src/Generated/Users/Item/Teamwork/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php +++ b/src/Generated/Users/Item/Teamwork/InstalledApps/Item/TeamsAppDefinition/TeamsAppDefinitionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TeamsAppDefinition; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The details of this version of the app. * @param TeamsAppDefinitionRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamsAppDefinitionRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TeamsAppDefinition::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?TeamsAppDefinitionRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?TeamsAppDefinitionRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Teamwork/InstalledApps/Item/UserScopeTeamsAppInstallationItemRequestBuilder.php b/src/Generated/Users/Item/Teamwork/InstalledApps/Item/UserScopeTeamsAppInstallationItemRequestBuilder.php index 6f0f5f89d20..a69fb69a14f 100644 --- a/src/Generated/Users/Item/Teamwork/InstalledApps/Item/UserScopeTeamsAppInstallationItemRequestBuilder.php +++ b/src/Generated/Users/Item/Teamwork/InstalledApps/Item/UserScopeTeamsAppInstallationItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserScopeTeamsAppInstallation; use Microsoft\Graph\Generated\Users\Item\Teamwork\InstalledApps\Item\Chat\ChatRequestBuilder; @@ -58,58 +57,49 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Uninstall an app from the personal scope of the specified user. This API is available in the following national cloud deployments. * @param UserScopeTeamsAppInstallationItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/userteamwork-delete-installedapps?view=graph-rest-1.0 Find more info here */ public function delete(?UserScopeTeamsAppInstallationItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Retrieve the app installed in the personal scope of the specified user. This API is available in the following national cloud deployments. * @param UserScopeTeamsAppInstallationItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/userteamwork-get-installedapps?view=graph-rest-1.0 Find more info here */ public function get(?UserScopeTeamsAppInstallationItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserScopeTeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserScopeTeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property installedApps in users * @param UserScopeTeamsAppInstallation $body The request body * @param UserScopeTeamsAppInstallationItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserScopeTeamsAppInstallation $body, ?UserScopeTeamsAppInstallationItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserScopeTeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserScopeTeamsAppInstallation::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -126,6 +116,7 @@ public function toDeleteRequestInformation(?UserScopeTeamsAppInstallationItemReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -139,7 +130,6 @@ public function toGetRequestInformation(?UserScopeTeamsAppInstallationItemReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -147,6 +137,7 @@ public function toGetRequestInformation(?UserScopeTeamsAppInstallationItemReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -161,11 +152,11 @@ public function toPatchRequestInformation(UserScopeTeamsAppInstallation $body, ? $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Teamwork/SendActivityNotification/SendActivityNotificationRequestBuilder.php b/src/Generated/Users/Item/Teamwork/SendActivityNotification/SendActivityNotificationRequestBuilder.php index 404b26223ad..2459abb9a2b 100644 --- a/src/Generated/Users/Item/Teamwork/SendActivityNotification/SendActivityNotificationRequestBuilder.php +++ b/src/Generated/Users/Item/Teamwork/SendActivityNotification/SendActivityNotificationRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Send an activity feed notification to a user. For more details about sending notifications and the requirements for doing so, see sending Teams activity notifications. This API is available in the following national cloud deployments. * @param SendActivityNotificationPostRequestBody $body The request body * @param SendActivityNotificationRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/userteamwork-sendactivitynotification?view=graph-rest-1.0 Find more info here */ public function post(SendActivityNotificationPostRequestBody $body, ?SendActivityNotificationRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(SendActivityNotificationPostRequestBody $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Teamwork/TeamworkRequestBuilder.php b/src/Generated/Users/Item/Teamwork/TeamworkRequestBuilder.php index 6090b052338..18f70f83908 100644 --- a/src/Generated/Users/Item/Teamwork/TeamworkRequestBuilder.php +++ b/src/Generated/Users/Item/Teamwork/TeamworkRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UserTeamwork; use Microsoft\Graph\Generated\Users\Item\Teamwork\AssociatedTeams\AssociatedTeamsRequestBuilder; @@ -58,56 +57,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property teamwork for users * @param TeamworkRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TeamworkRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * A container for Microsoft Teams features available for the user. Read-only. Nullable. * @param TeamworkRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TeamworkRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserTeamwork::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserTeamwork::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property teamwork in users * @param UserTeamwork $body The request body * @param TeamworkRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(UserTeamwork $body, ?TeamworkRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserTeamwork::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserTeamwork::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -124,6 +114,7 @@ public function toDeleteRequestInformation(?TeamworkRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -137,7 +128,6 @@ public function toGetRequestInformation(?TeamworkRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -145,6 +135,7 @@ public function toGetRequestInformation(?TeamworkRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -159,11 +150,11 @@ public function toPatchRequestInformation(UserTeamwork $body, ?TeamworkRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Count/CountRequestBuilder.php index 1491c585108..8722dd6211f 100644 --- a/src/Generated/Users/Item/Todo/Lists/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Delta/DeltaRequestBuilder.php index 45880e2e8d8..b3457d47a41 100644 --- a/src/Generated/Users/Item/Todo/Lists/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Extensions/Count/CountRequestBuilder.php index 2a8d6e4f6fc..db5bb7e7b95 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Extensions/ExtensionsRequestBuilder.php index 34e41ee088e..6d8b5d8ea24 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of open extensions defined for the task list. Nullable. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for users * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Extensions/Item/ExtensionItemRequestBuilder.php index 1951a778620..774a9fb4695 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of open extensions defined for the task list. Nullable. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Count/CountRequestBuilder.php index 0582a76d409..fdd17f77b2c 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Delta/DeltaRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Delta/DeltaRequestBuilder.php index 47667d5bba8..2e7f10b9f35 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Delta/DeltaRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Delta/DeltaRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Invoke function delta * @param DeltaRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DeltaRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DeltaGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -58,7 +54,6 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +61,7 @@ public function toGetRequestInformation(?DeltaRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/AttachmentSessionsRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/AttachmentSessionsRequestBuilder.php index 1929ac9914d..21b6aa8da67 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/AttachmentSessionsRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/AttachmentSessionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AttachmentSessionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Todo\Lists\Item\Tasks\Item\AttachmentSessions\Count\CountRequestBuilder; @@ -54,19 +53,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get attachmentSessions from users * @param AttachmentSessionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentSessionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentSessionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentSessionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -79,7 +75,6 @@ public function toGetRequestInformation(?AttachmentSessionsRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -87,6 +82,7 @@ public function toGetRequestInformation(?AttachmentSessionsRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/Count/CountRequestBuilder.php index 1e8ec5c69be..ff4857cd4a0 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/Item/AttachmentSessionItemRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/Item/AttachmentSessionItemRequestBuilder.php index 08bba270e13..a07a3fb1d1d 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/Item/AttachmentSessionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/Item/AttachmentSessionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AttachmentSession; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Todo\Lists\Item\Tasks\Item\AttachmentSessions\Item\Content\ContentRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property attachmentSessions for users * @param AttachmentSessionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?AttachmentSessionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Get attachmentSessions from users * @param AttachmentSessionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?AttachmentSessionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property attachmentSessions in users * @param AttachmentSession $body The request body * @param AttachmentSessionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(AttachmentSession $body, ?AttachmentSessionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?AttachmentSessionItemRequestBuilderD $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?AttachmentSessionItemRequestBuilderGetR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?AttachmentSessionItemRequestBuilderGetR } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(AttachmentSession $body, ?AttachmentSe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/Item/Content/ContentRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/Item/Content/ContentRequestBuilder.php index 879ff4aaacd..9addceea499 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/Item/Content/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/AttachmentSessions/Item/Content/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AttachmentSession; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,38 +34,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The content streams that are uploaded. * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * The content streams that are uploaded. * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,6 +78,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -97,12 +93,12 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PUT; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/AttachmentsRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/AttachmentsRequestBuilder.php index 63cd2c338ef..586ef915e2d 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/AttachmentsRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/AttachmentsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AttachmentBase; use Microsoft\Graph\Generated\Models\AttachmentBaseCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the taskFileAttachment objects and their properties. The contentBytes property will not be returned in the response. Use the Get attachment API to view the contentBytes. This API is available in the following national cloud deployments. * @param AttachmentsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotask-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentBaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentBaseCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Add a new taskFileAttachment object to a todoTask. This operation limits the size of the attachment you can add to under 3 MB. If the size of the file attachments is more than 3 MB, create an upload session to upload the attachments. This API is available in the following national cloud deployments. * @param AttachmentBase $body The request body * @param AttachmentsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotask-post-attachments?view=graph-rest-1.0 Find more info here */ public function post(AttachmentBase $body, ?AttachmentsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?AttachmentsRequestBuilderGetRequestConf } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(AttachmentBase $body, ?AttachmentsReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/Count/CountRequestBuilder.php index ad93a711476..a17119f28f4 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php index 31f078e142f..4200239dcd4 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/CreateUploadSession/CreateUploadSessionRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\UploadSession; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -35,20 +34,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Create an upload session to iteratively upload ranges of a file as an attachment to a todoTask. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. The request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows the transfer to be resumed, in case the network connection is dropped during the upload. The following are the steps to attach a file to a Microsoft To Do task using an upload session: For an example that describes the end-to-end attachment process, see attach files to a To Do task. This API is available in the following national cloud deployments. * @param CreateUploadSessionPostRequestBody $body The request body * @param CreateUploadSessionRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/taskfileattachment-createuploadsession?view=graph-rest-1.0 Find more info here */ public function post(CreateUploadSessionPostRequestBody $body, ?CreateUploadSessionRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UploadSession::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -62,11 +58,11 @@ public function toPostRequestInformation(CreateUploadSessionPostRequestBody $bod $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/Item/AttachmentBaseItemRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/Item/AttachmentBaseItemRequestBuilder.php index 86f6cdaff5a..30846d131ee 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/Item/AttachmentBaseItemRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/Item/AttachmentBaseItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AttachmentBase; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\Todo\Lists\Item\Tasks\Item\Attachments\Item\Value\ContentRequestBuilder; @@ -42,39 +41,33 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a taskFileAttachment object from a todoTask resource. This API is available in the following national cloud deployments. * @param AttachmentBaseItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/taskfileattachment-delete?view=graph-rest-1.0 Find more info here */ public function delete(?AttachmentBaseItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a taskFileAttachment object. This API is available in the following national cloud deployments. * @param AttachmentBaseItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/taskfileattachment-get?view=graph-rest-1.0 Find more info here */ public function get(?AttachmentBaseItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AttachmentBase::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AttachmentBase::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -91,6 +84,7 @@ public function toDeleteRequestInformation(?AttachmentBaseItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -104,7 +98,6 @@ public function toGetRequestInformation(?AttachmentBaseItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -112,6 +105,7 @@ public function toGetRequestInformation(?AttachmentBaseItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/Item/Value/ContentRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/Item/Value/ContentRequestBuilder.php index 8d35c1f1d55..f3fcc99a3b6 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/Item/Value/ContentRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Attachments/Item/Value/ContentRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,39 +33,37 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get media content for the navigation property attachments from users * @param ContentRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotask-list-attachments?view=graph-rest-1.0 Find more info here */ public function get(?ContentRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** * Update media content for the navigation property attachments in users * @param StreamInterface $body Binary request body * @param ContentRequestBuilderPutRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function put(StreamInterface $body, ?ContentRequestBuilderPutRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPutRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, StreamInterface::class, $errorMappings); + return $result; } /** @@ -83,6 +80,7 @@ public function toGetRequestInformation(?ContentRequestBuilderGetRequestConfigur $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/octet-stream, application/json, application/json"); return $requestInfo; } @@ -101,7 +99,8 @@ public function toPutRequestInformation(StreamInterface $body, ?ContentRequestBu $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } - $requestInfo->setStreamContent($body); + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); + $requestInfo->setStreamContent($body, "application/octet-stream"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/ChecklistItems/ChecklistItemsRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/ChecklistItems/ChecklistItemsRequestBuilder.php index 8c00e27c9df..8104352b7ae 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/ChecklistItems/ChecklistItemsRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/ChecklistItems/ChecklistItemsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChecklistItem; use Microsoft\Graph\Generated\Models\ChecklistItemCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the checklistItem resources associated to a todoTask from the checklistItems navigation property. This API is available in the following national cloud deployments. * @param ChecklistItemsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotask-list-checklistitems?view=graph-rest-1.0 Find more info here */ public function get(?ChecklistItemsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChecklistItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChecklistItemCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new checklistItem object. This API is available in the following national cloud deployments. * @param ChecklistItem $body The request body * @param ChecklistItemsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotask-post-checklistitems?view=graph-rest-1.0 Find more info here */ public function post(ChecklistItem $body, ?ChecklistItemsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChecklistItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChecklistItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?ChecklistItemsRequestBuilderGetRequestC $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?ChecklistItemsRequestBuilderGetRequestC } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(ChecklistItem $body, ?ChecklistItemsReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/ChecklistItems/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/ChecklistItems/Count/CountRequestBuilder.php index 4d94350c78c..0ec131ca15a 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/ChecklistItems/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/ChecklistItems/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/ChecklistItems/Item/ChecklistItemItemRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/ChecklistItems/Item/ChecklistItemItemRequestBuilder.php index c33f6731eef..c7261c0ee6b 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/ChecklistItems/Item/ChecklistItemItemRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/ChecklistItems/Item/ChecklistItemItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ChecklistItem; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete a checklistItem object. This API is available in the following national cloud deployments. * @param ChecklistItemItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/checklistitem-delete?view=graph-rest-1.0 Find more info here */ public function delete(?ChecklistItemItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a checklistItem object. This API is available in the following national cloud deployments. * @param ChecklistItemItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/checklistitem-get?view=graph-rest-1.0 Find more info here */ public function get(?ChecklistItemItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChecklistItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChecklistItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a checklistItem object. This API is available in the following national cloud deployments. * @param ChecklistItem $body The request body * @param ChecklistItemItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/checklistitem-update?view=graph-rest-1.0 Find more info here */ public function patch(ChecklistItem $body, ?ChecklistItemItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ChecklistItem::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ChecklistItem::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?ChecklistItemItemRequestBuilderDelet $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?ChecklistItemItemRequestBuilderGetReque $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?ChecklistItemItemRequestBuilderGetReque } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(ChecklistItem $body, ?ChecklistItemIte $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Extensions/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Extensions/Count/CountRequestBuilder.php index c841826999a..3ee5fec4e29 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Extensions/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Extensions/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Extensions/ExtensionsRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Extensions/ExtensionsRequestBuilder.php index 1d17745c5b4..2f71b45c20c 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Extensions/ExtensionsRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Extensions/ExtensionsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ExtensionCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,38 +54,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The collection of open extensions defined for the task. Nullable. * @param ExtensionsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [ExtensionCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create new navigation property to extensions for users * @param Extension $body The request body * @param ExtensionsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function post(Extension $body, ?ExtensionsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -99,7 +92,6 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -107,6 +99,7 @@ public function toGetRequestInformation(?ExtensionsRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -121,11 +114,11 @@ public function toPostRequestInformation(Extension $body, ?ExtensionsRequestBuil $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Extensions/Item/ExtensionItemRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Extensions/Item/ExtensionItemRequestBuilder.php index c17a84cb19f..1c2807049e9 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Extensions/Item/ExtensionItemRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/Extensions/Item/ExtensionItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Extension; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,56 +33,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property extensions for users * @param ExtensionItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?ExtensionItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * The collection of open extensions defined for the task. Nullable. * @param ExtensionItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?ExtensionItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property extensions in users * @param Extension $body The request body * @param ExtensionItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Extension $body, ?ExtensionItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Extension::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -100,6 +90,7 @@ public function toDeleteRequestInformation(?ExtensionItemRequestBuilderDeleteReq $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -113,7 +104,6 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -121,6 +111,7 @@ public function toGetRequestInformation(?ExtensionItemRequestBuilderGetRequestCo } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -135,11 +126,11 @@ public function toPatchRequestInformation(Extension $body, ?ExtensionItemRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/LinkedResources/Count/CountRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/LinkedResources/Count/CountRequestBuilder.php index 487137d8253..1169d204906 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/LinkedResources/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/LinkedResources/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/LinkedResources/Item/LinkedResourceItemRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/LinkedResources/Item/LinkedResourceItemRequestBuilder.php index a756746a7bf..bf096be7858 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/LinkedResources/Item/LinkedResourceItemRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/LinkedResources/Item/LinkedResourceItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LinkedResource; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,59 +33,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a linkedResource object. This API is available in the following national cloud deployments. * @param LinkedResourceItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/linkedresource-delete?view=graph-rest-1.0 Find more info here */ public function delete(?LinkedResourceItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a linkedResource object. This API is available in the following national cloud deployments. * @param LinkedResourceItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/linkedresource-get?view=graph-rest-1.0 Find more info here */ public function get(?LinkedResourceItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LinkedResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LinkedResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a linkedResource object. This API is available in the following national cloud deployments. * @param LinkedResource $body The request body * @param LinkedResourceItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/linkedresource-update?view=graph-rest-1.0 Find more info here */ public function patch(LinkedResource $body, ?LinkedResourceItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LinkedResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LinkedResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -103,6 +93,7 @@ public function toDeleteRequestInformation(?LinkedResourceItemRequestBuilderDele $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -116,7 +107,6 @@ public function toGetRequestInformation(?LinkedResourceItemRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -124,6 +114,7 @@ public function toGetRequestInformation(?LinkedResourceItemRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -138,11 +129,11 @@ public function toPatchRequestInformation(LinkedResource $body, ?LinkedResourceI $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/LinkedResources/LinkedResourcesRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/LinkedResources/LinkedResourcesRequestBuilder.php index 8432b280bf1..e0e9c27870a 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/LinkedResources/LinkedResourcesRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/LinkedResources/LinkedResourcesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\LinkedResource; use Microsoft\Graph\Generated\Models\LinkedResourceCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; @@ -55,40 +54,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get information of one or more items in a partner application, based on which a specified task was created. The information is represented in a linkedResource object for each item. It includes an external ID for the item in the partner application, and if applicable, a deep link to that item in the application. This API is available in the following national cloud deployments. * @param LinkedResourcesRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotask-list-linkedresources?view=graph-rest-1.0 Find more info here */ public function get(?LinkedResourcesRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LinkedResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LinkedResourceCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a linkedResource object to associate a specified task with an item in a partner application. For example, you can associate a task with an email item in Outlook that spurred the task, and you can create a linkedResource object to track its association. You can also create a linkedResource object while creating a task. This API is available in the following national cloud deployments. * @param LinkedResource $body The request body * @param LinkedResourcesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotask-post-linkedresources?view=graph-rest-1.0 Find more info here */ public function post(LinkedResource $body, ?LinkedResourcesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [LinkedResource::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [LinkedResource::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -101,7 +94,6 @@ public function toGetRequestInformation(?LinkedResourcesRequestBuilderGetRequest $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -109,6 +101,7 @@ public function toGetRequestInformation(?LinkedResourcesRequestBuilderGetRequest } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -123,11 +116,11 @@ public function toPostRequestInformation(LinkedResource $body, ?LinkedResourcesR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/TodoTaskItemRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/TodoTaskItemRequestBuilder.php index 0084b37b0c4..a7244efb431 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/TodoTaskItemRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/Item/TodoTaskItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TodoTask; use Microsoft\Graph\Generated\Users\Item\Todo\Lists\Item\Tasks\Item\Attachments\AttachmentsRequestBuilder; @@ -74,59 +73,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a todoTask object. This API is available in the following national cloud deployments. * @param TodoTaskItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotask-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TodoTaskItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a todoTask object. This API is available in the following national cloud deployments. * @param TodoTaskItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotask-get?view=graph-rest-1.0 Find more info here */ public function get(?TodoTaskItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TodoTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TodoTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a todoTask object. This API is available in the following national cloud deployments. * @param TodoTask $body The request body * @param TodoTaskItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotask-update?view=graph-rest-1.0 Find more info here */ public function patch(TodoTask $body, ?TodoTaskItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TodoTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TodoTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -143,6 +133,7 @@ public function toDeleteRequestInformation(?TodoTaskItemRequestBuilderDeleteRequ $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -156,7 +147,6 @@ public function toGetRequestInformation(?TodoTaskItemRequestBuilderGetRequestCon $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -164,6 +154,7 @@ public function toGetRequestInformation(?TodoTaskItemRequestBuilderGetRequestCon } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -178,11 +169,11 @@ public function toPatchRequestInformation(TodoTask $body, ?TodoTaskItemRequestBu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/TasksRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/TasksRequestBuilder.php index 4944623145c..51890b1c88f 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/Tasks/TasksRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/Tasks/TasksRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TodoTask; use Microsoft\Graph\Generated\Models\TodoTaskCollectionResponse; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the todoTask resources from the tasks navigation property of a specified todoTaskList. This API is available in the following national cloud deployments. * @param TasksRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotasklist-list-tasks?view=graph-rest-1.0 Find more info here */ public function get(?TasksRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TodoTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TodoTaskCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new task object in a specified todoTaskList. This API is available in the following national cloud deployments. * @param TodoTask $body The request body * @param TasksRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotasklist-post-tasks?view=graph-rest-1.0 Find more info here */ public function post(TodoTask $body, ?TasksRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TodoTask::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TodoTask::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?TasksRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(TodoTask $body, ?TasksRequestBuilderPos $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/Item/TodoTaskListItemRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/Item/TodoTaskListItemRequestBuilder.php index 94e8a5b2656..d91070f0496 100644 --- a/src/Generated/Users/Item/Todo/Lists/Item/TodoTaskListItemRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/Item/TodoTaskListItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TodoTaskList; use Microsoft\Graph\Generated\Users\Item\Todo\Lists\Item\Extensions\ExtensionsRequestBuilder; @@ -50,59 +49,50 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Deletes a todoTaskList object. This API is available in the following national cloud deployments. * @param TodoTaskListItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotasklist-delete?view=graph-rest-1.0 Find more info here */ public function delete(?TodoTaskListItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Read the properties and relationships of a todoTaskList object. This API is available in the following national cloud deployments. * @param TodoTaskListItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotasklist-get?view=graph-rest-1.0 Find more info here */ public function get(?TodoTaskListItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TodoTaskList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TodoTaskList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the properties of a todoTaskList object. This API is available in the following national cloud deployments. * @param TodoTaskList $body The request body * @param TodoTaskListItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todotasklist-update?view=graph-rest-1.0 Find more info here */ public function patch(TodoTaskList $body, ?TodoTaskListItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TodoTaskList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TodoTaskList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -119,6 +109,7 @@ public function toDeleteRequestInformation(?TodoTaskListItemRequestBuilderDelete $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -132,7 +123,6 @@ public function toGetRequestInformation(?TodoTaskListItemRequestBuilderGetReques $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -140,6 +130,7 @@ public function toGetRequestInformation(?TodoTaskListItemRequestBuilderGetReques } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -154,11 +145,11 @@ public function toPatchRequestInformation(TodoTaskList $body, ?TodoTaskListItemR $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/Lists/ListsRequestBuilder.php b/src/Generated/Users/Item/Todo/Lists/ListsRequestBuilder.php index 8426d8a3379..5678d0a3281 100644 --- a/src/Generated/Users/Item/Todo/Lists/ListsRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/Lists/ListsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\TodoTaskList; use Microsoft\Graph\Generated\Models\TodoTaskListCollectionResponse; @@ -63,40 +62,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get a list of the todoTaskList objects and their properties. This API is available in the following national cloud deployments. * @param ListsRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todo-list-lists?view=graph-rest-1.0 Find more info here */ public function get(?ListsRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TodoTaskListCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TodoTaskListCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Create a new lists object. This API is available in the following national cloud deployments. * @param TodoTaskList $body The request body * @param ListsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/todo-post-lists?view=graph-rest-1.0 Find more info here */ public function post(TodoTaskList $body, ?ListsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TodoTaskList::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TodoTaskList::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -109,7 +102,6 @@ public function toGetRequestInformation(?ListsRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -117,6 +109,7 @@ public function toGetRequestInformation(?ListsRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -131,11 +124,11 @@ public function toPostRequestInformation(TodoTaskList $body, ?ListsRequestBuilde $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/Todo/TodoRequestBuilder.php b/src/Generated/Users/Item/Todo/TodoRequestBuilder.php index 34cb84ebecf..2b94fcddf9d 100644 --- a/src/Generated/Users/Item/Todo/TodoRequestBuilder.php +++ b/src/Generated/Users/Item/Todo/TodoRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\Todo; use Microsoft\Graph\Generated\Users\Item\Todo\Lists\ListsRequestBuilder; @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Delete navigation property todo for users * @param TodoRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function delete(?TodoRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** * Represents the To Do services available to a user. * @param TodoRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?TodoRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Todo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Todo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** * Update the navigation property todo in users * @param Todo $body The request body * @param TodoRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function patch(Todo $body, ?TodoRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Todo::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Todo::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?TodoRequestBuilderDeleteRequestConfi $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } @@ -121,7 +112,6 @@ public function toGetRequestInformation(?TodoRequestBuilderGetRequestConfigurati $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -129,6 +119,7 @@ public function toGetRequestInformation(?TodoRequestBuilderGetRequestConfigurati } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Todo $body, ?TodoRequestBuilderPatchRe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/TransitiveMemberOf/Count/CountRequestBuilder.php b/src/Generated/Users/Item/TransitiveMemberOf/Count/CountRequestBuilder.php index 8e27a2f4b82..ab6161e084a 100644 --- a/src/Generated/Users/Item/TransitiveMemberOf/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/TransitiveMemberOf/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php b/src/Generated/Users/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php index 22693637b08..7ceca5d8f75 100644 --- a/src/Generated/Users/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/TransitiveMemberOf/GraphAdministrativeUnit/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Users/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index 2ac835e1f3e..19da4a4c284 100644 --- a/src/Generated/Users/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Users/Item/TransitiveMemberOf/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnitCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\TransitiveMemberOf\GraphAdministrativeUnit\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.administrativeUnit in the microsoft.graph.directoryObject collection * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnitCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/TransitiveMemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php b/src/Generated/Users/Item/TransitiveMemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php index 3d73010bcb1..7482b0b10ec 100644 --- a/src/Generated/Users/Item/TransitiveMemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/TransitiveMemberOf/GraphDirectoryRole/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/TransitiveMemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php b/src/Generated/Users/Item/TransitiveMemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php index 62f6aa6bfde..41d76a88a20 100644 --- a/src/Generated/Users/Item/TransitiveMemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php +++ b/src/Generated/Users/Item/TransitiveMemberOf/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryRoleCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\TransitiveMemberOf\GraphDirectoryRole\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.directoryRole in the microsoft.graph.directoryObject collection * @param GraphDirectoryRoleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDirectoryRoleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRoleCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php b/src/Generated/Users/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php index 8f739aa2457..c03c0a335be 100644 --- a/src/Generated/Users/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php +++ b/src/Generated/Users/Item/TransitiveMemberOf/GraphGroup/Count/CountRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the number of the resource * @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + /** @var Promise $result */ + $result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings); + return $result; } /** @@ -58,7 +56,6 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "text/plain"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -66,6 +63,7 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "text/plain;q=0.9"); return $requestInfo; } diff --git a/src/Generated/Users/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Users/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php index 8692f361529..2f19998fcf2 100644 --- a/src/Generated/Users/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Users/Item/TransitiveMemberOf/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\GroupCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\TransitiveMemberOf\GraphGroup\Count\CountRequestBuilder; @@ -42,19 +41,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the items of type microsoft.graph.group in the microsoft.graph.directoryObject collection * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [GroupCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -67,7 +63,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -75,6 +70,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php b/src/Generated/Users/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php index 434baeafbfd..964ec15a9c2 100644 --- a/src/Generated/Users/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php +++ b/src/Generated/Users/Item/TransitiveMemberOf/Item/DirectoryObjectItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObject; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\TransitiveMemberOf\Item\GraphAdministrativeUnit\GraphAdministrativeUnitRequestBuilder; @@ -58,19 +57,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The groups, including nested groups, and directory roles that a user is a member of. Nullable. * @param DirectoryObjectItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?DirectoryObjectItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObject::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -83,7 +79,6 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -91,6 +86,7 @@ public function toGetRequestInformation(?DirectoryObjectItemRequestBuilderGetReq } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php b/src/Generated/Users/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php index 3012cf64884..1f8be4743f8 100644 --- a/src/Generated/Users/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php +++ b/src/Generated/Users/Item/TransitiveMemberOf/Item/GraphAdministrativeUnit/GraphAdministrativeUnitRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\AdministrativeUnit; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.administrativeUnit * @param GraphAdministrativeUnitRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphAdministrativeUnitRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [AdministrativeUnit::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphAdministrativeUnitRequestBuilderGe } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/TransitiveMemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php b/src/Generated/Users/Item/TransitiveMemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php index 0d217492fb1..da0e06177bb 100644 --- a/src/Generated/Users/Item/TransitiveMemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php +++ b/src/Generated/Users/Item/TransitiveMemberOf/Item/GraphDirectoryRole/GraphDirectoryRoleRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryRole; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.directoryRole * @param GraphDirectoryRoleRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphDirectoryRoleRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryRole::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphDirectoryRoleRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php b/src/Generated/Users/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php index cce4fca7287..eee839e84c6 100644 --- a/src/Generated/Users/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php +++ b/src/Generated/Users/Item/TransitiveMemberOf/Item/GraphGroup/GraphGroupRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\Group; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; @@ -34,19 +33,16 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * Get the item of type microsoft.graph.directoryObject as microsoft.graph.group * @param GraphGroupRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception */ public function get(?GraphGroupRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [Group::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -59,7 +55,6 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -67,6 +62,7 @@ public function toGetRequestInformation(?GraphGroupRequestBuilderGetRequestConfi } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php b/src/Generated/Users/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php index f44a54165f6..39b41b09281 100644 --- a/src/Generated/Users/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php +++ b/src/Generated/Users/Item/TransitiveMemberOf/TransitiveMemberOfRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\DirectoryObjectCollectionResponse; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Users\Item\TransitiveMemberOf\Count\CountRequestBuilder; @@ -78,20 +77,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * The groups, including nested groups, and directory roles that a user is a member of. Nullable. * @param TransitiveMemberOfRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-list-transitivememberof?view=graph-rest-1.0 Find more info here */ public function get(?TransitiveMemberOfRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [DirectoryObjectCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -104,7 +100,6 @@ public function toGetRequestInformation(?TransitiveMemberOfRequestBuilderGetRequ $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -112,6 +107,7 @@ public function toGetRequestInformation(?TransitiveMemberOfRequestBuilderGetRequ } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } diff --git a/src/Generated/Users/Item/TranslateExchangeIds/TranslateExchangeIdsRequestBuilder.php b/src/Generated/Users/Item/TranslateExchangeIds/TranslateExchangeIdsRequestBuilder.php index 832d860379e..8bbf19d9f67 100644 --- a/src/Generated/Users/Item/TranslateExchangeIds/TranslateExchangeIdsRequestBuilder.php +++ b/src/Generated/Users/Item/TranslateExchangeIds/TranslateExchangeIdsRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Translate identifiers of Outlook-related resources between formats. This API is available in the following national cloud deployments. * @param TranslateExchangeIdsPostRequestBody $body The request body * @param TranslateExchangeIdsRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/user-translateexchangeids?view=graph-rest-1.0 Find more info here */ public function post(TranslateExchangeIdsPostRequestBody $body, ?TranslateExchangeIdsRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [TranslateExchangeIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [TranslateExchangeIdsPostResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -61,11 +57,11 @@ public function toPostRequestInformation(TranslateExchangeIdsPostRequestBody $bo $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/UserItemRequestBuilder.php b/src/Generated/Users/Item/UserItemRequestBuilder.php index ad2bae7e445..cdc2dd71298 100644 --- a/src/Generated/Users/Item/UserItemRequestBuilder.php +++ b/src/Generated/Users/Item/UserItemRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Users\Item\Activities\ActivitiesRequestBuilder; @@ -594,22 +593,19 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap } /** - * Deletes a user. + * Delete user. When deleted, user resources are moved to a temporary container and can be restored within 30 days. After that time, they are permanently deleted. To learn more, see deletedItems. This API is available in the following national cloud deployments. * @param UserItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-onboarding-user-delete?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/user-delete?view=graph-rest-1.0 Find more info here */ public function delete(?UserItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -623,42 +619,36 @@ public function exportDeviceAndAppManagementDataWithSkipWithTop(int $skip, int $ } /** - * Read properties and relationships of the user object. + * Retrieve the properties and relationships of user object. This API is available in the following national cloud deployments. * @param UserItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/intune-onboarding-user-get?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/user-get?view=graph-rest-1.0 Find more info here */ public function get(?UserItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Update the properties of a user object. Not all properties can be updated by Member or Guest users with their default permissions without Administrator roles. Compare member and guest default permissions to see properties they can manage. This API is available in the following national cloud deployments. + * Update the properties of a user object. * @param User $body The request body * @param UserItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/user-update?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-onboarding-user-update?view=graph-rest-1.0 Find more info here */ public function patch(User $body, ?UserItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -672,7 +662,7 @@ public function reminderViewWithStartDateTimeWithEndDateTime(string $endDateTime } /** - * Deletes a user. + * Delete user. When deleted, user resources are moved to a temporary container and can be restored within 30 days. After that time, they are permanently deleted. To learn more, see deletedItems. This API is available in the following national cloud deployments. * @param UserItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -685,11 +675,12 @@ public function toDeleteRequestInformation(?UserItemRequestBuilderDeleteRequestC $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); return $requestInfo; } /** - * Read properties and relationships of the user object. + * Retrieve the properties and relationships of user object. This API is available in the following national cloud deployments. * @param UserItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation */ @@ -698,7 +689,6 @@ public function toGetRequestInformation(?UserItemRequestBuilderGetRequestConfigu $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -706,11 +696,12 @@ public function toGetRequestInformation(?UserItemRequestBuilderGetRequestConfigu } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Update the properties of a user object. Not all properties can be updated by Member or Guest users with their default permissions without Administrator roles. Compare member and guest default permissions to see properties they can manage. This API is available in the following national cloud deployments. + * Update the properties of a user object. * @param User $body The request body * @param UserItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -720,11 +711,11 @@ public function toPatchRequestInformation(User $body, ?UserItemRequestBuilderPat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::PATCH; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/Item/UserItemRequestBuilderGetQueryParameters.php b/src/Generated/Users/Item/UserItemRequestBuilderGetQueryParameters.php index 4ffb975bcb1..3df725736f2 100644 --- a/src/Generated/Users/Item/UserItemRequestBuilderGetQueryParameters.php +++ b/src/Generated/Users/Item/UserItemRequestBuilderGetQueryParameters.php @@ -5,7 +5,7 @@ use Microsoft\Kiota\Abstractions\QueryParameter; /** - * Read properties and relationships of the user object. + * Retrieve the properties and relationships of user object. This API is available in the following national cloud deployments. */ class UserItemRequestBuilderGetQueryParameters { diff --git a/src/Generated/Users/Item/WipeManagedAppRegistrationsByDeviceTag/WipeManagedAppRegistrationsByDeviceTagRequestBuilder.php b/src/Generated/Users/Item/WipeManagedAppRegistrationsByDeviceTag/WipeManagedAppRegistrationsByDeviceTagRequestBuilder.php index b28af73bacc..5f397d3eb7e 100644 --- a/src/Generated/Users/Item/WipeManagedAppRegistrationsByDeviceTag/WipeManagedAppRegistrationsByDeviceTagRequestBuilder.php +++ b/src/Generated/Users/Item/WipeManagedAppRegistrationsByDeviceTag/WipeManagedAppRegistrationsByDeviceTagRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Issues a wipe operation on an app registration with specified device tag. * @param WipeManagedAppRegistrationsByDeviceTagPostRequestBody $body The request body * @param WipeManagedAppRegistrationsByDeviceTagRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-user-wipemanagedappregistrationsbydevicetag?view=graph-rest-1.0 Find more info here */ public function post(WipeManagedAppRegistrationsByDeviceTagPostRequestBody $body, ?WipeManagedAppRegistrationsByDeviceTagRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(WipeManagedAppRegistrationsByDeviceTagP $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/UsersRequestBuilder.php b/src/Generated/Users/UsersRequestBuilder.php index 8d3543df233..a495daeef01 100644 --- a/src/Generated/Users/UsersRequestBuilder.php +++ b/src/Generated/Users/UsersRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Graph\Generated\Models\User; use Microsoft\Graph\Generated\Models\UserCollectionResponse; @@ -87,40 +86,34 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap /** * List properties and relationships of the user objects. * @param UsersRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/intune-mam-user-list?view=graph-rest-1.0 Find more info here */ public function get(?UsersRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toGetRequestInformation($requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [UserCollectionResponse::class, 'createFromDiscriminatorValue'], $errorMappings); } /** - * Create a new user.The request body contains the user to create. At a minimum, you must specify the required properties for the user. You can optionally specify any other writable properties. This API is available in the following national cloud deployments. + * Create a new user object. * @param User $body The request body * @param UsersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise - * @link https://learn.microsoft.com/graph/api/user-post-users?view=graph-rest-1.0 Find more info here + * @return Promise + * @throws Exception + * @link https://learn.microsoft.com/graph/api/intune-onboarding-user-create?view=graph-rest-1.0 Find more info here */ public function post(User $body, ?UsersRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendAsync($requestInfo, [User::class, 'createFromDiscriminatorValue'], $errorMappings); } /** @@ -133,7 +126,6 @@ public function toGetRequestInformation(?UsersRequestBuilderGetRequestConfigurat $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::GET; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); if ($requestConfiguration->queryParameters !== null) { @@ -141,11 +133,12 @@ public function toGetRequestInformation(?UsersRequestBuilderGetRequestConfigurat } $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); return $requestInfo; } /** - * Create a new user.The request body contains the user to create. At a minimum, you must specify the required properties for the user. You can optionally specify any other writable properties. This API is available in the following national cloud deployments. + * Create a new user object. * @param User $body The request body * @param UsersRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @return RequestInformation @@ -155,11 +148,11 @@ public function toPostRequestInformation(User $body, ?UsersRequestBuilderPostReq $requestInfo->urlTemplate = $this->urlTemplate; $requestInfo->pathParameters = $this->pathParameters; $requestInfo->httpMethod = HttpMethod::POST; - $requestInfo->addHeader('Accept', "application/json"); if ($requestConfiguration !== null) { $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json;q=1"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/Users/ValidateProperties/ValidatePropertiesRequestBuilder.php b/src/Generated/Users/ValidateProperties/ValidatePropertiesRequestBuilder.php index 487ee5f5a67..3733cc18f8a 100644 --- a/src/Generated/Users/ValidateProperties/ValidatePropertiesRequestBuilder.php +++ b/src/Generated/Users/ValidateProperties/ValidatePropertiesRequestBuilder.php @@ -4,7 +4,6 @@ use Exception; use Http\Promise\Promise; -use Http\Promise\RejectedPromise; use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; use Microsoft\Kiota\Abstractions\BaseRequestBuilder; use Microsoft\Kiota\Abstractions\HttpMethod; @@ -34,20 +33,17 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap * Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties function. The following policy validations are performed for the display name and mail nickname properties:1. Validate the prefix and suffix naming policy2. Validate the custom banned words policy3. Validate that the mail nickname is unique This API only returns the first validation failure that is encountered. If the properties fail multiple validations, only the first validation failure is returned. However, you can validate both the mail nickname and the display name and receive a collection of validation errors if you are only validating the prefix and suffix naming policy. To learn more about configuring naming policies, see Configure naming policy. This API is available in the following national cloud deployments. * @param ValidatePropertiesPostRequestBody $body The request body * @param ValidatePropertiesRequestBuilderPostRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. - * @return Promise + * @return Promise + * @throws Exception * @link https://learn.microsoft.com/graph/api/directoryobject-validateproperties?view=graph-rest-1.0 Find more info here */ public function post(ValidatePropertiesPostRequestBody $body, ?ValidatePropertiesRequestBuilderPostRequestConfiguration $requestConfiguration = null): Promise { $requestInfo = $this->toPostRequestInformation($body, $requestConfiguration); - try { - $errorMappings = [ - '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], - '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], - ]; - return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); - } catch(Exception $ex) { - return new RejectedPromise($ex); - } + $errorMappings = [ + '4XX' => [ODataError::class, 'createFromDiscriminatorValue'], + '5XX' => [ODataError::class, 'createFromDiscriminatorValue'], + ]; + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); } /** @@ -65,6 +61,7 @@ public function toPostRequestInformation(ValidatePropertiesPostRequestBody $body $requestInfo->addHeaders($requestConfiguration->headers); $requestInfo->addRequestOptions(...$requestConfiguration->options); } + $requestInfo->tryAddHeader('Accept', "application/json, application/json"); $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); return $requestInfo; } diff --git a/src/Generated/kiota-lock.json b/src/Generated/kiota-lock.json index 44c344fd596..ecb2e07c630 100644 --- a/src/Generated/kiota-lock.json +++ b/src/Generated/kiota-lock.json @@ -1,6 +1,6 @@ { - "descriptionHash": "F33AFCD32A6BA97C831E8FCF676AFACF4A4BCD58C26D22772979400057A1639EA09039BDCDA5B19FC1191743D889B759606DEA235C2696393CD189BB830469B4", - "descriptionLocation": "/mnt/vss/_work/1/s/msgraph-metadata/clean_v10_openapi/openapi.yaml", + "descriptionHash": "68D5F4EDF9DDC2C262F4F8B6807D7D6D6D9155C9502457C53A3F81C3EE8AB5AD511C98299C625841797014846991CB7D519FB639D4E120B6FAE362F1F8027B32", + "descriptionLocation": "../../msgraph-metadata/clean_v10_openapi/openapi.yaml", "lockFileVersion": "1.0.0", "kiotaVersion": "1.8.0", "clientClassName": "BaseGraphClient", @@ -21,10 +21,10 @@ "Microsoft.Kiota.Serialization.Form.FormParseNodeFactory" ], "structuredMimeTypes": [ - "application/json", - "text/plain", - "application/x-www-form-urlencoded", - "multipart/form-data" + "application/json;q=1", + "text/plain;q=0.9", + "application/x-www-form-urlencoded;q=0.2", + "multipart/form-data;q=0.1" ], "includePatterns": [], "excludePatterns": [ From 6984a7b2c4ce971d9eac09bc495055d491e57399 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Wed, 1 Nov 2023 16:19:33 +0300 Subject: [PATCH 2/2] Bump Graph core --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index cd769f91102..be0976a11a3 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ ], "require": { "php": "^8.0 || ^7.4", - "microsoft/microsoft-graph-core": "2.0.0-RC11" + "microsoft/microsoft-graph-core": "2.0.0-RC12" }, "require-dev": { "phpunit/phpunit": "^8.0 || ^9.0",